From 5737de9ed16db08c27c707e1610c5046510d312c Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Wed, 15 Oct 2025 13:59:50 +0200 Subject: [PATCH 01/59] Improve JS docs (#166) - Add doc string to ModalClient - Add usage examples to object services - Add cross links between concepts --- modal-js/src/app.ts | 22 +++++++---- modal-js/src/client.ts | 24 ++++++++++-- modal-js/src/cls.ts | 16 +++++--- modal-js/src/function.ts | 14 +++++-- modal-js/src/function_call.ts | 27 ++++++++----- modal-js/src/image.ts | 36 +++++++++-------- modal-js/src/proxy.ts | 14 +++++-- modal-js/src/queue.ts | 48 +++++++++++++---------- modal-js/src/sandbox.ts | 62 ++++++++++++++++-------------- modal-js/src/sandbox_filesystem.ts | 2 +- modal-js/src/secret.ts | 22 +++++++---- modal-js/src/volume.ts | 22 +++++++---- 12 files changed, 194 insertions(+), 115 deletions(-) diff --git a/modal-js/src/app.ts b/modal-js/src/app.ts index 26b65ea9..b6d4ab30 100644 --- a/modal-js/src/app.ts +++ b/modal-js/src/app.ts @@ -8,7 +8,13 @@ import { Secret } from "./secret"; import { GPUConfig } from "../proto/modal_proto/api"; /** - * Service for managing Apps. + * Service for managing {@link App}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const app = await modal.apps.fromName("my-app"); + * ``` */ export class AppService { readonly #client: ModalClient; @@ -17,7 +23,7 @@ export class AppService { } /** - * Referencea deployed App by name, or create if it does not exist. + * Reference a deployed {@link App} by name, or create if it does not exist. */ async fromName(name: string, params: AppFromNameParams = {}): Promise { try { @@ -37,7 +43,7 @@ export class AppService { } } -/** Optional parameters for `client.apps.fromName()`. */ +/** Optional parameters for {@link AppService#fromName client.apps.fromName()}. */ export type AppFromNameParams = { environment?: string; createIfMissing?: boolean; @@ -102,14 +108,14 @@ export class App { } /** - * @deprecated Use `client.apps.fromName()` instead. + * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. */ static async lookup(name: string, options: LookupOptions = {}): Promise { return getDefaultClient().apps.fromName(name, options); } /** - * @deprecated Use `client.sandboxes.create()` instead. + * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead. */ async createSandbox( image: Image, @@ -119,21 +125,21 @@ export class App { } /** - * @deprecated Use `client.images.fromRegistry()` instead. + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. */ async imageFromRegistry(tag: string, secret?: Secret): Promise { return getDefaultClient().images.fromRegistry(tag, secret).build(this); } /** - * @deprecated Use `client.images.fromAwsEcr()` instead. + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. */ async imageFromAwsEcr(tag: string, secret: Secret): Promise { return getDefaultClient().images.fromAwsEcr(tag, secret).build(this); } /** - * @deprecated Use `client.images.fromGcpArtifactRegistry()` instead. + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. */ async imageFromGcpArtifactRegistry( tag: string, diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index aca60a63..e1fffba7 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -41,6 +41,24 @@ export type ModalGrpcClient = Client< TimeoutOptions & RetryOptions >; +/** + * The main client for interacting with Modal's cloud infrastructure. + * + * ModalClient provides access to all Modal services through service properties. + * Create a client instance and use its service properties to manage {@link App}s, + * {@link Function_ Function}s, * {@link Sandbox}es, and other Modal resources. + * + * @example + * ```typescript + * import { ModalClient } from "modal"; + * + * const modal = new ModalClient(); + * + * const app = await modal.apps.fromName("my-app"); + * const image = modal.images.fromRegistry("python:3.13"); + * const sandbox = await modal.sandboxes.create(app, image); + * ``` + */ export class ModalClient { readonly apps: AppService; readonly cls: ClsService; @@ -351,7 +369,7 @@ export const client = new Proxy({} as ModalGrpcClient, { }); /** - * @deprecated Use `new ModalClient()` instead. + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. */ export type ClientOptions = { tokenId: string; @@ -360,7 +378,7 @@ export type ClientOptions = { }; /** - * @deprecated Use `new ModalClient()` instead. + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. */ export function initializeClient(options: ClientOptions) { defaultClientOptions = { @@ -373,7 +391,7 @@ export function initializeClient(options: ClientOptions) { /** * Stops the auth token refresh. - * @deprecated Use `modalClient.close()` instead. + * @deprecated Use {@link ModalClient#close modalClient.close()} instead. */ export function close() { if (defaultClient) { diff --git a/modal-js/src/cls.ts b/modal-js/src/cls.ts index abfc6137..02fc8e8e 100644 --- a/modal-js/src/cls.ts +++ b/modal-js/src/cls.ts @@ -19,14 +19,20 @@ import { mergeEnvIntoSecrets } from "./secret"; import { Retries, parseRetries } from "./retries"; import type { Volume } from "./volume"; -/** Optional parameters for `client.cls.fromName()`. */ +/** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */ export type ClsFromNameParams = { environment?: string; createIfMissing?: boolean; }; /** - * Service for managing Cls. + * Service for managing {@link Cls}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const cls = await modal.cls.fromName("my-app", "MyCls"); + * ``` */ export class ClsService { readonly #client: ModalClient; @@ -35,7 +41,7 @@ export class ClsService { } /** - * Reference a Cls from a deployed App by its name. + * Reference a {@link Cls} from a deployed {@link App} by its name. */ async fromName( appName: string, @@ -132,7 +138,7 @@ export class Cls { } /** - * @deprecated Use `client.cls.fromName()` instead. + * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead. */ static async lookup( appName: string, @@ -373,7 +379,7 @@ function encodeParameter( return paramValue; } -/** Represents an instance of a deployed Modal Cls, optionally with parameters. */ +/** Represents an instance of a deployed Modal {@link Cls}, optionally with parameters. */ export class ClsInstance { #methods: Map; diff --git a/modal-js/src/function.ts b/modal-js/src/function.ts index aadd2f7b..ddf99638 100644 --- a/modal-js/src/function.ts +++ b/modal-js/src/function.ts @@ -32,7 +32,13 @@ export type FunctionFromNameParams = { }; /** - * Service for managing Functions. + * Service for managing {@link Function_ Function}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const function = await modal.functions.fromName("my-app", "my-function"); + * ``` */ export class FunctionService { readonly #client: ModalClient; @@ -41,7 +47,7 @@ export class FunctionService { } /** - * Reference a Function by its name in an App. + * Reference a {@link Function_ Function} by its name in an App. */ async fromName( appName: string, @@ -74,13 +80,13 @@ export class FunctionService { } } -/** Simple data structure storing stats for a running Function. */ +/** Simple data structure storing stats for a running {@link Function_ Function}. */ export interface FunctionStats { backlog: number; numTotalRunners: number; } -/** Optional parameters for `Function_.updateAutoscaler()`. */ +/** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */ export interface FunctionUpdateAutoscalerParams { minContainers?: number; maxContainers?: number; diff --git a/modal-js/src/function_call.ts b/modal-js/src/function_call.ts index 97e84c42..6358784d 100644 --- a/modal-js/src/function_call.ts +++ b/modal-js/src/function_call.ts @@ -4,7 +4,14 @@ import { getDefaultClient, type ModalClient } from "./client"; import { ControlPlaneInvocation } from "./invocation"; /** - * Service for managing FunctionCalls. + * Service for managing {@link FunctionCall}s. + * + * Normally only ever accessed via the client as: + * + * ```typescript + * const modal = new ModalClient(); + * const functionCall = await modal.functionCalls.fromId("123"); + * ``` */ export class FunctionCallService { readonly #client: ModalClient; @@ -13,27 +20,27 @@ export class FunctionCallService { } /** - * Create a new Function call from ID. + * Create a new {@link FunctionCall} from ID. */ async fromId(functionCallId: string): Promise { return new FunctionCall(this.#client, functionCallId); } } -/** Optional parameters for `FunctionCall.get()`. */ +/** Optional parameters for {@link FunctionCall#get FunctionCall.get()}. */ export type FunctionCallGetParams = { timeout?: number; // in milliseconds }; -/** Optional parameters for `FunctionCall.cancel()`. */ +/** Optional parameters for {@link FunctionCall#cancel FunctionCall.cancel()}. */ export type FunctionCallCancelParams = { terminateContainers?: boolean; }; /** - * Represents a Modal FunctionCall. Function Calls are Function invocations with - * a given input. They can be consumed asynchronously (see `get()`) or cancelled - * (see `cancel()`). + * Represents a Modal FunctionCall. FunctionCalls are {@link Function_ Function} invocations with + * a given input. They can be consumed asynchronously (see {@link FunctionCall#get FunctionCall.get()}) or cancelled + * (see {@link FunctionCall#cancel FunctionCall.cancel()}). */ export class FunctionCall { readonly functionCallId: string; @@ -46,13 +53,13 @@ export class FunctionCall { } /** - * @deprecated Use `client.functionCalls.fromId()` instead. + * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead. */ static fromId(functionCallId: string): FunctionCall { return new FunctionCall(undefined, functionCallId); } - /** Get the result of a Function call, optionally waiting with a timeout. */ + /** Get the result of a FunctionCall, optionally waiting with a timeout. */ async get(params: FunctionCallGetParams = {}): Promise { const timeout = params.timeout; const invocation = ControlPlaneInvocation.fromFunctionCallId( @@ -62,7 +69,7 @@ export class FunctionCall { return invocation.awaitOutput(timeout); } - /** Cancel a running Function call. */ + /** Cancel a running FunctionCall. */ async cancel(params: FunctionCallCancelParams = {}) { const cpClient = this.#client?.cpClient || getDefaultClient().cpClient; diff --git a/modal-js/src/image.ts b/modal-js/src/image.ts index a3032fec..90f39195 100644 --- a/modal-js/src/image.ts +++ b/modal-js/src/image.ts @@ -14,7 +14,13 @@ import { Status } from "nice-grpc"; import { NotFoundError, InvalidError } from "./errors"; /** - * Service for managing Images. + * Service for managing {@link Image}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const image = await modal.images.fromRegistry("alpine"); + * ``` */ export class ImageService { readonly #client: ModalClient; @@ -23,7 +29,7 @@ export class ImageService { } /** - * Creates an Image from an Image ID + * Creates an {@link Image} from an Image ID * * @param imageId - Image ID. */ @@ -45,7 +51,7 @@ export class ImageService { } /** - * Creates an Image from a raw registry tag, optionally using a Secret for authentication. + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. * * @param tag - The registry tag for the Image. * @param secret - Optional. A Secret containing credentials for registry authentication. @@ -67,7 +73,7 @@ export class ImageService { } /** - * Creates an Image from a raw registry tag, optionally using a Secret for authentication. + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. * * @param tag - The registry tag for the Image. * @param secret - A Secret containing credentials for registry authentication. @@ -89,7 +95,7 @@ export class ImageService { } /** - * Creates an Image from a raw registry tag, optionally using a Secret for authentication. + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. * * @param tag - The registry tag for the Image. * @param secret - A Secret containing credentials for registry authentication. @@ -111,7 +117,7 @@ export class ImageService { } /** - * Delete an Image by ID. Warning: This removes an *entire Image*, and cannot be undone. + * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. */ async delete(imageId: string, _: ImageDeleteParams = {}): Promise { const image = await this.fromId(imageId); @@ -119,15 +125,15 @@ export class ImageService { } } -/** Optional parameters for `client.images.delete()`. */ +/** Optional parameters for {@link ImageService#delete client.images.delete()}. */ export type ImageDeleteParams = Record; -/** Optional parameters for `Image.dockerfileCommands()`. */ +/** Optional parameters for {@link Image#dockerfileCommands Image.dockerfileCommands()}. */ export type ImageDockerfileCommandsParams = { /** Environment variables to set in the build environment. */ env?: Record; - /** Secrets that will be made available as environment variables to this layer's build environment. */ + /** {@link Secret}s that will be made available as environment variables to this layer's build environment. */ secrets?: Secret[]; /** GPU reservation for this layer's build environment (e.g. "A100", "T4:2", "A100-80GB:4"). */ @@ -146,7 +152,7 @@ type Layer = { forceBuild?: boolean; }; -/** A container image, used for starting Sandboxes. */ +/** A container image, used for starting {@link Sandbox}es. */ export class Image { #client: ModalClient; #imageId: string; @@ -181,28 +187,28 @@ export class Image { } /** - * @deprecated Use `client.images.fromId()` instead. + * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead. */ static async fromId(imageId: string): Promise { return getDefaultClient().images.fromId(imageId); } /** - * @deprecated Use `client.images.fromRegistry()` instead. + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. */ static fromRegistry(tag: string, secret?: Secret): Image { return getDefaultClient().images.fromRegistry(tag, secret); } /** - * @deprecated Use `client.images.fromAwsEcr()` instead. + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. */ static fromAwsEcr(tag: string, secret: Secret): Image { return getDefaultClient().images.fromAwsEcr(tag, secret); } /** - * @deprecated Use `client.images.fromGcpArtifactRegistry()` instead. + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. */ static fromGcpArtifactRegistry(tag: string, secret: Secret): Image { return getDefaultClient().images.fromGcpArtifactRegistry(tag, secret); @@ -363,7 +369,7 @@ export class Image { } /** - * @deprecated Use `client.images.delete()` instead. + * @deprecated Use {@link ImageService#delete client.images.delete()} instead. */ static async delete( imageId: string, diff --git a/modal-js/src/proxy.ts b/modal-js/src/proxy.ts index 03c4e27d..06e2ab04 100644 --- a/modal-js/src/proxy.ts +++ b/modal-js/src/proxy.ts @@ -3,7 +3,7 @@ import { ClientError, Status } from "nice-grpc"; import { NotFoundError } from "./errors"; /** - * Service for managing Proxies. + * Service for managing {@link Proxy Proxies}. */ export class ProxyService { readonly #client: ModalClient; @@ -12,7 +12,13 @@ export class ProxyService { } /** - * Reference a Proxy by its name. + * Reference a {@link Proxy} by its name. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const proxy = await modal.proxies.fromName("my-proxy"); + * ``` */ async fromName(name: string, params?: ProxyFromNameParams): Promise { try { @@ -32,7 +38,7 @@ export class ProxyService { } } -/** Optional parameters for `client.proxies.fromName()`. */ +/** Optional parameters for {@link ProxyService#fromName client.proxies.fromName()}. */ export type ProxyFromNameParams = { environment?: string; }; @@ -47,7 +53,7 @@ export class Proxy { } /** - * @deprecated Use `client.proxies.fromName()` instead. + * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead. */ static async fromName( name: string, diff --git a/modal-js/src/queue.ts b/modal-js/src/queue.ts index ddee99c5..dd4eaa6c 100644 --- a/modal-js/src/queue.ts +++ b/modal-js/src/queue.ts @@ -13,24 +13,30 @@ import { EphemeralHeartbeatManager } from "./ephemeral"; const queueInitialPutBackoff = 100; // 100 milliseconds const queueDefaultPartitionTtl = 24 * 3600 * 1000; // 24 hours -/** Optional parameters for `client.queues.fromName()`. */ +/** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */ export type QueueFromNameParams = { environment?: string; createIfMissing?: boolean; }; -/** Optional parameters for `client.queues.delete()`. */ +/** Optional parameters for {@link QueueService#delete client.queues.delete()}. */ export type QueueDeleteParams = { environment?: string; }; -/** Optional parameters for `client.queues.ephemeral()`. */ +/** Optional parameters for {@link QueueService#ephemeral client.queues.ephemeral()}. */ export type QueueEphemeralParams = { environment?: string; }; /** - * Service for managing Queues. + * Service for managing {@link Queue}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const queue = await modal.queues.fromName("my-queue"); + * ``` */ export class QueueService { readonly #client: ModalClient; @@ -39,8 +45,8 @@ export class QueueService { } /** - * Create a nameless, temporary Queue. - * You will need to call `closeEphemeral()` to delete the Queue. + * Create a nameless, temporary {@link Queue}. + * You will need to call {@link Queue#closeEphemeral Queue.closeEphemeral()} to delete the Queue. */ async ephemeral(params: QueueEphemeralParams = {}): Promise { const resp = await this.#client.cpClient.queueGetOrCreate({ @@ -56,7 +62,7 @@ export class QueueService { } /** - * Lookup a Queue by name. + * Reference a {@link Queue} by name. */ async fromName( name: string, @@ -73,7 +79,7 @@ export class QueueService { } /** - * Delete a Queue by name. + * Delete a {@link Queue} by name. */ async delete(name: string, params: QueueDeleteParams = {}): Promise { const queue = await this.fromName(name, params); @@ -81,7 +87,7 @@ export class QueueService { } } -/** Optional parameters for `Queue.clear()`. */ +/** Optional parameters for {@link Queue#clear Queue.clear()}. */ export type QueueClearParams = { /** Partition to clear, uses default partition if not set. */ partition?: string; @@ -90,7 +96,7 @@ export type QueueClearParams = { all?: boolean; }; -/** Optional parameters for `Queue.get()`. */ +/** Optional parameters for {@link Queue#get Queue.get()}. */ export type QueueGetParams = { /** How long to wait if the Queue is empty (default: indefinite). */ timeout?: number; @@ -99,10 +105,10 @@ export type QueueGetParams = { partition?: string; }; -/** Optional parameters for `Queue.getMany()`. */ +/** Optional parameters for {@link Queue#getMany Queue.getMany()}. */ export type QueueGetManyParams = QueueGetParams; -/** Optional parameters for `Queue.put()`. */ +/** Optional parameters for {@link Queue#put Queue.put()}. */ export type QueuePutParams = { /** How long to wait if the Queue is full (default: indefinite). */ timeout?: number; @@ -114,10 +120,10 @@ export type QueuePutParams = { partitionTtl?: number; }; -/** Optional parameters for `Queue.putMany()`. */ +/** Optional parameters for {@link Queue#putMany Queue.putMany()}. */ export type QueuePutManyParams = QueuePutParams; -/** Optional parameters for `Queue.len()`. */ +/** Optional parameters for {@link Queue#len Queue.len()}. */ export type QueueLenParams = { /** Partition to compute length, uses default partition if not set. */ partition?: string; @@ -126,7 +132,7 @@ export type QueueLenParams = { total?: boolean; }; -/** Optional parameters for `Queue.iterate()`. */ +/** Optional parameters for {@link Queue#iterate Queue.iterate()}. */ export type QueueIterateParams = { /** How long to wait between successive items before exiting iteration (default: 0). */ itemPollTimeout?: number; @@ -136,7 +142,7 @@ export type QueueIterateParams = { }; /** - * Distributed, FIFO queue for data flow in Modal Apps. + * Distributed, FIFO queue for data flow in Modal {@link App Apps}. */ export class Queue { readonly #client: ModalClient; @@ -171,7 +177,7 @@ export class Queue { } /** - * @deprecated Use `client.queues.ephemeral()` instead. + * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead. */ static async ephemeral(params: QueueEphemeralParams = {}): Promise { return getDefaultClient().queues.ephemeral(params); @@ -187,7 +193,7 @@ export class Queue { } /** - * @deprecated Use `client.queues.fromName()` instead. + * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead. */ static async lookup( name: string, @@ -197,7 +203,7 @@ export class Queue { } /** - * @deprecated Use `client.queues.delete()` instead. + * @deprecated Use {@link QueueService#delete client.queues.delete()} instead. */ static async delete( name: string, @@ -319,7 +325,7 @@ export class Queue { * * If the Queue is full, this will retry with exponential backoff until the * provided `timeout` is reached, or indefinitely if `timeout` is not set. - * Raises `QueueFullError` if the Queue is still full after the timeout. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. */ async put(v: any, params: QueuePutParams = {}): Promise { await this.#put([v], params.timeout, params.partition, params.partitionTtl); @@ -330,7 +336,7 @@ export class Queue { * * If the Queue is full, this will retry with exponential backoff until the * provided `timeout` is reached, or indefinitely if `timeout` is not set. - * Raises `QueueFullError` if the Queue is still full after the timeout. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. */ async putMany(values: any[], params: QueuePutManyParams = {}): Promise { await this.#put( diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index e0efad38..2138be8d 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -64,7 +64,7 @@ export type StdioBehavior = "pipe" | "ignore"; */ export type StreamMode = "text" | "binary"; -/** Optional parameters for `client.sandboxes.create()`. */ +/** Optional parameters for {@link SandboxService#create client.sandboxes.create()}. */ export type SandboxCreateParams = { /** Reservation of physical CPU cores for the Sandbox, can be fractional. */ cpu?: number; @@ -93,13 +93,13 @@ export type SandboxCreateParams = { /** Environment variables to set in the Sandbox. */ env?: Record; - /** Secrets to inject into the Sandbox as environment variables. */ + /** {@link Secret}s to inject into the Sandbox as environment variables. */ secrets?: Secret[]; - /** Mount points for Modal Volumes. */ + /** Mount points for Modal {@link Volume}s. */ volumes?: Record; - /** Mount points for cloud buckets. */ + /** Mount points for {@link CloudBucketMount}s. */ cloudBucketMounts?: Record; /** Enable a PTY for the Sandbox. */ @@ -129,7 +129,7 @@ export type SandboxCreateParams = { /** Enable verbose logging. */ verbose?: boolean; - /** Reference to a Modal Proxy to use in front of this Sandbox. */ + /** Reference to a Modal {@link Proxy} to use in front of this Sandbox. */ proxy?: Proxy; /** Optional name for the Sandbox. Unique within an App. */ @@ -267,7 +267,13 @@ export async function buildSandboxCreateRequestProto( } /** - * Service for managing Sandboxes. + * Service for managing {@link Sandbox}es. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const sandbox = await modal.sandboxes.create(app, image); + * ``` */ export class SandboxService { readonly #client: ModalClient; @@ -276,7 +282,7 @@ export class SandboxService { } /** - * Create a new Sandbox in the App with the specified Image and options. + * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options. */ async create( app: App, @@ -314,7 +320,7 @@ export class SandboxService { return new Sandbox(this.#client, createResp.sandboxId); } - /** Returns a running Sandbox object from an ID. + /** Returns a running {@link Sandbox} object from an ID. * * @returns Sandbox with ID */ @@ -333,10 +339,10 @@ export class SandboxService { return new Sandbox(this.#client, sandboxId); } - /** Get a running Sandbox by name from a deployed App. + /** Get a running {@link Sandbox} by name from a deployed {@link App}. * - * Raises a NotFoundError if no running Sandbox is found with the given name. - * A Sandbox's name is the `name` argument passed to `sandboxes.create()`. + * Raises a {@link NotFoundError} if no running Sandbox is found with the given name. + * A Sandbox's name is the `name` argument passed to {@link SandboxService#create sandboxes.create()}. * * @param appName - Name of the deployed App * @param name - Name of the Sandbox @@ -365,7 +371,7 @@ export class SandboxService { } /** - * List all Sandboxes for the current Environment or App ID (if specified). + * List all {@link Sandbox}es for the current Environment or App ID (if specified). * If tags are specified, only Sandboxes that have at least those tags are returned. */ async *list( @@ -409,9 +415,9 @@ export class SandboxService { } } -/** Optional parameters for `client.sandboxes.list()`. */ +/** Optional parameters for {@link SandboxService#list client.sandboxes.list()}. */ export type SandboxListParams = { - /** Filter Sandboxes for a specific App. */ + /** Filter Sandboxes for a specific {@link App}. */ appId?: string; /** Only return Sandboxes that include all specified tags. */ tags?: Record; @@ -419,12 +425,12 @@ export type SandboxListParams = { environment?: string; }; -/** Optional parameters for `client.sandboxes.fromName()`. */ +/** Optional parameters for {@link SandboxService#fromName client.sandboxes.fromName()}. */ export type SandboxFromNameParams = { environment?: string; }; -/** Optional parameters for `Sandbox.exec()`. */ +/** Optional parameters for {@link Sandbox#exec Sandbox.exec()}. */ export type SandboxExecParams = { /** Specifies text or binary encoding for input and output streams. */ mode?: StreamMode; @@ -438,13 +444,13 @@ export type SandboxExecParams = { timeout?: number; /** Environment variables to set for the command. */ env?: Record; - /** Secrets to inject as environment variables for the commmand.*/ + /** {@link Secret}s to inject as environment variables for the commmand.*/ secrets?: Secret[]; /** Enable a PTY for the command. */ pty?: boolean; }; -/** A port forwarded from within a running Modal Sandbox. */ +/** A port forwarded from within a running Modal {@link Sandbox}. */ export class Tunnel { /** @ignore */ constructor( @@ -551,7 +557,7 @@ export class Sandbox { ); } - /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in `Sandbox.list`. */ + /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */ async setTags(tags: Record): Promise { const tagsList = Object.entries(tags).map(([tagName, tagValue]) => ({ tagName, @@ -593,14 +599,14 @@ export class Sandbox { } /** - * @deprecated Use `client.sandboxes.fromId()` instead. + * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead. */ static async fromId(sandboxId: string): Promise { return getDefaultClient().sandboxes.fromId(sandboxId); } /** - * @deprecated Use `client.sandboxes.fromName()` instead. + * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead. */ static async fromName( appName: string, @@ -616,7 +622,7 @@ export class Sandbox { * Open a file in the Sandbox filesystem. * @param path - Path to the file to open * @param mode - File open mode (r, w, a, r+, w+, a+) - * @returns Promise that resolves to a SandboxFile + * @returns Promise that resolves to a {@link SandboxFile} */ async open(path: string, mode: SandboxFileMode = "r"): Promise { const taskId = await this.#getTaskId(); @@ -706,11 +712,11 @@ export class Sandbox { } } - /** Get Tunnel metadata for the Sandbox. + /** Get {@link Tunnel} metadata for the Sandbox. * - * Raises `SandboxTimeoutError` if the tunnels are not available after the timeout. + * Raises {@link SandboxTimeoutError} if the tunnels are not available after the timeout. * - * @returns A dictionary of Tunnel objects which are keyed by the container port. + * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. */ async tunnels(timeout = 50000): Promise> { if (this.#tunnels) { @@ -744,10 +750,10 @@ export class Sandbox { /** * Snapshot the filesystem of the Sandbox. * - * Returns an `Image` object which can be used to spawn a new Sandbox with the same filesystem. + * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. * * @param timeout - Timeout for the snapshot operation in milliseconds - * @returns Promise that resolves to an Image + * @returns Promise that resolves to an {@link Image} */ async snapshotFilesystem(timeout = 55000): Promise { const resp = await this.#client.cpClient.sandboxSnapshotFs({ @@ -785,7 +791,7 @@ export class Sandbox { } /** - * @deprecated Use `client.sandboxes.list()` instead. + * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. */ static async *list( params: SandboxListParams = {}, diff --git a/modal-js/src/sandbox_filesystem.ts b/modal-js/src/sandbox_filesystem.ts index 4ad5ee4b..f355c5fb 100644 --- a/modal-js/src/sandbox_filesystem.ts +++ b/modal-js/src/sandbox_filesystem.ts @@ -10,7 +10,7 @@ import { SandboxFilesystemError } from "./errors"; export type SandboxFileMode = "r" | "w" | "a" | "r+" | "w+" | "a+"; /** - * SandboxFile represents an open file in the Sandbox filesystem. + * SandboxFile represents an open file in the {@link Sandbox} filesystem. * Provides read/write operations similar to Node.js `fsPromises.FileHandle`. */ export class SandboxFile { diff --git a/modal-js/src/secret.ts b/modal-js/src/secret.ts index 7000714a..e554c940 100644 --- a/modal-js/src/secret.ts +++ b/modal-js/src/secret.ts @@ -3,19 +3,25 @@ import { ClientError, Status } from "nice-grpc"; import { InvalidError, NotFoundError } from "./errors"; import { ObjectCreationType } from "../proto/modal_proto/api"; -/** Optional parameters for `client.secrets.fromName()`. */ +/** Optional parameters for {@link SecretService#fromName client.secrets.fromName()}. */ export type SecretFromNameParams = { environment?: string; requiredKeys?: string[]; }; -/** Optional parameters for `client.secrets.fromObject()`. */ +/** Optional parameters for {@link SecretService#fromObject client.secrets.fromObject()}. */ export type SecretFromObjectParams = { environment?: string; }; /** - * Service for managing Secrets. + * Service for managing {@link Secret Secrets}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const secret = await modal.secrets.fromName("my-secret"); + * ``` */ export class SecretService { readonly #client: ModalClient; @@ -23,7 +29,7 @@ export class SecretService { this.#client = client; } - /** Reference a Secret by its name. */ + /** Reference a {@link Secret} by its name. */ async fromName(name: string, params?: SecretFromNameParams): Promise { try { const resp = await this.#client.cpClient.secretGetOrCreate({ @@ -45,7 +51,7 @@ export class SecretService { } } - /** Create a Secret from a plain object of key-value pairs. */ + /** Create a {@link Secret} from a plain object of key-value pairs. */ async fromObject( entries: Record, params?: SecretFromObjectParams, @@ -78,7 +84,7 @@ export class SecretService { } } -/** Secrets provide a dictionary of environment variables for Images. */ +/** Secrets provide a dictionary of environment variables for {@link Image}s. */ export class Secret { readonly secretId: string; readonly name?: string; @@ -90,7 +96,7 @@ export class Secret { } /** - * @deprecated Use `client.secrets.fromName()` instead. + * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead. */ static async fromName( name: string, @@ -100,7 +106,7 @@ export class Secret { } /** - * @deprecated Use `client.secrets.fromObject()` instead. + * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead. */ static async fromObject( entries: Record, diff --git a/modal-js/src/volume.ts b/modal-js/src/volume.ts index 439b0ee8..40e28aef 100644 --- a/modal-js/src/volume.ts +++ b/modal-js/src/volume.ts @@ -4,19 +4,25 @@ import { ClientError, Status } from "nice-grpc"; import { NotFoundError, InvalidError } from "./errors"; import { EphemeralHeartbeatManager } from "./ephemeral"; -/** Optional parameters for `client.volumes.fromName()`. */ +/** Optional parameters for {@link VolumeService#fromName client.volumes.fromName()}. */ export type VolumeFromNameParams = { environment?: string; createIfMissing?: boolean; }; -/** Optional parameters for `client.volumes.ephemeral()`. */ +/** Optional parameters for {@link VolumeService#ephemeral client.volumes.ephemeral()}. */ export type VolumeEphemeralParams = { environment?: string; }; /** - * Service for managing Volumes. + * Service for managing {@link Volume}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const volume = await modal.volumes.fromName("my-volume"); + * ``` */ export class VolumeService { readonly #client: ModalClient; @@ -25,7 +31,7 @@ export class VolumeService { } /** - * Reference a Volume by its name. + * Reference a {@link Volume} by its name. */ async fromName(name: string, params?: VolumeFromNameParams): Promise { try { @@ -45,7 +51,7 @@ export class VolumeService { } /** - * Create a nameless, temporary Volume. + * Create a nameless, temporary {@link Volume}. * It persists until closeEphemeral() is called, or the process exits. */ async ephemeral(params: VolumeEphemeralParams = {}): Promise { @@ -62,7 +68,7 @@ export class VolumeService { } } -/** Volumes provide persistent storage that can be mounted in Modal Functions. */ +/** Volumes provide persistent storage that can be mounted in Modal {@link Function_ Function}s. */ export class Volume { readonly volumeId: string; readonly name?: string; @@ -83,7 +89,7 @@ export class Volume { } /** - * @deprecated Use `client.volumes.fromName()` instead. + * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead. */ static async fromName( name: string, @@ -102,7 +108,7 @@ export class Volume { } /** - * @deprecated Use `client.volumes.ephemeral()` instead. + * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead. */ static async ephemeral(options: VolumeEphemeralParams = {}): Promise { return getDefaultClient().volumes.ephemeral(options); From d35476aa722f3056d9bf1d7866a069524abb40ce Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Wed, 15 Oct 2025 11:37:40 -0400 Subject: [PATCH 02/59] Use trusted provider to publish to npm (#167) * Use trusted provider to publish to npm * Move permissions to the job level * Less diff --- .github/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5f130481..05209f81 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,7 +9,9 @@ jobs: publish: runs-on: ubuntu-24.04 if: startsWith(github.event.head_commit.message, '[RELEASE] Prepare release for') + environment: publish permissions: + id-token: write # Required for OIDC for trusted provider: https://docs.npmjs.com/trusted-publishers#github-actions-configuration contents: write steps: @@ -40,5 +42,3 @@ jobs: - name: Publish and push tags run: | python ci/release.py publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 9a4f6d44f92079804bbd0ff8e999172b59a14c1d Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Fri, 17 Oct 2025 10:44:50 +0200 Subject: [PATCH 03/59] Track which SDK version is being used (#164) --- modal-go/client.go | 42 ++++++++++---- .../test/integration/version-tracking/go.mod | 25 +++++++++ .../test/integration/version-tracking/go.sum | 55 +++++++++++++++++++ .../test/integration/version-tracking/main.go | 17 ++++++ .../test/integration/version-tracking/test.sh | 21 +++++++ modal-go/test/integration_test.go | 41 ++++++++++++++ modal-js/src/client.ts | 9 +++ modal-js/src/version.ts | 7 +++ modal-js/test/version_tracking.test.ts | 17 ++++++ modal-js/tsup.config.ts | 4 ++ modal-js/vitest.config.ts | 4 ++ 11 files changed, 232 insertions(+), 10 deletions(-) create mode 100644 modal-go/test/integration/version-tracking/go.mod create mode 100644 modal-go/test/integration/version-tracking/go.sum create mode 100644 modal-go/test/integration/version-tracking/main.go create mode 100755 modal-go/test/integration/version-tracking/test.sh create mode 100644 modal-go/test/integration_test.go create mode 100644 modal-js/src/version.ts create mode 100644 modal-js/test/version_tracking.test.ts diff --git a/modal-go/client.go b/modal-go/client.go index 2f538ed2..d83e227c 100644 --- a/modal-go/client.go +++ b/modal-go/client.go @@ -7,6 +7,7 @@ import ( "crypto/tls" "fmt" "os" + "runtime/debug" "strconv" "strings" "sync" @@ -23,6 +24,19 @@ import ( pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" ) +var sdkVersion = sync.OnceValue(func() string { + const mod = "github.com/modal-labs/libmodal/modal-go" + + if info, ok := debug.ReadBuildInfo(); ok { + for _, dep := range info.Deps { + if dep.Path == mod { + return dep.Version + } + } + } + return "v0.0.0" +}) + // Client exposes services for interacting with Modal resources. // You should not instantiate it directly, and instead use [NewClient]/[NewClientWithOptions]. type Client struct { @@ -40,6 +54,7 @@ type Client struct { config config profile Profile + sdkVersion string cpClient pb.ModalClientClient // control plane client ipClients map[string]pb.ModalClientClient // input plane clients authTokenManager *AuthTokenManager @@ -90,9 +105,10 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { } c := &Client{ - config: cfg, - profile: profile, - ipClients: make(map[string]pb.ModalClientClient), + config: cfg, + profile: profile, + sdkVersion: sdkVersion(), + ipClients: make(map[string]pb.ModalClientClient), } var err error @@ -157,6 +173,11 @@ func (c *Client) Close() { c.authTokenManager.Stop() } +// Version returns the SDK version. +func (c *Client) Version() string { + return c.sdkVersion +} + // timeoutCallOption carries a per-RPC absolute timeout. type timeoutCallOption struct { grpc.EmptyCallOption @@ -222,13 +243,13 @@ func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClie grpc.MaxCallSendMsgSize(maxMessageSize), ), grpc.WithChainUnaryInterceptor( - headerInjectorUnaryInterceptor(profile), + headerInjectorUnaryInterceptor(profile, c.sdkVersion), authTokenInterceptor(c), retryInterceptor(), timeoutInterceptor(), ), grpc.WithChainStreamInterceptor( - headerInjectorStreamInterceptor(profile), + headerInjectorStreamInterceptor(profile, c.sdkVersion), ), ) if err != nil { @@ -238,7 +259,7 @@ func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClie } // injectRequiredHeaders adds required headers to the context. -func injectRequiredHeaders(ctx context.Context, profile Profile) (context.Context, error) { +func injectRequiredHeaders(ctx context.Context, profile Profile, sdkVersion string) (context.Context, error) { if profile.TokenID == "" || profile.TokenSecret == "" { return nil, fmt.Errorf("missing token_id or token_secret, please set in .modal.toml, environment variables, or via NewClientWithOptions()") } @@ -248,13 +269,14 @@ func injectRequiredHeaders(ctx context.Context, profile Profile) (context.Contex ctx, "x-modal-client-type", clientType, "x-modal-client-version", "1.0.0", // CLIENT VERSION: Behaves like this Python SDK version + "x-modal-libmodal-version", "modal-go/"+sdkVersion, "x-modal-token-id", profile.TokenID, "x-modal-token-secret", profile.TokenSecret, ), nil } // headerInjectorUnaryInterceptor adds required headers to outgoing unary RPCs. -func headerInjectorUnaryInterceptor(profile Profile) grpc.UnaryClientInterceptor { +func headerInjectorUnaryInterceptor(profile Profile, sdkVersion string) grpc.UnaryClientInterceptor { return func( ctx context.Context, method string, @@ -264,7 +286,7 @@ func headerInjectorUnaryInterceptor(profile Profile) grpc.UnaryClientInterceptor opts ...grpc.CallOption, ) error { var err error - ctx, err = injectRequiredHeaders(ctx, profile) + ctx, err = injectRequiredHeaders(ctx, profile, sdkVersion) if err != nil { return err } @@ -273,7 +295,7 @@ func headerInjectorUnaryInterceptor(profile Profile) grpc.UnaryClientInterceptor } // headerInjectorStreamInterceptor adds required headers to outgoing streaming RPCs. -func headerInjectorStreamInterceptor(profile Profile) grpc.StreamClientInterceptor { +func headerInjectorStreamInterceptor(profile Profile, sdkVersion string) grpc.StreamClientInterceptor { return func( ctx context.Context, desc *grpc.StreamDesc, @@ -283,7 +305,7 @@ func headerInjectorStreamInterceptor(profile Profile) grpc.StreamClientIntercept opts ...grpc.CallOption, ) (grpc.ClientStream, error) { var err error - ctx, err = injectRequiredHeaders(ctx, profile) + ctx, err = injectRequiredHeaders(ctx, profile, sdkVersion) if err != nil { return nil, err } diff --git a/modal-go/test/integration/version-tracking/go.mod b/modal-go/test/integration/version-tracking/go.mod new file mode 100644 index 00000000..a6391acf --- /dev/null +++ b/modal-go/test/integration/version-tracking/go.mod @@ -0,0 +1,25 @@ +module test-version-detection + +go 1.23.0 + +require github.com/modal-labs/libmodal/modal-go v0.0.99 + +require ( + github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced // indirect + github.com/djherbis/buffer v1.2.0 // indirect + github.com/djherbis/nio/v3 v3.0.1 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kisielk/og-rek v1.3.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect + google.golang.org/grpc v1.72.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect +) + +replace github.com/modal-labs/libmodal/modal-go => ../../.. diff --git a/modal-go/test/integration/version-tracking/go.sum b/modal-go/test/integration/version-tracking/go.sum new file mode 100644 index 00000000..9a8ba54c --- /dev/null +++ b/modal-go/test/integration/version-tracking/go.sum @@ -0,0 +1,55 @@ +github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced h1:HxlRMDx/VeRqzj3nvqX9k4tjeBcEIkoNHDJPsS389hs= +github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced/go.mod h1:p7lmI+ecoe1RTyD11SPXWsSQ3H+pJ4cp5y7vtKW4QdM= +github.com/djherbis/buffer v1.1.0/go.mod h1:VwN8VdFkMY0DCALdY8o00d3IZ6Amz/UNVMWcSaJT44o= +github.com/djherbis/buffer v1.2.0 h1:PH5Dd2ss0C7CRRhQCZ2u7MssF+No9ide8Ye71nPHcrQ= +github.com/djherbis/buffer v1.2.0/go.mod h1:fjnebbZjCUpPinBRD+TDwXSOeNQ7fPQWLfGQqiAiUyE= +github.com/djherbis/nio/v3 v3.0.1 h1:6wxhnuppteMa6RHA4L81Dq7ThkZH8SwnDzXDYy95vB4= +github.com/djherbis/nio/v3 v3.0.1/go.mod h1:Ng4h80pbZFMla1yKzm61cF0tqqilXZYrogmWgZxOcmg= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kisielk/og-rek v1.3.0 h1:lTXdQXqFETZKA//FWH4RBNAuiJ/dofxIwHAidoUZoMk= +github.com/kisielk/og-rek v1.3.0/go.mod h1:4at7oxyfBTDilURhNCf7irHWtosJlJl9uyqUqAkrP4w= +github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= +github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY= +golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 h1:h6p3mQqrmT1XkHVTfzLdNz1u7IhINeZkz67/xTbOuWs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= +google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/modal-go/test/integration/version-tracking/main.go b/modal-go/test/integration/version-tracking/main.go new file mode 100644 index 00000000..8d1d9009 --- /dev/null +++ b/modal-go/test/integration/version-tracking/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "fmt" + + "github.com/modal-labs/libmodal/modal-go" +) + +func main() { + client, err := modal.NewClient() + if err != nil { + panic(fmt.Sprintf("ERROR: Failed to create client: %v", err)) + } + defer client.Close() + + fmt.Println(client.Version()) +} diff --git a/modal-go/test/integration/version-tracking/test.sh b/modal-go/test/integration/version-tracking/test.sh new file mode 100755 index 00000000..08c5c0b7 --- /dev/null +++ b/modal-go/test/integration/version-tracking/test.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +cd "$(dirname "$0")" +go mod tidy +go build -o test-app . + +output=$(./test-app) + +expected="v0.0.99" + +if [ "$output" = "$expected" ]; then + rm -f test-app + exit 0 +else + echo "Version tracking failed:" + echo " Expected: $expected" + echo " Got: $output" + rm -f test-app + exit 1 +fi diff --git a/modal-go/test/integration_test.go b/modal-go/test/integration_test.go new file mode 100644 index 00000000..22b17be4 --- /dev/null +++ b/modal-go/test/integration_test.go @@ -0,0 +1,41 @@ +package test + +import ( + "os" + "os/exec" + "path/filepath" + "testing" + + "github.com/onsi/gomega" +) + +func TestIntegrationTests(t *testing.T) { + g := gomega.NewWithT(t) + + cwd, err := os.Getwd() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + testScripts := []string{ + "integration/version-tracking/test.sh", + } + + for _, relPath := range testScripts { + path := filepath.Join(cwd, relPath) + + t.Run(relPath, func(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := os.Stat(path) + g.Expect(err).ShouldNot(gomega.HaveOccurred(), "integration test script should exist at %s", path) + + cmd := exec.Command("sh", path) + cmd.Dir = filepath.Dir(path) + output, err := cmd.CombinedOutput() + + if err != nil { + t.Logf("Integration test output:\n%s", string(output)) + t.Fatalf("Integration test failed: %v", err) + } + }) + } +} diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index e1fffba7..999caa98 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -24,6 +24,7 @@ import { VolumeService } from "./volume"; import { ClientType, ModalClientDefinition } from "../proto/modal_proto/api"; import { getProfile, type Profile } from "./config"; import { AuthTokenManager } from "./auth_token_manager"; +import { getSDKVersion } from "./version"; export interface ModalClientParams { tokenId?: string; @@ -130,6 +131,10 @@ export class ModalClient { } } + version(): string { + return getSDKVersion(); + } + private createClient(profile: Profile): ModalGrpcClient { // Channels don't do anything until you send a request on them. // Ref: https://github.com/modal-labs/modal-client/blob/main/modal/_utils/grpc_utils.py @@ -171,6 +176,10 @@ export class ModalClient { String(ClientType.CLIENT_TYPE_LIBMODAL_JS), ); options.metadata.set("x-modal-client-version", "1.0.0"); // CLIENT VERSION: Behaves like this Python SDK version + options.metadata.set( + "x-modal-libmodal-version", + `modal-js/${getSDKVersion()}`, + ); options.metadata.set("x-modal-token-id", tokenId); options.metadata.set("x-modal-token-secret", tokenSecret); diff --git a/modal-js/src/version.ts b/modal-js/src/version.ts new file mode 100644 index 00000000..2f83b5c8 --- /dev/null +++ b/modal-js/src/version.ts @@ -0,0 +1,7 @@ +declare const __MODAL_SDK_VERSION__: string; + +export function getSDKVersion(): string { + return typeof __MODAL_SDK_VERSION__ !== "undefined" + ? __MODAL_SDK_VERSION__ + : "0.0.0"; +} diff --git a/modal-js/test/version_tracking.test.ts b/modal-js/test/version_tracking.test.ts new file mode 100644 index 00000000..5d0caeb1 --- /dev/null +++ b/modal-js/test/version_tracking.test.ts @@ -0,0 +1,17 @@ +import { expect, test } from "vitest"; +import { ModalClient } from "modal"; + +declare const __MODAL_SDK_VERSION__: string; + +test("VersionConstantFormat", () => { + expect(__MODAL_SDK_VERSION__).toBeDefined(); + expect(__MODAL_SDK_VERSION__).toMatch(/^\d+\.\d+\.\d+$/); +}); + +test("ClientVersion", () => { + const client = new ModalClient(); + expect(client.version()).toBeDefined(); + expect(client.version()).toMatch(/^\d+\.\d+\.\d+$/); + expect(client.version()).toBe(__MODAL_SDK_VERSION__); + client.close(); +}); diff --git a/modal-js/tsup.config.ts b/modal-js/tsup.config.ts index 84f1bb36..14b13958 100644 --- a/modal-js/tsup.config.ts +++ b/modal-js/tsup.config.ts @@ -1,8 +1,12 @@ import { defineConfig } from "tsup"; +import packageJson from "./package.json" with { type: "json" }; export default defineConfig({ entry: ["src/index.ts"], format: ["esm", "cjs"], dts: true, clean: true, + define: { + __MODAL_SDK_VERSION__: JSON.stringify(packageJson.version), // also set in vitest.config.ts + }, }); diff --git a/modal-js/vitest.config.ts b/modal-js/vitest.config.ts index d7690409..978f78de 100644 --- a/modal-js/vitest.config.ts +++ b/modal-js/vitest.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from "vitest/config"; import path from "node:path"; +import packageJson from "./package.json" with { type: "json" }; export default defineConfig({ test: { @@ -13,4 +14,7 @@ export default defineConfig({ modal: path.resolve(__dirname, "./src/index.ts"), }, }, + define: { + __MODAL_SDK_VERSION__: JSON.stringify(packageJson.version), // also set in tsup.config.ts + }, }); From 7f56680c156d7b3c39c75f68d1b0b647a58eaf97 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 12:06:48 +0200 Subject: [PATCH 04/59] Enable making dev pre-releases (#168) Main changes: - enable making dev releases, like `v0.3.26-dev.0` - will now enforce that the JS and Go SDKs have the same version (will manually bump to 0.5.0, and they will stay synced from there) - add a `--dry-run` mode - remove all git operations from `modal-js/package.json`, and move to `ci/release.py`. --- .github/workflows/publish.yaml | 8 +- .github/workflows/release.yaml | 10 ++- ci/release.py | 139 +++++++++++++++++++++++---------- modal-js/package.json | 5 +- 4 files changed, 113 insertions(+), 49 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 05209f81..b8b55e0d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -8,7 +8,7 @@ on: jobs: publish: runs-on: ubuntu-24.04 - if: startsWith(github.event.head_commit.message, '[RELEASE] Prepare release for') + if: startsWith(github.event.head_commit.message, '[RELEASE] Prepare release for') || startsWith(github.event.head_commit.message, '[DEV-RELEASE] Prepare dev release for') environment: publish permissions: id-token: write # Required for OIDC for trusted provider: https://docs.npmjs.com/trusted-publishers#github-actions-configuration @@ -41,4 +41,8 @@ jobs: - name: Publish and push tags run: | - python ci/release.py publish + if [[ "${{ github.event.head_commit.message }}" == "[DEV-RELEASE]"* ]]; then + python ci/release.py publish --dev + else + python ci/release.py publish + fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a8e68fdf..1868b4c6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,6 +10,14 @@ on: - patch - minor - major + release_type: + description: 'Release type' + required: true + type: choice + options: + - stable + - dev + default: stable jobs: open-pr-for-release: @@ -52,7 +60,7 @@ jobs: - name: Switch to ci-release and make release commits run: | git switch -c ci-release - python ci/release.py version ${{ inputs.update }} + python ci/release.py version ${{ inputs.update }} ${{ inputs.release_type == 'dev' && '--dev' || '' }} git push origin ci-release --force - name: Create Pull Request diff --git a/ci/release.py b/ci/release.py index 018471af..790500cb 100644 --- a/ci/release.py +++ b/ci/release.py @@ -1,21 +1,32 @@ """CLI to help prepare and publish release. -To prepare release for +To prepare stable release: ```bash -python ci/release.py version patch # or 'minor' +python ci/release.py version patch # or 'minor' or 'major' ``` -To publish run: +To prepare dev release: + +```bash +python ci/release.py version patch --dev +``` + +To publish stable release: ```bash python ci/release.py publish ``` +To publish dev release: + +```bash +python ci/release.py publish --dev +``` + """ import json -import re from argparse import ArgumentParser from pathlib import Path from subprocess import run @@ -62,79 +73,121 @@ def check_git_clean(): raise RuntimeError(f"git status is not clean:\n{git_status.stdout}") -def get_current_go_version_from_changelog(changelog_content: str): - match = re.search(r"modal-go/v(?P[\d]+)\.(?P[\d]+)\.(?P[\d]+)", changelog_content) - if not match: - raise RuntimeError("Unable to parse modal-go version") - current_go_verison = {key: int(match.group(key)) for key in ["major", "minor", "patch"]} - return current_go_verison +def get_current_js_version(): + package_path = Path("modal-js") / "package.json" + with package_path.open("r") as f: + json_package = json.load(f) + return json_package["version"] def update_version(args): - """Updates version and changelog to prepare for release..""" + """Updates version and changelog and prepare a release PR.""" if args.update not in ["major", "minor", "patch"]: raise RuntimeError("update parameter must be 'major', 'minor', or 'patch'") - # Make sure changelog has new items in "Unreleased" - changelog_path = Path("CHANGELOG.md") - changelog_content = changelog_path.read_text() - check_unreleased_has_items(changelog_content) - check_git_clean() - # Get updated go version - go_version = get_current_go_version_from_changelog(changelog_content) - go_version[args.update] += 1 - new_go_version = f"v{go_version['major']}.{go_version['minor']}.{go_version['patch']}" + if args.dev: + current_version = get_current_js_version() - # Update and get new js version - run_cli(["npm", "version", args.update], text=True, cwd="modal-js") - package_path = Path("modal-js") / "package.json" - with package_path.open("r") as f: - json_package = json.load(f) - new_js_version = json_package["version"] + if "-dev." in current_version: + run_cli(["npm", "version", "prerelease", "--no-git-tag-version"], cwd="modal-js") + else: + run_cli(["npm", "version", f"pre{args.update}", "--preid=dev", "--no-git-tag-version"], cwd="modal-js") + + new_version = get_current_js_version() + + run_cli(["git", "diff"]) - # Update changelog with versions - version_header = f"modal-js/v{new_js_version}, modal-go/{new_go_version}" + commit_message = f"[DEV-RELEASE] Prepare dev release for modal-js/v{new_version}, modal-go/v{new_version}" + if args.dry_run: + print("\nDRY RUN: Would create commit with message:") + print(commit_message) + run_cli(["git", "restore", "--", "modal-js/package.json", "modal-js/package-lock.json"]) + else: + run_cli(["git", "add", "modal-js/package.json", "modal-js/package-lock.json"]) + run_cli(["git", "commit", "-m", commit_message]) + else: + changelog_path = Path("CHANGELOG.md") + changelog_content = changelog_path.read_text() + check_unreleased_has_items(changelog_content) - new_header = dedent(f"""\ - ## Unreleased + run_cli(["npm", "version", args.update, "--no-git-tag-version"], text=True, cwd="modal-js") + new_version = get_current_js_version() - No unreleased changes. + version_header = f"modal-js/v{new_version}, modal-go/v{new_version}" - ## {version_header}""") + new_header = dedent(f"""\ + ## Unreleased - new_changelog_content = changelog_content.replace("## Unreleased", new_header) - changelog_path.write_text(new_changelog_content) + No unreleased changes. - run_cli(["git", "diff"]) - run_cli(["git", "add", str(changelog_path)]) - run_cli(["git", "commit", "-m", f"[RELEASE] Prepare release for {version_header}"]) + ## {version_header}""") + + new_changelog_content = changelog_content.replace("## Unreleased", new_header) + changelog_path.write_text(new_changelog_content) + + run_cli(["git", "diff"]) + run_cli(["git", "add", "modal-js/package.json", "modal-js/package-lock.json", str(changelog_path)]) + + commit_message = f"[RELEASE] Prepare release for {version_header}" + if args.dry_run: + print("\nDRY RUN: Would create commit with message:") + print(commit_message) + run_cli(["git", "reset", "HEAD"]) + run_cli( + ["git", "restore", "--", "modal-js/package.json", "modal-js/package-lock.json", str(changelog_path)] + ) + else: + run_cli(["git", "commit", "-m", commit_message]) def publish(args): """Publish both modal-js and modal-go""" check_git_clean() - run_cli(["npm", "publish"], cwd="modal-js") - go_version = get_current_go_version_from_changelog(Path("CHANGELOG.md").read_text()) - go_version_str = f"v{go_version['major']}.{go_version['minor']}.{go_version['patch']}" - - run_cli(["git", "tag", f"modal-go/{go_version_str}"]) + version = get_current_js_version() + js_tag = f"modal-js/v{version}" + go_tag = f"modal-go/v{version}" + + if args.dry_run: + print("\nDRY RUN: Would execute the following operations:") + print(" - git push (push version commit)") + if args.dev: + print(" - npm publish --tag next (in modal-js/)") + else: + print(" - npm publish (in modal-js/)") + print(f" - Create and push git tags: {js_tag}, {go_tag}") + return + + run_cli(["git", "push"]) + + if args.dev: + run_cli(["npm", "publish", "--tag", "next"], cwd="modal-js") + else: + run_cli(["npm", "publish"], cwd="modal-js") + + run_cli(["git", "tag", js_tag]) + run_cli(["git", "tag", go_tag]) run_cli(["git", "push", "--tags"]) - run_cli(["curl", f"https://proxy.golang.org/github.com/modal-labs/libmodal/modal-go/@v/{go_version_str}.info"]) + run_cli(["curl", f"https://proxy.golang.org/github.com/modal-labs/libmodal/modal-go/@v/v{version}.info"]) def main(): """Entrypoint for preparing and publishing release.""" parser = ArgumentParser() subparsers = parser.add_subparsers(required=True) + version_parser = subparsers.add_parser("version") version_parser.add_argument("update") + version_parser.add_argument("--dev", action="store_true", help="Create dev release") + version_parser.add_argument("--dry-run", action="store_true", help="Show what would be done without making changes") version_parser.set_defaults(func=update_version) publish_parser = subparsers.add_parser("publish") + publish_parser.add_argument("--dev", action="store_true", help="Publish dev release") + publish_parser.add_argument("--dry-run", action="store_true", help="Show what would be done without making changes") publish_parser.set_defaults(func=publish) args = parser.parse_args() diff --git a/modal-js/package.json b/modal-js/package.json index 1401bf3c..ce3c1691 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -34,9 +34,8 @@ "prepare": "scripts/gen-proto.sh", "test": "vitest run", "test:watch": "vitest", - "version": "npm run check && git add -A && git commit -m \"modal-js/v$npm_package_version\"", - "prepublishOnly": "npm run build && git push", - "postpublish": "git tag modal-js/v$npm_package_version && git push --tags" + "version": "npm run check", + "prepublishOnly": "npm run build" }, "dependencies": { "cbor-x": "^1.6.0", From 9826dd473171d4694c7be9e414eb6a7eaeebb01b Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 13:43:41 +0200 Subject: [PATCH 05/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.0, modal-go/v0.5.0-dev.0 (#169) * [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.0, modal-go/v0.5.0-dev.0 * Fix version format tests --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- modal-js/test/version_tracking.test.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 530f3213..eea51880 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.3.25", + "version": "0.5.0-dev.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.3.25", + "version": "0.5.0-dev.0", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index ce3c1691..9ceeb4f1 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.3.25", + "version": "0.5.0-dev.0", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", diff --git a/modal-js/test/version_tracking.test.ts b/modal-js/test/version_tracking.test.ts index 5d0caeb1..155ddb30 100644 --- a/modal-js/test/version_tracking.test.ts +++ b/modal-js/test/version_tracking.test.ts @@ -5,13 +5,13 @@ declare const __MODAL_SDK_VERSION__: string; test("VersionConstantFormat", () => { expect(__MODAL_SDK_VERSION__).toBeDefined(); - expect(__MODAL_SDK_VERSION__).toMatch(/^\d+\.\d+\.\d+$/); + expect(__MODAL_SDK_VERSION__).toMatch(/^\d+\.\d+\.\d+(-dev\.\d+)?$/); }); test("ClientVersion", () => { const client = new ModalClient(); expect(client.version()).toBeDefined(); - expect(client.version()).toMatch(/^\d+\.\d+\.\d+$/); + expect(client.version()).toMatch(/^\d+\.\d+\.\d+(-dev\.\d+)?$/); expect(client.version()).toBe(__MODAL_SDK_VERSION__); client.close(); }); From 5042d75a2ea200bf8453c92235fd8702e855a90c Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 14:32:18 +0200 Subject: [PATCH 06/59] Move GH workflow permissions to top level (#170) --- .github/workflows/publish.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b8b55e0d..45320a1c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -5,14 +5,15 @@ on: branches: - main +permissions: + id-token: write # Required for OIDC for trusted provider: https://docs.npmjs.com/trusted-publishers#github-actions-configuration + contents: write + jobs: publish: runs-on: ubuntu-24.04 if: startsWith(github.event.head_commit.message, '[RELEASE] Prepare release for') || startsWith(github.event.head_commit.message, '[DEV-RELEASE] Prepare dev release for') environment: publish - permissions: - id-token: write # Required for OIDC for trusted provider: https://docs.npmjs.com/trusted-publishers#github-actions-configuration - contents: write steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 From ffcfda758db41311200c472d4387382044f25983 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 14:49:09 +0200 Subject: [PATCH 07/59] Push git tags before npm publish (#172) --- ci/release.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ci/release.py b/ci/release.py index 790500cb..e6690238 100644 --- a/ci/release.py +++ b/ci/release.py @@ -152,25 +152,24 @@ def publish(args): if args.dry_run: print("\nDRY RUN: Would execute the following operations:") - print(" - git push (push version commit)") + print("- git push (push version commit)") + print(f"- Create and push git tags: {js_tag}, {go_tag}") if args.dev: - print(" - npm publish --tag next (in modal-js/)") + print("- npm publish --tag next (in modal-js/)") else: - print(" - npm publish (in modal-js/)") - print(f" - Create and push git tags: {js_tag}, {go_tag}") + print("- npm publish (in modal-js/)") return run_cli(["git", "push"]) + run_cli(["git", "tag", js_tag]) + run_cli(["git", "tag", go_tag]) + run_cli(["git", "push", "--tags"]) if args.dev: run_cli(["npm", "publish", "--tag", "next"], cwd="modal-js") else: run_cli(["npm", "publish"], cwd="modal-js") - run_cli(["git", "tag", js_tag]) - run_cli(["git", "tag", go_tag]) - run_cli(["git", "push", "--tags"]) - run_cli(["curl", f"https://proxy.golang.org/github.com/modal-labs/libmodal/modal-go/@v/v{version}.info"]) From 9cedd88c223ed241cf85b7c535fe065f454439eb Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 12:56:50 +0000 Subject: [PATCH 08/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.1, modal-go/v0.5.0-dev.1 (#171) Co-authored-by: thomasjpfan --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index eea51880..99a0928a 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.0", + "version": "0.5.0-dev.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.0", + "version": "0.5.0-dev.1", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 9ceeb4f1..344cb548 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.0", + "version": "0.5.0-dev.1", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From afdecaaf768f0aa7eb492b0dcd799ddc5b5f1c65 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 15:10:04 +0200 Subject: [PATCH 09/59] Add git tag required by npm (#173) --- ci/release.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ci/release.py b/ci/release.py index e6690238..33f2815a 100644 --- a/ci/release.py +++ b/ci/release.py @@ -147,13 +147,12 @@ def publish(args): check_git_clean() version = get_current_js_version() - js_tag = f"modal-js/v{version}" - go_tag = f"modal-go/v{version}" + git_tags = [f"{version}", f"modal-js/v{version}", f"modal-go/v{version}"] if args.dry_run: print("\nDRY RUN: Would execute the following operations:") print("- git push (push version commit)") - print(f"- Create and push git tags: {js_tag}, {go_tag}") + print(f"- Create and push git tags: {' '.join(git_tags)}") if args.dev: print("- npm publish --tag next (in modal-js/)") else: @@ -161,8 +160,8 @@ def publish(args): return run_cli(["git", "push"]) - run_cli(["git", "tag", js_tag]) - run_cli(["git", "tag", go_tag]) + for tag in git_tags: + run_cli(["git", "tag", tag]) run_cli(["git", "push", "--tags"]) if args.dev: From 6a7e00eee03715225bd48c5e3ce81d0979286f8b Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 13:17:37 +0000 Subject: [PATCH 10/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.2, modal-go/v0.5.0-dev.2 (#174) Co-authored-by: ehdr --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 99a0928a..e1ca826f 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.1", + "version": "0.5.0-dev.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.1", + "version": "0.5.0-dev.2", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 344cb548..73c87283 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.1", + "version": "0.5.0-dev.2", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From 7d0fe45a599bdeb8c69718fcf4d7be354eb0603f Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 15:37:09 +0200 Subject: [PATCH 11/59] Upgrade the actions/setup-node GH Action (#175) --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 45320a1c..63f471cd 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -24,7 +24,7 @@ jobs: with: python-version: '3.13' - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: "20.x" cache: 'npm' From 193fb7239cc7533ce7ebaea60d84e420b30891b5 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:48:06 +0200 Subject: [PATCH 12/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.3, modal-go/v0.5.0-dev.3 (#176) Co-authored-by: thomasjpfan --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index e1ca826f..c53829a3 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.2", + "version": "0.5.0-dev.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.2", + "version": "0.5.0-dev.3", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 73c87283..26d31099 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.2", + "version": "0.5.0-dev.3", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From 7f9cd91665cebd9eb9fbfc10880bb51087b42f67 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 16:14:19 +0200 Subject: [PATCH 13/59] Explicitly upgrade npm to a version that supports trusted publishing (#177) --- .github/workflows/publish.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 63f471cd..7e443d60 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -31,6 +31,9 @@ jobs: registry-url: 'https://registry.npmjs.org' cache-dependency-path: modal-js/package-lock.json + - name: Ensure npm 11.5.1 or later for trusted publishing + run: npm install -g npm@>=11.5.1 + - name: Install npm packages run: npm install working-directory: ./modal-js From f37324c685b79241de7fc24b4ca63d80f8458e8a Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:17:59 +0000 Subject: [PATCH 14/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.4, modal-go/v0.5.0-dev.4 (#178) Co-authored-by: ehdr --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index c53829a3..9c857370 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.3", + "version": "0.5.0-dev.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.3", + "version": "0.5.0-dev.4", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 26d31099..d0f81759 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.3", + "version": "0.5.0-dev.4", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From f2f731275ba6bccb01533c4360924df3c42baa67 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 16:29:12 +0200 Subject: [PATCH 15/59] Quote the npm version (#179) --- .github/workflows/publish.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7e443d60..aafd33f8 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -32,7 +32,8 @@ jobs: cache-dependency-path: modal-js/package-lock.json - name: Ensure npm 11.5.1 or later for trusted publishing - run: npm install -g npm@>=11.5.1 + run: npm install -g 'npm@>=11.5.1' + working-directory: ./modal-js - name: Install npm packages run: npm install From 7495abf0287b446146e3e8cbc7db7bd55e695689 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:32:29 +0000 Subject: [PATCH 16/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.5, modal-go/v0.5.0-dev.5 (#180) Co-authored-by: ehdr --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 9c857370..32fcffb2 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.4", + "version": "0.5.0-dev.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.4", + "version": "0.5.0-dev.5", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index d0f81759..e50c4847 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.4", + "version": "0.5.0-dev.5", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From 34bc0127668501edd97a8f4c4283dabfafc3f6cf Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 20 Oct 2025 16:40:00 +0200 Subject: [PATCH 17/59] Skip git clean assertion in publish flow (#181) --- ci/release.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/release.py b/ci/release.py index 33f2815a..af465fff 100644 --- a/ci/release.py +++ b/ci/release.py @@ -144,8 +144,6 @@ def update_version(args): def publish(args): """Publish both modal-js and modal-go""" - check_git_clean() - version = get_current_js_version() git_tags = [f"{version}", f"modal-js/v{version}", f"modal-go/v{version}"] From 3f3b366f6756c3e2166cfcf6c65b96792fbdb499 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:47:28 +0000 Subject: [PATCH 18/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.6, modal-go/v0.5.0-dev.6 (#182) Co-authored-by: ehdr --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 32fcffb2..a7535081 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.5", + "version": "0.5.0-dev.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.5", + "version": "0.5.0-dev.6", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index e50c4847..78e34e4b 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.5", + "version": "0.5.0-dev.6", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From dc00374c53b25318adbbcaac2bbe91e616195081 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 16:54:31 +0200 Subject: [PATCH 19/59] [DEV-RELEASE] Prepare dev release for modal-js/v0.5.0-dev.7, modal-go/v0.5.0-dev.7 (#183) Co-authored-by: ehdr --- modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index a7535081..12f1914e 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.6", + "version": "0.5.0-dev.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.6", + "version": "0.5.0-dev.7", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 78e34e4b..cf7268d7 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.6", + "version": "0.5.0-dev.7", "description": "Modal client library for JavaScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs", From 679c33053c35406dc21db201728f3b2405ff2588 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 23 Oct 2025 11:34:49 +0200 Subject: [PATCH 20/59] Update DEVELOPING.md with new release process (#186) --- DEVELOPING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPING.md b/DEVELOPING.md index 7baf1829..a8091f44 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -59,5 +59,5 @@ We check the generated protobuf files into Git so that the package can be instal ## How to publish 1. Ensure all changes are captured in the ["Unreleased" section of the `CHANGELOG.md`](https://github.com/modal-labs/libmodal/blob/main/CHANGELOG.md#unreleased). -2. Manually trigger the [Open PR for release](https://github.com/modal-labs/libmodal/actions/workflows/release.yaml) workflow in GitHub Actions by clicking "Run workflow" and selecting the version to bump (patch, minor, or major). -3. Review and merge the release PR. This automatically triggers the [Publish Release](https://github.com/modal-labs/libmodal/actions/workflows/publish.yaml) workflow, which builds and publishes the packages. +2. Manually trigger the [Open PR for release](https://github.com/modal-labs/libmodal/actions/workflows/release.yaml) workflow in GitHub Actions by clicking "Run workflow", selecting the version to bump (patch, minor, or major), and choosing "stable" or "dev" as the release type. +3. Review and merge the release PR. This automatically triggers the [Publish Release](https://github.com/modal-labs/libmodal/actions/workflows/publish.yaml) workflow, which builds and publishes the packages. If it's a dev release, a `-dev.X` suffix is appended to the version, and the packages are published with the `next` tag on npm. From 1536da37fa8a18bb8fe0e6ecfac73712e2ed13fe Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 27 Oct 2025 12:59:07 +0100 Subject: [PATCH 21/59] Make the grpcmock framework internal (#185) --- modal-go/{testsupport => internal}/grpcmock/mock.go | 0 modal-go/test/cls_with_options_test.go | 2 +- modal-go/test/function_test.go | 2 +- modal-go/test/image_test.go | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename modal-go/{testsupport => internal}/grpcmock/mock.go (100%) diff --git a/modal-go/testsupport/grpcmock/mock.go b/modal-go/internal/grpcmock/mock.go similarity index 100% rename from modal-go/testsupport/grpcmock/mock.go rename to modal-go/internal/grpcmock/mock.go diff --git a/modal-go/test/cls_with_options_test.go b/modal-go/test/cls_with_options_test.go index e69862e3..02417ebe 100644 --- a/modal-go/test/cls_with_options_test.go +++ b/modal-go/test/cls_with_options_test.go @@ -6,8 +6,8 @@ import ( "time" modal "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" - "github.com/modal-labs/libmodal/modal-go/testsupport/grpcmock" "github.com/onsi/gomega" ) diff --git a/modal-go/test/function_test.go b/modal-go/test/function_test.go index 9994cc35..ee992de7 100644 --- a/modal-go/test/function_test.go +++ b/modal-go/test/function_test.go @@ -7,8 +7,8 @@ import ( "time" modal "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" - "github.com/modal-labs/libmodal/modal-go/testsupport/grpcmock" "github.com/onsi/gomega" ) diff --git a/modal-go/test/image_test.go b/modal-go/test/image_test.go index f138c8f5..19722390 100644 --- a/modal-go/test/image_test.go +++ b/modal-go/test/image_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" - "github.com/modal-labs/libmodal/modal-go/testsupport/grpcmock" "github.com/onsi/gomega" ) From 92c606fca7082d4ff84675b39f95e2999add56d9 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 27 Oct 2025 14:12:20 +0100 Subject: [PATCH 22/59] Rename init-client example to match JS (#187) --- modal-go/examples/{init-client => custom-client}/main.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modal-go/examples/{init-client => custom-client}/main.go (100%) diff --git a/modal-go/examples/init-client/main.go b/modal-go/examples/custom-client/main.go similarity index 100% rename from modal-go/examples/init-client/main.go rename to modal-go/examples/custom-client/main.go From e59ac664a959e68f7aed923a3d5264d9184a15cd Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 27 Oct 2025 15:42:51 +0100 Subject: [PATCH 23/59] Add CPU and mem limit params to Sandboxes and Cls (#184) --- CHANGELOG.md | 3 + modal-go/cls.go | 43 ++++++- modal-go/cls_test.go | 126 ++++++++++++++++++ modal-go/sandbox.go | 76 +++++++++-- modal-go/sandbox_test.go | 90 +++++++++++++ modal-js/src/cls.ts | 55 +++++++- modal-js/src/sandbox.ts | 54 +++++++- modal-js/test/cls_with_options.test.ts | 172 +++++++++++++++++++++++++ modal-js/test/sandbox.test.ts | 74 +++++++++++ 9 files changed, 674 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a374fb1..76dd1c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ The first beta release of the Modal SDKs for JS and Go (graduating from alpha). - All `Params` structs are now passed as pointers for consistency and to support optional parameters. - Field names follow Go casing conventions (e.g., `Id` → `ID`, `Url` → `URL`, `TokenId` → `TokenID`). +Additional new features: +- Added support for setting CPU and memory limits when creating Sandboxes and Cls instances. + ## modal-js/v0.3.25, modal-go/v0.0.25 - Fixed a bug in modal-js related to unpickling objects from Python (Function calls, Queues, etc.), where integers between 32678 and 65535 were incorrectly decoded as signed integers. diff --git a/modal-go/cls.go b/modal-go/cls.go index 2b0e7e81..acdae43b 100644 --- a/modal-go/cls.go +++ b/modal-go/cls.go @@ -22,7 +22,9 @@ type clsServiceImpl struct{ client *Client } // ClsWithOptionsParams represents runtime options for a Modal Cls. type ClsWithOptionsParams struct { CPU *float64 + CPULimit *float64 Memory *int + MemoryLimit *int GPU *string Env map[string]string Secrets []*Secret @@ -48,7 +50,9 @@ type ClsWithBatchingParams struct { type serviceOptions struct { cpu *float64 + cpuLimit *float64 memory *int + memoryLimit *int gpu *string env *map[string]string secrets *[]*Secret @@ -198,7 +202,9 @@ func (c *Cls) WithOptions(params *ClsWithOptionsParams) *Cls { merged := mergeServiceOptions(c.serviceOptions, &serviceOptions{ cpu: params.CPU, + cpuLimit: params.CPULimit, memory: params.Memory, + memoryLimit: params.MemoryLimit, gpu: params.GPU, env: envPtr, secrets: secretsPtr, @@ -404,7 +410,9 @@ func mergeServiceOptions(base, new *serviceOptions) *serviceOptions { merged := &serviceOptions{ cpu: base.cpu, + cpuLimit: base.cpuLimit, memory: base.memory, + memoryLimit: base.memoryLimit, gpu: base.gpu, env: base.env, secrets: base.secrets, @@ -423,9 +431,15 @@ func mergeServiceOptions(base, new *serviceOptions) *serviceOptions { if new.cpu != nil { merged.cpu = new.cpu } + if new.cpuLimit != nil { + merged.cpuLimit = new.cpuLimit + } if new.memory != nil { merged.memory = new.memory } + if new.memoryLimit != nil { + merged.memoryLimit = new.memoryLimit + } if new.gpu != nil { merged.gpu = new.gpu } @@ -476,14 +490,41 @@ func buildFunctionOptionsProto(options *serviceOptions) (*pb.FunctionOptions, er builder := pb.FunctionOptions_builder{} - if options.cpu != nil || options.memory != nil || options.gpu != nil { + if options.cpu != nil || options.cpuLimit != nil || options.memory != nil || options.memoryLimit != nil || options.gpu != nil { resBuilder := pb.Resources_builder{} + + if options.cpu == nil && options.cpuLimit != nil { + return nil, fmt.Errorf("must also specify non-zero CPU request when CPULimit is specified") + } if options.cpu != nil { + if *options.cpu <= 0 { + return nil, fmt.Errorf("the CPU request (%f) must be a positive number", *options.cpu) + } resBuilder.MilliCpu = uint32(*options.cpu * 1000) + if options.cpuLimit != nil { + if *options.cpuLimit < *options.cpu { + return nil, fmt.Errorf("the CPU request (%f) cannot be higher than CPULimit (%f)", *options.cpu, *options.cpuLimit) + } + resBuilder.MilliCpuMax = uint32(*options.cpuLimit * 1000) + } + } + + if options.memory == nil && options.memoryLimit != nil { + return nil, fmt.Errorf("must also specify non-zero Memory request when MemoryLimit is specified") } if options.memory != nil { + if *options.memory <= 0 { + return nil, fmt.Errorf("the Memory request (%d) must be a positive number", *options.memory) + } resBuilder.MemoryMb = uint32(*options.memory) + if options.memoryLimit != nil { + if *options.memoryLimit < *options.memory { + return nil, fmt.Errorf("the Memory request (%d) cannot be higher than MemoryLimit (%d)", *options.memory, *options.memoryLimit) + } + resBuilder.MemoryMbMax = uint32(*options.memoryLimit) + } } + if options.gpu != nil { gpuConfig, err := parseGPUConfig(*options.gpu) if err != nil { diff --git a/modal-go/cls_test.go b/modal-go/cls_test.go index 9f31a8c7..a237729f 100644 --- a/modal-go/cls_test.go +++ b/modal-go/cls_test.go @@ -13,3 +13,129 @@ func TestBuildFunctionOptionsProto_NilOptions(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(options).Should(gomega.BeNil()) } + +func TestBuildFunctionOptionsProto_WithCPUAndCPULimit(t *testing.T) { + g := gomega.NewWithT(t) + + cpu := 2.0 + cpuLimit := 4.5 + options, err := buildFunctionOptionsProto(&serviceOptions{ + cpu: &cpu, + cpuLimit: &cpuLimit, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(options).ShouldNot(gomega.BeNil()) + + resources := options.GetResources() + g.Expect(resources.GetMilliCpu()).To(gomega.Equal(uint32(2000))) + g.Expect(resources.GetMilliCpuMax()).To(gomega.Equal(uint32(4500))) +} + +func TestBuildFunctionOptionsProto_CPULimitLowerThanCPU(t *testing.T) { + g := gomega.NewWithT(t) + + cpu := 4.0 + cpuLimit := 2.0 + _, err := buildFunctionOptionsProto(&serviceOptions{ + cpu: &cpu, + cpuLimit: &cpuLimit, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("the CPU request (4.000000) cannot be higher than CPULimit (2.000000)")) +} + +func TestBuildFunctionOptionsProto_CPULimitWithoutCPU(t *testing.T) { + g := gomega.NewWithT(t) + + cpuLimit := 4.0 + _, err := buildFunctionOptionsProto(&serviceOptions{ + cpuLimit: &cpuLimit, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero CPU request when CPULimit is specified")) +} + +func TestBuildFunctionOptionsProto_WithMemoryAndMemoryLimit(t *testing.T) { + g := gomega.NewWithT(t) + + memory := 1024 + memoryLimit := 2048 + options, err := buildFunctionOptionsProto(&serviceOptions{ + memory: &memory, + memoryLimit: &memoryLimit, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(options).ShouldNot(gomega.BeNil()) + + resources := options.GetResources() + g.Expect(resources.GetMemoryMb()).To(gomega.Equal(uint32(1024))) + g.Expect(resources.GetMemoryMbMax()).To(gomega.Equal(uint32(2048))) +} + +func TestBuildFunctionOptionsProto_MemoryLimitLowerThanMemory(t *testing.T) { + g := gomega.NewWithT(t) + + memory := 2048 + memoryLimit := 1024 + _, err := buildFunctionOptionsProto(&serviceOptions{ + memory: &memory, + memoryLimit: &memoryLimit, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("the Memory request (2048) cannot be higher than MemoryLimit (1024)")) +} + +func TestBuildFunctionOptionsProto_MemoryLimitWithoutMemory(t *testing.T) { + g := gomega.NewWithT(t) + + memoryLimit := 2048 + _, err := buildFunctionOptionsProto(&serviceOptions{ + memoryLimit: &memoryLimit, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero Memory request when MemoryLimit is specified")) +} + +func TestBuildFunctionOptionsProto_NegativeCPU(t *testing.T) { + g := gomega.NewWithT(t) + + cpu := -1.0 + _, err := buildFunctionOptionsProto(&serviceOptions{ + cpu: &cpu, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} + +func TestBuildFunctionOptionsProto_ZeroCPU(t *testing.T) { + g := gomega.NewWithT(t) + + cpu := 0.0 + _, err := buildFunctionOptionsProto(&serviceOptions{ + cpu: &cpu, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} + +func TestBuildFunctionOptionsProto_NegativeMemory(t *testing.T) { + g := gomega.NewWithT(t) + + memory := -100 + _, err := buildFunctionOptionsProto(&serviceOptions{ + memory: &memory, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} + +func TestBuildFunctionOptionsProto_ZeroMemory(t *testing.T) { + g := gomega.NewWithT(t) + + memory := 0 + _, err := buildFunctionOptionsProto(&serviceOptions{ + memory: &memory, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index ff37e877..4db86ecc 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -29,8 +29,10 @@ type sandboxServiceImpl struct{ client *Client } // SandboxCreateParams are options for creating a Modal Sandbox. type SandboxCreateParams struct { - CPU float64 // CPU request in physical cores. + CPU float64 // CPU request in fractional, physical cores. + CPULimit float64 // Hard limit in fractional, physical CPU cores. Zero means no limit. Memory int // Memory request in MiB. + MemoryLimit int // Hard memory limit in MiB. Zero means no limit. GPU string // GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). Timeout time.Duration // Maximum lifetime for the Sandbox. IdleTimeout time.Duration // The amount of time that a Sandbox can be idle before being terminated. @@ -168,21 +170,69 @@ func buildSandboxCreateRequestProto(appID, imageID string, params SandboxCreateP idleTimeoutSecs = &v } + var milliCPU, milliCPUMax *uint32 + if params.CPU == 0 && params.CPULimit > 0 { + return nil, fmt.Errorf("must also specify non-zero CPU request when CPULimit is specified") + } + if params.CPU != 0 { + if params.CPU <= 0 { + return nil, fmt.Errorf("the CPU request (%f) must be a positive number", params.CPU) + } + v := uint32(1000 * params.CPU) + milliCPU = &v + if params.CPULimit > 0 { + if params.CPULimit < params.CPU { + return nil, fmt.Errorf("the CPU request (%f) cannot be higher than CPULimit (%f)", params.CPU, params.CPULimit) + } + vMax := uint32(1000 * params.CPULimit) + milliCPUMax = &vMax + } + } + + var memoryMb, memoryMbMax uint32 + if params.Memory == 0 && params.MemoryLimit > 0 { + return nil, fmt.Errorf("must also specify non-zero Memory request when MemoryLimit is specified") + } + if params.Memory != 0 { + if params.Memory <= 0 { + return nil, fmt.Errorf("the Memory request (%d) must be a positive number", params.Memory) + } + memoryMb = uint32(params.Memory) + if params.MemoryLimit > 0 { + if params.MemoryLimit < params.Memory { + return nil, fmt.Errorf("the Memory request (%d) cannot be higher than MemoryLimit (%d)", params.Memory, params.MemoryLimit) + } + memoryMbMax = uint32(params.MemoryLimit) + } + } + + resourcesBuilder := pb.Resources_builder{ + GpuConfig: gpuConfig, + } + if milliCPU != nil { + resourcesBuilder.MilliCpu = *milliCPU + } + if milliCPUMax != nil { + resourcesBuilder.MilliCpuMax = *milliCPUMax + } + if memoryMb > 0 { + resourcesBuilder.MemoryMb = memoryMb + } + if memoryMbMax > 0 { + resourcesBuilder.MemoryMbMax = memoryMbMax + } + return pb.SandboxCreateRequest_builder{ AppId: appID, Definition: pb.Sandbox_builder{ - EntrypointArgs: params.Command, - ImageId: imageID, - SecretIds: secretIds, - TimeoutSecs: uint32(params.Timeout.Seconds()), - IdleTimeoutSecs: idleTimeoutSecs, - Workdir: workdir, - NetworkAccess: networkAccess, - Resources: pb.Resources_builder{ - MilliCpu: uint32(1000 * params.CPU), - MemoryMb: uint32(params.Memory), - GpuConfig: gpuConfig, - }.Build(), + EntrypointArgs: params.Command, + ImageId: imageID, + SecretIds: secretIds, + TimeoutSecs: uint32(params.Timeout.Seconds()), + IdleTimeoutSecs: idleTimeoutSecs, + Workdir: workdir, + NetworkAccess: networkAccess, + Resources: resourcesBuilder.Build(), VolumeMounts: volumeMounts, CloudBucketMounts: cloudBucketMounts, PtyInfo: ptyInfo, diff --git a/modal-go/sandbox_test.go b/modal-go/sandbox_test.go index 5e3a53e2..60bf0d80 100644 --- a/modal-go/sandbox_test.go +++ b/modal-go/sandbox_test.go @@ -62,3 +62,93 @@ func TestContainerExecProto_WithPTY(t *testing.T) { g.Expect(ptyInfo.GetPtyType()).To(gomega.Equal(pb.PTYInfo_PTY_TYPE_SHELL)) g.Expect(ptyInfo.GetNoTerminateOnIdleStdin()).To(gomega.BeTrue()) } + +func TestSandboxCreateRequestProto_WithCPUAndCPULimit(t *testing.T) { + g := gomega.NewWithT(t) + + req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + CPU: 2.0, + CPULimit: 4.5, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + resources := req.GetDefinition().GetResources() + g.Expect(resources.GetMilliCpu()).To(gomega.Equal(uint32(2000))) + g.Expect(resources.GetMilliCpuMax()).To(gomega.Equal(uint32(4500))) +} + +func TestSandboxCreateRequestProto_CPULimitLowerThanCPU(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + CPU: 4.0, + CPULimit: 2.0, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("the CPU request (4.000000) cannot be higher than CPULimit (2.000000)")) +} + +func TestSandboxCreateRequestProto_CPULimitWithoutCPU(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + CPULimit: 4.0, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero CPU request when CPULimit is specified")) +} + +func TestSandboxCreateRequestProto_WithMemoryAndMemoryLimit(t *testing.T) { + g := gomega.NewWithT(t) + + req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + Memory: 1024, + MemoryLimit: 2048, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + resources := req.GetDefinition().GetResources() + g.Expect(resources.GetMemoryMb()).To(gomega.Equal(uint32(1024))) + g.Expect(resources.GetMemoryMbMax()).To(gomega.Equal(uint32(2048))) +} + +func TestSandboxCreateRequestProto_MemoryLimitLowerThanMemory(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + Memory: 2048, + MemoryLimit: 1024, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("the Memory request (2048) cannot be higher than MemoryLimit (1024)")) +} + +func TestSandboxCreateRequestProto_MemoryLimitWithoutMemory(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + MemoryLimit: 2048, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero Memory request when MemoryLimit is specified")) +} + +func TestSandboxCreateRequestProto_NegativeCPU(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + CPU: -1.0, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} + +func TestSandboxCreateRequestProto_NegativeMemory(t *testing.T) { + g := gomega.NewWithT(t) + + _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ + Memory: -100, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) +} diff --git a/modal-js/src/cls.ts b/modal-js/src/cls.ts index 02fc8e8e..4d9c2af4 100644 --- a/modal-js/src/cls.ts +++ b/modal-js/src/cls.ts @@ -84,7 +84,9 @@ export class ClsService { export type ClsWithOptionsParams = { cpu?: number; + cpuLimit?: number; memory?: number; + memoryLimit?: number; gpu?: string; env?: Record; secrets?: Secret[]; @@ -263,11 +265,58 @@ async function buildFunctionOptionsProto( const o = options ?? {}; const gpuConfig = parseGpuConfig(o.gpu); + + let milliCpu: number | undefined = undefined; + let milliCpuMax: number | undefined = undefined; + if (o.cpu === undefined && o.cpuLimit !== undefined) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (o.cpu !== undefined) { + if (o.cpu <= 0) { + throw new Error(`cpu (${o.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1000 * o.cpu); + if (o.cpuLimit !== undefined) { + if (o.cpuLimit < o.cpu) { + throw new Error( + `cpu (${o.cpu}) cannot be higher than cpuLimit (${o.cpuLimit})`, + ); + } + milliCpuMax = Math.trunc(1000 * o.cpuLimit); + } + } + + let memoryMb: number | undefined = undefined; + let memoryMbMax: number | undefined = undefined; + if (o.memory === undefined && o.memoryLimit !== undefined) { + throw new Error("must also specify memory when memoryLimit is specified"); + } + if (o.memory !== undefined) { + if (o.memory <= 0) { + throw new Error(`memory (${o.memory}) must be a positive number`); + } + memoryMb = o.memory; + if (o.memoryLimit !== undefined) { + if (o.memoryLimit < o.memory) { + throw new Error( + `memory (${o.memory}) cannot be higher than memoryLimit (${o.memoryLimit})`, + ); + } + memoryMbMax = o.memoryLimit; + } + } + const resources = - o.cpu !== undefined || o.memory !== undefined || gpuConfig + milliCpu !== undefined || + milliCpuMax !== undefined || + memoryMb !== undefined || + memoryMbMax !== undefined || + gpuConfig ? { - milliCpu: o.cpu !== undefined ? Math.round(1000 * o.cpu) : undefined, - memoryMb: o.memory, + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, gpuConfig, } : undefined; diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 2138be8d..5cf6c5c4 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -69,9 +69,15 @@ export type SandboxCreateParams = { /** Reservation of physical CPU cores for the Sandbox, can be fractional. */ cpu?: number; + /** Hard limit of physical CPU cores for the Sandbox, can be fractional. */ + cpuLimit?: number; + /** Reservation of memory in MiB. */ memory?: number; + /** Hard limit of memory in MiB. */ + memoryLimit?: number; + /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */ gpu?: string; @@ -235,6 +241,48 @@ export async function buildSandboxCreateRequestProto( ptyInfo = defaultSandboxPTYInfo(); } + let milliCpu: number | undefined = undefined; + let milliCpuMax: number | undefined = undefined; + if (params.cpu === undefined && params.cpuLimit !== undefined) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (params.cpu !== undefined) { + if (params.cpu <= 0) { + throw new Error(`cpu (${params.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1000 * params.cpu); + if (params.cpuLimit !== undefined) { + if (params.cpuLimit < params.cpu) { + throw new Error( + `cpu (${params.cpu}) cannot be higher than cpuLimit (${params.cpuLimit})`, + ); + } + milliCpuMax = Math.trunc(1000 * params.cpuLimit); + } + } + + let memoryMb: number | undefined = undefined; + let memoryMbMax: number | undefined = undefined; + if (params.memory === undefined && params.memoryLimit !== undefined) { + throw new Error("must also specify memory when memoryLimit is specified"); + } + if (params.memory !== undefined) { + if (params.memory <= 0) { + throw new Error( + `the memory request (${params.memory}) must be a positive number`, + ); + } + memoryMb = params.memory; + if (params.memoryLimit !== undefined) { + if (params.memoryLimit < params.memory) { + throw new Error( + `the memory request (${params.memory}) cannot be higher than memoryLimit (${params.memoryLimit})`, + ); + } + memoryMbMax = params.memoryLimit; + } + } + return SandboxCreateRequest.create({ appId, definition: { @@ -248,8 +296,10 @@ export async function buildSandboxCreateRequestProto( networkAccess, resources: { // https://modal.com/docs/guide/resources - milliCpu: Math.round(1000 * (params.cpu ?? 0.125)), - memoryMb: params.memory ?? 128, + milliCpu: milliCpu ?? Math.trunc(1000 * 0.125), + milliCpuMax: milliCpuMax ?? 0, + memoryMb: memoryMb ?? 128, + memoryMbMax: memoryMbMax ?? 0, gpuConfig, }, volumeMounts, diff --git a/modal-js/test/cls_with_options.test.ts b/modal-js/test/cls_with_options.test.ts index e3e66d6f..787bfdfb 100644 --- a/modal-js/test/cls_with_options.test.ts +++ b/modal-js/test/cls_with_options.test.ts @@ -199,3 +199,175 @@ test("withOptions({ volumes: {} }) binds and does not replace volumes", async () mock.assertExhausted(); }); + +test("withOptions({ cpu, cpuLimit }) sets milliCpu and milliCpuMax", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + mock.handleUnary("FunctionBindParams", (req: any) => { + expect(req).toMatchObject({ functionId: "fid" }); + const fo = req.functionOptions; + expect(fo).toBeDefined(); + expect(fo.resources).toBeDefined(); + expect(fo.resources.milliCpu).toBe(2000); + expect(fo.resources.milliCpuMax).toBe(4500); + return { boundFunctionId: "fid-1", handleMetadata: {} }; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + const instance = await cls + .withOptions({ cpu: 2.0, cpuLimit: 4.5 }) + .instance(); + expect(instance).toBeTruthy(); + + mock.assertExhausted(); +}); + +test("withOptions cpuLimit lower than cpu throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect( + cls.withOptions({ cpu: 4.0, cpuLimit: 2.0 }).instance(), + ).rejects.toThrow("cpu (4) cannot be higher than cpuLimit (2)"); + + mock.assertExhausted(); +}); + +test("withOptions cpuLimit without cpu throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect(cls.withOptions({ cpuLimit: 4.0 }).instance()).rejects.toThrow( + "must also specify cpu when cpuLimit is specified", + ); + + mock.assertExhausted(); +}); + +test("withOptions({ memory, memoryLimit }) sets memoryMb and memoryMbMax", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + mock.handleUnary("FunctionBindParams", (req: any) => { + expect(req).toMatchObject({ functionId: "fid" }); + const fo = req.functionOptions; + expect(fo).toBeDefined(); + expect(fo.resources).toBeDefined(); + expect(fo.resources.memoryMb).toBe(1024); + expect(fo.resources.memoryMbMax).toBe(2048); + return { boundFunctionId: "fid-1", handleMetadata: {} }; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + const instance = await cls + .withOptions({ memory: 1024, memoryLimit: 2048 }) + .instance(); + expect(instance).toBeTruthy(); + + mock.assertExhausted(); +}); + +test("withOptions memoryLimit lower than memory throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect( + cls.withOptions({ memory: 2048, memoryLimit: 1024 }).instance(), + ).rejects.toThrow("memory (2048) cannot be higher than memoryLimit (1024)"); + + mock.assertExhausted(); +}); + +test("withOptions memoryLimit without memory throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect( + cls.withOptions({ memoryLimit: 2048 }).instance(), + ).rejects.toThrow("must also specify memory when memoryLimit is specified"); + + mock.assertExhausted(); +}); + +test("withOptions negative cpu throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect(cls.withOptions({ cpu: -1.0 }).instance()).rejects.toThrow( + "must be a positive number", + ); + + mock.assertExhausted(); +}); + +test("withOptions zero cpu throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect(cls.withOptions({ cpu: 0.0 }).instance()).rejects.toThrow( + "must be a positive number", + ); + + mock.assertExhausted(); +}); + +test("withOptions negative memory throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect(cls.withOptions({ memory: -100 }).instance()).rejects.toThrow( + "must be a positive number", + ); + + mock.assertExhausted(); +}); + +test("withOptions zero memory throws error", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => { + return _mockFunctionProto; + }); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + await expect(cls.withOptions({ memory: 0 }).instance()).rejects.toThrow( + "must be a positive number", + ); + + mock.assertExhausted(); +}); diff --git a/modal-js/test/sandbox.test.ts b/modal-js/test/sandbox.test.ts index f48d91d9..e8172aec 100644 --- a/modal-js/test/sandbox.test.ts +++ b/modal-js/test/sandbox.test.ts @@ -586,3 +586,77 @@ test("buildSandboxCreateRequestProto with PTY", async () => { expect(ptyInfo.envColorterm).toBe("truecolor"); expect(ptyInfo.ptyType).toBe(PTYInfo_PTYType.PTY_TYPE_SHELL); }); + +test("buildSandboxCreateRequestProto with CPU and CPULimit", async () => { + const req = await buildSandboxCreateRequestProto("app-123", "img-456", { + cpu: 2.0, + cpuLimit: 4.5, + }); + + const resources = req.definition!.resources!; + expect(resources.milliCpu).toBe(2000); + expect(resources.milliCpuMax).toBe(4500); +}); + +test("buildSandboxCreateRequestProto CPULimit lower than CPU", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + cpu: 4.0, + cpuLimit: 2.0, + }), + ).rejects.toThrow("cpu (4) cannot be higher than cpuLimit (2)"); +}); + +test("buildSandboxCreateRequestProto CPULimit without CPU", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + cpuLimit: 4.0, + }), + ).rejects.toThrow("must also specify cpu when cpuLimit is specified"); +}); + +test("buildSandboxCreateRequestProto with Memory and MemoryLimit", async () => { + const req = await buildSandboxCreateRequestProto("app-123", "img-456", { + memory: 1024, + memoryLimit: 2048, + }); + + const resources = req.definition!.resources!; + expect(resources.memoryMb).toBe(1024); + expect(resources.memoryMbMax).toBe(2048); +}); + +test("buildSandboxCreateRequestProto MemoryLimit lower than Memory", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + memory: 2048, + memoryLimit: 1024, + }), + ).rejects.toThrow( + "the memory request (2048) cannot be higher than memoryLimit (1024)", + ); +}); + +test("buildSandboxCreateRequestProto MemoryLimit without Memory", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + memoryLimit: 2048, + }), + ).rejects.toThrow("must also specify memory when memoryLimit is specified"); +}); + +test("buildSandboxCreateRequestProto negative CPU", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + cpu: -1.0, + }), + ).rejects.toThrow("must be a positive number"); +}); + +test("buildSandboxCreateRequestProto negative Memory", async () => { + await expect( + buildSandboxCreateRequestProto("app-123", "img-456", { + memory: -100, + }), + ).rejects.toThrow("must be a positive number"); +}); From 61738e315d5b54f6a5c370c8ed22e4ac8e0a317c Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 27 Oct 2025 18:25:19 +0100 Subject: [PATCH 24/59] Don't set Sandbox resource defaults in SDK (#188) Let the server set fallback defaults like for the other SDKs. --- modal-js/src/sandbox.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 5cf6c5c4..726338c7 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -295,11 +295,10 @@ export async function buildSandboxCreateRequestProto( workdir: params.workdir ?? undefined, networkAccess, resources: { - // https://modal.com/docs/guide/resources - milliCpu: milliCpu ?? Math.trunc(1000 * 0.125), - milliCpuMax: milliCpuMax ?? 0, - memoryMb: memoryMb ?? 128, - memoryMbMax: memoryMbMax ?? 0, + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, gpuConfig, }, volumeMounts, From 2264bed1dd56f4515081ccde644f208c70a2326e Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Tue, 28 Oct 2025 15:26:09 +0100 Subject: [PATCH 25/59] Add unit suffixes to params (...Ms, ...MiB, etc.) (#189) Also don't set Sandbox resource defaults in SDK - Let the server set fallback defaults like for the other SDKs. --- CHANGELOG.md | 3 + DEVELOPING.md | 12 ++ MIGRATION-GUIDE.md | 20 ++++ modal-go/cls.go | 46 ++++---- modal-go/cls_test.go | 32 +++--- modal-go/sandbox.go | 24 ++-- modal-go/sandbox_test.go | 16 +-- modal-go/test/cls_with_options_test.go | 4 +- modal-js/examples/sandbox-tunnels.ts | 4 +- modal-js/src/client.ts | 15 ++- modal-js/src/cls.ts | 54 +++++---- modal-js/src/function.ts | 12 +- modal-js/src/function_call.ts | 8 +- modal-js/src/index.ts | 1 + modal-js/src/invocation.ts | 46 ++++---- modal-js/src/queue.ts | 108 +++++++++++------- modal-js/src/sandbox.ts | 71 +++++++----- modal-js/src/validation.ts | 14 +++ modal-js/test/cls_with_options.test.ts | 32 +++--- modal-js/test/function.test.ts | 2 +- modal-js/test/function_call.test.ts | 6 +- modal-js/test/legacy/cls_with_options.test.ts | 14 +-- modal-js/test/legacy/function.test.ts | 2 +- modal-js/test/legacy/function_call.test.ts | 6 +- modal-js/test/legacy/queue.test.ts | 10 +- modal-js/test/legacy/sandbox.test.ts | 2 +- modal-js/test/queue.test.ts | 10 +- modal-js/test/sandbox.test.ts | 20 ++-- modal-js/test/validation.test.ts | 65 +++++++++++ 29 files changed, 423 insertions(+), 236 deletions(-) create mode 100644 modal-js/src/validation.ts create mode 100644 modal-js/test/validation.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 76dd1c5e..d4b8617d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,13 @@ The first beta release of the Modal SDKs for JS and Go (graduating from alpha). - Calling deployed Functions and classes now uses a new protocol for payload serialization which requires the deployed apps to use the Modal Python SDK 1.2 or newer. - Internally removed the global client (and config/profile data in global scope), moving all that to the Client type. - Consistent parameter naming across both SDKs: all `Options` structs/interfaces renamed to `Params`. +- JS-specific changes: + - Added explicit unit suffixes to all parameters that represent durations (in milliseconds, suffixed with `Ms`) or memory amounts (in MiB, suffixed with `MiB`). - Go-specific changes: - Changed how we do context passing, so contexts now only affect the current operation and are not used for lifecycle management of the created resources. - All `Params` structs are now passed as pointers for consistency and to support optional parameters. - Field names follow Go casing conventions (e.g., `Id` → `ID`, `Url` → `URL`, `TokenId` → `TokenID`). + - Added explicit unit suffixes to all parameters that represent memory amounts (in MiB, suffixed with `MiB`). Additional new features: - Added support for setting CPU and memory limits when creating Sandboxes and Cls instances. diff --git a/DEVELOPING.md b/DEVELOPING.md index a8091f44..3902d417 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -31,6 +31,12 @@ cd modal-js node --import tsx examples/sandbox.ts ``` +### JS naming conventions + +- Parameters should always include explicit unit suffixes to make the API more self-documenting and prevent confusion about units: + - durations should be suffixed with `Ms`, e.g. `timeoutMs` instead of `timeout` + - memory should be suffixed with `MiB`, e.g. `memoryMiB` instead of `memory` + ### gRPC support We're using `nice-grpc` because the `@grpc/grpc-js` library doesn't support promises and is difficult to customize with types. @@ -56,6 +62,12 @@ scripts/gen-proto.sh We check the generated protobuf files into Git so that the package can be installed with `go get`. +### Go naming conventions + +- Parameters should always include explicit unit suffixes to make the API more self-documenting and prevent confusion about units: + - durations should NOT be suffixed, since they have type `time.Duration` + - memory should be suffixed with `MiB`, e.g. `memoryMiB` instead of `memory` + ## How to publish 1. Ensure all changes are captured in the ["Unreleased" section of the `CHANGELOG.md`](https://github.com/modal-labs/libmodal/blob/main/CHANGELOG.md#unreleased). diff --git a/MIGRATION-GUIDE.md b/MIGRATION-GUIDE.md index c992bd99..74226039 100644 --- a/MIGRATION-GUIDE.md +++ b/MIGRATION-GUIDE.md @@ -145,6 +145,19 @@ const client = new ModalClient({ tokenId: "...", tokenSecret: "..." }); - `SecretFromObjectParams` -> new export (no previous equivalent) - `VolumeFromNameOptions` -> `VolumeFromNameParams` +### Parameter Name Changes - Unit Suffixes + +Parameters now include explicit unit suffixes to make the API more self-documenting and prevent confusion about units: + +- `timeout` → `timeoutMs` +- `idleTimeout` → `idleTimeoutMs` +- `scaledownWindow` → `scaledownWindowMs` +- `itemPollTimeout` → `itemPollTimeoutMs` +- `partitionTtl` → `partitionTtlMs` + +- `memory` → `memoryMiB` +- `memoryLimit` → `memoryLimitMiB` + ## Go Brief example of using the new API (with `err` handling omitted for brevity): @@ -351,3 +364,10 @@ client, err := modal.NewClientWithOptions(&modal.ClientParams{ - `SecretFromNameOptions` -> `SecretFromNameParams` - `UpdateAutoscalerOptions` -> `FunctionUpdateAutoscalerParams` - `VolumeFromNameOptions` -> `VolumeFromNameParams` + +### Parameter Name Changes - Unit Suffixes + +Parameters now include explicit unit suffixes to make the API more self-documenting and prevent confusion about units: + +- `memory` → `memoryMiB` +- `memoryLimit` → `memoryLimitMiB` diff --git a/modal-go/cls.go b/modal-go/cls.go index acdae43b..b2c20a55 100644 --- a/modal-go/cls.go +++ b/modal-go/cls.go @@ -23,8 +23,8 @@ type clsServiceImpl struct{ client *Client } type ClsWithOptionsParams struct { CPU *float64 CPULimit *float64 - Memory *int - MemoryLimit *int + MemoryMiB *int + MemoryLimitMiB *int GPU *string Env map[string]string Secrets []*Secret @@ -51,8 +51,8 @@ type ClsWithBatchingParams struct { type serviceOptions struct { cpu *float64 cpuLimit *float64 - memory *int - memoryLimit *int + memoryMiB *int + memoryLimitMiB *int gpu *string env *map[string]string secrets *[]*Secret @@ -203,8 +203,8 @@ func (c *Cls) WithOptions(params *ClsWithOptionsParams) *Cls { merged := mergeServiceOptions(c.serviceOptions, &serviceOptions{ cpu: params.CPU, cpuLimit: params.CPULimit, - memory: params.Memory, - memoryLimit: params.MemoryLimit, + memoryMiB: params.MemoryMiB, + memoryLimitMiB: params.MemoryLimitMiB, gpu: params.GPU, env: envPtr, secrets: secretsPtr, @@ -411,8 +411,8 @@ func mergeServiceOptions(base, new *serviceOptions) *serviceOptions { merged := &serviceOptions{ cpu: base.cpu, cpuLimit: base.cpuLimit, - memory: base.memory, - memoryLimit: base.memoryLimit, + memoryMiB: base.memoryMiB, + memoryLimitMiB: base.memoryLimitMiB, gpu: base.gpu, env: base.env, secrets: base.secrets, @@ -434,11 +434,11 @@ func mergeServiceOptions(base, new *serviceOptions) *serviceOptions { if new.cpuLimit != nil { merged.cpuLimit = new.cpuLimit } - if new.memory != nil { - merged.memory = new.memory + if new.memoryMiB != nil { + merged.memoryMiB = new.memoryMiB } - if new.memoryLimit != nil { - merged.memoryLimit = new.memoryLimit + if new.memoryLimitMiB != nil { + merged.memoryLimitMiB = new.memoryLimitMiB } if new.gpu != nil { merged.gpu = new.gpu @@ -490,7 +490,7 @@ func buildFunctionOptionsProto(options *serviceOptions) (*pb.FunctionOptions, er builder := pb.FunctionOptions_builder{} - if options.cpu != nil || options.cpuLimit != nil || options.memory != nil || options.memoryLimit != nil || options.gpu != nil { + if options.cpu != nil || options.cpuLimit != nil || options.memoryMiB != nil || options.memoryLimitMiB != nil || options.gpu != nil { resBuilder := pb.Resources_builder{} if options.cpu == nil && options.cpuLimit != nil { @@ -509,19 +509,19 @@ func buildFunctionOptionsProto(options *serviceOptions) (*pb.FunctionOptions, er } } - if options.memory == nil && options.memoryLimit != nil { - return nil, fmt.Errorf("must also specify non-zero Memory request when MemoryLimit is specified") + if options.memoryMiB == nil && options.memoryLimitMiB != nil { + return nil, fmt.Errorf("must also specify non-zero MemoryMiB request when MemoryLimitMiB is specified") } - if options.memory != nil { - if *options.memory <= 0 { - return nil, fmt.Errorf("the Memory request (%d) must be a positive number", *options.memory) + if options.memoryMiB != nil { + if *options.memoryMiB <= 0 { + return nil, fmt.Errorf("the MemoryMiB request (%d) must be a positive number", *options.memoryMiB) } - resBuilder.MemoryMb = uint32(*options.memory) - if options.memoryLimit != nil { - if *options.memoryLimit < *options.memory { - return nil, fmt.Errorf("the Memory request (%d) cannot be higher than MemoryLimit (%d)", *options.memory, *options.memoryLimit) + resBuilder.MemoryMb = uint32(*options.memoryMiB) + if options.memoryLimitMiB != nil { + if *options.memoryLimitMiB < *options.memoryMiB { + return nil, fmt.Errorf("the MemoryMiB request (%d) cannot be higher than MemoryLimitMiB (%d)", *options.memoryMiB, *options.memoryLimitMiB) } - resBuilder.MemoryMbMax = uint32(*options.memoryLimit) + resBuilder.MemoryMbMax = uint32(*options.memoryLimitMiB) } } diff --git a/modal-go/cls_test.go b/modal-go/cls_test.go index a237729f..4db4007f 100644 --- a/modal-go/cls_test.go +++ b/modal-go/cls_test.go @@ -58,11 +58,11 @@ func TestBuildFunctionOptionsProto_CPULimitWithoutCPU(t *testing.T) { func TestBuildFunctionOptionsProto_WithMemoryAndMemoryLimit(t *testing.T) { g := gomega.NewWithT(t) - memory := 1024 - memoryLimit := 2048 + memoryMiB := 1024 + memoryLimitMiB := 2048 options, err := buildFunctionOptionsProto(&serviceOptions{ - memory: &memory, - memoryLimit: &memoryLimit, + memoryMiB: &memoryMiB, + memoryLimitMiB: &memoryLimitMiB, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(options).ShouldNot(gomega.BeNil()) @@ -75,25 +75,25 @@ func TestBuildFunctionOptionsProto_WithMemoryAndMemoryLimit(t *testing.T) { func TestBuildFunctionOptionsProto_MemoryLimitLowerThanMemory(t *testing.T) { g := gomega.NewWithT(t) - memory := 2048 - memoryLimit := 1024 + memoryMiB := 2048 + memoryLimitMiB := 1024 _, err := buildFunctionOptionsProto(&serviceOptions{ - memory: &memory, - memoryLimit: &memoryLimit, + memoryMiB: &memoryMiB, + memoryLimitMiB: &memoryLimitMiB, }) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).To(gomega.ContainSubstring("the Memory request (2048) cannot be higher than MemoryLimit (1024)")) + g.Expect(err.Error()).To(gomega.ContainSubstring("the MemoryMiB request (2048) cannot be higher than MemoryLimitMiB (1024)")) } func TestBuildFunctionOptionsProto_MemoryLimitWithoutMemory(t *testing.T) { g := gomega.NewWithT(t) - memoryLimit := 2048 + memoryLimitMiB := 2048 _, err := buildFunctionOptionsProto(&serviceOptions{ - memoryLimit: &memoryLimit, + memoryLimitMiB: &memoryLimitMiB, }) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero Memory request when MemoryLimit is specified")) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero MemoryMiB request when MemoryLimitMiB is specified")) } func TestBuildFunctionOptionsProto_NegativeCPU(t *testing.T) { @@ -121,9 +121,9 @@ func TestBuildFunctionOptionsProto_ZeroCPU(t *testing.T) { func TestBuildFunctionOptionsProto_NegativeMemory(t *testing.T) { g := gomega.NewWithT(t) - memory := -100 + memoryMiB := -100 _, err := buildFunctionOptionsProto(&serviceOptions{ - memory: &memory, + memoryMiB: &memoryMiB, }) g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) @@ -132,9 +132,9 @@ func TestBuildFunctionOptionsProto_NegativeMemory(t *testing.T) { func TestBuildFunctionOptionsProto_ZeroMemory(t *testing.T) { g := gomega.NewWithT(t) - memory := 0 + memoryMiB := 0 _, err := buildFunctionOptionsProto(&serviceOptions{ - memory: &memory, + memoryMiB: &memoryMiB, }) g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 4db86ecc..94010de8 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -31,8 +31,8 @@ type sandboxServiceImpl struct{ client *Client } type SandboxCreateParams struct { CPU float64 // CPU request in fractional, physical cores. CPULimit float64 // Hard limit in fractional, physical CPU cores. Zero means no limit. - Memory int // Memory request in MiB. - MemoryLimit int // Hard memory limit in MiB. Zero means no limit. + MemoryMiB int // Memory request in MiB. + MemoryLimitMiB int // Hard memory limit in MiB. Zero means no limit. GPU string // GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). Timeout time.Duration // Maximum lifetime for the Sandbox. IdleTimeout time.Duration // The amount of time that a Sandbox can be idle before being terminated. @@ -190,19 +190,19 @@ func buildSandboxCreateRequestProto(appID, imageID string, params SandboxCreateP } var memoryMb, memoryMbMax uint32 - if params.Memory == 0 && params.MemoryLimit > 0 { - return nil, fmt.Errorf("must also specify non-zero Memory request when MemoryLimit is specified") + if params.MemoryMiB == 0 && params.MemoryLimitMiB > 0 { + return nil, fmt.Errorf("must also specify non-zero MemoryMiB request when MemoryLimitMiB is specified") } - if params.Memory != 0 { - if params.Memory <= 0 { - return nil, fmt.Errorf("the Memory request (%d) must be a positive number", params.Memory) + if params.MemoryMiB != 0 { + if params.MemoryMiB <= 0 { + return nil, fmt.Errorf("the MemoryMiB request (%d) must be a positive number", params.MemoryMiB) } - memoryMb = uint32(params.Memory) - if params.MemoryLimit > 0 { - if params.MemoryLimit < params.Memory { - return nil, fmt.Errorf("the Memory request (%d) cannot be higher than MemoryLimit (%d)", params.Memory, params.MemoryLimit) + memoryMb = uint32(params.MemoryMiB) + if params.MemoryLimitMiB > 0 { + if params.MemoryLimitMiB < params.MemoryMiB { + return nil, fmt.Errorf("the MemoryMiB request (%d) cannot be higher than MemoryLimitMiB (%d)", params.MemoryMiB, params.MemoryLimitMiB) } - memoryMbMax = uint32(params.MemoryLimit) + memoryMbMax = uint32(params.MemoryLimitMiB) } } diff --git a/modal-go/sandbox_test.go b/modal-go/sandbox_test.go index 60bf0d80..f38c89e0 100644 --- a/modal-go/sandbox_test.go +++ b/modal-go/sandbox_test.go @@ -102,8 +102,8 @@ func TestSandboxCreateRequestProto_WithMemoryAndMemoryLimit(t *testing.T) { g := gomega.NewWithT(t) req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ - Memory: 1024, - MemoryLimit: 2048, + MemoryMiB: 1024, + MemoryLimitMiB: 2048, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -116,21 +116,21 @@ func TestSandboxCreateRequestProto_MemoryLimitLowerThanMemory(t *testing.T) { g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ - Memory: 2048, - MemoryLimit: 1024, + MemoryMiB: 2048, + MemoryLimitMiB: 1024, }) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).To(gomega.ContainSubstring("the Memory request (2048) cannot be higher than MemoryLimit (1024)")) + g.Expect(err.Error()).To(gomega.ContainSubstring("the MemoryMiB request (2048) cannot be higher than MemoryLimitMiB (1024)")) } func TestSandboxCreateRequestProto_MemoryLimitWithoutMemory(t *testing.T) { g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ - MemoryLimit: 2048, + MemoryLimitMiB: 2048, }) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero Memory request when MemoryLimit is specified")) + g.Expect(err.Error()).To(gomega.ContainSubstring("must also specify non-zero MemoryMiB request when MemoryLimitMiB is specified")) } func TestSandboxCreateRequestProto_NegativeCPU(t *testing.T) { @@ -147,7 +147,7 @@ func TestSandboxCreateRequestProto_NegativeMemory(t *testing.T) { g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ - Memory: -100, + MemoryMiB: -100, }) g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("must be a positive number")) diff --git a/modal-go/test/cls_with_options_test.go b/modal-go/test/cls_with_options_test.go index 02417ebe..b99c2dc8 100644 --- a/modal-go/test/cls_with_options_test.go +++ b/modal-go/test/cls_with_options_test.go @@ -65,14 +65,14 @@ func TestClsWithOptionsStacking(t *testing.T) { secret := &modal.Secret{SecretID: "sec-1"} volume := &modal.Volume{VolumeID: "vol-1"} cpu := 0.25 - memory := 256 + memoryMiB := 256 gpu := "T4" timeout := 45 * time.Second newTimeout := 60 * time.Second optioned := cls. WithOptions(&modal.ClsWithOptionsParams{Timeout: &timeout, CPU: &cpu}). - WithOptions(&modal.ClsWithOptionsParams{Timeout: &newTimeout, Memory: &memory, GPU: &gpu}). + WithOptions(&modal.ClsWithOptionsParams{Timeout: &newTimeout, MemoryMiB: &memoryMiB, GPU: &gpu}). WithOptions(&modal.ClsWithOptionsParams{Secrets: []*modal.Secret{secret}, Volumes: map[string]*modal.Volume{"/mnt/test": volume}}) instance, err := optioned.Instance(ctx, nil) diff --git a/modal-js/examples/sandbox-tunnels.ts b/modal-js/examples/sandbox-tunnels.ts index dcab4162..e2145c33 100644 --- a/modal-js/examples/sandbox-tunnels.ts +++ b/modal-js/examples/sandbox-tunnels.ts @@ -11,8 +11,8 @@ const image = modal.images.fromRegistry("python:3.12-alpine"); const sandbox = await modal.sandboxes.create(app, image, { command: ["python3", "-m", "http.server", "8000"], encryptedPorts: [8000], - timeout: 60000, // 1 minute - idleTimeout: 30000, // 30 seconds + timeoutMs: 60000, // 1 minute + idleTimeoutMs: 30000, // 30 seconds }); console.log("Sandbox created:", sandbox.sandboxId); diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index 999caa98..8cce3e6b 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -25,13 +25,14 @@ import { ClientType, ModalClientDefinition } from "../proto/modal_proto/api"; import { getProfile, type Profile } from "./config"; import { AuthTokenManager } from "./auth_token_manager"; import { getSDKVersion } from "./version"; +import { checkForRenamedParams } from "./validation"; export interface ModalClientParams { tokenId?: string; tokenSecret?: string; environment?: string; endpoint?: string; - timeout?: number; + timeoutMs?: number; maxRetries?: number; /** @ignore */ cpClient?: ModalGrpcClient; @@ -80,6 +81,8 @@ export class ModalClient { private authTokenManager: AuthTokenManager | null = null; constructor(params?: ModalClientParams) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const baseProfile = getProfile(process.env["MODAL_PROFILE"]); this.profile = { ...baseProfile, @@ -200,17 +203,17 @@ export class ModalClient { type TimeoutOptions = { /** Timeout for this call, interpreted as a duration in milliseconds */ - timeout?: number; + timeoutMs?: number; }; /** gRPC client middleware to set timeout and retries on a call. */ const timeoutMiddleware: ClientMiddleware = async function* timeoutMiddleware(call, options) { - if (!options.timeout || options.signal?.aborted) { + if (!options.timeoutMs || options.signal?.aborted) { return yield* call.next(call.request, options); } - const { timeout, signal: origSignal, ...restOptions } = options; + const { timeoutMs, signal: origSignal, ...restOptions } = options; const abortController = new AbortController(); const abortListener = () => abortController.abort(); origSignal?.addEventListener("abort", abortListener); @@ -220,7 +223,7 @@ const timeoutMiddleware: ClientMiddleware = const timer = setTimeout(() => { timedOut = true; abortController.abort(); - }, timeout); + }, timeoutMs); try { return yield* call.next(call.request, { @@ -236,7 +239,7 @@ const timeoutMiddleware: ClientMiddleware = throw new ClientError( call.method.path, Status.DEADLINE_EXCEEDED, - `Timed out after ${timeout}ms`, + `Timed out after ${timeoutMs}ms`, ); } } diff --git a/modal-js/src/cls.ts b/modal-js/src/cls.ts index 4d9c2af4..4fc6127e 100644 --- a/modal-js/src/cls.ts +++ b/modal-js/src/cls.ts @@ -18,6 +18,7 @@ import type { Secret } from "./secret"; import { mergeEnvIntoSecrets } from "./secret"; import { Retries, parseRetries } from "./retries"; import type { Volume } from "./volume"; +import { checkForRenamedParams } from "./validation"; /** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */ export type ClsFromNameParams = { @@ -85,8 +86,8 @@ export class ClsService { export type ClsWithOptionsParams = { cpu?: number; cpuLimit?: number; - memory?: number; - memoryLimit?: number; + memoryMiB?: number; + memoryLimitMiB?: number; gpu?: string; env?: Record; secrets?: Secret[]; @@ -94,8 +95,8 @@ export type ClsWithOptionsParams = { retries?: number | Retries; maxContainers?: number; bufferContainers?: number; - scaledownWindow?: number; // in milliseconds - timeout?: number; // in milliseconds + scaledownWindowMs?: number; + timeoutMs?: number; }; export type ClsWithConcurrencyParams = { @@ -264,6 +265,13 @@ async function buildFunctionOptionsProto( if (!options) return undefined; const o = options ?? {}; + checkForRenamedParams(o, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + scaledownWindow: "scaledownWindowMs", + timeout: "timeoutMs", + }); + const gpuConfig = parseGpuConfig(o.gpu); let milliCpu: number | undefined = undefined; @@ -288,21 +296,23 @@ async function buildFunctionOptionsProto( let memoryMb: number | undefined = undefined; let memoryMbMax: number | undefined = undefined; - if (o.memory === undefined && o.memoryLimit !== undefined) { - throw new Error("must also specify memory when memoryLimit is specified"); + if (o.memoryMiB === undefined && o.memoryLimitMiB !== undefined) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified", + ); } - if (o.memory !== undefined) { - if (o.memory <= 0) { - throw new Error(`memory (${o.memory}) must be a positive number`); + if (o.memoryMiB !== undefined) { + if (o.memoryMiB <= 0) { + throw new Error(`memoryMiB (${o.memoryMiB}) must be a positive number`); } - memoryMb = o.memory; - if (o.memoryLimit !== undefined) { - if (o.memoryLimit < o.memory) { + memoryMb = o.memoryMiB; + if (o.memoryLimitMiB !== undefined) { + if (o.memoryLimitMiB < o.memoryMiB) { throw new Error( - `memory (${o.memory}) cannot be higher than memoryLimit (${o.memoryLimit})`, + `memoryMiB (${o.memoryMiB}) cannot be higher than memoryLimitMiB (${o.memoryLimitMiB})`, ); } - memoryMbMax = o.memoryLimit; + memoryMbMax = o.memoryLimitMiB; } } @@ -342,13 +352,15 @@ async function buildFunctionOptionsProto( } : undefined; - if (o.scaledownWindow !== undefined && o.scaledownWindow % 1000 !== 0) { + if (o.scaledownWindowMs !== undefined && o.scaledownWindowMs % 1000 !== 0) { throw new Error( - `scaledownWindow must be a multiple of 1000ms, got ${o.scaledownWindow}`, + `scaledownWindowMs must be a multiple of 1000ms, got ${o.scaledownWindowMs}`, ); } - if (o.timeout !== undefined && o.timeout % 1000 !== 0) { - throw new Error(`timeout must be a multiple of 1000ms, got ${o.timeout}`); + if (o.timeoutMs !== undefined && o.timeoutMs % 1000 !== 0) { + throw new Error( + `timeoutMs must be a multiple of 1000ms, got ${o.timeoutMs}`, + ); } const functionOptions = FunctionOptions.create({ @@ -361,8 +373,10 @@ async function buildFunctionOptionsProto( concurrencyLimit: o.maxContainers, bufferContainers: o.bufferContainers, taskIdleTimeoutSecs: - o.scaledownWindow !== undefined ? o.scaledownWindow / 1000 : undefined, - timeoutSecs: o.timeout !== undefined ? o.timeout / 1000 : undefined, + o.scaledownWindowMs !== undefined + ? o.scaledownWindowMs / 1000 + : undefined, + timeoutSecs: o.timeoutMs !== undefined ? o.timeoutMs / 1000 : undefined, maxConcurrentInputs: o.maxConcurrentInputs, targetConcurrentInputs: o.targetConcurrentInputs, batchMaxSize: o.batchMaxSize, diff --git a/modal-js/src/function.ts b/modal-js/src/function.ts index ddf99638..0baabb2a 100644 --- a/modal-js/src/function.ts +++ b/modal-js/src/function.ts @@ -18,6 +18,7 @@ import { InputPlaneInvocation, Invocation, } from "./invocation"; +import { checkForRenamedParams } from "./validation"; // From: modal/_utils/blob_utils.py const maxObjectSizeBytes = 2 * 1024 * 1024; // 2 MiB @@ -91,7 +92,7 @@ export interface FunctionUpdateAutoscalerParams { minContainers?: number; maxContainers?: number; bufferContainers?: number; - scaledownWindow?: number; + scaledownWindowMs?: number; } /** Represents a deployed Modal Function, which can be invoked remotely. */ @@ -186,7 +187,7 @@ export class Function_ { async getCurrentStats(): Promise { const resp = await this.#client.cpClient.functionGetCurrentStats( { functionId: this.functionId }, - { timeout: 10000 }, + { timeoutMs: 10000 }, ); return { backlog: resp.backlog, @@ -198,6 +199,8 @@ export class Function_ { async updateAutoscaler( params: FunctionUpdateAutoscalerParams, ): Promise { + checkForRenamedParams(params, { scaledownWindow: "scaledownWindowMs" }); + await this.#client.cpClient.functionUpdateSchedulingParams({ functionId: this.functionId, warmPoolSizeOverride: 0, // Deprecated field, always set to 0 @@ -205,7 +208,10 @@ export class Function_ { minContainers: params.minContainers, maxContainers: params.maxContainers, bufferContainers: params.bufferContainers, - scaledownWindow: params.scaledownWindow, + scaledownWindow: + params.scaledownWindowMs !== undefined + ? Math.trunc(params.scaledownWindowMs / 1000) + : undefined, }, }); } diff --git a/modal-js/src/function_call.ts b/modal-js/src/function_call.ts index 6358784d..be4c11ee 100644 --- a/modal-js/src/function_call.ts +++ b/modal-js/src/function_call.ts @@ -2,6 +2,7 @@ import { getDefaultClient, type ModalClient } from "./client"; import { ControlPlaneInvocation } from "./invocation"; +import { checkForRenamedParams } from "./validation"; /** * Service for managing {@link FunctionCall}s. @@ -29,7 +30,7 @@ export class FunctionCallService { /** Optional parameters for {@link FunctionCall#get FunctionCall.get()}. */ export type FunctionCallGetParams = { - timeout?: number; // in milliseconds + timeoutMs?: number; }; /** Optional parameters for {@link FunctionCall#cancel FunctionCall.cancel()}. */ @@ -61,12 +62,13 @@ export class FunctionCall { /** Get the result of a FunctionCall, optionally waiting with a timeout. */ async get(params: FunctionCallGetParams = {}): Promise { - const timeout = params.timeout; + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const invocation = ControlPlaneInvocation.fromFunctionCallId( this.#client || getDefaultClient(), this.functionCallId, ); - return invocation.awaitOutput(timeout); + return invocation.awaitOutput(params.timeoutMs); } /** Cancel a running FunctionCall. */ diff --git a/modal-js/src/index.ts b/modal-js/src/index.ts index 2119ea4e..9e751836 100644 --- a/modal-js/src/index.ts +++ b/modal-js/src/index.ts @@ -87,3 +87,4 @@ export { Proxy, ProxyService, type ProxyFromNameParams } from "./proxy"; export { CloudBucketMount } from "./cloud_bucket_mount"; export { ModalClient, type ModalClientParams } from "./client"; export { type Profile } from "./config"; +export { checkForRenamedParams } from "./validation"; diff --git a/modal-js/src/invocation.ts b/modal-js/src/invocation.ts index 2976f23b..616ce1a1 100644 --- a/modal-js/src/invocation.ts +++ b/modal-js/src/invocation.ts @@ -15,7 +15,7 @@ import { FunctionTimeoutError, InternalFailure, RemoteError } from "./errors"; import { cborDecode } from "./serialization"; // From: modal-client/modal/_utils/function_utils.py -const outputsTimeout = 55 * 1000; +const outputsTimeoutMs = 55 * 1000; /** * This abstraction exists so that we can easily send inputs to either the control plane or the input plane. @@ -24,7 +24,7 @@ const outputsTimeout = 55 * 1000; * For now, we support just the control plane, and will add support for the input plane soon. */ export interface Invocation { - awaitOutput(timeout?: number): Promise; + awaitOutput(timeoutMs?: number): Promise; retry(retryCount: number): Promise; } @@ -83,21 +83,21 @@ export class ControlPlaneInvocation implements Invocation { return new ControlPlaneInvocation(client.cpClient, functionCallId); } - async awaitOutput(timeout?: number): Promise { + async awaitOutput(timeoutMs?: number): Promise { return await pollFunctionOutput( this.cpClient, - (timeoutMillis: number) => this.#getOutput(timeoutMillis), - timeout, + (timeoutMs: number) => this.#getOutput(timeoutMs), + timeoutMs, ); } async #getOutput( - timeoutMillis: number, + timeoutMs: number, ): Promise { const response = await this.cpClient.functionGetOutputs({ functionCallId: this.functionCallId, maxValues: 1, - timeout: timeoutMillis / 1000, // Backend needs seconds + timeout: timeoutMs / 1000, lastEntryId: "0-0", clearOnSuccess: true, requestedAt: timeNowSeconds(), @@ -174,21 +174,21 @@ export class InputPlaneInvocation implements Invocation { ); } - async awaitOutput(timeout?: number): Promise { + async awaitOutput(timeoutMs?: number): Promise { return await pollFunctionOutput( this.cpClient, - (timeoutMillis: number) => this.#getOutput(timeoutMillis), - timeout, + (timeoutMs: number) => this.#getOutput(timeoutMs), + timeoutMs, ); } async #getOutput( - timeoutMillis: number, + timeoutMs: number, ): Promise { const response = await this.ipClient.attemptAwait({ attemptToken: this.attemptToken, requestedAt: timeNowSeconds(), - timeoutSecs: timeoutMillis / 1000, + timeoutSecs: timeoutMs / 1000, }); return response.output; } @@ -212,7 +212,7 @@ function timeNowSeconds() { * from either the control plane or the input plane, depending on the implementation. */ type GetOutput = ( - timeoutMillis: number, + timeoutMs: number, ) => Promise; /*** @@ -223,27 +223,27 @@ type GetOutput = ( async function pollFunctionOutput( cpClient: ModalGrpcClient, getOutput: GetOutput, - timeout?: number, // in milliseconds + timeoutMs?: number, ): Promise { const startTime = Date.now(); - let pollTimeout = outputsTimeout; - if (timeout !== undefined) { - pollTimeout = Math.min(timeout, outputsTimeout); + let pollTimeoutMs = outputsTimeoutMs; + if (timeoutMs !== undefined) { + pollTimeoutMs = Math.min(timeoutMs, outputsTimeoutMs); } while (true) { - const output = await getOutput(pollTimeout); + const output = await getOutput(pollTimeoutMs); if (output) { return await processResult(cpClient, output.result, output.dataFormat); } - if (timeout !== undefined) { - const remainingTime = timeout - (Date.now() - startTime); - if (remainingTime <= 0) { - const message = `Timeout exceeded: ${(timeout / 1000).toFixed(1)}s`; + if (timeoutMs !== undefined) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Timeout exceeded: ${timeoutMs}ms`; throw new FunctionTimeoutError(message); } - pollTimeout = Math.min(outputsTimeout, remainingTime); + pollTimeoutMs = Math.min(outputsTimeoutMs, remainingMs); } } } diff --git a/modal-js/src/queue.ts b/modal-js/src/queue.ts index dd4eaa6c..fed4f704 100644 --- a/modal-js/src/queue.ts +++ b/modal-js/src/queue.ts @@ -9,9 +9,10 @@ import { InvalidError, QueueEmptyError, QueueFullError } from "./errors"; import { dumps as pickleEncode, loads as pickleDecode } from "./pickle"; import { ClientError, Status } from "nice-grpc"; import { EphemeralHeartbeatManager } from "./ephemeral"; +import { checkForRenamedParams } from "./validation"; -const queueInitialPutBackoff = 100; // 100 milliseconds -const queueDefaultPartitionTtl = 24 * 3600 * 1000; // 24 hours +const queueInitialPutBackoffMs = 100; +const queueDefaultPartitionTtlMs = 24 * 3600 * 1000; // 24 hours /** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */ export type QueueFromNameParams = { @@ -98,8 +99,8 @@ export type QueueClearParams = { /** Optional parameters for {@link Queue#get Queue.get()}. */ export type QueueGetParams = { - /** How long to wait if the Queue is empty (default: indefinite). */ - timeout?: number; + /** How long to wait if the Queue is empty in milliseconds (default: indefinite). */ + timeoutMs?: number; /** Partition to fetch values from, uses default partition if not set. */ partition?: string; @@ -110,14 +111,14 @@ export type QueueGetManyParams = QueueGetParams; /** Optional parameters for {@link Queue#put Queue.put()}. */ export type QueuePutParams = { - /** How long to wait if the Queue is full (default: indefinite). */ - timeout?: number; + /** How long to wait if the Queue is full in milliseconds (default: indefinite). */ + timeoutMs?: number; /** Partition to add items to, uses default partition if not set. */ partition?: string; - /** TTL for the partition in seconds (default: 1 day). */ - partitionTtl?: number; + /** TTL for the partition in milliseconds (default: 1 day). */ + partitionTtlMs?: number; }; /** Optional parameters for {@link Queue#putMany Queue.putMany()}. */ @@ -134,8 +135,8 @@ export type QueueLenParams = { /** Optional parameters for {@link Queue#iterate Queue.iterate()}. */ export type QueueIterateParams = { - /** How long to wait between successive items before exiting iteration (default: 0). */ - itemPollTimeout?: number; + /** How long to wait between successive items before exiting iteration in milliseconds (default: 0). */ + itemPollTimeoutMs?: number; /** Partition to iterate, uses default partition if not set. */ partition?: string; @@ -228,32 +229,36 @@ export class Queue { }); } - async #get(n: number, partition?: string, timeout?: number): Promise { + async #get( + n: number, + partition?: string, + timeoutMs?: number, + ): Promise { const partitionKey = Queue.#validatePartitionKey(partition); const startTime = Date.now(); - let pollTimeout = 50_000; - if (timeout !== undefined) { - pollTimeout = Math.min(pollTimeout, timeout); + let pollTimeoutMs = 50_000; + if (timeoutMs !== undefined) { + pollTimeoutMs = Math.min(pollTimeoutMs, timeoutMs); } while (true) { const response = await this.#client.cpClient.queueGet({ queueId: this.queueId, partitionKey, - timeout: pollTimeout / 1000, + timeout: pollTimeoutMs / 1000, nValues: n, }); if (response.values && response.values.length > 0) { return response.values.map((value) => pickleDecode(value)); } - if (timeout !== undefined) { - const remaining = timeout - (Date.now() - startTime); - if (remaining <= 0) { - const message = `Queue ${this.queueId} did not return values within ${timeout}ms.`; + if (timeoutMs !== undefined) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Queue ${this.queueId} did not return values within ${timeoutMs}ms.`; throw new QueueEmptyError(message); } - pollTimeout = Math.min(pollTimeout, remaining); + pollTimeoutMs = Math.min(pollTimeoutMs, remainingMs); } } } @@ -262,11 +267,13 @@ export class Queue { * Remove and return the next object from the Queue. * * By default, this will wait until at least one item is present in the Queue. - * If `timeout` is set, raises `QueueEmptyError` if no items are available + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available * within that timeout in milliseconds. */ async get(params: QueueGetParams = {}): Promise { - const values = await this.#get(1, params.partition, params.timeout); + checkForRenamedParams(params, { timeout: "timeoutMs" }); + + const values = await this.#get(1, params.partition, params.timeoutMs); return values[0]; // Must have length >= 1 if returned. } @@ -274,24 +281,26 @@ export class Queue { * Remove and return up to `n` objects from the Queue. * * By default, this will wait until at least one item is present in the Queue. - * If `timeout` is set, raises `QueueEmptyError` if no items are available + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available * within that timeout in milliseconds. */ async getMany(n: number, params: QueueGetManyParams = {}): Promise { - return await this.#get(n, params.partition, params.timeout); + checkForRenamedParams(params, { timeout: "timeoutMs" }); + + return await this.#get(n, params.partition, params.timeoutMs); } async #put( values: any[], - timeout?: number, + timeoutMs?: number, partition?: string, - partitionTtl?: number, + partitionTtlMs?: number, ): Promise { const valuesEncoded = values.map((v) => pickleEncode(v)); const partitionKey = Queue.#validatePartitionKey(partition); - let delay = queueInitialPutBackoff; - const deadline = timeout ? Date.now() + timeout : undefined; + let delay = queueInitialPutBackoffMs; + const deadline = timeoutMs ? Date.now() + timeoutMs : undefined; while (true) { try { await this.#client.cpClient.queuePut({ @@ -299,7 +308,7 @@ export class Queue { values: valuesEncoded, partitionKey, partitionTtlSeconds: - (partitionTtl || queueDefaultPartitionTtl) / 1000, + (partitionTtlMs || queueDefaultPartitionTtlMs) / 1000, }); break; } catch (e) { @@ -324,26 +333,41 @@ export class Queue { * Add an item to the end of the Queue. * * If the Queue is full, this will retry with exponential backoff until the - * provided `timeout` is reached, or indefinitely if `timeout` is not set. + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. * Raises {@link QueueFullError} if the Queue is still full after the timeout. */ async put(v: any, params: QueuePutParams = {}): Promise { - await this.#put([v], params.timeout, params.partition, params.partitionTtl); + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs", + }); + + await this.#put( + [v], + params.timeoutMs, + params.partition, + params.partitionTtlMs, + ); } /** * Add several items to the end of the Queue. * * If the Queue is full, this will retry with exponential backoff until the - * provided `timeout` is reached, or indefinitely if `timeout` is not set. + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. * Raises {@link QueueFullError} if the Queue is still full after the timeout. */ async putMany(values: any[], params: QueuePutManyParams = {}): Promise { + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs", + }); + await this.#put( values, - params.timeout, + params.timeoutMs, params.partition, - params.partitionTtl, + params.partitionTtlMs, ); } @@ -366,22 +390,24 @@ export class Queue { async *iterate( params: QueueIterateParams = {}, ): AsyncGenerator { - const { partition, itemPollTimeout = 0 } = params; + checkForRenamedParams(params, { itemPollTimeout: "itemPollTimeoutMs" }); + + const { partition, itemPollTimeoutMs = 0 } = params; let lastEntryId = undefined; const validatedPartitionKey = Queue.#validatePartitionKey(partition); - let fetchDeadline = Date.now() + itemPollTimeout; + let fetchDeadline = Date.now() + itemPollTimeoutMs; - const maxPollDuration = 30_000; + const maxPollDurationMs = 30_000; while (true) { - const pollDuration = Math.max( + const pollDurationMs = Math.max( 0.0, - Math.min(maxPollDuration, fetchDeadline - Date.now()), + Math.min(maxPollDurationMs, fetchDeadline - Date.now()), ); const request: QueueNextItemsRequest = { queueId: this.queueId, partitionKey: validatedPartitionKey, - itemPollTimeout: pollDuration / 1000, + itemPollTimeout: pollDurationMs / 1000, lastEntryId: lastEntryId || "", }; @@ -391,7 +417,7 @@ export class Queue { yield pickleDecode(item.value); lastEntryId = item.entryId; } - fetchDeadline = Date.now() + itemPollTimeout; + fetchDeadline = Date.now() + itemPollTimeoutMs; } else if (Date.now() > fetchDeadline) { break; } diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 726338c7..67c5c2ab 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -48,6 +48,7 @@ import type { CloudBucketMount } from "./cloud_bucket_mount"; import { cloudBucketMountToProto } from "./cloud_bucket_mount"; import type { App } from "./app"; import { parseGpuConfig } from "./app"; +import { checkForRenamedParams } from "./validation"; /** * Stdin is always present, but this option allow you to drop stdout or stderr @@ -73,19 +74,19 @@ export type SandboxCreateParams = { cpuLimit?: number; /** Reservation of memory in MiB. */ - memory?: number; + memoryMiB?: number; /** Hard limit of memory in MiB. */ - memoryLimit?: number; + memoryLimitMiB?: number; /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */ gpu?: string; - /** Timeout of the Sandbox container, defaults to 10 minutes. */ - timeout?: number; + /** Timeout of the Sandbox container in milliseconds, defaults to 10 minutes. */ + timeoutMs?: number; /** The amount of time in milliseconds that a sandbox can be idle before being terminated. */ - idleTimeout?: number; + idleTimeoutMs?: number; /** Working directory of the Sandbox. */ workdir?: string; @@ -147,17 +148,24 @@ export async function buildSandboxCreateRequestProto( imageId: string, params: SandboxCreateParams = {}, ): Promise { + checkForRenamedParams(params, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + timeout: "timeoutMs", + idleTimeout: "idleTimeoutMs", + }); + const gpuConfig = parseGpuConfig(params.gpu); // The gRPC API only accepts a whole number of seconds. - if (params.timeout && params.timeout % 1000 !== 0) { + if (params.timeoutMs && params.timeoutMs % 1000 !== 0) { throw new Error( - `timeout must be a multiple of 1000ms, got ${params.timeout}`, + `timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}`, ); } - if (params.idleTimeout && params.idleTimeout % 1000 !== 0) { + if (params.idleTimeoutMs && params.idleTimeoutMs % 1000 !== 0) { throw new Error( - `idleTimeout must be a multiple of 1000ms, got ${params.idleTimeout}`, + `idleTimeoutMs must be a multiple of 1000ms, got ${params.idleTimeoutMs}`, ); } @@ -263,23 +271,25 @@ export async function buildSandboxCreateRequestProto( let memoryMb: number | undefined = undefined; let memoryMbMax: number | undefined = undefined; - if (params.memory === undefined && params.memoryLimit !== undefined) { - throw new Error("must also specify memory when memoryLimit is specified"); + if (params.memoryMiB === undefined && params.memoryLimitMiB !== undefined) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified", + ); } - if (params.memory !== undefined) { - if (params.memory <= 0) { + if (params.memoryMiB !== undefined) { + if (params.memoryMiB <= 0) { throw new Error( - `the memory request (${params.memory}) must be a positive number`, + `the memoryMiB request (${params.memoryMiB}) must be a positive number`, ); } - memoryMb = params.memory; - if (params.memoryLimit !== undefined) { - if (params.memoryLimit < params.memory) { + memoryMb = params.memoryMiB; + if (params.memoryLimitMiB !== undefined) { + if (params.memoryLimitMiB < params.memoryMiB) { throw new Error( - `the memory request (${params.memory}) cannot be higher than memoryLimit (${params.memoryLimit})`, + `the memoryMiB request (${params.memoryMiB}) cannot be higher than memoryLimitMiB (${params.memoryLimitMiB})`, ); } - memoryMbMax = params.memoryLimit; + memoryMbMax = params.memoryLimitMiB; } } @@ -289,9 +299,12 @@ export async function buildSandboxCreateRequestProto( // Sleep default is implicit in image builder version <=2024.10 entrypointArgs: params.command ?? ["sleep", "48h"], imageId, - timeoutSecs: params.timeout != undefined ? params.timeout / 1000 : 600, + timeoutSecs: + params.timeoutMs != undefined ? params.timeoutMs / 1000 : 600, idleTimeoutSecs: - params.idleTimeout != undefined ? params.idleTimeout / 1000 : undefined, + params.idleTimeoutMs != undefined + ? params.idleTimeoutMs / 1000 + : undefined, workdir: params.workdir ?? undefined, networkAccess, resources: { @@ -490,7 +503,7 @@ export type SandboxExecParams = { /** Working directory to run the command in. */ workdir?: string; /** Timeout for the process in milliseconds. Defaults to 0 (no timeout). */ - timeout?: number; + timeoutMs?: number; /** Environment variables to set for the command. */ env?: Record; /** {@link Secret}s to inject as environment variables for the commmand.*/ @@ -552,6 +565,8 @@ export async function buildContainerExecRequestProto( command: string[], params?: SandboxExecParams, ): Promise { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const secretIds = (params?.secrets || []).map((secret) => secret.secretId); let ptyInfo: PTYInfo | undefined; @@ -563,7 +578,7 @@ export async function buildContainerExecRequestProto( taskId, command, workdir: params?.workdir, - timeoutSecs: params?.timeout ? params.timeout / 1000 : 0, + timeoutSecs: params?.timeoutMs ? params.timeoutMs / 1000 : 0, secretIds, ptyInfo, }); @@ -767,14 +782,14 @@ export class Sandbox { * * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. */ - async tunnels(timeout = 50000): Promise> { + async tunnels(timeoutMs = 50000): Promise> { if (this.#tunnels) { return this.#tunnels; } const resp = await this.#client.cpClient.sandboxGetTunnels({ sandboxId: this.sandboxId, - timeout: timeout / 1000, // Convert to seconds + timeout: timeoutMs / 1000, }); if ( @@ -801,13 +816,13 @@ export class Sandbox { * * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. * - * @param timeout - Timeout for the snapshot operation in milliseconds + * @param timeoutMs - Timeout for the snapshot operation in milliseconds * @returns Promise that resolves to an {@link Image} */ - async snapshotFilesystem(timeout = 55000): Promise { + async snapshotFilesystem(timeoutMs = 55000): Promise { const resp = await this.#client.cpClient.sandboxSnapshotFs({ sandboxId: this.sandboxId, - timeout: timeout / 1000, + timeout: timeoutMs / 1000, }); if ( diff --git a/modal-js/src/validation.ts b/modal-js/src/validation.ts new file mode 100644 index 00000000..09f4829f --- /dev/null +++ b/modal-js/src/validation.ts @@ -0,0 +1,14 @@ +export function checkForRenamedParams( + params: any, + renames: Record, +): void { + if (!params) return; + + for (const [oldName, newName] of Object.entries(renames)) { + if (oldName in params) { + throw new Error( + `Parameter '${oldName}' has been renamed to '${newName}'.`, + ); + } + } +} diff --git a/modal-js/test/cls_with_options.test.ts b/modal-js/test/cls_with_options.test.ts index 787bfdfb..c3cc2cbc 100644 --- a/modal-js/test/cls_with_options.test.ts +++ b/modal-js/test/cls_with_options.test.ts @@ -47,8 +47,8 @@ test("Cls.withOptions stacking", async () => { const volume = { volumeId: "vol-1" } as Volume; const optioned = cls - .withOptions({ timeout: 45_000, cpu: 0.25 }) - .withOptions({ timeout: 60_000, memory: 256, gpu: "T4" }) + .withOptions({ timeoutMs: 45_000, cpu: 0.25 }) + .withOptions({ timeoutMs: 60_000, memoryMiB: 256, gpu: "T4" }) .withOptions({ secrets: [secret], volumes: { "/mnt/test": volume } }); const instance = await optioned.instance(); @@ -78,7 +78,7 @@ test("Cls.withConcurrency/withConcurrency/withBatching chaining", async () => { }); const chained = cls - .withOptions({ timeout: 60_000 }) + .withOptions({ timeoutMs: 60_000 }) .withConcurrency({ maxInputs: 10 }) .withBatching({ maxBatchSize: 11, waitMs: 12 }); @@ -142,13 +142,13 @@ test("Cls.withOptions invalid values", async () => { }); const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); - await expect(cls.withOptions({ timeout: 1500 }).instance()).rejects.toThrow( - /timeout must be a multiple of 1000ms/, + await expect(cls.withOptions({ timeoutMs: 1500 }).instance()).rejects.toThrow( + /timeoutMs must be a multiple of 1000ms/, ); await expect( - cls.withOptions({ scaledownWindow: 2500 }).instance(), - ).rejects.toThrow(/scaledownWindow must be a multiple of 1000ms/); + cls.withOptions({ scaledownWindowMs: 2500 }).instance(), + ).rejects.toThrow(/scaledownWindowMs must be a multiple of 1000ms/); mock.assertExhausted(); }); @@ -275,7 +275,7 @@ test("withOptions({ memory, memoryLimit }) sets memoryMb and memoryMbMax", async const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); const instance = await cls - .withOptions({ memory: 1024, memoryLimit: 2048 }) + .withOptions({ memoryMiB: 1024, memoryLimitMiB: 2048 }) .instance(); expect(instance).toBeTruthy(); @@ -291,8 +291,10 @@ test("withOptions memoryLimit lower than memory throws error", async () => { const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); await expect( - cls.withOptions({ memory: 2048, memoryLimit: 1024 }).instance(), - ).rejects.toThrow("memory (2048) cannot be higher than memoryLimit (1024)"); + cls.withOptions({ memoryMiB: 2048, memoryLimitMiB: 1024 }).instance(), + ).rejects.toThrow( + "memoryMiB (2048) cannot be higher than memoryLimitMiB (1024)", + ); mock.assertExhausted(); }); @@ -306,8 +308,10 @@ test("withOptions memoryLimit without memory throws error", async () => { const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); await expect( - cls.withOptions({ memoryLimit: 2048 }).instance(), - ).rejects.toThrow("must also specify memory when memoryLimit is specified"); + cls.withOptions({ memoryLimitMiB: 2048 }).instance(), + ).rejects.toThrow( + "must also specify memoryMiB when memoryLimitMiB is specified", + ); mock.assertExhausted(); }); @@ -350,7 +354,7 @@ test("withOptions negative memory throws error", async () => { }); const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); - await expect(cls.withOptions({ memory: -100 }).instance()).rejects.toThrow( + await expect(cls.withOptions({ memoryMiB: -100 }).instance()).rejects.toThrow( "must be a positive number", ); @@ -365,7 +369,7 @@ test("withOptions zero memory throws error", async () => { }); const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); - await expect(cls.withOptions({ memory: 0 }).instance()).rejects.toThrow( + await expect(cls.withOptions({ memoryMiB: 0 }).instance()).rejects.toThrow( "must be a positive number", ); diff --git a/modal-js/test/function.test.ts b/modal-js/test/function.test.ts index eda354af..27242fa3 100644 --- a/modal-js/test/function.test.ts +++ b/modal-js/test/function.test.ts @@ -136,7 +136,7 @@ test("FunctionUpdateAutoscaler", async () => { minContainers: 1, maxContainers: 10, bufferContainers: 2, - scaledownWindow: 300, + scaledownWindowMs: 300 * 1000, }); mock.handleUnary("/FunctionUpdateSchedulingParams", (req) => { diff --git a/modal-js/test/function_call.test.ts b/modal-js/test/function_call.test.ts index 33e0f7e3..134f4613 100644 --- a/modal-js/test/function_call.test.ts +++ b/modal-js/test/function_call.test.ts @@ -28,7 +28,7 @@ test("FunctionSpawn", async () => { expect(functionCall.functionCallId).toBeDefined(); // Getting outputs with timeout raises error. - const promise = functionCall.get({ timeout: 1000 }); // 1000ms + const promise = functionCall.get({ timeoutMs: 1000 }); // 1000ms await expect(promise).rejects.toThrowError(FunctionTimeoutError); }); @@ -38,10 +38,10 @@ test("FunctionCallGet0", async () => { const call = await sleep.spawn([0.5]); // Polling for output with timeout 0 should raise an error, since the // function call has not finished yet. - await expect(call.get({ timeout: 0 })).rejects.toThrowError( + await expect(call.get({ timeoutMs: 0 })).rejects.toThrowError( FunctionTimeoutError, ); expect(await call.get()).toBe(null); // Wait for the function call to finish. - expect(await call.get({ timeout: 0 })).toBe(null); // Now we can get the result. + expect(await call.get({ timeoutMs: 0 })).toBe(null); // Now we can get the result. }); diff --git a/modal-js/test/legacy/cls_with_options.test.ts b/modal-js/test/legacy/cls_with_options.test.ts index 37224d29..7b717f89 100644 --- a/modal-js/test/legacy/cls_with_options.test.ts +++ b/modal-js/test/legacy/cls_with_options.test.ts @@ -47,8 +47,8 @@ test("Cls.withOptions stacking", async () => { const volume = { volumeId: "vol-1" } as Volume; const optioned = cls - .withOptions({ timeout: 45_000, cpu: 0.25 }) - .withOptions({ timeout: 60_000, memory: 256, gpu: "T4" }) + .withOptions({ timeoutMs: 45_000, cpu: 0.25 }) + .withOptions({ timeoutMs: 60_000, memoryMiB: 256, gpu: "T4" }) .withOptions({ secrets: [secret], volumes: { "/mnt/test": volume } }); const instance = await optioned.instance(); @@ -78,7 +78,7 @@ test("Cls.withConcurrency/withConcurrency/withBatching chaining", async () => { }); const chained = cls - .withOptions({ timeout: 60_000 }) + .withOptions({ timeoutMs: 60_000 }) .withConcurrency({ maxInputs: 10 }) .withBatching({ maxBatchSize: 11, waitMs: 12 }); @@ -142,13 +142,13 @@ test("Cls.withOptions invalid values", async () => { }); const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); - await expect(cls.withOptions({ timeout: 1500 }).instance()).rejects.toThrow( - /timeout must be a multiple of 1000ms/, + await expect(cls.withOptions({ timeoutMs: 1500 }).instance()).rejects.toThrow( + /timeoutMs must be a multiple of 1000ms/, ); await expect( - cls.withOptions({ scaledownWindow: 2500 }).instance(), - ).rejects.toThrow(/scaledownWindow must be a multiple of 1000ms/); + cls.withOptions({ scaledownWindowMs: 2500 }).instance(), + ).rejects.toThrow(/scaledownWindowMs must be a multiple of 1000ms/); mock.assertExhausted(); }); diff --git a/modal-js/test/legacy/function.test.ts b/modal-js/test/legacy/function.test.ts index 6bf7ceab..2dadbb68 100644 --- a/modal-js/test/legacy/function.test.ts +++ b/modal-js/test/legacy/function.test.ts @@ -81,7 +81,7 @@ test("FunctionUpdateAutoscaler", async () => { minContainers: 1, maxContainers: 10, bufferContainers: 2, - scaledownWindow: 300, + scaledownWindowMs: 300 * 1000, }); mock.handleUnary("/FunctionUpdateSchedulingParams", (req) => { diff --git a/modal-js/test/legacy/function_call.test.ts b/modal-js/test/legacy/function_call.test.ts index f1c9d534..58da512c 100644 --- a/modal-js/test/legacy/function_call.test.ts +++ b/modal-js/test/legacy/function_call.test.ts @@ -27,7 +27,7 @@ test("FunctionSpawn", async () => { expect(functionCall.functionCallId).toBeDefined(); // Getting outputs with timeout raises error. - const promise = functionCall.get({ timeout: 1000 }); // 1000ms + const promise = functionCall.get({ timeoutMs: 1000 }); await expect(promise).rejects.toThrowError(FunctionTimeoutError); }); @@ -37,10 +37,10 @@ test("FunctionCallGet0", async () => { const call = await sleep.spawn([0.5]); // Polling for output with timeout 0 should raise an error, since the // function call has not finished yet. - await expect(call.get({ timeout: 0 })).rejects.toThrowError( + await expect(call.get({ timeoutMs: 0 })).rejects.toThrowError( FunctionTimeoutError, ); expect(await call.get()).toBe(null); // Wait for the function call to finish. - expect(await call.get({ timeout: 0 })).toBe(null); // Now we can get the result. + expect(await call.get({ timeoutMs: 0 })).toBe(null); // Now we can get the result. }); diff --git a/modal-js/test/legacy/queue.test.ts b/modal-js/test/legacy/queue.test.ts index 3ba456bd..cdb0c49c 100644 --- a/modal-js/test/legacy/queue.test.ts +++ b/modal-js/test/legacy/queue.test.ts @@ -27,9 +27,9 @@ test("QueueSuite1", async () => { expect(await queue.get()).toBe(123); await queue.put(432); - expect(await queue.get({ timeout: 0 })).toBe(432); + expect(await queue.get({ timeoutMs: 0 })).toBe(432); - await expect(queue.get({ timeout: 0 })).rejects.toThrow(QueueEmptyError); + await expect(queue.get({ timeoutMs: 0 })).rejects.toThrow(QueueEmptyError); expect(await queue.len()).toBe(0); await queue.putMany([1, 2, 3]); @@ -50,7 +50,7 @@ test("QueueSuite2", async () => { }; const consumer = async (queue: Queue) => { - for await (const item of queue.iterate({ itemPollTimeout: 1000 })) { + for await (const item of queue.iterate({ itemPollTimeoutMs: 1000 })) { results.push(item); } }; @@ -73,9 +73,9 @@ test("QueueNonBlocking", async () => { // Assuming the queue is available, these operations // Should succeed immediately. const queue = await Queue.ephemeral(); - await queue.put(123, { timeout: 0 }); + await queue.put(123, { timeoutMs: 0 }); expect(await queue.len()).toBe(1); - expect(await queue.get({ timeout: 0 })).toBe(123); + expect(await queue.get({ timeoutMs: 0 })).toBe(123); queue.closeEphemeral(); }); diff --git a/modal-js/test/legacy/sandbox.test.ts b/modal-js/test/legacy/sandbox.test.ts index be77ab58..d641b110 100644 --- a/modal-js/test/legacy/sandbox.test.ts +++ b/modal-js/test/legacy/sandbox.test.ts @@ -97,7 +97,7 @@ test("SandboxExecOptions", async () => { // Test with a custom working directory and timeout. const p = await sb.exec(["pwd"], { workdir: "/tmp", - timeout: 5000, + timeoutMs: 5000, }); expect(await p.stdout.readText()).toBe("/tmp\n"); diff --git a/modal-js/test/queue.test.ts b/modal-js/test/queue.test.ts index 29aa5d2b..65c69645 100644 --- a/modal-js/test/queue.test.ts +++ b/modal-js/test/queue.test.ts @@ -28,9 +28,9 @@ test("QueueSuite1", async () => { expect(await queue.get()).toBe(123); await queue.put(432); - expect(await queue.get({ timeout: 0 })).toBe(432); + expect(await queue.get({ timeoutMs: 0 })).toBe(432); - await expect(queue.get({ timeout: 0 })).rejects.toThrow(QueueEmptyError); + await expect(queue.get({ timeoutMs: 0 })).rejects.toThrow(QueueEmptyError); expect(await queue.len()).toBe(0); await queue.putMany([1, 2, 3]); @@ -51,7 +51,7 @@ test("QueueSuite2", async () => { }; const consumer = async (queue: Queue) => { - for await (const item of queue.iterate({ itemPollTimeout: 1000 })) { + for await (const item of queue.iterate({ itemPollTimeoutMs: 1000 })) { results.push(item); } }; @@ -74,9 +74,9 @@ test("QueueNonBlocking", async () => { // Assuming the queue is available, these operations // Should succeed immediately. const queue = await tc.queues.ephemeral(); - await queue.put(123, { timeout: 0 }); + await queue.put(123, { timeoutMs: 0 }); expect(await queue.len()).toBe(1); - expect(await queue.get({ timeout: 0 })).toBe(123); + expect(await queue.get({ timeoutMs: 0 })).toBe(123); queue.closeEphemeral(); }); diff --git a/modal-js/test/sandbox.test.ts b/modal-js/test/sandbox.test.ts index e8172aec..e1c86b85 100644 --- a/modal-js/test/sandbox.test.ts +++ b/modal-js/test/sandbox.test.ts @@ -106,7 +106,7 @@ test("SandboxExecOptions", async () => { // Test with a custom working directory and timeout. const p = await sb.exec(["pwd"], { workdir: "/tmp", - timeout: 5000, + timeoutMs: 5000, }); expect(await p.stdout.readText()).toBe("/tmp\n"); @@ -617,8 +617,8 @@ test("buildSandboxCreateRequestProto CPULimit without CPU", async () => { test("buildSandboxCreateRequestProto with Memory and MemoryLimit", async () => { const req = await buildSandboxCreateRequestProto("app-123", "img-456", { - memory: 1024, - memoryLimit: 2048, + memoryMiB: 1024, + memoryLimitMiB: 2048, }); const resources = req.definition!.resources!; @@ -629,20 +629,22 @@ test("buildSandboxCreateRequestProto with Memory and MemoryLimit", async () => { test("buildSandboxCreateRequestProto MemoryLimit lower than Memory", async () => { await expect( buildSandboxCreateRequestProto("app-123", "img-456", { - memory: 2048, - memoryLimit: 1024, + memoryMiB: 2048, + memoryLimitMiB: 1024, }), ).rejects.toThrow( - "the memory request (2048) cannot be higher than memoryLimit (1024)", + "the memoryMiB request (2048) cannot be higher than memoryLimitMiB (1024)", ); }); test("buildSandboxCreateRequestProto MemoryLimit without Memory", async () => { await expect( buildSandboxCreateRequestProto("app-123", "img-456", { - memoryLimit: 2048, + memoryLimitMiB: 2048, }), - ).rejects.toThrow("must also specify memory when memoryLimit is specified"); + ).rejects.toThrow( + "must also specify memoryMiB when memoryLimitMiB is specified", + ); }); test("buildSandboxCreateRequestProto negative CPU", async () => { @@ -656,7 +658,7 @@ test("buildSandboxCreateRequestProto negative CPU", async () => { test("buildSandboxCreateRequestProto negative Memory", async () => { await expect( buildSandboxCreateRequestProto("app-123", "img-456", { - memory: -100, + memoryMiB: -100, }), ).rejects.toThrow("must be a positive number"); }); diff --git a/modal-js/test/validation.test.ts b/modal-js/test/validation.test.ts new file mode 100644 index 00000000..15fb8435 --- /dev/null +++ b/modal-js/test/validation.test.ts @@ -0,0 +1,65 @@ +import { checkForRenamedParams } from "../src/validation"; + +import { expect, test } from "vitest"; +import { createMockModalClients } from "../test-support/grpc_mock"; + +test("checkForRenamedParams", () => { + expect(() => + checkForRenamedParams({ timeout: 5000 }, { timeout: "timeoutMs" }), + ).toThrow("Parameter 'timeout' has been renamed to 'timeoutMs'."); + + expect(() => + checkForRenamedParams({ timeoutMs: 5000 }, { timeout: "timeoutMs" }), + ).not.toThrow(); + + expect(() => + checkForRenamedParams(null, { timeout: "timeoutMs" }), + ).not.toThrow(); + + expect(() => + checkForRenamedParams(undefined, { timeout: "timeoutMs" }), + ).not.toThrow(); + + expect(() => + checkForRenamedParams({}, { timeout: "timeoutMs" }), + ).not.toThrow(); +}); + +test("ModalClient constructor rejects old 'timeout' parameter", async () => { + const { ModalClient } = await import("modal"); + + expect( + () => + new ModalClient({ + timeout: 5000, + } as any), + ).toThrow("Parameter 'timeout' has been renamed to 'timeoutMs'."); +}); + +test("Cls.withOptions rejects old parameter names", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("FunctionGet", (_: any) => ({ + functionId: "fid", + handleMetadata: { + methodHandleMetadata: { echo_string: {} }, + classParameterInfo: { schema: [] }, + }, + })); + + const cls = await mc.cls.fromName("libmodal-test-support", "EchoCls"); + + await expect( + cls.withOptions({ timeout: 5000 } as any).instance(), + ).rejects.toThrow("Parameter 'timeout' has been renamed to 'timeoutMs'."); + + await expect( + cls.withOptions({ memory: 512 } as any).instance(), + ).rejects.toThrow("Parameter 'memory' has been renamed to 'memoryMiB'."); + + await expect( + cls.withOptions({ memoryLimit: 1024 } as any).instance(), + ).rejects.toThrow( + "Parameter 'memoryLimit' has been renamed to 'memoryLimitMiB'.", + ); +}); From de5a94531ea558c6d2eb2d7c8f25a5713bc9a5b7 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Tue, 28 Oct 2025 16:23:01 +0100 Subject: [PATCH 26/59] Minor copy updates (#191) - Use "SDK" rather than "client". - Remove language about alpha status - semver indicates maturity going forward. - Update docs link. --- modal-go/doc.go | 15 +++++---------- modal-js/package.json | 4 ++-- test-support/README.md | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/modal-go/doc.go b/modal-go/doc.go index 64f8c9e5..8a630d85 100644 --- a/modal-go/doc.go +++ b/modal-go/doc.go @@ -1,7 +1,7 @@ -// Package modal is a lightweight, idiomatic Go client for Modal.com. +// Package modal is a lightweight, idiomatic Go SDK for Modal.com. // -// The library mirrors the core feature-set of Modal’s Python client while -// feeling natural in Go: +// It mirrors the core feature-set of Modal’s Python SDK while feeling +// natural in Go: // // - Spin up Sandboxes — fast, secure, ephemeral VMs for running code. // - Invoke Modal Functions and manage their inputs / outputs. @@ -14,7 +14,7 @@ // // # Authentication // -// At runtime the client resolves credentials in this order: +// At runtime the SDK resolves credentials in this order: // // 1. Environment variables // MODAL_TOKEN_ID, MODAL_TOKEN_SECRET, MODAL_ENVIRONMENT (optional) @@ -23,11 +23,6 @@ // // See `config.go` for the resolution logic. // -// # Stability -// -// `libmodal` is **alpha** software; the API may change without notice until -// a v1.0.0 release. Please pin versions and file issues generously. -// // For additional examples and language-parity tests, see -// https://github.com/modal-labs/libmodal. +// https://github.com/modal-labs/libmodal/tree/main/modal-go. package modal diff --git a/modal-js/package.json b/modal-js/package.json index cf7268d7..9bb8257d 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,9 +1,9 @@ { "name": "modal", "version": "0.5.0-dev.7", - "description": "Modal client library for JavaScript", + "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", - "homepage": "https://modal.com/docs", + "homepage": "https://modal.com/docs/guide/sdk-javascript-go", "repository": { "type": "git", "url": "git+https://github.com/modal-labs/libmodal.git" diff --git a/test-support/README.md b/test-support/README.md index bb7f7198..4b814faa 100644 --- a/test-support/README.md +++ b/test-support/README.md @@ -2,7 +2,7 @@ Sign in to Modal, which you'll use for running the test programs. -Then deploy the apps and secrets in this folder using the Python client. This +Then deploy the apps and secrets in this folder using the Python SDK. This requires being signed in to AWS (Modal Labs account): ```bash From 767107b42bd69500ad663f024c3e9866198d53fd Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 17:13:09 +0100 Subject: [PATCH 27/59] [RELEASE] Prepare release for modal-js/v0.5.0, modal-go/v0.5.0 (#192) Co-authored-by: ehdr --- CHANGELOG.md | 4 ++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4b8617d..f3350586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.0, modal-go/v0.5.0 + The first beta release of the Modal SDKs for JS and Go (graduating from alpha). See the [Migration Guide](./MIGRATION-GUIDE.md) for a detailed list of breaking changes. - The SDKs now expose a central Modal Client object as the main entry point for interacting with Modal resources. diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 12f1914e..08e7f2b3 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0-dev.7", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0-dev.7", + "version": "0.5.0", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 9bb8257d..6bf5ab52 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0-dev.7", + "version": "0.5.0", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From eb234798905e84a82329619bf66831b9a7373825 Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Tue, 28 Oct 2025 17:47:07 -0400 Subject: [PATCH 28/59] Use full link in readme (#193) --- modal-js/README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/modal-js/README.md b/modal-js/README.md index a549a164..83424078 100644 --- a/modal-js/README.md +++ b/modal-js/README.md @@ -31,25 +31,25 @@ See the main [Modal documentation](https://modal.com/docs/guide) and [user guide We also provide a number of examples: -- [Call a deployed Function](./examples/function-call.ts) -- [Spawn a deployed Function](./examples/function-spawn.ts) -- [Call a deployed Cls](./examples/cls-call.ts) -- [Call a deployed Cls, and override its options](./examples/cls-call-with-options.ts) -- [Create a Sandbox](./examples/sandbox.ts) -- [Create a named Sandbox](./examples/sandbox-named.ts) -- [Create a Sandbox with GPU](./examples/sandbox-gpu.ts) -- [Create a Sandbox using a private image from AWS ECR](./examples/sandbox-private-image.ts) -- [Take a snapshot of the filesystem of a Sandbox](./examples/sandbox-filesystem-snapshot.ts) -- [Execute Sandbox commands](./examples/sandbox-exec.ts) -- [Running a coding agent in a Sandbox](./examples/sandbox-agent.ts) -- [Check the status and exit code of a Sandbox](./examples/sandbox-poll.ts) -- [Access Sandbox filesystem](./examples/sandbox-filesystem.ts) -- [Expose ports on a Sandbox using Tunnels](./examples/sandbox-tunnels.ts) -- [Include Secrets in Sandbox](./examples/sandbox-secrets.ts) -- [Mount a Volume to a Sandbox](./examples/sandbox-volume.ts), and same but [with an ephemeral Volume](./examples/sandbox-volume-ephemeral.ts) -- [Mount a cloud bucket to a Sandbox](./examples/sandbox-cloud-bucket.ts) -- [Eagerly build an Image for a Sandbox](./examples/sandbox-prewarm.ts) -- [Building custom Images](./examples/image-building.ts) +- [Call a deployed Function](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/function-call.ts) +- [Spawn a deployed Function](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/function-spawn.ts) +- [Call a deployed Cls](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/cls-call.ts) +- [Call a deployed Cls, and override its options](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/cls-call-with-options.ts) +- [Create a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox.ts) +- [Create a named Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-named.ts) +- [Create a Sandbox with GPU](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-gpu.ts) +- [Create a Sandbox using a private image from AWS ECR](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-private-image.ts) +- [Take a snapshot of the filesystem of a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-filesystem-snapshot.ts) +- [Execute Sandbox commands](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-exec.ts) +- [Running a coding agent in a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-agent.ts) +- [Check the status and exit code of a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-poll.ts) +- [Access Sandbox filesystem](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-filesystem.ts) +- [Expose ports on a Sandbox using Tunnels](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-tunnels.ts) +- [Include Secrets in Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-secrets.ts) +- [Mount a Volume to a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-volume.ts), and same but [with an ephemeral Volume](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-volume-ephemeral.ts) +- [Mount a cloud bucket to a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-cloud-bucket.ts) +- [Eagerly build an Image for a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-prewarm.ts) +- [Building custom Images](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/image-building.ts) ### Authenticating with Modal From c8072ebf62270ab030817e07dbbbb8e549f3e015 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Wed, 29 Oct 2025 09:38:55 +0100 Subject: [PATCH 29/59] Fix docs links in READMEs (#194) --- modal-go/README.md | 2 +- modal-js/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modal-go/README.md b/modal-go/README.md index c8bf1b60..68ff1bb8 100644 --- a/modal-go/README.md +++ b/modal-go/README.md @@ -40,7 +40,7 @@ Go 1.23 or later. ## Documentation -See the main [Modal documentation](https://modal.com/docs/guide) and [user guides](https://modal.com/docs/guide) for high-level overviews. For details, see the [API reference documentation for for Go](https://pkg.go.dev/github.com/modal-labs/libmodal/modal-go#section-documentation). +See the main [Modal documentation](https://modal.com/docs) and [user guides](https://modal.com/docs/guide) for high-level overviews. For details, see the [API reference documentation for for Go](https://pkg.go.dev/github.com/modal-labs/libmodal/modal-go#section-documentation). We also provide a number of examples: - [Call a deployed Function](./examples/function-call/main.go) diff --git a/modal-js/README.md b/modal-js/README.md index 83424078..d1583857 100644 --- a/modal-js/README.md +++ b/modal-js/README.md @@ -27,7 +27,7 @@ Node 22 or later. We bundle both ES Modules and CommonJS formats, so you can loa ## Documentation -See the main [Modal documentation](https://modal.com/docs/guide) and [user guides](https://modal.com/docs/guide) for high-level overviews. For details, see the [API reference documentation for for JS](https://modal-labs.github.io/libmodal/). +See the main [Modal documentation](https://modal.com/docs) and [user guides](https://modal.com/docs/guide) for high-level overviews. For details, see the [API reference documentation for for JS](https://modal-labs.github.io/libmodal/). We also provide a number of examples: From 4baf6b6d1275a612e394d77704a44bc76f1f596b Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 30 Oct 2025 16:19:01 +0100 Subject: [PATCH 30/59] Ensure we respect Context timeouts in all function calls (#195) * Add test for slow GRPC timeouts * Pass context through to HTTP calls * Check if Context has expired --- CHANGELOG.md | 2 +- modal-go/function.go | 2 +- modal-go/image.go | 8 +++ modal-go/invocation.go | 10 +++- modal-go/queue.go | 13 +++++ modal-go/sandbox.go | 13 +++++ modal-go/test/grpc_test.go | 114 +++++++++++++++++++++++++++++++++++++ 7 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 modal-go/test/grpc_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f3350586..7633a361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased -No unreleased changes. +- All Go SDK functions that take a Context will respect the timeout of the context. ## modal-js/v0.5.0, modal-go/v0.5.0 diff --git a/modal-go/function.go b/modal-go/function.go index 7445890c..2fce58a3 100644 --- a/modal-go/function.go +++ b/modal-go/function.go @@ -371,7 +371,7 @@ func blobUpload(ctx context.Context, client pb.ModalClientClient, data []byte) ( return "", fmt.Errorf("Function input size exceeds multipart upload threshold, unsupported by this SDK version") case pb.BlobCreateResponse_UploadUrl_case: - req, err := http.NewRequest("PUT", resp.GetUploadUrl(), bytes.NewReader(data)) + req, err := http.NewRequestWithContext(ctx, "PUT", resp.GetUploadUrl(), bytes.NewReader(data)) if err != nil { return "", fmt.Errorf("failed to create upload request: %w", err) } diff --git a/modal-go/image.go b/modal-go/image.go index 2489207d..c694526b 100644 --- a/modal-go/image.go +++ b/modal-go/image.go @@ -196,6 +196,10 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { var currentImageID string for i, currentLayer := range image.layers { + if err := ctx.Err(); err != nil { + return nil, err + } + mergedSecrets, err := mergeEnvIntoSecrets(ctx, image.client, ¤tLayer.env, ¤tLayer.secrets) if err != nil { return nil, err @@ -255,6 +259,10 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { // Not built or in the process of building - wait for build lastEntryID := "" for result == nil { + if err := ctx.Err(); err != nil { + return nil, err + } + stream, err := image.client.cpClient.ImageJoinStreaming(ctx, pb.ImageJoinStreamingRequest_builder{ ImageId: resp.GetImageId(), Timeout: 55, diff --git a/modal-go/invocation.go b/modal-go/invocation.go index b47d6ea5..cd40e32d 100644 --- a/modal-go/invocation.go +++ b/modal-go/invocation.go @@ -180,6 +180,10 @@ func pollFunctionOutput(ctx context.Context, client pb.ModalClientClient, getOut } for { + if err := ctx.Err(); err != nil { + return nil, err + } + output, err := getOutput(ctx, pollTimeout) if err != nil { return nil, err @@ -246,7 +250,11 @@ func blobDownload(ctx context.Context, client pb.ModalClientClient, blobID strin if err != nil { return nil, err } - s3resp, err := http.Get(resp.GetDownloadUrl()) + req, err := http.NewRequestWithContext(ctx, "GET", resp.GetDownloadUrl(), nil) + if err != nil { + return nil, fmt.Errorf("failed to create download request: %w", err) + } + s3resp, err := http.DefaultClient.Do(req) if err != nil { return nil, fmt.Errorf("failed to download blob: %w", err) } diff --git a/modal-go/queue.go b/modal-go/queue.go index 81e36d58..cad0dddf 100644 --- a/modal-go/queue.go +++ b/modal-go/queue.go @@ -186,6 +186,10 @@ func (q *Queue) get(ctx context.Context, n int, params *QueueGetParams) ([]any, } for { + if err := ctx.Err(); err != nil { + return nil, err + } + resp, err := q.client.cpClient.QueueGet(ctx, pb.QueueGetRequest_builder{ QueueId: q.QueueID, PartitionKey: partitionKey, @@ -284,6 +288,10 @@ func (q *Queue) put(ctx context.Context, values []any, params *QueuePutParams) e } for { + if err := ctx.Err(); err != nil { + return err + } + _, err := q.client.cpClient.QueuePut(ctx, pb.QueuePutRequest_builder{ QueueId: q.QueueID, Values: valuesEncoded, @@ -400,6 +408,11 @@ func (q *Queue) Iterate(ctx context.Context, params *QueueIterateParams) iter.Se fetchDeadline := time.Now().Add(itemPoll) for { + if err := ctx.Err(); err != nil { + yield(nil, err) + return + } + pollDuration := max(0, min(maxPoll, time.Until(fetchDeadline))) resp, err := q.client.cpClient.QueueNextItems(ctx, pb.QueueNextItemsRequest_builder{ QueueId: q.QueueID, diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 94010de8..06e9c4ea 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -537,6 +537,10 @@ func (sb *Sandbox) Terminate(ctx context.Context) error { // Wait blocks until the Sandbox exits. func (sb *Sandbox) Wait(ctx context.Context) (int, error) { for { + if err := ctx.Err(); err != nil { + return 0, err + } + resp, err := sb.client.cpClient.SandboxWait(ctx, pb.SandboxWaitRequest_builder{ SandboxId: sb.SandboxID, Timeout: 10, @@ -677,6 +681,11 @@ func (s *sandboxServiceImpl) List(ctx context.Context, params *SandboxListParams return func(yield func(*Sandbox, error) bool) { var before float64 for { + if err := ctx.Err(); err != nil { + yield(nil, err) + return + } + resp, err := s.client.cpClient.SandboxList(ctx, pb.SandboxListRequest_builder{ AppId: params.AppID, BeforeTimestamp: before, @@ -764,6 +773,10 @@ func newContainerProcess(cpClient pb.ModalClientClient, execID string, params Sa // Wait blocks until the container process exits and returns its exit code. func (cp *ContainerProcess) Wait(ctx context.Context) (int, error) { for { + if err := ctx.Err(); err != nil { + return 0, err + } + resp, err := cp.cpClient.ContainerExecWait(ctx, pb.ContainerExecWaitRequest_builder{ ExecId: cp.execID, Timeout: 55, diff --git a/modal-go/test/grpc_test.go b/modal-go/test/grpc_test.go new file mode 100644 index 00000000..15c65001 --- /dev/null +++ b/modal-go/test/grpc_test.go @@ -0,0 +1,114 @@ +package test + +import ( + "context" + "net" + "testing" + "time" + + "github.com/modal-labs/libmodal/modal-go" + pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" + "github.com/onsi/gomega" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "google.golang.org/grpc/test/bufconn" +) + +type slowModalServer struct { + pb.UnimplementedModalClientServer + sleepDuration time.Duration +} + +// AppGetOrCreate is just chosen arbitrarily as a GRPC method to use for testing. +func (s *slowModalServer) AppGetOrCreate(ctx context.Context, req *pb.AppGetOrCreateRequest) (*pb.AppGetOrCreateResponse, error) { + select { + case <-time.After(s.sleepDuration): + return pb.AppGetOrCreateResponse_builder{AppId: req.GetAppName()}.Build(), nil + case <-ctx.Done(): + return nil, ctx.Err() + } +} + +func (s *slowModalServer) AuthTokenGet(ctx context.Context, req *pb.AuthTokenGetRequest) (*pb.AuthTokenGetResponse, error) { + return pb.AuthTokenGetResponse_builder{Token: "test-token"}.Build(), nil +} + +func TestAppFromName_RespectsContextDeadline(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + serverSleep time.Duration + contextTimeout time.Duration + expectTimeout bool + }{ + { + name: "deadline exceeded", + serverSleep: 100 * time.Millisecond, + contextTimeout: 10 * time.Millisecond, + expectTimeout: true, + }, + { + name: "completes before deadline", + serverSleep: 10 * time.Millisecond, + contextTimeout: 100 * time.Millisecond, + expectTimeout: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + g := gomega.NewWithT(t) + + lis := bufconn.Listen(1024 * 1024) + + grpcServer := grpc.NewServer() + pb.RegisterModalClientServer(grpcServer, &slowModalServer{ + sleepDuration: tc.serverSleep, + }) + + go func() { + if err := grpcServer.Serve(lis); err != nil { + t.Logf("Server error: %v", err) + } + }() + defer grpcServer.Stop() + + bufDialer := func(context.Context, string) (net.Conn, error) { + return lis.Dial() + } + + conn, err := grpc.NewClient("passthrough:///bufnet", + grpc.WithContextDialer(bufDialer), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer conn.Close() + + client, err := modal.NewClientWithOptions(&modal.ClientParams{ + TokenID: "test-token-id", + TokenSecret: "test-token-secret", + Environment: "test", + ControlPlaneClient: pb.NewModalClientClient(conn), + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + ctxWithTimeout, cancel := context.WithTimeout(context.Background(), tc.contextTimeout) + defer cancel() + + app, err := client.Apps.FromName(ctxWithTimeout, "test-app", nil) + + if tc.expectTimeout { + g.Expect(err).Should(gomega.HaveOccurred()) + st, ok := status.FromError(err) + g.Expect(ok).To(gomega.BeTrue()) + g.Expect(st.Code()).To(gomega.Equal(codes.DeadlineExceeded)) + } else { + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(app.AppID).To(gomega.Equal("test-app")) + } + }) + } +} From fa37303d354550bcd1addb05bc87fce7f3c1d9e8 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 3 Nov 2025 10:25:27 +0100 Subject: [PATCH 31/59] Simplify the `Image.delete()` implementations (#198) They made an unneccessary GRPC call. --- modal-go/image.go | 8 +++----- modal-js/src/image.ts | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modal-go/image.go b/modal-go/image.go index c694526b..ab5044cd 100644 --- a/modal-go/image.go +++ b/modal-go/image.go @@ -318,11 +318,9 @@ type ImageDeleteParams struct { // Delete deletes an Image by ID. Warning: This removes an *entire Image*, and cannot be undone. func (s *imageServiceImpl) Delete(ctx context.Context, imageID string, params *ImageDeleteParams) error { - image, err := s.FromID(ctx, imageID) - if err != nil { - return err + _, err := s.client.cpClient.ImageDelete(ctx, pb.ImageDeleteRequest_builder{ImageId: imageID}.Build()) + if status, ok := status.FromError(err); ok && status.Code() == codes.NotFound { + return NotFoundError{fmt.Sprintf("Image '%s' not found", imageID)} } - - _, err = s.client.cpClient.ImageDelete(ctx, pb.ImageDeleteRequest_builder{ImageId: image.ImageID}.Build()) return err } diff --git a/modal-js/src/image.ts b/modal-js/src/image.ts index 90f39195..5e04a96b 100644 --- a/modal-js/src/image.ts +++ b/modal-js/src/image.ts @@ -120,8 +120,19 @@ export class ImageService { * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. */ async delete(imageId: string, _: ImageDeleteParams = {}): Promise { - const image = await this.fromId(imageId); - await this.#client.cpClient.imageDelete({ imageId: image.imageId }); + try { + await this.#client.cpClient.imageDelete({ imageId }); + } catch (err) { + if (err instanceof ClientError && err.code === Status.NOT_FOUND) + throw new NotFoundError(err.details); + if ( + err instanceof ClientError && + err.code === Status.FAILED_PRECONDITION && + err.details.includes("Could not find image with ID") + ) + throw new NotFoundError(err.details); + throw err; + } } } From 30932d4825b24999f3ceece235c1c8ce3d8ab5aa Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 3 Nov 2025 10:45:07 +0100 Subject: [PATCH 32/59] Add support for debug logging by setting `MODAL_LOGLEVEL=debug` (#196) Co-authored-by: Thomas J. Fan --- modal-go/app.go | 1 + modal-go/auth_token_manager.go | 15 +- modal-go/client.go | 53 ++++- modal-go/client_test.go | 33 +++ modal-go/config.go | 4 + modal-go/doc.go | 12 ++ modal-go/function.go | 13 ++ modal-go/image.go | 3 + modal-go/logger.go | 38 ++++ modal-go/logger_test.go | 40 ++++ modal-go/queue.go | 4 + modal-go/sandbox.go | 9 + modal-go/secret.go | 3 + modal-go/test/auth_token_manager_test.go | 13 +- modal-go/volume.go | 3 + modal-js/src/app.ts | 7 + modal-js/src/auth_token_manager.ts | 21 +- modal-js/src/client.ts | 200 ++++++++++++------ modal-js/src/cls.ts | 9 + modal-js/src/config.ts | 3 + modal-js/src/function.ts | 41 +++- modal-js/src/image.ts | 3 + modal-js/src/index.ts | 1 + modal-js/src/logger.test.ts | 82 +++++++ modal-js/src/logger.ts | 147 +++++++++++++ modal-js/src/queue.ts | 13 ++ modal-js/src/sandbox.ts | 26 ++- modal-js/src/secret.ts | 12 ++ modal-js/src/volume.ts | 13 ++ modal-js/test/auth_token_manager.test.ts | 3 +- .../test/legacy/auth_token_manager.test.ts | 3 +- 31 files changed, 737 insertions(+), 91 deletions(-) create mode 100644 modal-go/client_test.go create mode 100644 modal-go/logger.go create mode 100644 modal-go/logger_test.go create mode 100644 modal-js/src/logger.test.ts create mode 100644 modal-js/src/logger.ts diff --git a/modal-go/app.go b/modal-go/app.go index 1c6c6487..bc49f001 100644 --- a/modal-go/app.go +++ b/modal-go/app.go @@ -82,5 +82,6 @@ func (s *appServiceImpl) FromName(ctx context.Context, name string, params *AppF return nil, err } + s.client.logger.Debug("Retrieved App", "app_id", resp.GetAppId(), "app_name", name) return &App{AppID: resp.GetAppId(), Name: name}, nil } diff --git a/modal-go/auth_token_manager.go b/modal-go/auth_token_manager.go index 66cb54f7..6d8cd663 100644 --- a/modal-go/auth_token_manager.go +++ b/modal-go/auth_token_manager.go @@ -5,7 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "log" + "log/slog" "strings" "sync/atomic" "time" @@ -28,14 +28,16 @@ type TokenAndExpiry struct { // AuthTokenManager manages authentication tokens using a goroutine, and refreshes the token REFRESH_WINDOW seconds before it expires. type AuthTokenManager struct { client pb.ModalClientClient + logger *slog.Logger cancelFn context.CancelFunc tokenAndExpiry atomic.Value } -func NewAuthTokenManager(client pb.ModalClientClient) *AuthTokenManager { +func NewAuthTokenManager(client pb.ModalClientClient, logger *slog.Logger) *AuthTokenManager { manager := &AuthTokenManager{ client: client, + logger: logger, } manager.tokenAndExpiry.Store(TokenAndExpiry{ @@ -106,7 +108,7 @@ func (m *AuthTokenManager) backgroundRefresh(ctx context.Context) { // Refresh the token if _, err := m.FetchToken(ctx); err != nil { - log.Printf("Failed to refresh auth token: %v", err) + m.logger.Error("Failed to refresh auth token", "error", err) // Sleep for 5 seconds before trying again on failure select { case <-ctx.Done(): @@ -133,7 +135,7 @@ func (m *AuthTokenManager) FetchToken(ctx context.Context) (string, error) { if exp := m.decodeJWT(token); exp > 0 { expiry = exp } else { - log.Printf("x-modal-auth-token does not contain exp field") + m.logger.Warn("x-modal-auth-token does not contain exp field") // We'll use the token, and set the expiry to 20 min from now. expiry = time.Now().Unix() + DefaultExpiryOffset } @@ -143,6 +145,11 @@ func (m *AuthTokenManager) FetchToken(ctx context.Context) (string, error) { expiry: expiry, }) + timeUntilRefresh := time.Duration(expiry-time.Now().Unix()-RefreshWindow) * time.Second + m.logger.DebugContext(ctx, "Fetched auth token", + "expires_in", time.Until(time.Unix(expiry, 0)), + "refresh_in", timeUntilRefresh) + return token, nil } diff --git a/modal-go/client.go b/modal-go/client.go index d83e227c..b6738852 100644 --- a/modal-go/client.go +++ b/modal-go/client.go @@ -6,6 +6,7 @@ import ( "context" "crypto/tls" "fmt" + "log/slog" "os" "runtime/debug" "strconv" @@ -55,6 +56,7 @@ type Client struct { config config profile Profile sdkVersion string + logger *slog.Logger cpClient pb.ModalClientClient // control plane client ipClients map[string]pb.ModalClientClient // input plane clients authTokenManager *AuthTokenManager @@ -72,6 +74,7 @@ type ClientParams struct { TokenSecret string Environment string Config *config + Logger *slog.Logger ControlPlaneClient pb.ModalClientClient } @@ -104,14 +107,28 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { profile.Environment = params.Environment } + var logger *slog.Logger + var err error + + if params.Logger != nil { + logger = params.Logger + } else { + logger, err = newLogger(profile) + if err != nil { + return nil, fmt.Errorf("failed to initialize logger: %w", err) + } + } + c := &Client{ config: cfg, profile: profile, sdkVersion: sdkVersion(), + logger: logger, ipClients: make(map[string]pb.ModalClientClient), } - var err error + logger.Debug("Initializing Modal client", "version", sdkVersion(), "server_url", profile.ServerURL) + if params.ControlPlaneClient != nil { c.cpClient = params.ControlPlaneClient } else { @@ -121,11 +138,13 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { return nil, fmt.Errorf("failed to create control plane client: %w", err) } - c.authTokenManager = NewAuthTokenManager(c.cpClient) + c.authTokenManager = NewAuthTokenManager(c.cpClient, c.logger) if err := c.authTokenManager.Start(context.Background()); err != nil { return nil, fmt.Errorf("failed to start auth token manager: %w", err) } + logger.Debug("Modal client initialized successfully") + c.Apps = &appServiceImpl{client: c} c.CloudBucketMounts = &cloudBucketMountServiceImpl{client: c} c.Cls = &clsServiceImpl{client: c} @@ -158,6 +177,7 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { return client, nil } + c.logger.Debug("Creating input plane client", "server_url", serverURL) prof := c.profile prof.ServerURL = serverURL _, client, err := newClient(prof, c) @@ -170,7 +190,9 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { // Close stops the background auth token refresh. func (c *Client) Close() { + c.logger.Debug("Closing Modal client") c.authTokenManager.Stop() + c.logger.Debug("Modal client closed") } // Version returns the SDK version. @@ -225,16 +247,21 @@ func isRetryableGrpc(err error) bool { func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClient, error) { var target string var creds credentials.TransportCredentials + var scheme string if after, ok := strings.CutPrefix(profile.ServerURL, "https://"); ok { target = after creds = credentials.NewTLS(&tls.Config{}) + scheme = "https" } else if after, ok := strings.CutPrefix(profile.ServerURL, "http://"); ok { target = after creds = insecure.NewCredentials() + scheme = "http" } else { return nil, nil, status.Errorf(codes.InvalidArgument, "invalid server URL: %s", profile.ServerURL) } + c.logger.Debug("Connecting to Modal server", "target", target, "scheme", scheme) + conn, err := grpc.NewClient( target, grpc.WithTransportCredentials(creds), @@ -245,7 +272,7 @@ func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClie grpc.WithChainUnaryInterceptor( headerInjectorUnaryInterceptor(profile, c.sdkVersion), authTokenInterceptor(c), - retryInterceptor(), + retryInterceptor(c), timeoutInterceptor(), ), grpc.WithChainStreamInterceptor( @@ -362,7 +389,7 @@ func timeoutInterceptor() grpc.UnaryClientInterceptor { } } -func retryInterceptor() grpc.UnaryClientInterceptor { +func retryInterceptor(c *Client) grpc.UnaryClientInterceptor { return func( ctx context.Context, method string, @@ -371,6 +398,7 @@ func retryInterceptor() grpc.UnaryClientInterceptor { inv grpc.UnaryInvoker, opts ...grpc.CallOption, ) error { + c.logger.DebugContext(ctx, "Sending gRPC request", "method", method) // start with package defaults retries := defaultRetryAttempts baseDelay := defaultRetryBaseDelay @@ -425,12 +453,29 @@ func retryInterceptor() grpc.UnaryClientInterceptor { if st, ok := status.FromError(err); ok { // gRPC error if _, ok := retryable[st.Code()]; !ok || attempt == retries { + if attempt == retries && attempt > 0 { + c.logger.DebugContext(ctx, "Final retry attempt failed", + "error", err, + "retries", attempt, + "delay", delay, + "method", method, + "idempotency_key", idempotency[:8]) + } return err } } else { // Unexpected, non-gRPC error return err } + if attempt > 0 { + c.logger.DebugContext(ctx, "Retryable failure", + "error", err, + "retries", attempt, + "delay", delay, + "method", method, + "idempotency_key", idempotency[:8]) + } + if sleepCtx(ctx, delay) != nil { return err // ctx cancelled or deadline exceeded } diff --git a/modal-go/client_test.go b/modal-go/client_test.go new file mode 100644 index 00000000..d3dd8d3e --- /dev/null +++ b/modal-go/client_test.go @@ -0,0 +1,33 @@ +package modal + +import ( + "io" + "log/slog" + "os" + "testing" + + "github.com/onsi/gomega" +) + +func TestClientWithLogger(t *testing.T) { + g := gomega.NewWithT(t) + + // Use a buffer to capture log output + r, w, err := os.Pipe() + g.Expect(err).To(gomega.BeNil()) + + logger := slog.New(slog.NewTextHandler(w, &slog.HandlerOptions{Level: slog.LevelDebug})) + g.Expect(logger).NotTo(gomega.BeNil()) + + client, err := NewClientWithOptions(&ClientParams{Logger: logger}) + g.Expect(err).To(gomega.BeNil()) + g.Expect(client).NotTo(gomega.BeNil()) + + w.Close() + + output, err := io.ReadAll(r) + g.Expect(err).To(gomega.BeNil()) + + g.Expect(output).To(gomega.ContainSubstring("Initializing Modal client")) + g.Expect(output).To(gomega.ContainSubstring("Modal client initialized successfully")) +} diff --git a/modal-go/config.go b/modal-go/config.go index d801b0dc..cb56de02 100644 --- a/modal-go/config.go +++ b/modal-go/config.go @@ -19,6 +19,7 @@ type Profile struct { TokenSecret string Environment string ImageBuilderVersion string + LogLevel string } // rawProfile mirrors the TOML structure on disk. @@ -28,6 +29,7 @@ type rawProfile struct { TokenSecret string `toml:"token_secret"` Environment string `toml:"environment"` ImageBuilderVersion string `toml:"image_builder_version"` + LogLevel string `toml:"loglevel"` Active bool `toml:"active"` } @@ -80,6 +82,7 @@ func getProfile(name string, cfg config) Profile { tokenSecret := firstNonEmpty(os.Getenv("MODAL_TOKEN_SECRET"), raw.TokenSecret) environment := firstNonEmpty(os.Getenv("MODAL_ENVIRONMENT"), raw.Environment) imageBuilderVersion := firstNonEmpty(os.Getenv("MODAL_IMAGE_BUILDER_VERSION"), raw.ImageBuilderVersion) + logLevel := firstNonEmpty(os.Getenv("MODAL_LOGLEVEL"), raw.LogLevel) return Profile{ ServerURL: serverURL, @@ -87,6 +90,7 @@ func getProfile(name string, cfg config) Profile { TokenSecret: tokenSecret, Environment: environment, ImageBuilderVersion: imageBuilderVersion, + LogLevel: logLevel, } } diff --git a/modal-go/doc.go b/modal-go/doc.go index 8a630d85..a140913e 100644 --- a/modal-go/doc.go +++ b/modal-go/doc.go @@ -23,6 +23,18 @@ // // See `config.go` for the resolution logic. // +// # Logging +// +// The SDK logging level can be controlled in multiple ways (in order of precedence): +// +// 1. `MODAL_LOGLEVEL` environment variable +// 2. `loglevel` field in the active profile in `~/.modal.toml` +// 3. Defaults to WARN +// +// Supported values are DEBUG, INFO, WARN, and ERROR (case-insensitive). +// +// Logs are written to stderr. +// // For additional examples and language-parity tests, see // https://github.com/modal-labs/libmodal/tree/main/modal-go. package modal diff --git a/modal-go/function.go b/modal-go/function.go index 2fce58a3..20376774 100644 --- a/modal-go/function.go +++ b/modal-go/function.go @@ -96,6 +96,10 @@ func (s *functionServiceImpl) FromName(ctx context.Context, appName string, name } handleMetadata := resp.GetHandleMetadata() + s.client.logger.DebugContext(ctx, "Retrieved Function", + "function_id", resp.GetFunctionId(), + "app_name", appName, + "function_name", name) return &Function{FunctionID: resp.GetFunctionId(), handleMetadata: handleMetadata, client: s.client}, nil } @@ -247,6 +251,7 @@ func (f *Function) getWebURL() string { // Remote executes a single input on a remote Function. func (f *Function) Remote(ctx context.Context, args []any, kwargs map[string]any) (any, error) { + f.client.logger.DebugContext(ctx, "Executing function call", "function_id", f.FunctionID) input, err := f.createInput(ctx, args, kwargs) if err != nil { return nil, err @@ -260,9 +265,13 @@ func (f *Function) Remote(ctx context.Context, args []any, kwargs map[string]any for { output, err := invocation.awaitOutput(ctx, nil) if err == nil { + f.client.logger.DebugContext(ctx, "Function call completed", "function_id", f.FunctionID) return output, nil } if errors.As(err, &InternalFailure{}) && retryCount <= maxSystemRetries { + f.client.logger.DebugContext(ctx, "Retrying function call due to internal failure", + "function_id", f.FunctionID, + "retry_count", retryCount) if retryErr := invocation.retry(ctx, retryCount); retryErr != nil { return nil, retryErr } @@ -292,6 +301,7 @@ func (f *Function) createRemoteInvocation(ctx context.Context, input *pb.Functio // Spawn starts running a single input on a remote Function. func (f *Function) Spawn(ctx context.Context, args []any, kwargs map[string]any) (*FunctionCall, error) { + f.client.logger.DebugContext(ctx, "Spawning function call", "function_id", f.FunctionID) input, err := f.createInput(ctx, args, kwargs) if err != nil { return nil, err @@ -304,6 +314,9 @@ func (f *Function) Spawn(ctx context.Context, args []any, kwargs map[string]any) FunctionCallID: invocation.FunctionCallID, client: f.client, } + f.client.logger.DebugContext(ctx, "Function call spawned", + "function_id", f.FunctionID, + "function_call_id", invocation.FunctionCallID) return &functionCall, nil } diff --git a/modal-go/image.go b/modal-go/image.go index ab5044cd..8d74829d 100644 --- a/modal-go/image.go +++ b/modal-go/image.go @@ -187,6 +187,8 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { return image, nil } + image.client.logger.DebugContext(ctx, "Building image", "app_id", app.AppID) + for _, currentLayer := range image.layers { if err := validateDockerfileCommands(currentLayer.commands); err != nil { return nil, err @@ -309,6 +311,7 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { } image.ImageID = currentImageID + image.client.logger.DebugContext(ctx, "Image build completed", "image_id", currentImageID) return image, nil } diff --git a/modal-go/logger.go b/modal-go/logger.go new file mode 100644 index 00000000..91ea2a50 --- /dev/null +++ b/modal-go/logger.go @@ -0,0 +1,38 @@ +package modal + +import ( + "fmt" + "log/slog" + "os" + "strings" +) + +func parseLogLevel(level string) (slog.Level, error) { + if level == "" { + return slog.LevelWarn, nil + } + + switch strings.ToUpper(level) { + case "DEBUG": + return slog.LevelDebug, nil + case "INFO": + return slog.LevelInfo, nil + case "WARN", "WARNING": + return slog.LevelWarn, nil + case "ERROR": + return slog.LevelError, nil + default: + return slog.LevelWarn, fmt.Errorf("invalid log level value: %q (must be DEBUG, INFO, WARN, or ERROR)", level) + } +} + +func newLogger(profile Profile) (*slog.Logger, error) { + level, err := parseLogLevel(profile.LogLevel) + if err != nil { + return nil, err + } + handler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{ + Level: level, + }) + return slog.New(handler), nil +} diff --git a/modal-go/logger_test.go b/modal-go/logger_test.go new file mode 100644 index 00000000..90958fe5 --- /dev/null +++ b/modal-go/logger_test.go @@ -0,0 +1,40 @@ +package modal + +import ( + "log/slog" + "testing" + + "github.com/onsi/gomega" +) + +func TestParseLogLevel(t *testing.T) { + g := gomega.NewWithT(t) + + tests := []struct { + input string + expected slog.Level + }{ + {"DEBUG", slog.LevelDebug}, + {"INFO", slog.LevelInfo}, + {"WARN", slog.LevelWarn}, + {"WARNING", slog.LevelWarn}, + {"ERROR", slog.LevelError}, + {"eRrOr", slog.LevelError}, + {"", slog.LevelWarn}, + } + + for _, tt := range tests { + level, err := parseLogLevel(tt.input) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(level).Should(gomega.Equal(tt.expected)) + } +} + +func TestParseLogLevel_InvalidValue(t *testing.T) { + g := gomega.NewWithT(t) + + level, err := parseLogLevel("invalid") + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err.Error()).Should(gomega.ContainSubstring("invalid log level")) + g.Expect(level).Should(gomega.Equal(slog.LevelWarn)) +} diff --git a/modal-go/queue.go b/modal-go/queue.go index cad0dddf..6883ce56 100644 --- a/modal-go/queue.go +++ b/modal-go/queue.go @@ -64,6 +64,8 @@ func (s *queueServiceImpl) Ephemeral(ctx context.Context, params *QueueEphemeral return nil, err } + s.client.logger.DebugContext(ctx, "Created ephemeral Queue", "queue_id", resp.GetQueueId()) + ephemeralCtx, cancel := context.WithCancel(context.Background()) startEphemeralHeartbeat(ephemeralCtx, func() error { _, err := s.client.cpClient.QueueHeartbeat(ephemeralCtx, pb.QueueHeartbeatRequest_builder{ @@ -117,6 +119,8 @@ func (s *queueServiceImpl) FromName(ctx context.Context, name string, params *Qu if err != nil { return nil, err } + + s.client.logger.DebugContext(ctx, "Retrieved Queue", "queue_id", resp.GetQueueId(), "queue_name", name) return &Queue{ QueueID: resp.GetQueueId(), Name: name, diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 06e9c4ea..5deabf81 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -279,6 +279,7 @@ func (s *sandboxServiceImpl) Create(ctx context.Context, app *App, image *Image, return nil, err } + s.client.logger.DebugContext(ctx, "Created Sandbox", "sandbox_id", createResp.GetSandboxId()) return newSandbox(s.client, createResp.GetSandboxId()), nil } @@ -473,6 +474,10 @@ func (sb *Sandbox) Exec(ctx context.Context, command []string, params *SandboxEx if err != nil { return nil, err } + sb.client.logger.DebugContext(ctx, "Created ContainerProcess", + "exec_id", resp.GetExecId(), + "sandbox_id", sb.SandboxID, + "command", command) return newContainerProcess(sb.client.cpClient, resp.GetExecId(), *params), nil } @@ -550,6 +555,10 @@ func (sb *Sandbox) Wait(ctx context.Context) (int, error) { } if resp.GetResult() != nil { returnCode := getReturnCode(resp.GetResult()) + sb.client.logger.DebugContext(ctx, "Sandbox wait completed", + "sandbox_id", sb.SandboxID, + "status", resp.GetResult().GetStatus().String(), + "return_code", returnCode) if returnCode != nil { return *returnCode, nil } diff --git a/modal-go/secret.go b/modal-go/secret.go index 696cb2c0..3079c93c 100644 --- a/modal-go/secret.go +++ b/modal-go/secret.go @@ -42,6 +42,7 @@ func (s *secretServiceImpl) FromName(ctx context.Context, name string, params *S return nil, err } + s.client.logger.DebugContext(ctx, "Retrieved Secret", "secret_id", resp.GetSecretId(), "secret_name", name) return &Secret{SecretID: resp.GetSecretId(), Name: name}, nil } @@ -64,6 +65,8 @@ func (s *secretServiceImpl) FromMap(ctx context.Context, keyValuePairs map[strin if err != nil { return nil, err } + + s.client.logger.DebugContext(ctx, "Created ephemeral Secret", "secret_id", resp.GetSecretId()) return &Secret{SecretID: resp.GetSecretId()}, nil } diff --git a/modal-go/test/auth_token_manager_test.go b/modal-go/test/auth_token_manager_test.go index c3871324..59d8d63f 100644 --- a/modal-go/test/auth_token_manager_test.go +++ b/modal-go/test/auth_token_manager_test.go @@ -2,6 +2,7 @@ package test import ( "context" + "log/slog" "testing" "time" @@ -46,7 +47,7 @@ func TestAuthTokenManager_DecodeJWT(t *testing.T) { g := gomega.NewWithT(t) mockClient := newMockAuthClient() - manager := modal.NewAuthTokenManager(mockClient) + manager := modal.NewAuthTokenManager(mockClient, slog.Default()) validToken := createTestJWT(123456789) mockClient.setAuthToken(validToken) @@ -66,7 +67,7 @@ func TestAuthTokenManager_InitialFetch(t *testing.T) { token := createTestJWT(time.Now().Unix() + 3600) mockClient.setAuthToken(token) - manager := modal.NewAuthTokenManager(mockClient) + manager := modal.NewAuthTokenManager(mockClient, slog.Default()) err := manager.Start(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred()) defer manager.Stop() @@ -83,7 +84,7 @@ func TestAuthTokenManager_InitialFetch(t *testing.T) { func TestAuthTokenManager_IsExpired(t *testing.T) { g := gomega.NewWithT(t) - manager := modal.NewAuthTokenManager(nil) + manager := modal.NewAuthTokenManager(nil, slog.Default()) // Test not expired manager.SetToken("token", time.Now().Unix()+3600) @@ -104,7 +105,7 @@ func TestAuthTokenManager_RefreshExpiredToken(t *testing.T) { expiringToken := createTestJWT(now - 60) freshToken := createTestJWT(now + 3600) - manager := modal.NewAuthTokenManager(mockClient) + manager := modal.NewAuthTokenManager(mockClient, slog.Default()) manager.SetToken(expiringToken, now-60) mockClient.setAuthToken(freshToken) @@ -128,7 +129,7 @@ func TestAuthTokenManager_RefreshNearExpiryToken(t *testing.T) { expiringToken := createTestJWT(now + 60) freshToken := createTestJWT(now + 3600) - manager := modal.NewAuthTokenManager(mockClient) + manager := modal.NewAuthTokenManager(mockClient, slog.Default()) manager.SetToken(expiringToken, now+60) mockClient.setAuthToken(freshToken) @@ -148,7 +149,7 @@ func TestAuthTokenManager_GetToken_ExpiredToken(t *testing.T) { g := gomega.NewWithT(t) mockClient := newMockAuthClient() - manager := modal.NewAuthTokenManager(mockClient) + manager := modal.NewAuthTokenManager(mockClient, slog.Default()) _, err := manager.GetToken(context.Background()) g.Expect(err).Should(gomega.HaveOccurred()) diff --git a/modal-go/volume.go b/modal-go/volume.go index 68aeeccf..824e866f 100644 --- a/modal-go/volume.go +++ b/modal-go/volume.go @@ -55,6 +55,7 @@ func (s *volumeServiceImpl) FromName(ctx context.Context, name string, params *V return nil, err } + s.client.logger.DebugContext(ctx, "Retrieved Volume", "volume_id", resp.GetVolumeId(), "volume_name", name) return &Volume{VolumeID: resp.GetVolumeId(), Name: name, readOnly: false, cancelEphemeral: nil}, nil } @@ -92,6 +93,8 @@ func (s *volumeServiceImpl) Ephemeral(ctx context.Context, params *VolumeEphemer return nil, err } + s.client.logger.DebugContext(ctx, "Created ephemeral Volume", "volume_id", resp.GetVolumeId()) + ephemeralCtx, cancel := context.WithCancel(context.Background()) startEphemeralHeartbeat(ephemeralCtx, func() error { _, err := s.client.cpClient.VolumeHeartbeat(ephemeralCtx, pb.VolumeHeartbeatRequest_builder{ diff --git a/modal-js/src/app.ts b/modal-js/src/app.ts index b6d4ab30..d947f067 100644 --- a/modal-js/src/app.ts +++ b/modal-js/src/app.ts @@ -34,6 +34,13 @@ export class AppService { ? ObjectCreationType.OBJECT_CREATION_TYPE_CREATE_IF_MISSING : ObjectCreationType.OBJECT_CREATION_TYPE_UNSPECIFIED, }); + this.#client.logger.debug( + "Retrieved App", + "app_id", + resp.appId, + "app_name", + name, + ); return new App(resp.appId, name); } catch (err) { if (err instanceof ClientError && err.code === Status.NOT_FOUND) diff --git a/modal-js/src/auth_token_manager.ts b/modal-js/src/auth_token_manager.ts index 71c87722..563e355a 100644 --- a/modal-js/src/auth_token_manager.ts +++ b/modal-js/src/auth_token_manager.ts @@ -1,18 +1,22 @@ // Start refreshing this many seconds before the token expires +import type { Logger } from "./logger"; + export const REFRESH_WINDOW = 5 * 60; // If the token doesn't have an expiry field, default to current time plus this value (not expected). export const DEFAULT_EXPIRY_OFFSET = 20 * 60; export class AuthTokenManager { private client: any; + private logger: Logger; private currentToken: string = ""; private tokenExpiry: number = 0; private stopped: boolean = false; private timeoutId: NodeJS.Timeout | null = null; private initialTokenPromise: Promise | null = null; - constructor(client: any) { + constructor(client: any, logger: Logger) { this.client = client; + this.logger = logger; } /** @@ -52,10 +56,21 @@ export class AuthTokenManager { if (exp > 0) { this.tokenExpiry = exp; } else { - console.warn("Failed to decode x-modal-auth-token exp field"); + this.logger.warn("x-modal-auth-token does not contain exp field"); // We'll use the token, and set the expiry to DEFAULT_EXPIRY_OFFSET from now. this.tokenExpiry = Math.floor(Date.now() / 1000) + DEFAULT_EXPIRY_OFFSET; } + + const now = Math.floor(Date.now() / 1000); + const expiresIn = this.tokenExpiry - now; + const refreshIn = this.tokenExpiry - now - REFRESH_WINDOW; + this.logger.debug( + "Fetched auth token", + "expires_in", + `${expiresIn}s`, + "refresh_in", + `${refreshIn}s`, + ); } /** @@ -81,7 +96,7 @@ export class AuthTokenManager { try { await this.fetchToken(); } catch (error) { - console.error("Failed to refresh auth token:", error); + this.logger.error("Failed to refresh auth token", "error", error); // Sleep for 5 seconds before trying again on failure await new Promise((resolve) => setTimeout(resolve, 5000)); } diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index 8cce3e6b..dd85ad32 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -26,6 +26,7 @@ import { getProfile, type Profile } from "./config"; import { AuthTokenManager } from "./auth_token_manager"; import { getSDKVersion } from "./version"; import { checkForRenamedParams } from "./validation"; +import { createLogger, type Logger, type LogLevel } from "./logger"; export interface ModalClientParams { tokenId?: string; @@ -34,6 +35,8 @@ export interface ModalClientParams { endpoint?: string; timeoutMs?: number; maxRetries?: number; + logger?: Logger; + logLevel?: LogLevel; /** @ignore */ cpClient?: ModalGrpcClient; } @@ -76,6 +79,7 @@ export class ModalClient { /** @ignore */ readonly cpClient: ModalGrpcClient; readonly profile: Profile; + readonly logger: Logger; private ipClients: Map; private authTokenManager: AuthTokenManager | null = null; @@ -91,9 +95,21 @@ export class ModalClient { ...(params?.environment && { environment: params.environment }), }; + const logLevelValue = params?.logLevel || this.profile.logLevel || ""; + this.logger = createLogger(params?.logger, logLevelValue); + this.logger.debug( + "Initializing Modal client", + "version", + getSDKVersion(), + "server_url", + this.profile.serverUrl, + ); + this.ipClients = new Map(); this.cpClient = params?.cpClient ?? this.createClient(this.profile); + this.logger.debug("Modal client initialized successfully"); + this.apps = new AppService(this); this.cls = new ClsService(this); this.functions = new FunctionService(this); @@ -121,6 +137,7 @@ export class ModalClient { return existing; } + this.logger.debug("Creating input plane client", "server_url", serverUrl); const profile = { ...this.profile, serverUrl }; const newClient = this.createClient(profile); this.ipClients.set(serverUrl, newClient); @@ -128,10 +145,12 @@ export class ModalClient { } close(): void { + this.logger.debug("Closing Modal client"); if (this.authTokenManager) { this.authTokenManager.stop(); this.authTokenManager = null; } + this.logger.debug("Modal client closed"); } version(): string { @@ -148,15 +167,124 @@ export class ModalClient { }); return createClientFactory() .use(this.authMiddleware(profile)) - .use(retryMiddleware) + .use(this.retryMiddleware()) .use(timeoutMiddleware) .create(ModalClientDefinition, channel); } + /** Middleware to retry transient errors and timeouts for unary requests. */ + private retryMiddleware(): ClientMiddleware { + const logger = this.logger; + return async function* retryMiddleware( + call: ClientMiddlewareCall, + options: CallOptions & RetryOptions, + ) { + const { + retries = 3, + baseDelay = 100, + maxDelay = 1000, + delayFactor = 2, + additionalStatusCodes = [], + signal, + ...restOptions + } = options; + + if (call.requestStream || call.responseStream || !retries) { + // Don't retry streaming calls, or if retries are disabled. + return yield* call.next(call.request, restOptions); + } + + const retryableCodes = new Set([ + ...retryableGrpcStatusCodes, + ...additionalStatusCodes, + ]); + + // One idempotency key for the whole call (all attempts). + const idempotencyKey = uuidv4(); + + const startTime = Date.now(); + let attempt = 0; + let delayMs = baseDelay; + + logger.debug("Sending gRPC request", "method", call.method.path); + + while (true) { + // Clone/augment metadata for this attempt. + const metadata = new Metadata(restOptions.metadata ?? {}); + + metadata.set("x-idempotency-key", idempotencyKey); + metadata.set("x-retry-attempt", String(attempt)); + if (attempt > 0) { + metadata.set( + "x-retry-delay", + ((Date.now() - startTime) / 1000).toFixed(3), + ); + } + + try { + // Forward the call. + return yield* call.next(call.request, { + ...restOptions, + metadata, + signal, + }); + } catch (err) { + // Immediately propagate non-retryable situations. + if ( + !(err instanceof ClientError) || + !retryableCodes.has(err.code) || + attempt >= retries + ) { + if (attempt === retries && attempt > 0) { + logger.debug( + "Final retry attempt failed", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8), + ); + } + throw err; + } + + if (attempt > 0) { + logger.debug( + "Retryable failure", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8), + ); + } + + // Exponential back-off with a hard cap. + await sleep(delayMs, signal); + delayMs = Math.min(delayMs * delayFactor, maxDelay); + attempt += 1; + } + } + }; + } + private authMiddleware(profile: Profile): ClientMiddleware { const getOrCreateAuthTokenManager = () => { if (!this.authTokenManager) { - this.authTokenManager = new AuthTokenManager(this.cpClient); + this.authTokenManager = new AuthTokenManager( + this.cpClient, + this.logger, + ); this.authTokenManager.start(); } return this.authTokenManager; @@ -292,74 +420,6 @@ type RetryOptions = { additionalStatusCodes?: Status[]; }; -/** Middleware to retry transient errors and timeouts for unary requests. */ -const retryMiddleware: ClientMiddleware = - async function* retryMiddleware(call, options) { - const { - retries = 3, - baseDelay = 100, - maxDelay = 1000, - delayFactor = 2, - additionalStatusCodes = [], - signal, - ...restOptions - } = options; - - if (call.requestStream || call.responseStream || !retries) { - // Don't retry streaming calls, or if retries are disabled. - return yield* call.next(call.request, restOptions); - } - - const retryableCodes = new Set([ - ...retryableGrpcStatusCodes, - ...additionalStatusCodes, - ]); - - // One idempotency key for the whole call (all attempts). - const idempotencyKey = uuidv4(); - - const startTime = Date.now(); - let attempt = 0; - let delayMs = baseDelay; - - while (true) { - // Clone/augment metadata for this attempt. - const metadata = new Metadata(restOptions.metadata ?? {}); - - metadata.set("x-idempotency-key", idempotencyKey); - metadata.set("x-retry-attempt", String(attempt)); - if (attempt > 0) { - metadata.set( - "x-retry-delay", - ((Date.now() - startTime) / 1000).toFixed(3), - ); - } - - try { - // Forward the call. - return yield* call.next(call.request, { - ...restOptions, - metadata, - signal, - }); - } catch (err) { - // Immediately propagate non-retryable situations. - if ( - !(err instanceof ClientError) || - !retryableCodes.has(err.code) || - attempt >= retries - ) { - throw err; - } - - // Exponential back-off with a hard cap. - await sleep(delayMs, signal); - delayMs = Math.min(delayMs * delayFactor, maxDelay); - attempt += 1; - } - } - }; - // Legacy default client - lazily initialized let defaultClient: ModalClient | undefined; diff --git a/modal-js/src/cls.ts b/modal-js/src/cls.ts index 4fc6127e..58871c5d 100644 --- a/modal-js/src/cls.ts +++ b/modal-js/src/cls.ts @@ -69,6 +69,15 @@ export class ClsService { ); } + this.#client.logger.debug( + "Retrieved Cls", + "function_id", + serviceFunction.functionId, + "app_name", + appName, + "cls_name", + name, + ); return new Cls( this.#client, serviceFunction.functionId, diff --git a/modal-js/src/config.ts b/modal-js/src/config.ts index 4d386821..97615a4b 100644 --- a/modal-js/src/config.ts +++ b/modal-js/src/config.ts @@ -12,6 +12,7 @@ interface Config { token_secret?: string; environment?: string; imageBuilderVersion?: string; + loglevel?: string; active?: boolean; }; } @@ -23,6 +24,7 @@ export interface Profile { tokenSecret?: string; environment?: string; imageBuilderVersion?: string; + logLevel?: string; } function readConfigFile(): Config { @@ -73,6 +75,7 @@ export function getProfile(profileName?: string): Profile { imageBuilderVersion: process.env["MODAL_IMAGE_BUILDER_VERSION"] || profileData.imageBuilderVersion, + logLevel: process.env["MODAL_LOGLEVEL"] || profileData.loglevel, }; return profile as Profile; // safe to null-cast because of check above } diff --git a/modal-js/src/function.ts b/modal-js/src/function.ts index 0baabb2a..c8b9cdee 100644 --- a/modal-js/src/function.ts +++ b/modal-js/src/function.ts @@ -67,6 +67,15 @@ export class FunctionService { objectTag: name, environmentName: this.#client.environmentName(params.environment), }); + this.#client.logger.debug( + "Retrieved Function", + "function_id", + resp.functionId, + "app_name", + appName, + "function_name", + name, + ); return new Function_( this.#client, resp.functionId, @@ -132,15 +141,33 @@ export class Function_ { args: any[] = [], kwargs: Record = {}, ): Promise { + this.#client.logger.debug( + "Executing function call", + "function_id", + this.functionId, + ); const input = await this.#createInput(args, kwargs); const invocation = await this.#createRemoteInvocation(input); // TODO(ryan): Add tests for retries. let retryCount = 0; while (true) { try { - return await invocation.awaitOutput(); + const result = await invocation.awaitOutput(); + this.#client.logger.debug( + "Function call completed", + "function_id", + this.functionId, + ); + return result; } catch (err) { if (err instanceof InternalFailure && retryCount <= maxSystemRetries) { + this.#client.logger.debug( + "Retrying function call due to internal failure", + "function_id", + this.functionId, + "retry_count", + retryCount, + ); await invocation.retry(retryCount); retryCount++; } else { @@ -173,6 +200,11 @@ export class Function_ { args: any[] = [], kwargs: Record = {}, ): Promise { + this.#client.logger.debug( + "Spawning function call", + "function_id", + this.functionId, + ); const input = await this.#createInput(args, kwargs); const invocation = await ControlPlaneInvocation.create( this.#client, @@ -180,6 +212,13 @@ export class Function_ { input, FunctionCallInvocationType.FUNCTION_CALL_INVOCATION_TYPE_ASYNC, ); + this.#client.logger.debug( + "Function call spawned", + "function_id", + this.functionId, + "function_call_id", + invocation.functionCallId, + ); return new FunctionCall(this.#client, invocation.functionCallId); } diff --git a/modal-js/src/image.ts b/modal-js/src/image.ts index 5e04a96b..6478ad15 100644 --- a/modal-js/src/image.ts +++ b/modal-js/src/image.ts @@ -281,6 +281,8 @@ export class Image { return this; } + this.#client.logger.debug("Building image", "app_id", app.appId); + let baseImageId: string | undefined; for (let i = 0; i < this.#layers.length; i++) { @@ -376,6 +378,7 @@ export class Image { baseImageId = resp.imageId; } this.#imageId = baseImageId!; + this.#client.logger.debug("Image build completed", "image_id", baseImageId); return this; } diff --git a/modal-js/src/index.ts b/modal-js/src/index.ts index 9e751836..08bc0568 100644 --- a/modal-js/src/index.ts +++ b/modal-js/src/index.ts @@ -87,4 +87,5 @@ export { Proxy, ProxyService, type ProxyFromNameParams } from "./proxy"; export { CloudBucketMount } from "./cloud_bucket_mount"; export { ModalClient, type ModalClientParams } from "./client"; export { type Profile } from "./config"; +export { type Logger, type LogLevel } from "./logger"; export { checkForRenamedParams } from "./validation"; diff --git a/modal-js/src/logger.test.ts b/modal-js/src/logger.test.ts new file mode 100644 index 00000000..e0288d61 --- /dev/null +++ b/modal-js/src/logger.test.ts @@ -0,0 +1,82 @@ +import { describe, it, expect, vi, test } from "vitest"; +import { + parseLogLevel, + DefaultLogger, + createLogger, + type Logger, +} from "./logger"; + +test("parseLogLevel", () => { + expect(parseLogLevel("debug")).toBe("debug"); + expect(parseLogLevel("DEBUG")).toBe("debug"); + expect(parseLogLevel("warning")).toBe("warn"); + expect(parseLogLevel("WARNING")).toBe("warn"); + + expect(parseLogLevel("")).toBe("warn"); + + expect(() => parseLogLevel("invalid")).toThrow( + 'Invalid log level value: "invalid" (must be debug, info, warn, or error)', + ); +}); + +describe("createLogger", () => { + it("should return DefaultLogger when no custom logger provided", () => { + const logger = createLogger(undefined, "debug"); + expect(logger).toBeInstanceOf(DefaultLogger); + }); + + it("should return FilteredLogger when custom logger provided", () => { + const mockLogger: Logger = { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; + + const logger = createLogger(mockLogger, "debug"); + expect(logger).toBeDefined(); + expect(logger).not.toBeInstanceOf(DefaultLogger); + }); + + it("should apply level filtering to custom logger", () => { + const mockLogger: Logger = { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; + + const logger = createLogger(mockLogger, "warn"); + + logger.debug("test"); + logger.info("test"); + logger.warn("test"); + logger.error("test"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).toHaveBeenCalledWith("test"); + expect(mockLogger.error).toHaveBeenCalledWith("test"); + }); + + it("should pass arguments to custom logger", () => { + const mockLogger: Logger = { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; + + const logger = createLogger(mockLogger, "debug"); + + logger.debug("message", "key1", "value1", "key2", 123); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "message", + "key1", + "value1", + "key2", + 123, + ); + }); +}); diff --git a/modal-js/src/logger.ts b/modal-js/src/logger.ts new file mode 100644 index 00000000..89651c25 --- /dev/null +++ b/modal-js/src/logger.ts @@ -0,0 +1,147 @@ +export type LogLevel = "debug" | "info" | "warn" | "error"; + +const LOG_LEVELS: Record = { + debug: 0, + info: 1, + warn: 2, + error: 3, +}; + +export interface Logger { + debug(message: string, ...args: any[]): void; + info(message: string, ...args: any[]): void; + warn(message: string, ...args: any[]): void; + error(message: string, ...args: any[]): void; +} + +export function parseLogLevel(level: string): LogLevel { + if (!level) { + return "warn"; + } + + const normalized = level.toLowerCase(); + if ( + normalized === "debug" || + normalized === "info" || + normalized === "warn" || + normalized === "warning" || + normalized === "error" + ) { + return normalized === "warning" ? "warn" : (normalized as LogLevel); + } + + throw new Error( + `Invalid log level value: "${level}" (must be debug, info, warn, or error)`, + ); +} + +export class DefaultLogger implements Logger { + private levelValue: number; + + constructor(level: LogLevel = "warn") { + this.levelValue = LOG_LEVELS[level]; + } + + debug(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.debug) { + console.log(this.formatMessage("DEBUG", message, args)); + } + } + + info(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.info) { + console.log(this.formatMessage("INFO", message, args)); + } + } + + warn(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.warn) { + console.warn(this.formatMessage("WARN", message, args)); + } + } + + error(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.error) { + console.error(this.formatMessage("ERROR", message, args)); + } + } + + private formatMessage(level: string, message: string, args: any[]): string { + const timestamp = new Date().toISOString(); + let formatted = `time=${timestamp} level=${level} msg="${message}"`; + + if (args.length > 0) { + for (let i = 0; i < args.length; i += 2) { + if (i + 1 < args.length) { + const key = args[i]; + const value = args[i + 1]; + formatted += ` ${key}=${this.formatValue(value)}`; + } + } + } + + return formatted; + } + + private formatValue(value: any): string { + if (typeof value === "string") { + return value.includes(" ") ? `"${value}"` : value; + } + if (value instanceof Error) { + return `"${value.message}"`; + } + if (Array.isArray(value)) { + return `[${value.join(",")}]`; + } + return String(value); + } +} + +class FilteredLogger implements Logger { + private levelValue: number; + + constructor( + private logger: Logger, + level: LogLevel, + ) { + this.levelValue = LOG_LEVELS[level]; + } + + debug(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.debug) { + this.logger.debug(message, ...args); + } + } + + info(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.info) { + this.logger.info(message, ...args); + } + } + + warn(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.warn) { + this.logger.warn(message, ...args); + } + } + + error(message: string, ...args: any[]): void { + if (this.levelValue <= LOG_LEVELS.error) { + this.logger.error(message, ...args); + } + } +} + +export function createLogger(logger?: Logger, logLevel: string = ""): Logger { + const level = parseLogLevel(logLevel); + + if (logger) { + return new FilteredLogger(logger, level); + } + + return new DefaultLogger(level); +} + +export function newLogger(logLevel: string = ""): Logger { + return createLogger(undefined, logLevel); +} diff --git a/modal-js/src/queue.ts b/modal-js/src/queue.ts index fed4f704..2a1a0851 100644 --- a/modal-js/src/queue.ts +++ b/modal-js/src/queue.ts @@ -55,6 +55,12 @@ export class QueueService { environmentName: this.#client.environmentName(params.environment), }); + this.#client.logger.debug( + "Created ephemeral Queue", + "queue_id", + resp.queueId, + ); + const ephemeralHbManager = new EphemeralHeartbeatManager(() => this.#client.cpClient.queueHeartbeat({ queueId: resp.queueId }), ); @@ -76,6 +82,13 @@ export class QueueService { : undefined, environmentName: this.#client.environmentName(params.environment), }); + this.#client.logger.debug( + "Retrieved Queue", + "queue_id", + resp.queueId, + "queue_name", + name, + ); return new Queue(this.#client, resp.queueId, name); } diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 67c5c2ab..5ffa7f27 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -379,6 +379,11 @@ export class SandboxService { throw err; } + this.#client.logger.debug( + "Created Sandbox", + "sandbox_id", + createResp.sandboxId, + ); return new Sandbox(this.#client, createResp.sandboxId); } @@ -736,6 +741,15 @@ export class Sandbox { ); const resp = await this.#client.cpClient.containerExec(req); + this.#client.logger.debug( + "Created ContainerProcess", + "exec_id", + resp.execId, + "sandbox_id", + this.sandboxId, + "command", + command, + ); return new ContainerProcess(this.#client, resp.execId, params); } @@ -771,7 +785,17 @@ export class Sandbox { timeout: 10, }); if (resp.result) { - return Sandbox.#getReturnCode(resp.result)!; + const returnCode = Sandbox.#getReturnCode(resp.result)!; + this.#client.logger.debug( + "Sandbox wait completed", + "sandbox_id", + this.sandboxId, + "status", + resp.result.status, + "return_code", + returnCode, + ); + return returnCode; } } } diff --git a/modal-js/src/secret.ts b/modal-js/src/secret.ts index e554c940..265be242 100644 --- a/modal-js/src/secret.ts +++ b/modal-js/src/secret.ts @@ -37,6 +37,13 @@ export class SecretService { environmentName: this.#client.environmentName(params?.environment), requiredKeys: params?.requiredKeys ?? [], }); + this.#client.logger.debug( + "Retrieved Secret", + "secret_id", + resp.secretId, + "secret_name", + name, + ); return new Secret(resp.secretId, name); } catch (err) { if (err instanceof ClientError && err.code === Status.NOT_FOUND) @@ -71,6 +78,11 @@ export class SecretService { envDict: entries as Record, environmentName: this.#client.environmentName(params?.environment), }); + this.#client.logger.debug( + "Created ephemeral Secret", + "secret_id", + resp.secretId, + ); return new Secret(resp.secretId); } catch (err) { if ( diff --git a/modal-js/src/volume.ts b/modal-js/src/volume.ts index 40e28aef..22f12718 100644 --- a/modal-js/src/volume.ts +++ b/modal-js/src/volume.ts @@ -42,6 +42,13 @@ export class VolumeService { ? ObjectCreationType.OBJECT_CREATION_TYPE_CREATE_IF_MISSING : ObjectCreationType.OBJECT_CREATION_TYPE_UNSPECIFIED, }); + this.#client.logger.debug( + "Retrieved Volume", + "volume_id", + resp.volumeId, + "volume_name", + name, + ); return new Volume(resp.volumeId, name); } catch (err) { if (err instanceof ClientError && err.code === Status.NOT_FOUND) @@ -60,6 +67,12 @@ export class VolumeService { environmentName: this.#client.environmentName(params.environment), }); + this.#client.logger.debug( + "Created ephemeral Volume", + "volume_id", + resp.volumeId, + ); + const ephemeralHbManager = new EphemeralHeartbeatManager(() => this.#client.cpClient.volumeHeartbeat({ volumeId: resp.volumeId }), ); diff --git a/modal-js/test/auth_token_manager.test.ts b/modal-js/test/auth_token_manager.test.ts index 9cc076d4..cf2a4c4b 100644 --- a/modal-js/test/auth_token_manager.test.ts +++ b/modal-js/test/auth_token_manager.test.ts @@ -2,6 +2,7 @@ import { describe, test, expect, vi, beforeEach, afterEach } from "vitest"; import jwt from "jsonwebtoken"; import { ModalClient } from "../src/client"; import { AuthTokenManager } from "../src/auth_token_manager"; +import { newLogger } from "../src/logger"; async function eventually( condition: () => boolean, @@ -45,7 +46,7 @@ describe("AuthTokenManager", () => { beforeEach(() => { mockClient = newMockAuthClient(); - manager = new AuthTokenManager(mockClient as any); + manager = new AuthTokenManager(mockClient as any, newLogger()); }); afterEach(() => { diff --git a/modal-js/test/legacy/auth_token_manager.test.ts b/modal-js/test/legacy/auth_token_manager.test.ts index 303e715e..4e497f28 100644 --- a/modal-js/test/legacy/auth_token_manager.test.ts +++ b/modal-js/test/legacy/auth_token_manager.test.ts @@ -1,6 +1,7 @@ import { describe, test, expect, vi, beforeEach, afterEach } from "vitest"; import jwt from "jsonwebtoken"; import { AuthTokenManager } from "../../src/auth_token_manager"; +import { newLogger } from "../../src/logger"; async function eventually( condition: () => boolean, @@ -44,7 +45,7 @@ describe("AuthTokenManager", () => { beforeEach(() => { mockClient = newMockAuthClient(); - manager = new AuthTokenManager(mockClient as any); + manager = new AuthTokenManager(mockClient as any, newLogger()); }); afterEach(() => { From 0999acfc4e3d36fcd823fc18aae74e27670c43b4 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 3 Nov 2025 12:56:32 +0100 Subject: [PATCH 33/59] Add support for MODAL_CONFIG_PATH (#199) --- CHANGELOG.md | 1 + modal-go/config.go | 20 +++++++++++--- modal-go/config_test.go | 51 ++++++++++++++++++++++++++++++++++++ modal-go/doc.go | 10 ++++--- modal-js/src/config.ts | 11 +++++++- modal-js/test/config.test.ts | 24 +++++++++++++++++ 6 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 modal-go/config_test.go create mode 100644 modal-js/test/config.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7633a361..a0a7c07f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased - All Go SDK functions that take a Context will respect the timeout of the context. +- Allow customizing the config file path via `MODAL_CONFIG_PATH` environment variable (defaults to `~/.modal.toml`). ## modal-js/v0.5.0, modal-go/v0.5.0 diff --git a/modal-go/config.go b/modal-go/config.go index cb56de02..08b62b99 100644 --- a/modal-go/config.go +++ b/modal-go/config.go @@ -35,14 +35,26 @@ type rawProfile struct { type config map[string]rawProfile -// readConfigFile loads ~/.modal.toml, returning an empty config if the file +func configFilePath() (string, error) { + if configPath := os.Getenv("MODAL_CONFIG_PATH"); configPath != "" { + return configPath, nil + } + + home, err := os.UserHomeDir() + if err != nil { + return "", fmt.Errorf("cannot locate homedir: %w", err) + } + return filepath.Join(home, ".modal.toml"), nil +} + +// readConfigFile loads the Modal config file, returning an empty config if the file // does not exist. func readConfigFile() (config, error) { - home, err := os.UserHomeDir() + path, err := configFilePath() if err != nil { - return nil, fmt.Errorf("cannot locate homedir: %w", err) + return nil, err } - path := filepath.Join(home, ".modal.toml") + content, err := os.ReadFile(path) if errors.Is(err, os.ErrNotExist) { return config{}, nil // silent absence is fine diff --git a/modal-go/config_test.go b/modal-go/config_test.go new file mode 100644 index 00000000..0907072f --- /dev/null +++ b/modal-go/config_test.go @@ -0,0 +1,51 @@ +package modal + +import ( + "os" + "path/filepath" + "testing" + + "github.com/onsi/gomega" +) + +func TestGetConfigPath_WithEnvVar(t *testing.T) { + g := gomega.NewWithT(t) + + originalPath := os.Getenv("MODAL_CONFIG_PATH") + defer func() { + if originalPath != "" { + os.Setenv("MODAL_CONFIG_PATH", originalPath) + } else { + os.Unsetenv("MODAL_CONFIG_PATH") + } + }() + + customPath := "/custom/path/to/config.toml" + os.Setenv("MODAL_CONFIG_PATH", customPath) + + path, err := configFilePath() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(path).Should(gomega.Equal(customPath)) +} + +func TestGetConfigPath_WithoutEnvVar(t *testing.T) { + g := gomega.NewWithT(t) + + originalPath := os.Getenv("MODAL_CONFIG_PATH") + defer func() { + if originalPath != "" { + os.Setenv("MODAL_CONFIG_PATH", originalPath) + } else { + os.Unsetenv("MODAL_CONFIG_PATH") + } + }() + + os.Unsetenv("MODAL_CONFIG_PATH") + + path, err := configFilePath() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + home, _ := os.UserHomeDir() + expectedPath := filepath.Join(home, ".modal.toml") + g.Expect(path).Should(gomega.Equal(expectedPath)) +} diff --git a/modal-go/doc.go b/modal-go/doc.go index a140913e..d3cf35d1 100644 --- a/modal-go/doc.go +++ b/modal-go/doc.go @@ -12,7 +12,11 @@ // handled in Python; this package is for calling and orchestrating them // from other projects. // -// # Authentication +// # Configuration +// +// The config file path can be customized via `MODAL_CONFIG_PATH` (defaults to `~/.modal.toml`). +// +// ## Authentication // // At runtime the SDK resolves credentials in this order: // @@ -21,9 +25,7 @@ // 2. A profile explicitly requested via `MODAL_PROFILE` // 3. A profile marked `active = true` in `~/.modal.toml` // -// See `config.go` for the resolution logic. -// -// # Logging +// ## Logging // // The SDK logging level can be controlled in multiple ways (in order of precedence): // diff --git a/modal-js/src/config.ts b/modal-js/src/config.ts index 97615a4b..a7bcd555 100644 --- a/modal-js/src/config.ts +++ b/modal-js/src/config.ts @@ -27,9 +27,18 @@ export interface Profile { logLevel?: string; } +export function configFilePath(): string { + const configPath = process.env["MODAL_CONFIG_PATH"]; + if (configPath && configPath !== "") { + return configPath; + } + return path.join(homedir(), ".modal.toml"); +} + function readConfigFile(): Config { try { - const configContent = readFileSync(path.join(homedir(), ".modal.toml"), { + const configPath = configFilePath(); + const configContent = readFileSync(configPath, { encoding: "utf-8", }); return parseToml(configContent) as Config; diff --git a/modal-js/test/config.test.ts b/modal-js/test/config.test.ts new file mode 100644 index 00000000..d92a1c2e --- /dev/null +++ b/modal-js/test/config.test.ts @@ -0,0 +1,24 @@ +import { expect, test, vi } from "vitest"; +import { homedir } from "node:os"; +import path from "node:path"; +import { configFilePath } from "../src/config"; + +test("GetConfigPath_WithEnvVar", () => { + const customPath = "/custom/path/to/config.toml"; + vi.stubEnv("MODAL_CONFIG_PATH", customPath); + + const result = configFilePath(); + expect(result).toBe(customPath); + + vi.unstubAllEnvs(); +}); + +test("GetConfigPath_WithoutEnvVar", () => { + vi.stubEnv("MODAL_CONFIG_PATH", undefined); + + const result = configFilePath(); + const expectedPath = path.join(homedir(), ".modal.toml"); + expect(result).toBe(expectedPath); + + vi.unstubAllEnvs(); +}); From 0874f5b91abbc94f973d9d1ae6abef747d538338 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 3 Nov 2025 16:58:39 +0100 Subject: [PATCH 34/59] Improve error if calling web end points as Functions (#197) --- CHANGELOG.md | 1 + modal-go/function.go | 19 +++++++++++- modal-go/test/function_test.go | 30 ++++++++++++++++++- modal-js/src/function.ts | 12 +++++++- modal-js/test/function.test.ts | 30 +++++++++++++++++-- test-support/setup.sh | 2 +- ...bmodal_test_support.py => test_support.py} | 6 ++++ 7 files changed, 94 insertions(+), 6 deletions(-) rename test-support/{libmodal_test_support.py => test_support.py} (89%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a7c07f..45c7ea2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased - All Go SDK functions that take a Context will respect the timeout of the context. +- Improved the error message when calling a webhook Function as a normal Function. - Allow customizing the config file path via `MODAL_CONFIG_PATH` environment variable (defaults to `~/.modal.toml`). ## modal-js/v0.5.0, modal-go/v0.5.0 diff --git a/modal-go/function.go b/modal-go/function.go index 20376774..1700907b 100644 --- a/modal-go/function.go +++ b/modal-go/function.go @@ -177,7 +177,7 @@ func (f *Function) createInput(ctx context.Context, args []any, kwargs map[strin // Error if CBOR is not supported if !cborSupported { - return nil, fmt.Errorf("the deployed Function does not support libmodal - please redeploy it using Modal Python SDK version >= 1.2") + return nil, fmt.Errorf("cannot call Modal Function from Go SDK since it was deployed with an incompatible Python SDK version. Redeploy with Modal Python SDK >= 1.2") } // Use CBOR encoding @@ -249,9 +249,23 @@ func (f *Function) getWebURL() string { return metadata.GetWebUrl() } +func (f *Function) checkNoWebURL(fnName string) error { + webURL := f.getWebURL() + if webURL != "" { + return InvalidError{fmt.Sprintf( + "A webhook Function cannot be invoked for remote execution with '%s'. Invoke this Function via its web url '%s' instead", + fnName, webURL, + )} + } + return nil +} + // Remote executes a single input on a remote Function. func (f *Function) Remote(ctx context.Context, args []any, kwargs map[string]any) (any, error) { f.client.logger.DebugContext(ctx, "Executing function call", "function_id", f.FunctionID) + if err := f.checkNoWebURL("Remote"); err != nil { + return nil, err + } input, err := f.createInput(ctx, args, kwargs) if err != nil { return nil, err @@ -302,6 +316,9 @@ func (f *Function) createRemoteInvocation(ctx context.Context, input *pb.Functio // Spawn starts running a single input on a remote Function. func (f *Function) Spawn(ctx context.Context, args []any, kwargs map[string]any) (*FunctionCall, error) { f.client.logger.DebugContext(ctx, "Spawning function call", "function_id", f.FunctionID) + if err := f.checkNoWebURL("Spawn"); err != nil { + return nil, err + } input, err := f.createInput(ctx, args, kwargs) if err != nil { return nil, err diff --git a/modal-go/test/function_test.go b/modal-go/test/function_test.go index ee992de7..f0b72e0d 100644 --- a/modal-go/test/function_test.go +++ b/modal-go/test/function_test.go @@ -43,7 +43,7 @@ func TestFunctionCallPreCborVersionError(t *testing.T) { // Represent Python kwargs. _, err = function.Remote(ctx, nil, map[string]any{"s": "hello"}) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).Should(gomega.ContainSubstring("please redeploy it using Modal Python SDK version >= 1.2")) + g.Expect(err.Error()).Should(gomega.ContainSubstring("Redeploy with Modal Python SDK >= 1.2")) } func TestFunctionCallGoMap(t *testing.T) { @@ -317,6 +317,34 @@ func TestFunctionFromNameWithDotNotation(t *testing.T) { g.Expect(err.Error()).To(gomega.Equal("cannot retrieve Cls methods using Functions.FromName(). Use:\n cls, _ := client.Cls.FromName(ctx, \"libmodal-test-support\", \"MyClass\", nil)\n instance, _ := cls.Instance(ctx, nil)\n m, _ := instance.Method(\"myMethod\")")) } +func TestWebEndpointRemoteCallError(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "web_endpoint_echo", nil) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + _, err = function.Remote(ctx, []any{"hello"}, nil) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err).Should(gomega.BeAssignableToTypeOf(modal.InvalidError{})) + g.Expect(err.Error()).Should(gomega.ContainSubstring("A webhook Function cannot be invoked for remote execution with 'Remote'")) +} + +func TestWebEndpointSpawnCallError(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "web_endpoint_echo", nil) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + _, err = function.Spawn(ctx, []any{"hello"}, nil) + g.Expect(err).Should(gomega.HaveOccurred()) + g.Expect(err).Should(gomega.BeAssignableToTypeOf(modal.InvalidError{})) + g.Expect(err.Error()).Should(gomega.ContainSubstring("A webhook Function cannot be invoked for remote execution with 'Spawn'")) +} + // compareFlexible compares two values with flexible type handling func compareFlexible(a, b interface{}) bool { // Handle nil cases explicitly diff --git a/modal-js/src/function.ts b/modal-js/src/function.ts index c8b9cdee..9b58be4b 100644 --- a/modal-js/src/function.ts +++ b/modal-js/src/function.ts @@ -136,6 +136,14 @@ export class Function_ { return await getDefaultClient().functions.fromName(appName, name, params); } + #checkNoWebUrl(fnName: string): void { + if (this.#handleMetadata?.webUrl) { + throw new InvalidError( + `A webhook Function cannot be invoked for remote execution with '.${fnName}'. Invoke this Function via its web url '${this.#handleMetadata.webUrl}' instead.`, + ); + } + } + // Execute a single input into a remote Function. async remote( args: any[] = [], @@ -146,6 +154,7 @@ export class Function_ { "function_id", this.functionId, ); + this.#checkNoWebUrl("remote"); const input = await this.#createInput(args, kwargs); const invocation = await this.#createRemoteInvocation(input); // TODO(ryan): Add tests for retries. @@ -205,6 +214,7 @@ export class Function_ { "function_id", this.functionId, ); + this.#checkNoWebUrl("spawn"); const input = await this.#createInput(args, kwargs); const invocation = await ControlPlaneInvocation.create( this.#client, @@ -275,7 +285,7 @@ export class Function_ { // the remote function isn't cbor compatible for inputs // so we can error early throw new InvalidError( - "the deployed Function does not support libmodal - please redeploy it using Modal Python SDK version >= 1.2", + "cannot call Modal Function from JS SDK since it was deployed with an incompatible Python SDK version. Redeploy with Modal Python SDK >= 1.2", ); } const payload = cborEncode([args, kwargs]); diff --git a/modal-js/test/function.test.ts b/modal-js/test/function.test.ts index 27242fa3..3f01de3b 100644 --- a/modal-js/test/function.test.ts +++ b/modal-js/test/function.test.ts @@ -1,5 +1,5 @@ import { tc } from "../test-support/test-client"; -import { NotFoundError } from "modal"; +import { InvalidError, NotFoundError } from "modal"; import { expect, test } from "vitest"; import { createMockModalClients } from "../test-support/grpc_mock"; import { Function_ } from "../src/function"; @@ -203,6 +203,32 @@ test("FunctionCallPreCborVersionError", async () => { // Represent Python kwargs. const promise = function_.remote([], { s: "hello" }); await expect(promise).rejects.toThrowError( - /please redeploy it using Modal Python SDK version >= 1.2/, + /Redeploy with Modal Python SDK >= 1.2/, + ); +}); + +test("WebEndpointRemoteCallError", async () => { + const function_ = await tc.functions.fromName( + "libmodal-test-support", + "web_endpoint_echo", + ); + + const promise = function_.remote(["hello"]); + await expect(promise).rejects.toThrowError(InvalidError); + await expect(promise).rejects.toThrowError( + /A webhook Function cannot be invoked for remote execution with '\.remote'/, + ); +}); + +test("WebEndpointSpawnCallError", async () => { + const function_ = await tc.functions.fromName( + "libmodal-test-support", + "web_endpoint_echo", + ); + + const promise = function_.spawn(["hello"]); + await expect(promise).rejects.toThrowError(InvalidError); + await expect(promise).rejects.toThrowError( + /A webhook Function cannot be invoked for remote execution with '\.spawn'/, ); }); diff --git a/test-support/setup.sh b/test-support/setup.sh index dd812ee0..97fe208d 100755 --- a/test-support/setup.sh +++ b/test-support/setup.sh @@ -5,7 +5,7 @@ set -euo pipefail cd "$(dirname "$0")" echo "Deploying 'libmodal_test_support.py'..." -modal deploy libmodal_test_support.py +modal deploy test_support.py echo "Deploying Secret 'libmodal-test-secret'..." modal secret create --force libmodal-test-secret \ diff --git a/test-support/libmodal_test_support.py b/test-support/test_support.py similarity index 89% rename from test-support/libmodal_test_support.py rename to test-support/test_support.py index 1edd463e..421379b2 100644 --- a/test-support/libmodal_test_support.py +++ b/test-support/test_support.py @@ -57,3 +57,9 @@ def echo_parameter(self) -> str: @modal.method() def echo_env_var(self, var_name: str) -> str: return f"output: {var_name}='{os.getenv(var_name, '[not set]')}'" + + +@app.function(image=modal.Image.debian_slim().pip_install("fastapi")) +@modal.fastapi_endpoint() +def web_endpoint_echo(s: str) -> str: + return "output: " + s From b90c0e9f06a5fa7983adc24a4e0dde382e283989 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:41:31 -0500 Subject: [PATCH 35/59] [RELEASE] Prepare release for modal-js/v0.5.1, modal-go/v0.5.1 (#200) * [RELEASE] Prepare release for modal-js/v0.5.1, modal-go/v0.5.1 * Update CHANGELOG.md --------- Co-authored-by: ehdr Co-authored-by: Eric Hansander --- CHANGELOG.md | 5 +++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45c7ea2c..26f4f83e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,14 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.1, modal-go/v0.5.1 + - All Go SDK functions that take a Context will respect the timeout of the context. - Improved the error message when calling a webhook Function as a normal Function. - Allow customizing the config file path via `MODAL_CONFIG_PATH` environment variable (defaults to `~/.modal.toml`). +- Add support for passing `MODAL_LOGLEVEL=debug` environment variable to also log debug logs, incl. all GRPC calls, etc. ## modal-js/v0.5.0, modal-go/v0.5.0 diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 08e7f2b3..804ec337 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.0", + "version": "0.5.1", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 6bf5ab52..553676fe 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.0", + "version": "0.5.1", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From 1db383c690a42b45c54c25b3250cd698af367ffd Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Tue, 4 Nov 2025 21:12:13 +0100 Subject: [PATCH 36/59] Allow adding custom gRPC interceptors when creating Modal clients (#201) --- CHANGELOG.md | 2 +- modal-go/README.md | 4 ++ modal-go/client.go | 68 ++++++++++++++++++----------- modal-go/client_test.go | 64 +++++++++++++++++++++++++-- modal-go/examples/telemetry/main.go | 68 +++++++++++++++++++++++++++++ modal-js/README.md | 9 ++++ modal-js/examples/telemetry.ts | 49 +++++++++++++++++++++ modal-js/src/client.ts | 23 ++++++++-- modal-js/test/client.test.ts | 45 +++++++++++++++++++ 9 files changed, 300 insertions(+), 32 deletions(-) create mode 100644 modal-go/examples/telemetry/main.go create mode 100644 modal-js/examples/telemetry.ts create mode 100644 modal-js/test/client.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f4f83e..21a70e73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased -No unreleased changes. +- Allow adding custom gRPC interceptors when creating a Modal client, to allow instrumentation, custom telemetry, etc. ## modal-js/v0.5.1, modal-go/v0.5.1 diff --git a/modal-go/README.md b/modal-go/README.md index 68ff1bb8..53670f4a 100644 --- a/modal-go/README.md +++ b/modal-go/README.md @@ -33,6 +33,9 @@ export MODAL_TOKEN_ID=ak-NOTAREALTOKENSTRINGXYZ export MODAL_TOKEN_SECRET=as-FAKESECRETSTRINGABCDEF ``` +### Telemetry and Observability + +The Modal Go SDK supports custom gRPC interceptors for telemetry, tracing, and observability. You can add custom unary and stream interceptors to measure API call latency, trace requests, and integrate with observability tools like OpenTelemetry, DataDog, and others. See the [telemetry example](./examples/telemetry/main.go) for more details. ## Requirements @@ -62,6 +65,7 @@ We also provide a number of examples: - [Mount a cloud bucket to a Sandbox](./examples/sandbox-cloud-bucket/main.go) - [Eagerly build an Image for a Sandbox](./examples/sandbox-prewarm/main.go) - [Building custom Images](./examples/image-building/main.go) +- [Add telemetry and tracing with custom interceptors](./examples/telemetry/main.go) ## Support diff --git a/modal-go/client.go b/modal-go/client.go index b6738852..f6cb8773 100644 --- a/modal-go/client.go +++ b/modal-go/client.go @@ -53,14 +53,16 @@ type Client struct { Secrets SecretService Volumes VolumeService - config config - profile Profile - sdkVersion string - logger *slog.Logger - cpClient pb.ModalClientClient // control plane client - ipClients map[string]pb.ModalClientClient // input plane clients - authTokenManager *AuthTokenManager - mu sync.RWMutex + config config + profile Profile + sdkVersion string + logger *slog.Logger + cpClient pb.ModalClientClient // control plane client + ipClients map[string]pb.ModalClientClient // input plane clients + authTokenManager *AuthTokenManager + additionalUnaryInterceptors []grpc.UnaryClientInterceptor + additionalStreamInterceptors []grpc.StreamClientInterceptor + mu sync.RWMutex } // NewClient generates a new client with the default profile configuration read from environment variables and ~/.modal.toml. @@ -76,6 +78,14 @@ type ClientParams struct { Config *config Logger *slog.Logger ControlPlaneClient pb.ModalClientClient + // GRPCUnaryInterceptors allows custom gRPC unary interceptors for telemetry, tracing, and observability. + // These are appended after Modal's built-in interceptors (header injection, auth, retry, timeout). + // Note that the Modal gRPC API is not considered a public API, and can change without warning. + GRPCUnaryInterceptors []grpc.UnaryClientInterceptor + // GRPCStreamInterceptors allows custom gRPC stream interceptors for telemetry, tracing, and observability. + // These are appended after Modal's built-in stream interceptors (header injection). + // Note that the Modal gRPC API is not considered a public API, and can change without warning. + GRPCStreamInterceptors []grpc.StreamClientInterceptor } // NewClientWithOptions generates a new client and allows overriding options in the default profile configuration. @@ -120,11 +130,13 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { } c := &Client{ - config: cfg, - profile: profile, - sdkVersion: sdkVersion(), - logger: logger, - ipClients: make(map[string]pb.ModalClientClient), + config: cfg, + profile: profile, + sdkVersion: sdkVersion(), + logger: logger, + ipClients: make(map[string]pb.ModalClientClient), + additionalUnaryInterceptors: params.GRPCUnaryInterceptors, + additionalStreamInterceptors: params.GRPCStreamInterceptors, } logger.Debug("Initializing Modal client", "version", sdkVersion(), "server_url", profile.ServerURL) @@ -132,7 +144,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { if params.ControlPlaneClient != nil { c.cpClient = params.ControlPlaneClient } else { - _, c.cpClient, err = newClient(profile, c) + _, c.cpClient, err = newClient(profile, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) } if err != nil { return nil, fmt.Errorf("failed to create control plane client: %w", err) @@ -180,7 +192,7 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { c.logger.Debug("Creating input plane client", "server_url", serverURL) prof := c.profile prof.ServerURL = serverURL - _, client, err := newClient(prof, c) + _, client, err := newClient(prof, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) if err != nil { return nil, err } @@ -244,7 +256,7 @@ func isRetryableGrpc(err error) bool { // newClient dials the given server URL with auth/timeout/retry interceptors installed. // It returns (conn, stub). Close the conn when done. -func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClient, error) { +func newClient(profile Profile, c *Client, customUnaryInterceptors []grpc.UnaryClientInterceptor, customStreamInterceptors []grpc.StreamClientInterceptor) (*grpc.ClientConn, pb.ModalClientClient, error) { var target string var creds credentials.TransportCredentials var scheme string @@ -262,6 +274,19 @@ func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClie c.logger.Debug("Connecting to Modal server", "target", target, "scheme", scheme) + unaryInterceptors := []grpc.UnaryClientInterceptor{ + headerInjectorUnaryInterceptor(profile, c.sdkVersion), + authTokenInterceptor(c), + retryInterceptor(c), + timeoutInterceptor(), + } + unaryInterceptors = append(unaryInterceptors, customUnaryInterceptors...) + + streamInterceptors := []grpc.StreamClientInterceptor{ + headerInjectorStreamInterceptor(profile, c.sdkVersion), + } + streamInterceptors = append(streamInterceptors, customStreamInterceptors...) + conn, err := grpc.NewClient( target, grpc.WithTransportCredentials(creds), @@ -269,15 +294,8 @@ func newClient(profile Profile, c *Client) (*grpc.ClientConn, pb.ModalClientClie grpc.MaxCallRecvMsgSize(maxMessageSize), grpc.MaxCallSendMsgSize(maxMessageSize), ), - grpc.WithChainUnaryInterceptor( - headerInjectorUnaryInterceptor(profile, c.sdkVersion), - authTokenInterceptor(c), - retryInterceptor(c), - timeoutInterceptor(), - ), - grpc.WithChainStreamInterceptor( - headerInjectorStreamInterceptor(profile, c.sdkVersion), - ), + grpc.WithChainUnaryInterceptor(unaryInterceptors...), + grpc.WithChainStreamInterceptor(streamInterceptors...), ) if err != nil { return nil, nil, err diff --git a/modal-go/client_test.go b/modal-go/client_test.go index d3dd8d3e..ef688334 100644 --- a/modal-go/client_test.go +++ b/modal-go/client_test.go @@ -1,12 +1,15 @@ package modal import ( + "context" "io" "log/slog" "os" + "sync" "testing" "github.com/onsi/gomega" + "google.golang.org/grpc" ) func TestClientWithLogger(t *testing.T) { @@ -14,20 +17,75 @@ func TestClientWithLogger(t *testing.T) { // Use a buffer to capture log output r, w, err := os.Pipe() - g.Expect(err).To(gomega.BeNil()) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) logger := slog.New(slog.NewTextHandler(w, &slog.HandlerOptions{Level: slog.LevelDebug})) g.Expect(logger).NotTo(gomega.BeNil()) client, err := NewClientWithOptions(&ClientParams{Logger: logger}) - g.Expect(err).To(gomega.BeNil()) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(client).NotTo(gomega.BeNil()) w.Close() output, err := io.ReadAll(r) - g.Expect(err).To(gomega.BeNil()) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(output).To(gomega.ContainSubstring("Initializing Modal client")) g.Expect(output).To(gomega.ContainSubstring("Modal client initialized successfully")) } + +func TestClientWithCustomInterceptors(t *testing.T) { + g := gomega.NewWithT(t) + + var firstCalled, secondCalled bool + var firstMethod, secondMethod string + var mu sync.Mutex + + firstInterceptor := func( + ctx context.Context, + method string, + req, reply any, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption, + ) error { + mu.Lock() + firstCalled = true + firstMethod = method + mu.Unlock() + return invoker(ctx, method, req, reply, cc, opts...) + } + + secondInterceptor := func( + ctx context.Context, + method string, + req, reply any, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption, + ) error { + mu.Lock() + secondCalled = true + secondMethod = method + mu.Unlock() + return invoker(ctx, method, req, reply, cc, opts...) + } + + client, err := NewClientWithOptions(&ClientParams{ + GRPCUnaryInterceptors: []grpc.UnaryClientInterceptor{firstInterceptor, secondInterceptor}, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(client).NotTo(gomega.BeNil()) + defer client.Close() + + _, err = client.Functions.FromName(context.Background(), "libmodal-test-support", "non-existent", nil) + g.Expect(err).Should(gomega.HaveOccurred()) // don't care about success here, just need the RPC + + mu.Lock() + g.Expect(firstCalled).To(gomega.BeTrue()) + g.Expect(firstMethod).To(gomega.ContainSubstring("ModalClient/")) + g.Expect(secondCalled).To(gomega.BeTrue()) + g.Expect(secondMethod).To(gomega.ContainSubstring("ModalClient/")) + mu.Unlock() +} diff --git a/modal-go/examples/telemetry/main.go b/modal-go/examples/telemetry/main.go new file mode 100644 index 00000000..21c78323 --- /dev/null +++ b/modal-go/examples/telemetry/main.go @@ -0,0 +1,68 @@ +// This example demonstrates how to add custom telemetry and tracing to Modal API calls +// using gRPC interceptors. It shows a simple custom interceptor, but the same principle +// could also be used with e.g. OpenTelemetry for distributed tracing. + +package main + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/modal-labs/libmodal/modal-go" + "google.golang.org/grpc" +) + +// telemetryInterceptor is a custom interceptor that measures API call latency +// and logs method names with timing information. +func telemetryInterceptor( + ctx context.Context, + method string, + req, reply any, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption, +) error { + start := time.Now() + err := invoker(ctx, method, req, reply, cc, opts...) + duration := time.Since(start) + + status := "success" + if err != nil { + status = "error" + } + fmt.Printf("[TELEMETRY] method=%s duration=%v status=%s\n", method, duration, status) + // You could also send this data to your observability backend, etc. + + return err +} + +func main() { + ctx := context.Background() + + fmt.Println("Initializing Modal client with telemetry interceptor. All API calls will be logged with timing information.") + + mc, err := modal.NewClientWithOptions(&modal.ClientParams{ + GRPCUnaryInterceptors: []grpc.UnaryClientInterceptor{ + telemetryInterceptor, + }, + }) + if err != nil { + log.Fatalf("Failed to create client: %v", err) + } + defer mc.Close() + + echo, err := mc.Functions.FromName(ctx, "libmodal-test-support", "echo_string", nil) + if err != nil { + log.Fatalf("Failed to get Function: %v", err) + } + + result, err := echo.Remote(ctx, nil, map[string]any{"s": "Hello from telemetry example!"}) + if err != nil { + log.Fatalf("Failed to call function: %v", err) + } + fmt.Printf("Result: %v\n", result) + + fmt.Println("\nAll operations completed. See the telemetry logs above!") +} diff --git a/modal-js/README.md b/modal-js/README.md index d1583857..82b625a7 100644 --- a/modal-js/README.md +++ b/modal-js/README.md @@ -50,6 +50,11 @@ We also provide a number of examples: - [Mount a cloud bucket to a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-cloud-bucket.ts) - [Eagerly build an Image for a Sandbox](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/sandbox-prewarm.ts) - [Building custom Images](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/image-building.ts) +- [Add telemetry and tracing with custom middleware](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/telemetry.ts) + +### Configuration + +The config file path can be customized via `MODAL_CONFIG_PATH` (defaults to `~/.modal.toml`). ### Authenticating with Modal @@ -61,6 +66,10 @@ export MODAL_TOKEN_ID=ak-NOTAREALTOKENSTRINGXYZ export MODAL_TOKEN_SECRET=as-FAKESECRETSTRINGABCDEF ``` +### Telemetry and Observability + +The Modal JavaScript SDK supports custom gRPC middleware for telemetry, tracing, and observability. You can add custom middleware to measure API call latency, trace requests, and integrate with observability tools like OpenTelemetry, DataDog, and others. See the [telemetry example](https://github.com/modal-labs/libmodal/blob/main/modal-js/examples/telemetry.ts) for more details. + ## Support For usage questions and other support, please reach out on the [Modal Community Slack](https://modal.com/slack). diff --git a/modal-js/examples/telemetry.ts b/modal-js/examples/telemetry.ts new file mode 100644 index 00000000..6e075370 --- /dev/null +++ b/modal-js/examples/telemetry.ts @@ -0,0 +1,49 @@ +// This example demonstrates how to add custom telemetry and tracing to Modal API calls +// using gRPC middleware. It shows a simple custom middleware, but the same principle +// could also be used with e.g. OpenTelemetry for distributed tracing. + +import { CallOptions, ClientMiddlewareCall } from "nice-grpc"; +import { ModalClient } from "modal"; + +// telemetryMiddleware is a custom middleware that measures API call latency +// and logs method names with timing information. +async function* telemetryMiddleware( + call: ClientMiddlewareCall, + options: CallOptions, +) { + const start = Date.now(); + + try { + const result = yield* call.next(call.request, options); + const duration = Date.now() - start; + console.log( + `[TELEMETRY] method=${call.method.path} duration=${duration}ms status=success`, + ); + // You could also send this data to your observability backend, etc. + return result; + } catch (err) { + const duration = Date.now() - start; + console.log( + `[TELEMETRY] method=${call.method.path} duration=${duration}ms status=error`, + ); + throw err; + } +} + +console.log( + "Initializing Modal client with telemetry middleware. All API calls will be logged with timing information.", +); + +const modal = new ModalClient({ + grpcMiddleware: [telemetryMiddleware], +}); + +const echo = await modal.functions.fromName( + "libmodal-test-support", + "echo_string", +); + +const result = await echo.remote([], { s: "Hello from telemetry example!" }); +console.log("Result:", result); + +console.log("\nAll operations completed. See the telemetry logs above!"); diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index dd85ad32..cab9a545 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -37,6 +37,16 @@ export interface ModalClientParams { maxRetries?: number; logger?: Logger; logLevel?: LogLevel; + /** + * Custom gRPC middleware to be applied to all API calls. + * These middleware are appended after Modal's built-in middleware + * (authentication, retry logic, and timeouts), allowing you to add + * telemetry, tracing, or other observability features. + * + * Note that the Modal gRPC API is not considered a public API, and + * can change without warning. + */ + grpcMiddleware?: ClientMiddleware[]; /** @ignore */ cpClient?: ModalGrpcClient; } @@ -83,6 +93,7 @@ export class ModalClient { private ipClients: Map; private authTokenManager: AuthTokenManager | null = null; + private customMiddleware: ClientMiddleware[]; constructor(params?: ModalClientParams) { checkForRenamedParams(params, { timeout: "timeoutMs" }); @@ -105,6 +116,7 @@ export class ModalClient { this.profile.serverUrl, ); + this.customMiddleware = params?.grpcMiddleware ?? []; this.ipClients = new Map(); this.cpClient = params?.cpClient ?? this.createClient(this.profile); @@ -165,11 +177,16 @@ export class ModalClient { "grpc.max_send_message_length": 100 * 1024 * 1024, "grpc-node.flow_control_window": 64 * 1024 * 1024, }); - return createClientFactory() + let factory = createClientFactory() .use(this.authMiddleware(profile)) .use(this.retryMiddleware()) - .use(timeoutMiddleware) - .create(ModalClientDefinition, channel); + .use(timeoutMiddleware); + + for (const middleware of this.customMiddleware) { + factory = factory.use(middleware); + } + + return factory.create(ModalClientDefinition, channel); } /** Middleware to retry transient errors and timeouts for unary requests. */ diff --git a/modal-js/test/client.test.ts b/modal-js/test/client.test.ts new file mode 100644 index 00000000..41532c7d --- /dev/null +++ b/modal-js/test/client.test.ts @@ -0,0 +1,45 @@ +import { ClientMiddlewareCall, CallOptions } from "nice-grpc"; +import { ModalClient } from "modal"; +import { expect, test } from "vitest"; + +test("ModalClient with custom middleware", async () => { + let firstCalled = false; + let secondCalled = false; + let firstMethod = ""; + let secondMethod = ""; + + const firstMiddleware = async function* ( + call: ClientMiddlewareCall, + options: CallOptions, + ) { + firstCalled = true; + firstMethod = call.method.path; + return yield* call.next(call.request, options); + }; + + const secondMiddleware = async function* ( + call: ClientMiddlewareCall, + options: CallOptions, + ) { + secondCalled = true; + secondMethod = call.method.path; + return yield* call.next(call.request, options); + }; + + const mc = new ModalClient({ + grpcMiddleware: [firstMiddleware, secondMiddleware], + }); + + try { + await mc.functions.fromName("libmodal-test-support", "non-existent"); + } catch (_err) { + // Don't care about success here, just need the RPC to be made + } finally { + mc.close(); + } + + expect(firstCalled).toBe(true); + expect(firstMethod).toContain("ModalClient/"); + expect(secondCalled).toBe(true); + expect(secondMethod).toContain("ModalClient/"); +}); From 367172bfdae22abec5fd611afa82fa79e5d2088c Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:17:42 -0500 Subject: [PATCH 37/59] [RELEASE] Prepare release for modal-js/v0.5.2, modal-go/v0.5.2 (#202) Co-authored-by: ehdr --- CHANGELOG.md | 4 ++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21a70e73..3fc44bfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.2, modal-go/v0.5.2 + - Allow adding custom gRPC interceptors when creating a Modal client, to allow instrumentation, custom telemetry, etc. ## modal-js/v0.5.1, modal-go/v0.5.1 diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 804ec337..d09c6bb1 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.1", + "version": "0.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.1", + "version": "0.5.2", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 553676fe..66dc38b7 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.1", + "version": "0.5.2", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From d7d236162d5c55f79147b68c91d81ca11225b99b Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Sat, 8 Nov 2025 18:21:23 +0100 Subject: [PATCH 38/59] Fix goroutine leak in output streaming functions (#203) Background goroutines in outputStreamSb and outputStreamCp used context.Background() which prevented cancellation when streams were closed early (e.g., via modal.Ignore). Now use cancellable contexts that terminate immediately when the reader is closed. --- modal-go/sandbox.go | 43 +++++++++++++++++---- modal-go/test/sandbox_test.go | 71 +++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 8 deletions(-) diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 5deabf81..8f78f34e 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -765,15 +765,15 @@ func newContainerProcess(cpClient pb.ModalClientClient, execID string, params Sa cp := &ContainerProcess{execID: execID, cpClient: cpClient} cp.Stdin = inputStreamCp(cpClient, execID) - cp.Stdout = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) if stdoutBehavior == Ignore { - cp.Stdout.Close() cp.Stdout = io.NopCloser(bytes.NewReader(nil)) + } else { + cp.Stdout = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) } - cp.Stderr = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) if stderrBehavior == Ignore { - cp.Stderr.Close() cp.Stderr = io.NopCloser(bytes.NewReader(nil)) + } else { + cp.Stderr = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) } return cp @@ -874,21 +874,37 @@ func (cps *cpStdin) Close() error { return err } +// cancelOnCloseReader is used to cancel background goroutines when the stream is closed. +type cancelOnCloseReader struct { + io.ReadCloser + cancel context.CancelFunc +} + +func (r *cancelOnCloseReader) Close() error { + r.cancel() + return r.ReadCloser.Close() +} + func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileDescriptor) io.ReadCloser { pr, pw := nio.Pipe(buffer.New(64 * 1024)) + ctx, cancel := context.WithCancel(context.Background()) go func() { defer pw.Close() + defer cancel() lastIndex := "0-0" completed := false retries := 10 for !completed { - stream, err := cpClient.SandboxGetLogs(context.Background(), pb.SandboxGetLogsRequest_builder{ + stream, err := cpClient.SandboxGetLogs(ctx, pb.SandboxGetLogsRequest_builder{ SandboxId: sandboxID, FileDescriptor: fd, Timeout: 55, LastEntryId: lastIndex, }.Build()) if err != nil { + if ctx.Err() != nil { + return + } if isRetryableGrpc(err) && retries > 0 { retries-- continue @@ -899,6 +915,9 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD for { batch, err := stream.Recv() if err != nil { + if ctx.Err() != nil { + return + } if err != io.EOF { if isRetryableGrpc(err) && retries > 0 { retries-- @@ -921,18 +940,20 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD } } }() - return pr + return &cancelOnCloseReader{ReadCloser: pr, cancel: cancel} } func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDescriptor) io.ReadCloser { pr, pw := nio.Pipe(buffer.New(64 * 1024)) + ctx, cancel := context.WithCancel(context.Background()) go func() { defer pw.Close() + defer cancel() var lastIndex uint64 completed := false retries := 10 for !completed { - stream, err := cpClient.ContainerExecGetOutput(context.Background(), pb.ContainerExecGetOutputRequest_builder{ + stream, err := cpClient.ContainerExecGetOutput(ctx, pb.ContainerExecGetOutputRequest_builder{ ExecId: execID, FileDescriptor: fd, Timeout: 55, @@ -940,6 +961,9 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc LastBatchIndex: lastIndex, }.Build()) if err != nil { + if ctx.Err() != nil { + return + } if isRetryableGrpc(err) && retries > 0 { retries-- continue @@ -950,6 +974,9 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc for { batch, err := stream.Recv() if err != nil { + if ctx.Err() != nil { + return + } if err != io.EOF { if isRetryableGrpc(err) && retries > 0 { retries-- @@ -972,5 +999,5 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc } } }() - return pr + return &cancelOnCloseReader{ReadCloser: pr, cancel: cancel} } diff --git a/modal-go/test/sandbox_test.go b/modal-go/test/sandbox_test.go index a3ad238a..21d40cb9 100644 --- a/modal-go/test/sandbox_test.go +++ b/modal-go/test/sandbox_test.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "math/rand" + "runtime" "testing" "time" @@ -646,3 +647,73 @@ func TestNamedSandboxNotFound(t *testing.T) { g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("not found")) } + +func TestNoGoroutineLeaksWithIgnoredOutput(t *testing.T) { + testCases := []struct { + name string + params *modal.SandboxExecParams + afterExec func(*gomega.WithT, *modal.ContainerProcess) + }{ + { + name: "with modal.Ignore", + params: &modal.SandboxExecParams{ + Stdout: modal.Ignore, + Stderr: modal.Ignore, + }, + afterExec: func(g *gomega.WithT, p *modal.ContainerProcess) {}, + }, + { + name: "with explicit Close", + params: &modal.SandboxExecParams{}, + afterExec: func(g *gomega.WithT, p *modal.ContainerProcess) { + err := p.Stdout.Close() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + err = p.Stderr.Close() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + }, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + g := gomega.NewWithT(t) + ctx := context.Background() + + app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + image := tc.Images.FromRegistry("alpine:3.21", nil) + + runtime.GC() + time.Sleep(100 * time.Millisecond) + initialGoroutines := runtime.NumGoroutine() + + sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + Command: []string{"sh", "-c", "echo 'test output'; sleep 1"}, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) + + p, err := sb.Exec(ctx, []string{"echo", "exec output"}, tt.params) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + tt.afterExec(g, p) + + exitCode, err := p.Wait(ctx) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(exitCode).To(gomega.Equal(0)) + + sandboxExitCode, err := sb.Wait(ctx) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(sandboxExitCode).To(gomega.Equal(0)) + + runtime.GC() + time.Sleep(500 * time.Millisecond) + + g.Eventually(func() int { + runtime.GC() + return runtime.NumGoroutine() + }, 5*time.Second, 100*time.Millisecond).Should(gomega.Equal(initialGoroutines)) + }) + } +} From a6e364635d4ab34a058f53176588ff14992f6ba1 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Sat, 8 Nov 2025 18:30:03 +0100 Subject: [PATCH 39/59] Update CHANGELOG for #203 (#205) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc44bfa..578cfec4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased -No unreleased changes. +- Fixed a bug in modal-go where `Sandbox.Exec` would leak goroutines. ## modal-js/v0.5.2, modal-go/v0.5.2 From 3e16a9a64fc76cf8cb05f5cb5ada71c1fd1255c7 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Sat, 8 Nov 2025 19:51:37 +0100 Subject: [PATCH 40/59] [RELEASE] Prepare release for modal-js/v0.5.3, modal-go/v0.5.3 (#206) Co-authored-by: ehdr --- CHANGELOG.md | 4 ++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 578cfec4..60a7bbc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.3, modal-go/v0.5.3 + - Fixed a bug in modal-go where `Sandbox.Exec` would leak goroutines. ## modal-js/v0.5.2, modal-go/v0.5.2 diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index d09c6bb1..996e716c 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.2", + "version": "0.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.2", + "version": "0.5.3", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 66dc38b7..90ff30cb 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.2", + "version": "0.5.3", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From b6d91c3a421f9e85d797c0d2e1417b1940c8a651 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Mon, 10 Nov 2025 11:29:21 +0100 Subject: [PATCH 41/59] Fix all goroutine leaks detected by goleak in Sandboxes and Images (#207) * Run Sandbox unit tests in parallel * Remove leak test, replaced by goleak * Enable goleak for goroutine leak detection in tests * Fix Sandbox output streaming goroutine leaks with lazy initialization The outputStreamSb and outputStreamCp functions created goroutines eagerly when Sandbox and ContainerProcess objects were instantiated, even if stdout/stderr were never read. These goroutines would remain blocked on stream.Recv() calls and wouldn't terminate properly. * Fix Image build streaming goroutine leak with ctx cancellation The ImageJoinStreaming gRPC call in Image.Build() was leaving a goroutine running after the stream completed. Add ctx cancellation to properly clean up the stream goroutine when done. --- CHANGELOG.md | 3 +- DEVELOPING.md | 4 ++ modal-go/go.mod | 2 + modal-go/go.sum | 16 +++++++- modal-go/image.go | 62 ++++++++++++++++++----------- modal-go/main_test.go | 20 ++++++++++ modal-go/sandbox.go | 58 +++++++++++++++++++++++---- modal-go/sandbox_filesystem.go | 5 ++- modal-go/sandbox_test.go | 10 +++++ modal-go/test/image_test.go | 2 + modal-go/test/main_test.go | 21 +++++++++- modal-go/test/sandbox_test.go | 71 ---------------------------------- 12 files changed, 168 insertions(+), 106 deletions(-) create mode 100644 modal-go/main_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 60a7bbc7..0c76d9da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased -No unreleased changes. +- Enabled [goleak](https://github.com/uber-go/goleak) for goroutine leak detection in tests. See [DEVELOPING.md](./DEVELOPING.md) for details. +- Fixed all detected goroutine leaks in Sandboxes and Images. ## modal-js/v0.5.3, modal-go/v0.5.3 diff --git a/DEVELOPING.md b/DEVELOPING.md index 3902d417..1cc1e3cd 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -68,6 +68,10 @@ We check the generated protobuf files into Git so that the package can be instal - durations should NOT be suffixed, since they have type `time.Duration` - memory should be suffixed with `MiB`, e.g. `memoryMiB` instead of `memory` +### Testing + +We use [goleak](https://github.com/uber-go/goleak) for goroutine leak detection, enabled by passing `-check-leaks` to `go test`. To identify which specific test is leaking, use [goleaks recommended method to find them](https://github.com/uber-go/goleak/?tab=readme-ov-file#determine-source-of-package-leaks), then use `go test -run` to run individual tests. + ## How to publish 1. Ensure all changes are captured in the ["Unreleased" section of the `CHANGELOG.md`](https://github.com/modal-labs/libmodal/blob/main/CHANGELOG.md#unreleased). diff --git a/modal-go/go.mod b/modal-go/go.mod index 0d8810f9..916a2759 100644 --- a/modal-go/go.mod +++ b/modal-go/go.mod @@ -13,6 +13,7 @@ require ( github.com/kisielk/og-rek v1.3.0 github.com/onsi/gomega v1.37.0 github.com/pelletier/go-toml/v2 v2.2.4 + go.uber.org/goleak v1.3.0 google.golang.org/grpc v1.72.0 google.golang.org/protobuf v1.36.6 ) @@ -20,6 +21,7 @@ require ( require ( github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced // indirect github.com/google/go-cmp v0.7.0 // indirect + github.com/kr/text v0.1.0 // indirect github.com/x448/float16 v0.8.4 // indirect golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect golang.org/x/net v0.39.0 // indirect diff --git a/modal-go/go.sum b/modal-go/go.sum index f99a2b21..cf2cf824 100644 --- a/modal-go/go.sum +++ b/modal-go/go.sum @@ -1,5 +1,7 @@ github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced h1:HxlRMDx/VeRqzj3nvqX9k4tjeBcEIkoNHDJPsS389hs= github.com/aristanetworks/gomap v0.0.0-20230726210543-f4e41046dced/go.mod h1:p7lmI+ecoe1RTyD11SPXWsSQ3H+pJ4cp5y7vtKW4QdM= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/djherbis/buffer v1.1.0/go.mod h1:VwN8VdFkMY0DCALdY8o00d3IZ6Amz/UNVMWcSaJT44o= github.com/djherbis/buffer v1.2.0 h1:PH5Dd2ss0C7CRRhQCZ2u7MssF+No9ide8Ye71nPHcrQ= github.com/djherbis/buffer v1.2.0/go.mod h1:fjnebbZjCUpPinBRD+TDwXSOeNQ7fPQWLfGQqiAiUyE= @@ -25,12 +27,21 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kisielk/og-rek v1.3.0 h1:lTXdQXqFETZKA//FWH4RBNAuiJ/dofxIwHAidoUZoMk= github.com/kisielk/og-rek v1.3.0/go.mod h1:4at7oxyfBTDilURhNCf7irHWtosJlJl9uyqUqAkrP4w= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0= github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= @@ -45,6 +56,8 @@ go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY= golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= @@ -61,7 +74,8 @@ google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/modal-go/image.go b/modal-go/image.go index 8d74829d..d62d0972 100644 --- a/modal-go/image.go +++ b/modal-go/image.go @@ -180,6 +180,44 @@ func validateDockerfileCommands(commands []string) error { return nil } +// waitForBuildIteration performs a single iteration of waiting for an image build to complete. +// It streams build updates and returns either a result (if build completes) or nil (if the stream +// ends without a result, requiring another iteration). +func (image *Image) waitForBuildIteration(ctx context.Context, imageID string, lastEntryID string) (*pb.GenericResult, string, error) { + streamCtx, cancel := context.WithCancel(ctx) + defer cancel() + + stream, err := image.client.cpClient.ImageJoinStreaming(streamCtx, pb.ImageJoinStreamingRequest_builder{ + ImageId: imageID, + Timeout: 55, + LastEntryId: lastEntryID, + }.Build()) + if err != nil { + return nil, lastEntryID, err + } + + for { + item, err := stream.Recv() + if err != nil { + if err == io.EOF { + return nil, lastEntryID, nil + } + return nil, lastEntryID, err + } + if item.GetEntryId() != "" { + lastEntryID = item.GetEntryId() + } + res := item.GetResult() + + // Ignore all log lines and progress updates. + if res == nil || res.GetStatus() == pb.GenericResult_GENERIC_STATUS_UNSPECIFIED { + continue + } + + return res, lastEntryID, nil + } +} + // Build eagerly builds an Image on Modal. func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { // Image is already hyrdated @@ -265,31 +303,11 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { return nil, err } - stream, err := image.client.cpClient.ImageJoinStreaming(ctx, pb.ImageJoinStreamingRequest_builder{ - ImageId: resp.GetImageId(), - Timeout: 55, - LastEntryId: lastEntryID, - }.Build()) + var err error + result, lastEntryID, err = image.waitForBuildIteration(ctx, resp.GetImageId(), lastEntryID) if err != nil { return nil, err } - for { - item, err := stream.Recv() - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - if item.GetEntryId() != "" { - lastEntryID = item.GetEntryId() - } - if item.GetResult() != nil && item.GetResult().GetStatus() != pb.GenericResult_GENERIC_STATUS_UNSPECIFIED { - result = item.GetResult() - break - } - // Ignore all log lines and progress updates. - } } } diff --git a/modal-go/main_test.go b/modal-go/main_test.go new file mode 100644 index 00000000..04b1d4a7 --- /dev/null +++ b/modal-go/main_test.go @@ -0,0 +1,20 @@ +package modal + +import ( + "flag" + "os" + "testing" +) + +// The checkLeaks flag is defined and used in the test package in ./test. +// However when running tests across both packages (go test . ./test -check-leaks), +// Go passes it to both packages, and we get a "flag provided but not defined" warning +// if it's not also defined here. +var checkLeaks = flag.Bool("check-leaks", false, "ignored in this package, but defined in the test package") //nolint:unused + +func TestMain(m *testing.M) { + flag.Parse() + + code := m.Run() + os.Exit(code) +} diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 8f78f34e..a06c1330 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -352,8 +352,16 @@ func defaultSandboxPTYInfo() *pb.PTYInfo { func newSandbox(client *Client, sandboxID string) *Sandbox { sb := &Sandbox{SandboxID: sandboxID, client: client} sb.Stdin = inputStreamSb(client.cpClient, sandboxID) - sb.Stdout = outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) - sb.Stderr = outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + sb.Stdout = &lazyStreamReader{ + initFunc: func() io.ReadCloser { + return outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) + }, + } + sb.Stderr = &lazyStreamReader{ + initFunc: func() io.ReadCloser { + return outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + }, + } return sb } @@ -768,12 +776,20 @@ func newContainerProcess(cpClient pb.ModalClientClient, execID string, params Sa if stdoutBehavior == Ignore { cp.Stdout = io.NopCloser(bytes.NewReader(nil)) } else { - cp.Stdout = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) + cp.Stdout = &lazyStreamReader{ + initFunc: func() io.ReadCloser { + return outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) + }, + } } if stderrBehavior == Ignore { cp.Stderr = io.NopCloser(bytes.NewReader(nil)) } else { - cp.Stderr = outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + cp.Stderr = &lazyStreamReader{ + initFunc: func() io.ReadCloser { + return outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + }, + } } return cp @@ -811,12 +827,12 @@ type sbStdin struct { index uint32 } -func (sbs *sbStdin) Write(p []byte) (n int, err error) { +func (sbs *sbStdin) Write(p []byte) (int, error) { sbs.mu.Lock() defer sbs.mu.Unlock() index := sbs.index sbs.index++ - _, err = sbs.cpClient.SandboxStdinWrite(context.Background(), pb.SandboxStdinWriteRequest_builder{ + _, err := sbs.cpClient.SandboxStdinWrite(context.Background(), pb.SandboxStdinWriteRequest_builder{ SandboxId: sbs.sandboxID, Input: p, Index: index, @@ -848,8 +864,8 @@ type cpStdin struct { cpClient pb.ModalClientClient } -func (cps *cpStdin) Write(p []byte) (n int, err error) { - _, err = cps.cpClient.ContainerExecPutInput(context.Background(), pb.ContainerExecPutInputRequest_builder{ +func (cps *cpStdin) Write(p []byte) (int, error) { + _, err := cps.cpClient.ContainerExecPutInput(context.Background(), pb.ContainerExecPutInputRequest_builder{ ExecId: cps.execID, Input: pb.RuntimeInputMessage_builder{ Message: p, @@ -885,6 +901,32 @@ func (r *cancelOnCloseReader) Close() error { return r.ReadCloser.Close() } +// lazyStreamReader defers stream initialization until the first read, preventing goroutine +// leaks for unused streams. Without lazy initialization, output stream goroutines are created +// eagerly and block on stream.Recv() calls. +type lazyStreamReader struct { + once sync.Once + reader io.ReadCloser + initFunc func() io.ReadCloser +} + +func (l *lazyStreamReader) Read(p []byte) (int, error) { + l.once.Do(func() { + l.reader = l.initFunc() + }) + return l.reader.Read(p) +} + +func (l *lazyStreamReader) Close() error { + l.once.Do(func() { + l.reader = io.NopCloser(bytes.NewReader(nil)) + }) + if l.reader != nil { + return l.reader.Close() + } + return nil +} + func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileDescriptor) io.ReadCloser { pr, pw := nio.Pipe(buffer.New(64 * 1024)) ctx, cancel := context.WithCancel(context.Background()) diff --git a/modal-go/sandbox_filesystem.go b/modal-go/sandbox_filesystem.go index f0667542..b9d7b62e 100644 --- a/modal-go/sandbox_filesystem.go +++ b/modal-go/sandbox_filesystem.go @@ -87,8 +87,11 @@ func runFilesystemExec(ctx context.Context, cpClient pb.ModalClientClient, req * retries := 10 totalRead := 0 + streamCtx, cancel := context.WithCancel(ctx) + defer cancel() + for { - outputIterator, err := cpClient.ContainerFilesystemExecGetOutput(ctx, pb.ContainerFilesystemExecGetOutputRequest_builder{ + outputIterator, err := cpClient.ContainerFilesystemExecGetOutput(streamCtx, pb.ContainerFilesystemExecGetOutputRequest_builder{ ExecId: resp.GetExecId(), Timeout: 55, }.Build()) diff --git a/modal-go/sandbox_test.go b/modal-go/sandbox_test.go index f38c89e0..b6b092b4 100644 --- a/modal-go/sandbox_test.go +++ b/modal-go/sandbox_test.go @@ -8,6 +8,7 @@ import ( ) func TestSandboxCreateRequestProto_WithoutPTY(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{}) @@ -19,6 +20,7 @@ func TestSandboxCreateRequestProto_WithoutPTY(t *testing.T) { } func TestSandboxCreateRequestProto_WithPTY(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -64,6 +66,7 @@ func TestContainerExecProto_WithPTY(t *testing.T) { } func TestSandboxCreateRequestProto_WithCPUAndCPULimit(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -78,6 +81,7 @@ func TestSandboxCreateRequestProto_WithCPUAndCPULimit(t *testing.T) { } func TestSandboxCreateRequestProto_CPULimitLowerThanCPU(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -89,6 +93,7 @@ func TestSandboxCreateRequestProto_CPULimitLowerThanCPU(t *testing.T) { } func TestSandboxCreateRequestProto_CPULimitWithoutCPU(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -99,6 +104,7 @@ func TestSandboxCreateRequestProto_CPULimitWithoutCPU(t *testing.T) { } func TestSandboxCreateRequestProto_WithMemoryAndMemoryLimit(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) req, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -113,6 +119,7 @@ func TestSandboxCreateRequestProto_WithMemoryAndMemoryLimit(t *testing.T) { } func TestSandboxCreateRequestProto_MemoryLimitLowerThanMemory(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -124,6 +131,7 @@ func TestSandboxCreateRequestProto_MemoryLimitLowerThanMemory(t *testing.T) { } func TestSandboxCreateRequestProto_MemoryLimitWithoutMemory(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -134,6 +142,7 @@ func TestSandboxCreateRequestProto_MemoryLimitWithoutMemory(t *testing.T) { } func TestSandboxCreateRequestProto_NegativeCPU(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ @@ -144,6 +153,7 @@ func TestSandboxCreateRequestProto_NegativeCPU(t *testing.T) { } func TestSandboxCreateRequestProto_NegativeMemory(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) _, err := buildSandboxCreateRequestProto("app-123", "img-456", SandboxCreateParams{ diff --git a/modal-go/test/image_test.go b/modal-go/test/image_test.go index 19722390..5390df8c 100644 --- a/modal-go/test/image_test.go +++ b/modal-go/test/image_test.go @@ -269,11 +269,13 @@ func TestDockerfileCommandsCopyCommandValidation(t *testing.T) { } func TestDockerfileCommandsWithOptions(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() mock := grpcmock.NewMockClient() defer func() { + mock.Close() g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) }() diff --git a/modal-go/test/main_test.go b/modal-go/test/main_test.go index 83e0b7f4..011a7a89 100644 --- a/modal-go/test/main_test.go +++ b/modal-go/test/main_test.go @@ -2,25 +2,42 @@ package test import ( "context" + "flag" "os" "testing" modal "github.com/modal-labs/libmodal/modal-go" "github.com/onsi/gomega" + "go.uber.org/goleak" ) // tc is the test Client, used for running tests against Modal infra. var tc *modal.Client +// checkLeaks enables package-level goroutine leak detection using goleak.VerifyTestMain. +// This approach works with t.Parallel() tests. +var checkLeaks = flag.Bool("check-leaks", false, "enable package-level goroutine leak detection (works with t.Parallel() tests)") + +var goleakOptions []goleak.Option + func TestMain(m *testing.M) { + flag.Parse() + c, err := modal.NewClient() if err != nil { panic(err) } tc = c - code := m.Run() - os.Exit(code) + // Capture baseline goroutines after client creation + goleakOptions = append(goleakOptions, goleak.IgnoreCurrent()) + + if *checkLeaks { + goleak.VerifyTestMain(m, goleakOptions...) + } else { + code := m.Run() + os.Exit(code) + } } func terminateSandbox(g *gomega.WithT, sb *modal.Sandbox) { diff --git a/modal-go/test/sandbox_test.go b/modal-go/test/sandbox_test.go index 21d40cb9..a3ad238a 100644 --- a/modal-go/test/sandbox_test.go +++ b/modal-go/test/sandbox_test.go @@ -5,7 +5,6 @@ import ( "fmt" "io" "math/rand" - "runtime" "testing" "time" @@ -647,73 +646,3 @@ func TestNamedSandboxNotFound(t *testing.T) { g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("not found")) } - -func TestNoGoroutineLeaksWithIgnoredOutput(t *testing.T) { - testCases := []struct { - name string - params *modal.SandboxExecParams - afterExec func(*gomega.WithT, *modal.ContainerProcess) - }{ - { - name: "with modal.Ignore", - params: &modal.SandboxExecParams{ - Stdout: modal.Ignore, - Stderr: modal.Ignore, - }, - afterExec: func(g *gomega.WithT, p *modal.ContainerProcess) {}, - }, - { - name: "with explicit Close", - params: &modal.SandboxExecParams{}, - afterExec: func(g *gomega.WithT, p *modal.ContainerProcess) { - err := p.Stdout.Close() - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - err = p.Stderr.Close() - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - }, - }, - } - - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - g := gomega.NewWithT(t) - ctx := context.Background() - - app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - - image := tc.Images.FromRegistry("alpine:3.21", nil) - - runtime.GC() - time.Sleep(100 * time.Millisecond) - initialGoroutines := runtime.NumGoroutine() - - sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ - Command: []string{"sh", "-c", "echo 'test output'; sleep 1"}, - }) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - defer terminateSandbox(g, sb) - - p, err := sb.Exec(ctx, []string{"echo", "exec output"}, tt.params) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - - tt.afterExec(g, p) - - exitCode, err := p.Wait(ctx) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(exitCode).To(gomega.Equal(0)) - - sandboxExitCode, err := sb.Wait(ctx) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(sandboxExitCode).To(gomega.Equal(0)) - - runtime.GC() - time.Sleep(500 * time.Millisecond) - - g.Eventually(func() int { - runtime.GC() - return runtime.NumGoroutine() - }, 5*time.Second, 100*time.Millisecond).Should(gomega.Equal(initialGoroutines)) - }) - } -} From f204d0e6a5d9492517cbdac49e0de9b287976007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Fors?= Date: Mon, 10 Nov 2025 11:44:48 +0100 Subject: [PATCH 42/59] Tiny readability improvement (#208) --- modal-go/image.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modal-go/image.go b/modal-go/image.go index d62d0972..ff8e4c4b 100644 --- a/modal-go/image.go +++ b/modal-go/image.go @@ -198,18 +198,18 @@ func (image *Image) waitForBuildIteration(ctx context.Context, imageID string, l for { item, err := stream.Recv() - if err != nil { - if err == io.EOF { - return nil, lastEntryID, nil - } + if err == io.EOF { + return nil, lastEntryID, nil + } else if err != nil { return nil, lastEntryID, err } + if item.GetEntryId() != "" { lastEntryID = item.GetEntryId() } - res := item.GetResult() // Ignore all log lines and progress updates. + res := item.GetResult() if res == nil || res.GetStatus() == pb.GenericResult_GENERIC_STATUS_UNSPECIFIED { continue } @@ -334,8 +334,7 @@ func (image *Image) Build(ctx context.Context, app *App) (*Image, error) { } // ImageDeleteParams are options for deleting an Image. -type ImageDeleteParams struct { -} +type ImageDeleteParams struct{} // Delete deletes an Image by ID. Warning: This removes an *entire Image*, and cannot be undone. func (s *imageServiceImpl) Delete(ctx context.Context, imageID string, params *ImageDeleteParams) error { From 156b18785d62b4759c00163f45f429bc40540514 Mon Sep 17 00:00:00 2001 From: Michael Waskom Date: Mon, 10 Nov 2025 09:02:04 -0500 Subject: [PATCH 43/59] Add deletion methods for Volume / Queue / Secret (#204) * Add Volume deletion methods * Add Secret delete methods * Make the Queue deletion match the other interfaces * Include object IDs in debugging logs * Add unit tests * Add reference docs * Fix error types * Lint * Make Queue.fromName raise a NotFoundError when missing * Update changelog * add explicit createIfMissing parameter in QueueDelete lookup --- CHANGELOG.md | 1 + modal-go/queue.go | 26 ++++++++++-- modal-go/secret.go | 44 +++++++++++++++++++ modal-go/test/queue_test.go | 80 +++++++++++++++++++++++++++++++++++ modal-go/test/secret_test.go | 82 ++++++++++++++++++++++++++++++++++++ modal-go/test/volume_test.go | 82 ++++++++++++++++++++++++++++++++++++ modal-go/volume.go | 39 +++++++++++++++++ modal-js/src/index.ts | 2 + modal-js/src/queue.ts | 67 +++++++++++++++++++++-------- modal-js/src/secret.ts | 34 +++++++++++++++ modal-js/src/volume.ts | 35 +++++++++++++++ modal-js/test/queue.test.ts | 42 +++++++++++++++++- modal-js/test/secret.test.ts | 41 ++++++++++++++++++ modal-js/test/volume.test.ts | 42 ++++++++++++++++++ 14 files changed, 595 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c76d9da..addb0a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Both client libraries are pre-1.0, and they have separate versioning. - Enabled [goleak](https://github.com/uber-go/goleak) for goroutine leak detection in tests. See [DEVELOPING.md](./DEVELOPING.md) for details. - Fixed all detected goroutine leaks in Sandboxes and Images. +- Added deletion methods for `Volume` and `Secret` objects and updated the deletion methods on `Queue` objects to support idempotent deletion via the `allowMissing` parameter. ## modal-js/v0.5.3, modal-go/v0.5.3 diff --git a/modal-go/queue.go b/modal-go/queue.go index 6883ce56..3d8aa258 100644 --- a/modal-go/queue.go +++ b/modal-go/queue.go @@ -116,6 +116,10 @@ func (s *queueServiceImpl) FromName(ctx context.Context, name string, params *Qu EnvironmentName: environmentName(params.Environment, s.client.profile), ObjectCreationType: creationType, }.Build()) + + if status, ok := status.FromError(err); ok && status.Code() == codes.NotFound { + return nil, NotFoundError{fmt.Sprintf("Queue '%s' not found", name)} + } if err != nil { return nil, err } @@ -131,21 +135,37 @@ func (s *queueServiceImpl) FromName(ctx context.Context, name string, params *Qu // QueueDeleteParams are options for client.Queues.Delete. type QueueDeleteParams struct { - Environment string + Environment string + AllowMissing bool } // Delete removes a Queue by name. +// +// Warning: Deletion is irreversible and will affect any Apps currently using the Queue. func (s *queueServiceImpl) Delete(ctx context.Context, name string, params *QueueDeleteParams) error { if params == nil { params = &QueueDeleteParams{} } - q, err := s.FromName(ctx, name, &QueueFromNameParams{Environment: params.Environment}) + q, err := s.FromName(ctx, name, &QueueFromNameParams{ + Environment: params.Environment, + CreateIfMissing: false, + }) + if err != nil { + if _, ok := err.(NotFoundError); ok && params.AllowMissing { + return nil + } return err } + _, err = s.client.cpClient.QueueDelete(ctx, pb.QueueDeleteRequest_builder{QueueId: q.QueueID}.Build()) - return err + if err != nil { + return err + } + + s.client.logger.DebugContext(ctx, "Deleted Queue", "queue_name", name, "queue_id", q.QueueID) + return nil } type QueueClearParams struct { diff --git a/modal-go/secret.go b/modal-go/secret.go index 3079c93c..9b4a3e60 100644 --- a/modal-go/secret.go +++ b/modal-go/secret.go @@ -2,14 +2,18 @@ package modal import ( "context" + "fmt" pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // SecretService provides Secret related operations. type SecretService interface { FromName(ctx context.Context, name string, params *SecretFromNameParams) (*Secret, error) FromMap(ctx context.Context, keyValuePairs map[string]string, params *SecretFromMapParams) (*Secret, error) + Delete(ctx context.Context, name string, params *SecretDeleteParams) error } type secretServiceImpl struct{ client *Client } @@ -38,6 +42,9 @@ func (s *secretServiceImpl) FromName(ctx context.Context, name string, params *S RequiredKeys: params.RequiredKeys, }.Build()) + if status, ok := status.FromError(err); ok && status.Code() == codes.NotFound { + return nil, NotFoundError{fmt.Sprintf("Secret '%s' not found", name)} + } if err != nil { return nil, err } @@ -51,6 +58,12 @@ type SecretFromMapParams struct { Environment string } +// SecretDeleteParams are options for client.Secrets.Delete. +type SecretDeleteParams struct { + Environment string + AllowMissing bool +} + // FromMap creates a Secret from a map of key-value pairs. func (s *secretServiceImpl) FromMap(ctx context.Context, keyValuePairs map[string]string, params *SecretFromMapParams) (*Secret, error) { if params == nil { @@ -70,6 +83,37 @@ func (s *secretServiceImpl) FromMap(ctx context.Context, keyValuePairs map[strin return &Secret{SecretID: resp.GetSecretId()}, nil } +// Delete deletes a named Secret. +// +// Warning: Deletion is irreversible and will affect any Apps currently using the Secret. +func (s *secretServiceImpl) Delete(ctx context.Context, name string, params *SecretDeleteParams) error { + if params == nil { + params = &SecretDeleteParams{} + } + + secret, err := s.FromName(ctx, name, &SecretFromNameParams{ + Environment: params.Environment, + }) + + if err != nil { + if _, ok := err.(NotFoundError); ok && params.AllowMissing { + return nil + } + return err + } + + _, err = s.client.cpClient.SecretDelete(ctx, pb.SecretDeleteRequest_builder{ + SecretId: secret.SecretID, + }.Build()) + + if err != nil { + return err + } + + s.client.logger.DebugContext(ctx, "Deleted Secret", "secret_name", name, "secret_id", secret.SecretID) + return nil +} + // mergeEnvIntoSecrets merges environment variables into the secrets list. // If env contains values, it creates a new Secret from the env map and appends it to the existing secrets. func mergeEnvIntoSecrets(ctx context.Context, client *Client, env *map[string]string, secrets *[]*Secret) ([]*Secret, error) { diff --git a/modal-go/test/queue_test.go b/modal-go/test/queue_test.go index 0693ab00..996d09d1 100644 --- a/modal-go/test/queue_test.go +++ b/modal-go/test/queue_test.go @@ -9,7 +9,10 @@ import ( "time" "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" + pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" "github.com/onsi/gomega" + "google.golang.org/protobuf/types/known/emptypb" ) func TestQueueInvalidName(t *testing.T) { @@ -201,3 +204,80 @@ func TestQueueNonEphemeral(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(value).To(gomega.Equal("data")) } + +func TestQueueDeleteSuccess(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/QueueGetOrCreate", + func(req *pb.QueueGetOrCreateRequest) (*pb.QueueGetOrCreateResponse, error) { + return pb.QueueGetOrCreateResponse_builder{ + QueueId: "qu-test-123", + }.Build(), nil + }, + ) + + grpcmock.HandleUnary( + mock, "/QueueDelete", + func(req *pb.QueueDeleteRequest) (*emptypb.Empty, error) { + g.Expect(req.GetQueueId()).To(gomega.Equal("qu-test-123")) + return &emptypb.Empty{}, nil + }, + ) + + err := mock.Queues.Delete(ctx, "test-queue", nil) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestQueueDeleteWithAllowMissing(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/QueueGetOrCreate", + func(req *pb.QueueGetOrCreateRequest) (*pb.QueueGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Queue 'missing' not found"} + }, + ) + + err := mock.Queues.Delete(ctx, "missing", &modal.QueueDeleteParams{ + AllowMissing: true, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestQueueDeleteWithAllowMissingFalseThrows(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/QueueGetOrCreate", + func(req *pb.QueueGetOrCreateRequest) (*pb.QueueGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Queue 'missing' not found"} + }, + ) + + err := mock.Queues.Delete(ctx, "missing", &modal.QueueDeleteParams{ + AllowMissing: false, + }) + g.Expect(err).Should(gomega.HaveOccurred()) +} diff --git a/modal-go/test/secret_test.go b/modal-go/test/secret_test.go index ccfaf4d6..19177e73 100644 --- a/modal-go/test/secret_test.go +++ b/modal-go/test/secret_test.go @@ -6,7 +6,10 @@ import ( "testing" "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" + pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" "github.com/onsi/gomega" + "google.golang.org/protobuf/types/known/emptypb" ) func TestSecretFromName(t *testing.T) { @@ -61,3 +64,82 @@ func TestSecretFromMap(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(string(output)).To(gomega.Equal("value\n")) } + +func TestSecretDeleteSuccess(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/SecretGetOrCreate", + func(req *pb.SecretGetOrCreateRequest) (*pb.SecretGetOrCreateResponse, error) { + return pb.SecretGetOrCreateResponse_builder{ + SecretId: "st-test-123", + }.Build(), nil + }, + ) + + grpcmock.HandleUnary( + mock, "/SecretDelete", + func(req *pb.SecretDeleteRequest) (*emptypb.Empty, error) { + g.Expect(req.GetSecretId()).To(gomega.Equal("st-test-123")) + return &emptypb.Empty{}, nil + }, + ) + + err := mock.Secrets.Delete(ctx, "test-secret", nil) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestSecretDeleteWithAllowMissing(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/SecretGetOrCreate", + func(req *pb.SecretGetOrCreateRequest) (*pb.SecretGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Secret 'missing' not found"} + }, + ) + + err := mock.Secrets.Delete(ctx, "missing", &modal.SecretDeleteParams{ + AllowMissing: true, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestSecretDeleteWithAllowMissingFalseThrows(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/SecretGetOrCreate", + func(req *pb.SecretGetOrCreateRequest) (*pb.SecretGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Secret 'missing' not found"} + }, + ) + + err := mock.Secrets.Delete(ctx, "missing", &modal.SecretDeleteParams{ + AllowMissing: false, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + var notFoundErr modal.NotFoundError + g.Expect(err).Should(gomega.BeAssignableToTypeOf(notFoundErr)) +} diff --git a/modal-go/test/volume_test.go b/modal-go/test/volume_test.go index 578c7c9e..5a331cff 100644 --- a/modal-go/test/volume_test.go +++ b/modal-go/test/volume_test.go @@ -5,7 +5,10 @@ import ( "testing" "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" + pb "github.com/modal-labs/libmodal/modal-go/proto/modal_proto" "github.com/onsi/gomega" + "google.golang.org/protobuf/types/known/emptypb" ) func TestVolumeFromName(t *testing.T) { @@ -57,3 +60,82 @@ func TestVolumeEphemeral(t *testing.T) { g.Expect(volume.IsReadOnly()).To(gomega.BeFalse()) g.Expect(volume.ReadOnly().IsReadOnly()).To(gomega.BeTrue()) } + +func TestVolumeDeleteSuccess(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/VolumeGetOrCreate", + func(req *pb.VolumeGetOrCreateRequest) (*pb.VolumeGetOrCreateResponse, error) { + return pb.VolumeGetOrCreateResponse_builder{ + VolumeId: "vo-test-123", + }.Build(), nil + }, + ) + + grpcmock.HandleUnary( + mock, "/VolumeDelete", + func(req *pb.VolumeDeleteRequest) (*emptypb.Empty, error) { + g.Expect(req.GetVolumeId()).To(gomega.Equal("vo-test-123")) + return &emptypb.Empty{}, nil + }, + ) + + err := mock.Volumes.Delete(ctx, "test-volume", nil) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestVolumeDeleteWithAllowMissing(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/VolumeGetOrCreate", + func(req *pb.VolumeGetOrCreateRequest) (*pb.VolumeGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Volume 'missing' not found"} + }, + ) + + err := mock.Volumes.Delete(ctx, "missing", &modal.VolumeDeleteParams{ + AllowMissing: true, + }) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} + +func TestVolumeDeleteWithAllowMissingFalseThrows(t *testing.T) { + t.Parallel() + g := gomega.NewWithT(t) + ctx := context.Background() + + mock := grpcmock.NewMockClient() + defer func() { + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) + }() + + grpcmock.HandleUnary( + mock, "/VolumeGetOrCreate", + func(req *pb.VolumeGetOrCreateRequest) (*pb.VolumeGetOrCreateResponse, error) { + return nil, modal.NotFoundError{Exception: "Volume 'missing' not found"} + }, + ) + + err := mock.Volumes.Delete(ctx, "missing", &modal.VolumeDeleteParams{ + AllowMissing: false, + }) + g.Expect(err).Should(gomega.HaveOccurred()) + var notFoundErr modal.NotFoundError + g.Expect(err).Should(gomega.BeAssignableToTypeOf(notFoundErr)) +} diff --git a/modal-go/volume.go b/modal-go/volume.go index 824e866f..5fc448a7 100644 --- a/modal-go/volume.go +++ b/modal-go/volume.go @@ -13,6 +13,7 @@ import ( type VolumeService interface { FromName(ctx context.Context, name string, params *VolumeFromNameParams) (*Volume, error) Ephemeral(ctx context.Context, params *VolumeEphemeralParams) (*Volume, error) + Delete(ctx context.Context, name string, params *VolumeDeleteParams) error } type volumeServiceImpl struct{ client *Client } @@ -79,6 +80,12 @@ type VolumeEphemeralParams struct { Environment string } +// VolumeDeleteParams are options for client.Volumes.Delete. +type VolumeDeleteParams struct { + Environment string + AllowMissing bool +} + // Ephemeral creates a nameless, temporary Volume, that persists until CloseEphemeral is called, or the process exits. func (s *volumeServiceImpl) Ephemeral(ctx context.Context, params *VolumeEphemeralParams) (*Volume, error) { if params == nil { @@ -120,3 +127,35 @@ func (v *Volume) CloseEphemeral() { panic(fmt.Sprintf("Volume %s is not ephemeral", v.VolumeID)) } } + +// Delete deletes a named Volume. +// +// Warning: Deletion is irreversible and will affect any Apps currently using the Volume. +func (s *volumeServiceImpl) Delete(ctx context.Context, name string, params *VolumeDeleteParams) error { + if params == nil { + params = &VolumeDeleteParams{} + } + + volume, err := s.FromName(ctx, name, &VolumeFromNameParams{ + Environment: params.Environment, + CreateIfMissing: false, + }) + + if err != nil { + if _, ok := err.(NotFoundError); ok && params.AllowMissing { + return nil + } + return err + } + + _, err = s.client.cpClient.VolumeDelete(ctx, pb.VolumeDeleteRequest_builder{ + VolumeId: volume.VolumeID, + }.Build()) + + if err != nil { + return err + } + + s.client.logger.DebugContext(ctx, "Deleted Volume", "volume_name", name, "volume_id", volume.VolumeID) + return nil +} diff --git a/modal-js/src/index.ts b/modal-js/src/index.ts index 08bc0568..59a96b8d 100644 --- a/modal-js/src/index.ts +++ b/modal-js/src/index.ts @@ -75,6 +75,7 @@ export { SecretService, type SecretFromNameParams, type SecretFromObjectParams, + type SecretDeleteParams, } from "./secret"; export { SandboxFile, type SandboxFileMode } from "./sandbox_filesystem"; export { @@ -82,6 +83,7 @@ export { VolumeService, type VolumeFromNameParams, type VolumeEphemeralParams, + type VolumeDeleteParams, } from "./volume"; export { Proxy, ProxyService, type ProxyFromNameParams } from "./proxy"; export { CloudBucketMount } from "./cloud_bucket_mount"; diff --git a/modal-js/src/queue.ts b/modal-js/src/queue.ts index 2a1a0851..76ba7091 100644 --- a/modal-js/src/queue.ts +++ b/modal-js/src/queue.ts @@ -5,7 +5,12 @@ import { QueueNextItemsRequest, } from "../proto/modal_proto/api"; import { getDefaultClient, type ModalClient } from "./client"; -import { InvalidError, QueueEmptyError, QueueFullError } from "./errors"; +import { + InvalidError, + NotFoundError, + QueueEmptyError, + QueueFullError, +} from "./errors"; import { dumps as pickleEncode, loads as pickleDecode } from "./pickle"; import { ClientError, Status } from "nice-grpc"; import { EphemeralHeartbeatManager } from "./ephemeral"; @@ -23,6 +28,7 @@ export type QueueFromNameParams = { /** Optional parameters for {@link QueueService#delete client.queues.delete()}. */ export type QueueDeleteParams = { environment?: string; + allowMissing?: boolean; }; /** Optional parameters for {@link QueueService#ephemeral client.queues.ephemeral()}. */ @@ -75,29 +81,54 @@ export class QueueService { name: string, params: QueueFromNameParams = {}, ): Promise { - const resp = await this.#client.cpClient.queueGetOrCreate({ - deploymentName: name, - objectCreationType: params.createIfMissing - ? ObjectCreationType.OBJECT_CREATION_TYPE_CREATE_IF_MISSING - : undefined, - environmentName: this.#client.environmentName(params.environment), - }); - this.#client.logger.debug( - "Retrieved Queue", - "queue_id", - resp.queueId, - "queue_name", - name, - ); - return new Queue(this.#client, resp.queueId, name); + try { + const resp = await this.#client.cpClient.queueGetOrCreate({ + deploymentName: name, + objectCreationType: params.createIfMissing + ? ObjectCreationType.OBJECT_CREATION_TYPE_CREATE_IF_MISSING + : undefined, + environmentName: this.#client.environmentName(params.environment), + }); + this.#client.logger.debug( + "Retrieved Queue", + "queue_id", + resp.queueId, + "queue_name", + name, + ); + return new Queue(this.#client, resp.queueId, name); + } catch (err) { + if (err instanceof ClientError && err.code === Status.NOT_FOUND) + throw new NotFoundError(err.details); + throw err; + } } /** * Delete a {@link Queue} by name. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Queue. */ async delete(name: string, params: QueueDeleteParams = {}): Promise { - const queue = await this.fromName(name, params); - await this.#client.cpClient.queueDelete({ queueId: queue.queueId }); + try { + const queue = await this.fromName(name, { + environment: params.environment, + createIfMissing: false, + }); + await this.#client.cpClient.queueDelete({ queueId: queue.queueId }); + this.#client.logger.debug( + "Deleted Queue", + "queue_name", + name, + "queue_id", + queue.queueId, + ); + } catch (err) { + if (err instanceof NotFoundError && params.allowMissing) { + return; + } + throw err; + } } } diff --git a/modal-js/src/secret.ts b/modal-js/src/secret.ts index 265be242..3c6eb781 100644 --- a/modal-js/src/secret.ts +++ b/modal-js/src/secret.ts @@ -14,6 +14,12 @@ export type SecretFromObjectParams = { environment?: string; }; +/** Optional parameters for {@link SecretService#delete client.secrets.delete()}. */ +export type SecretDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; + /** * Service for managing {@link Secret Secrets}. * @@ -94,6 +100,34 @@ export class SecretService { throw err; } } + + /** + * Delete a named {@link Secret}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Secret. + */ + async delete(name: string, params?: SecretDeleteParams): Promise { + try { + const secret = await this.fromName(name, { + environment: params?.environment, + }); + await this.#client.cpClient.secretDelete({ + secretId: secret.secretId, + }); + this.#client.logger.debug( + "Deleted Secret", + "secret_name", + name, + "secret_id", + secret.secretId, + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } } /** Secrets provide a dictionary of environment variables for {@link Image}s. */ diff --git a/modal-js/src/volume.ts b/modal-js/src/volume.ts index 22f12718..fcf17ba1 100644 --- a/modal-js/src/volume.ts +++ b/modal-js/src/volume.ts @@ -15,6 +15,12 @@ export type VolumeEphemeralParams = { environment?: string; }; +/** Optional parameters for {@link VolumeService#delete client.volumes.delete()}. */ +export type VolumeDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; + /** * Service for managing {@link Volume}s. * @@ -79,6 +85,35 @@ export class VolumeService { return new Volume(resp.volumeId, undefined, false, ephemeralHbManager); } + + /** + * Delete a named {@link Volume}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Volume. + */ + async delete(name: string, params?: VolumeDeleteParams): Promise { + try { + const volume = await this.fromName(name, { + environment: params?.environment, + createIfMissing: false, + }); + await this.#client.cpClient.volumeDelete({ + volumeId: volume.volumeId, + }); + this.#client.logger.debug( + "Deleted Volume", + "volume_name", + name, + "volume_id", + volume.volumeId, + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } } /** Volumes provide persistent storage that can be mounted in Modal {@link Function_ Function}s. */ diff --git a/modal-js/test/queue.test.ts b/modal-js/test/queue.test.ts index 65c69645..34bffd5d 100644 --- a/modal-js/test/queue.test.ts +++ b/modal-js/test/queue.test.ts @@ -1,8 +1,9 @@ import { tc } from "../test-support/test-client"; -import { Queue, QueueEmptyError } from "modal"; +import { Queue, QueueEmptyError, NotFoundError } from "modal"; import { expect, onTestFinished, test, vi } from "vitest"; import { ephemeralObjectHeartbeatSleep } from "../src/ephemeral"; import { createMockModalClients } from "../test-support/grpc_mock"; +import { ClientError, Status } from "nice-grpc"; test("QueueInvalidName", async () => { for (const name of ["has space", "has/slash", "a".repeat(65)]) { @@ -126,3 +127,42 @@ test("QueueEphemeralHeartbeatStopsAfterClose", async () => { mock.assertExhausted(); }); + +test("QueueDelete success", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/QueueGetOrCreate", () => ({ + queueId: "qu-test-123", + })); + + mock.handleUnary("/QueueDelete", (req: any) => { + expect(req.queueId).toBe("qu-test-123"); + return {}; + }); + + await mc.queues.delete("test-queue"); + mock.assertExhausted(); +}); + +test("QueueDelete with allowMissing=true", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/QueueGetOrCreate", () => { + throw new ClientError("", Status.NOT_FOUND, "Queue 'missing' not found"); + }); + + await mc.queues.delete("missing", { allowMissing: true }); + mock.assertExhausted(); +}); + +test("QueueDelete with allowMissing=false throws", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/QueueGetOrCreate", () => { + throw new ClientError("", Status.NOT_FOUND, "Queue 'missing' not found"); + }); + + await expect( + mc.queues.delete("missing", { allowMissing: false }), + ).rejects.toThrow(NotFoundError); +}); diff --git a/modal-js/test/secret.test.ts b/modal-js/test/secret.test.ts index 47d006cf..e13d92ad 100644 --- a/modal-js/test/secret.test.ts +++ b/modal-js/test/secret.test.ts @@ -1,6 +1,8 @@ import { tc } from "../test-support/test-client"; import { expect, test } from "vitest"; import { mergeEnvIntoSecrets } from "../src/secret"; +import { createMockModalClients } from "../test-support/grpc_mock"; +import { NotFoundError } from "../src/errors"; test("SecretFromName", async () => { const secret = await tc.secrets.fromName("libmodal-test-secret"); @@ -110,3 +112,42 @@ test("mergeEnvIntoSecrets with no env and no secrets returns empty array", async expect(result).toHaveLength(0); expect(result).toEqual([]); }); + +test("SecretDelete success", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/SecretGetOrCreate", () => ({ + secretId: "st-test-123", + })); + + mock.handleUnary("/SecretDelete", (req: any) => { + expect(req.secretId).toBe("st-test-123"); + return {}; + }); + + await mc.secrets.delete("test-secret"); + mock.assertExhausted(); +}); + +test("SecretDelete with allowMissing=true", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/SecretGetOrCreate", () => { + throw new NotFoundError("Secret 'missing' not found"); + }); + + await mc.secrets.delete("missing", { allowMissing: true }); + mock.assertExhausted(); +}); + +test("SecretDelete with allowMissing=false throws", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/SecretGetOrCreate", () => { + throw new NotFoundError("Secret 'missing' not found"); + }); + + await expect( + mc.secrets.delete("missing", { allowMissing: false }), + ).rejects.toThrow(NotFoundError); +}); diff --git a/modal-js/test/volume.test.ts b/modal-js/test/volume.test.ts index ae72e8c8..7406d682 100644 --- a/modal-js/test/volume.test.ts +++ b/modal-js/test/volume.test.ts @@ -1,5 +1,7 @@ import { tc } from "../test-support/test-client"; import { expect, test } from "vitest"; +import { createMockModalClients } from "../test-support/grpc_mock"; +import { NotFoundError } from "../src/errors"; test("Volume.fromName", async () => { const volume = await tc.volumes.fromName("libmodal-test-volume", { @@ -39,3 +41,43 @@ test("VolumeEphemeral", async () => { expect(volume.readOnly().isReadOnly).toBe(true); volume.closeEphemeral(); }); + +test("VolumeDelete success", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/VolumeGetOrCreate", () => ({ + volumeId: "vo-test-123", + metadata: { name: "test-volume" }, + })); + + mock.handleUnary("/VolumeDelete", (req: any) => { + expect(req.volumeId).toBe("vo-test-123"); + return {}; + }); + + await mc.volumes.delete("test-volume"); + mock.assertExhausted(); +}); + +test("VolumeDelete with allowMissing=true", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/VolumeGetOrCreate", () => { + throw new NotFoundError("Volume 'missing' not found"); + }); + + await mc.volumes.delete("missing", { allowMissing: true }); + mock.assertExhausted(); +}); + +test("VolumeDelete with allowMissing=false throws", async () => { + const { mockClient: mc, mockCpClient: mock } = createMockModalClients(); + + mock.handleUnary("/VolumeGetOrCreate", () => { + throw new NotFoundError("Volume 'missing' not found"); + }); + + await expect( + mc.volumes.delete("missing", { allowMissing: false }), + ).rejects.toThrow(NotFoundError); +}); From 345080a4f12f4d7aa18005ba71ff546838d39aad Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:09:58 +0100 Subject: [PATCH 44/59] [RELEASE] Prepare release for modal-js/v0.5.4, modal-go/v0.5.4 (#209) Co-authored-by: ehdr --- CHANGELOG.md | 4 ++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index addb0a51..e90de8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.4, modal-go/v0.5.4 + - Enabled [goleak](https://github.com/uber-go/goleak) for goroutine leak detection in tests. See [DEVELOPING.md](./DEVELOPING.md) for details. - Fixed all detected goroutine leaks in Sandboxes and Images. - Added deletion methods for `Volume` and `Secret` objects and updated the deletion methods on `Queue` objects to support idempotent deletion via the `allowMissing` parameter. diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 996e716c..8e20b77e 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.3", + "version": "0.5.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.3", + "version": "0.5.4", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 90ff30cb..87b0cab8 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.3", + "version": "0.5.4", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From a6cbd05a9de82ec80d629484f43daa277281d681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Fors?= Date: Wed, 12 Nov 2025 16:19:01 +0100 Subject: [PATCH 45/59] Use OIDC when authenticating with AWS (#211) --- .github/workflows/ci.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd58cddf..d00b5009 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,8 @@ name: CI +permissions: + id-token: write # id-token is required to for OIDC + on: push: branches: @@ -16,6 +19,11 @@ jobs: with: submodules: true + - uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1 + with: + role-to-assume: arn:aws:iam::459781239556:role/libmodal-ci-cd-role-62a288d + aws-region: us-east-1 + - name: Install uv uses: astral-sh/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5 with: @@ -45,9 +53,6 @@ jobs: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} MODAL_ENVIRONMENT: libmodal - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-1 MODAL_SYNC_ENTRYPOINT: 1 js: From 39b3cf32dea2a338aeb73d24041bb0cf8252f04a Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Wed, 12 Nov 2025 20:33:54 +0100 Subject: [PATCH 46/59] Add synchronicity[compile] extra (#212) * Add synchronicity[compile] extra * Actually use the right venv for the submodule --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d00b5009..8918b566 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,10 +34,13 @@ jobs: - name: Build submodule client working-directory: modal-client + env: + VIRTUAL_ENV: .venv run: | uv venv uv pip install -r requirements.dev.txt uv pip install . + uv pip install "synchronicity[compile]~=0.10.3" uv run inv protoc uv run inv type-stubs @@ -45,6 +48,7 @@ jobs: run: uv pip install ./modal-client - run: | + uv pip install ruff ruff check test-support/ ruff format --check test-support/ From d40e614574b27cfd63ee39d0cdc9a929bcc280d4 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 13 Nov 2025 10:03:54 +0100 Subject: [PATCH 47/59] Enable goroutine leak detection for all tests (#210) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Run more tests in parallel * Always close mock client * Run mock.AssertExhausted() at the end of tests, not in defer It doesn't make sense to check that the mock is exhausted unless the test has run to completion. * Enable Client cleanup before leak detection * Explicitly close gRPC conn's * Drop goleak.IgnoreCurrent() since it's no longer needed * Turn leak detection in tests on by default * Create new client per test case * Remove main_test in main package since it's no longer needed * Add a newGRPCMockClient test utility * Rename newModalClient to newTestClient --------- Co-authored-by: Örjan Fors --- CHANGELOG.md | 3 +- DEVELOPING.md | 2 +- modal-go/client.go | 76 ++++++++++++++----- modal-go/main_test.go | 20 ----- modal-go/test/auth_token_manager_test.go | 8 ++ modal-go/test/cls_test.go | 3 + modal-go/test/cls_with_options_test.go | 42 +++++----- modal-go/test/function_call_test.go | 2 + modal-go/test/function_test.go | 35 +++++---- modal-go/test/grpc_test.go | 4 +- modal-go/test/image_test.go | 19 +++-- modal-go/test/main_test.go | 37 +-------- modal-go/test/proxy_test.go | 2 + modal-go/test/queue_test.go | 28 ++++--- modal-go/test/retries_test.go | 1 + .../test/sandbox_filesystem_snapshot_test.go | 1 + modal-go/test/sandbox_filesystem_test.go | 36 +++++---- modal-go/test/sandbox_test.go | 21 +++++ modal-go/test/secret_test.go | 24 +++--- modal-go/test/testutils_test.go | 46 +++++++++++ modal-go/test/volume_test.go | 24 +++--- 21 files changed, 264 insertions(+), 170 deletions(-) delete mode 100644 modal-go/main_test.go create mode 100644 modal-go/test/testutils_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e90de8b4..ee8ccde2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased -No unreleased changes. +- Enabled goroutine leak detection for all tests by default. +- Fixed a few remaining goroutine leaks. ## modal-js/v0.5.4, modal-go/v0.5.4 diff --git a/DEVELOPING.md b/DEVELOPING.md index 1cc1e3cd..bb1f2ad6 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -70,7 +70,7 @@ We check the generated protobuf files into Git so that the package can be instal ### Testing -We use [goleak](https://github.com/uber-go/goleak) for goroutine leak detection, enabled by passing `-check-leaks` to `go test`. To identify which specific test is leaking, use [goleaks recommended method to find them](https://github.com/uber-go/goleak/?tab=readme-ov-file#determine-source-of-package-leaks), then use `go test -run` to run individual tests. +We use [goleak](https://github.com/uber-go/goleak) for goroutine leak detection. To identify which specific test is leaking, use [goleaks recommended method to find them](https://github.com/uber-go/goleak/?tab=readme-ov-file#determine-source-of-package-leaks), then use `go test -run` to run individual tests. ## How to publish diff --git a/modal-go/client.go b/modal-go/client.go index f6cb8773..ad40117b 100644 --- a/modal-go/client.go +++ b/modal-go/client.go @@ -38,6 +38,21 @@ var sdkVersion = sync.OnceValue(func() string { return "v0.0.0" }) +// clientWithConn wraps a ModalClientClient and its underlying gRPC connection +// to enable proper cleanup of connection-owned goroutines. +type clientWithConn struct { + pb.ModalClientClient + conn *grpc.ClientConn +} + +// Close closes the underlying gRPC connection, terminating all associated goroutines. +func (c *clientWithConn) Close() error { + if c.conn != nil { + return c.conn.Close() + } + return nil +} + // Client exposes services for interacting with Modal resources. // You should not instantiate it directly, and instead use [NewClient]/[NewClientWithOptions]. type Client struct { @@ -57,8 +72,8 @@ type Client struct { profile Profile sdkVersion string logger *slog.Logger - cpClient pb.ModalClientClient // control plane client - ipClients map[string]pb.ModalClientClient // input plane clients + cpClient *clientWithConn // control plane client + ipClients map[string]*clientWithConn // input plane clients authTokenManager *AuthTokenManager additionalUnaryInterceptors []grpc.UnaryClientInterceptor additionalStreamInterceptors []grpc.StreamClientInterceptor @@ -72,12 +87,19 @@ func NewClient() (*Client, error) { // ClientParams defines credentials and options for initializing the Modal client. type ClientParams struct { - TokenID string - TokenSecret string - Environment string - Config *config - Logger *slog.Logger + TokenID string + TokenSecret string + Environment string + Config *config + Logger *slog.Logger + // ControlPlaneClient is a custom gRPC client for testing. + // If provided, the client will use this instead of creating its own connection. + // Typically used with mock clients in tests. ControlPlaneClient pb.ModalClientClient + // ControlPlaneConn is the underlying gRPC connection for ControlPlaneClient. + // If provided, Client.Close() will close this connection for proper cleanup. + // Leave nil for mock clients that don't have real connections. + ControlPlaneConn *grpc.ClientConn // GRPCUnaryInterceptors allows custom gRPC unary interceptors for telemetry, tracing, and observability. // These are appended after Modal's built-in interceptors (header injection, auth, retry, timeout). // Note that the Modal gRPC API is not considered a public API, and can change without warning. @@ -134,7 +156,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { profile: profile, sdkVersion: sdkVersion(), logger: logger, - ipClients: make(map[string]pb.ModalClientClient), + ipClients: map[string]*clientWithConn{}, additionalUnaryInterceptors: params.GRPCUnaryInterceptors, additionalStreamInterceptors: params.GRPCStreamInterceptors, } @@ -142,12 +164,16 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { logger.Debug("Initializing Modal client", "version", sdkVersion(), "server_url", profile.ServerURL) if params.ControlPlaneClient != nil { - c.cpClient = params.ControlPlaneClient + c.cpClient = &clientWithConn{ + ModalClientClient: params.ControlPlaneClient, + conn: params.ControlPlaneConn, + } } else { - _, c.cpClient, err = newClient(profile, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) - } - if err != nil { - return nil, fmt.Errorf("failed to create control plane client: %w", err) + conn, client, err := newClient(profile, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) + if err != nil { + return nil, fmt.Errorf("failed to create control plane client: %w", err) + } + c.cpClient = &clientWithConn{ModalClientClient: client, conn: conn} } c.authTokenManager = NewAuthTokenManager(c.cpClient, c.logger) @@ -192,18 +218,34 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { c.logger.Debug("Creating input plane client", "server_url", serverURL) prof := c.profile prof.ServerURL = serverURL - _, client, err := newClient(prof, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) + conn, client, err := newClient(prof, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) if err != nil { return nil, err } - c.ipClients[serverURL] = client - return client, nil + c.ipClients[serverURL] = &clientWithConn{ModalClientClient: client, conn: conn} + return c.ipClients[serverURL], nil } -// Close stops the background auth token refresh. +// Close stops the background auth token refresh and closes all gRPC connections. func (c *Client) Close() { c.logger.Debug("Closing Modal client") c.authTokenManager.Stop() + + if c.cpClient != nil { + if err := c.cpClient.Close(); err != nil { + c.logger.Warn("Failed to close control plane connection", "error", err) + } + } + + c.mu.Lock() + for serverURL, client := range c.ipClients { + if err := client.Close(); err != nil { + c.logger.Warn("Failed to close input plane connection", "server_url", serverURL, "error", err) + } + } + c.ipClients = map[string]*clientWithConn{} + c.mu.Unlock() + c.logger.Debug("Modal client closed") } diff --git a/modal-go/main_test.go b/modal-go/main_test.go deleted file mode 100644 index 04b1d4a7..00000000 --- a/modal-go/main_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package modal - -import ( - "flag" - "os" - "testing" -) - -// The checkLeaks flag is defined and used in the test package in ./test. -// However when running tests across both packages (go test . ./test -check-leaks), -// Go passes it to both packages, and we get a "flag provided but not defined" warning -// if it's not also defined here. -var checkLeaks = flag.Bool("check-leaks", false, "ignored in this package, but defined in the test package") //nolint:unused - -func TestMain(m *testing.M) { - flag.Parse() - - code := m.Run() - os.Exit(code) -} diff --git a/modal-go/test/auth_token_manager_test.go b/modal-go/test/auth_token_manager_test.go index 59d8d63f..cd334b6d 100644 --- a/modal-go/test/auth_token_manager_test.go +++ b/modal-go/test/auth_token_manager_test.go @@ -44,6 +44,7 @@ func createTestJWT(expiry int64) string { } func TestAuthTokenManager_DecodeJWT(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -61,6 +62,7 @@ func TestAuthTokenManager_DecodeJWT(t *testing.T) { // Setting the initial token and having it cached. func TestAuthTokenManager_InitialFetch(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -82,6 +84,7 @@ func TestAuthTokenManager_InitialFetch(t *testing.T) { } func TestAuthTokenManager_IsExpired(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) manager := modal.NewAuthTokenManager(nil, slog.Default()) @@ -97,6 +100,7 @@ func TestAuthTokenManager_IsExpired(t *testing.T) { // Refreshing an expired token. Unlikely to occur since we refresh in background before expiry. func TestAuthTokenManager_RefreshExpiredToken(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -121,6 +125,7 @@ func TestAuthTokenManager_RefreshExpiredToken(t *testing.T) { } func TestAuthTokenManager_RefreshNearExpiryToken(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -146,6 +151,7 @@ func TestAuthTokenManager_RefreshNearExpiryToken(t *testing.T) { // Should error out if no valid token is available. func TestAuthTokenManager_GetToken_ExpiredToken(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -156,6 +162,7 @@ func TestAuthTokenManager_GetToken_ExpiredToken(t *testing.T) { } func TestClient_Close(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient := newMockAuthClient() @@ -171,6 +178,7 @@ func TestClient_Close(t *testing.T) { } func TestClient_MultipleInstancesSeparateManagers(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) mockClient1 := newMockAuthClient() diff --git a/modal-go/test/cls_test.go b/modal-go/test/cls_test.go index 74dc24de..5f16fc00 100644 --- a/modal-go/test/cls_test.go +++ b/modal-go/test/cls_test.go @@ -12,6 +12,7 @@ func TestClsCall(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) cls, err := tc.Cls.FromName(ctx, "libmodal-test-support", "EchoCls", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -46,6 +47,7 @@ func TestClsCall(t *testing.T) { func TestClsNotFound(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) + tc := newTestClient(t) _, err := tc.Cls.FromName(context.Background(), "libmodal-test-support", "NotRealClassName", nil) g.Expect(err).Should(gomega.BeAssignableToTypeOf(modal.NotFoundError{})) @@ -55,6 +57,7 @@ func TestClsCallInputPlane(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) cls, err := tc.Cls.FromName(ctx, "libmodal-test-support", "EchoClsInputPlane", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/cls_with_options_test.go b/modal-go/test/cls_with_options_test.go index b99c2dc8..88d74d40 100644 --- a/modal-go/test/cls_with_options_test.go +++ b/modal-go/test/cls_with_options_test.go @@ -24,10 +24,7 @@ func TestClsWithOptionsStacking(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -78,6 +75,8 @@ func TestClsWithOptionsStacking(t *testing.T) { instance, err := optioned.Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(instance).ToNot(gomega.BeNil()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestClsWithConcurrencyWithBatchingChaining(t *testing.T) { @@ -85,10 +84,7 @@ func TestClsWithConcurrencyWithBatchingChaining(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -123,6 +119,8 @@ func TestClsWithConcurrencyWithBatchingChaining(t *testing.T) { instance, err := chained.Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(instance).ToNot(gomega.BeNil()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestClsWithOptionsRetries(t *testing.T) { @@ -130,10 +128,7 @@ func TestClsWithOptionsRetries(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -171,6 +166,8 @@ func TestClsWithOptionsRetries(t *testing.T) { _, err = cls.WithOptions(&modal.ClsWithOptionsParams{Retries: retries}).Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestClsWithOptionsInvalidValues(t *testing.T) { @@ -178,10 +175,7 @@ func TestClsWithOptionsInvalidValues(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -212,6 +206,8 @@ func TestClsWithOptionsInvalidValues(t *testing.T) { _, err = cls.WithOptions(&modal.ClsWithOptionsParams{ScaledownWindow: &fractionalScaledown}).Instance(ctx, nil) g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).Should(gomega.ContainSubstring("whole number of seconds")) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestWithOptionsEmptySecretsDoesNotReplace(t *testing.T) { @@ -219,10 +215,7 @@ func TestWithOptionsEmptySecretsDoesNotReplace(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -248,6 +241,8 @@ func TestWithOptionsEmptySecretsDoesNotReplace(t *testing.T) { _, err = cls.WithOptions(&modal.ClsWithOptionsParams{Secrets: []*modal.Secret{}}).Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestWithOptionsEmptyVolumesDoesNotReplace(t *testing.T) { @@ -255,10 +250,7 @@ func TestWithOptionsEmptyVolumesDoesNotReplace(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -284,4 +276,6 @@ func TestWithOptionsEmptyVolumesDoesNotReplace(t *testing.T) { _, err = cls.WithOptions(&modal.ClsWithOptionsParams{Volumes: map[string]*modal.Volume{}}).Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } diff --git a/modal-go/test/function_call_test.go b/modal-go/test/function_call_test.go index c6f2ca97..ec3e30c4 100644 --- a/modal-go/test/function_call_test.go +++ b/modal-go/test/function_call_test.go @@ -13,6 +13,7 @@ func TestFunctionSpawn(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName( ctx, @@ -63,6 +64,7 @@ func TestFunctionCallGet0(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) sleep, _ := tc.Functions.FromName( ctx, diff --git a/modal-go/test/function_test.go b/modal-go/test/function_test.go index f0b72e0d..4ba6f86e 100644 --- a/modal-go/test/function_test.go +++ b/modal-go/test/function_test.go @@ -16,6 +16,7 @@ func TestFunctionCall(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "echo_string", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -36,6 +37,7 @@ func TestFunctionCallPreCborVersionError(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "test-support-1-1", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -50,6 +52,8 @@ func TestFunctionCallGoMap(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) + function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -71,14 +75,14 @@ func TestFunctionCallGoMap(t *testing.T) { reprResult, ok := resultSlice[1].(string) g.Expect(ok).Should(gomega.BeTrue()) g.Expect(reprResult).Should(gomega.Equal(`{'s': 'hello'}`)) - } func TestFunctionCallDateTimeRoundtrip(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) - ctx := context.Background() + tc := newTestClient(t) + function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -138,6 +142,7 @@ func TestFunctionCallLargeInput(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "bytelength", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -153,6 +158,7 @@ func TestFunctionNotFound(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) _, err := tc.Functions.FromName(ctx, "libmodal-test-support", "not_a_real_function", nil) g.Expect(err).Should(gomega.BeAssignableToTypeOf(modal.NotFoundError{})) @@ -162,6 +168,7 @@ func TestFunctionCallInputPlane(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "input_plane", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -177,10 +184,7 @@ func TestFunctionGetCurrentStats(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/FunctionGet", @@ -205,6 +209,8 @@ func TestFunctionGetCurrentStats(t *testing.T) { stats, err := f.GetCurrentStats(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(stats).To(gomega.Equal(&modal.FunctionStats{Backlog: 3, NumTotalRunners: 7})) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestFunctionUpdateAutoscaler(t *testing.T) { @@ -212,10 +218,7 @@ func TestFunctionUpdateAutoscaler(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/FunctionGet", @@ -263,6 +266,8 @@ func TestFunctionUpdateAutoscaler(t *testing.T) { MinContainers: ptrU32(2), }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func ptrU32(v uint32) *uint32 { return &v } @@ -272,10 +277,7 @@ func TestFunctionGetWebURL(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "FunctionGet", @@ -305,12 +307,15 @@ func TestFunctionGetWebURL(t *testing.T) { wef, err := mock.Functions.FromName(ctx, "libmodal-test-support", "web_endpoint", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(wef.GetWebURL()).To(gomega.Equal("https://endpoint.internal")) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestFunctionFromNameWithDotNotation(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) _, err := tc.Functions.FromName(ctx, "libmodal-test-support", "MyClass.myMethod", nil) g.Expect(err).Should(gomega.HaveOccurred()) @@ -321,6 +326,7 @@ func TestWebEndpointRemoteCallError(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "web_endpoint_echo", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -335,6 +341,7 @@ func TestWebEndpointSpawnCallError(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "web_endpoint_echo", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/grpc_test.go b/modal-go/test/grpc_test.go index 15c65001..c3bdd805 100644 --- a/modal-go/test/grpc_test.go +++ b/modal-go/test/grpc_test.go @@ -35,7 +35,7 @@ func (s *slowModalServer) AuthTokenGet(ctx context.Context, req *pb.AuthTokenGet return pb.AuthTokenGetResponse_builder{Token: "test-token"}.Build(), nil } -func TestAppFromName_RespectsContextDeadline(t *testing.T) { +func TestClientRespectsContextDeadline(t *testing.T) { t.Parallel() testCases := []struct { @@ -92,8 +92,10 @@ func TestAppFromName_RespectsContextDeadline(t *testing.T) { TokenSecret: "test-token-secret", Environment: "test", ControlPlaneClient: pb.NewModalClientClient(conn), + ControlPlaneConn: conn, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer client.Close() ctxWithTimeout, cancel := context.WithTimeout(context.Background(), tc.contextTimeout) defer cancel() diff --git a/modal-go/test/image_test.go b/modal-go/test/image_test.go index 5390df8c..467ab02d 100644 --- a/modal-go/test/image_test.go +++ b/modal-go/test/image_test.go @@ -15,6 +15,7 @@ func TestImageFromId(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -34,6 +35,7 @@ func TestImageFromRegistry(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -52,6 +54,7 @@ func TestImageFromRegistryWithSecret(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -72,6 +75,7 @@ func TestImageFromAwsEcr(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -90,6 +94,7 @@ func TestImageFromGcpArtifactRegistry(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -108,6 +113,7 @@ func TestCreateSandboxWithImage(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -126,6 +132,7 @@ func TestImageDelete(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -156,6 +163,7 @@ func TestDockerfileCommands(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -179,6 +187,7 @@ func TestDockerfileCommands(t *testing.T) { func TestDockerfileCommandsEmptyArrayNoOp(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) + tc := newTestClient(t) image1 := tc.Images.FromRegistry("alpine:3.21", nil) image2 := image1.DockerfileCommands([]string{}, nil) @@ -189,6 +198,7 @@ func TestDockerfileCommandsChaining(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -227,6 +237,7 @@ func TestDockerfileCommandsCopyCommandValidation(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -273,11 +284,7 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - mock.Close() - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "ImageGetOrCreate", @@ -377,4 +384,6 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(builtImage.ImageID).To(gomega.Equal("im-layer3")) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } diff --git a/modal-go/test/main_test.go b/modal-go/test/main_test.go index 011a7a89..a9e24f8b 100644 --- a/modal-go/test/main_test.go +++ b/modal-go/test/main_test.go @@ -1,46 +1,11 @@ package test import ( - "context" - "flag" - "os" "testing" - modal "github.com/modal-labs/libmodal/modal-go" - "github.com/onsi/gomega" "go.uber.org/goleak" ) -// tc is the test Client, used for running tests against Modal infra. -var tc *modal.Client - -// checkLeaks enables package-level goroutine leak detection using goleak.VerifyTestMain. -// This approach works with t.Parallel() tests. -var checkLeaks = flag.Bool("check-leaks", false, "enable package-level goroutine leak detection (works with t.Parallel() tests)") - -var goleakOptions []goleak.Option - func TestMain(m *testing.M) { - flag.Parse() - - c, err := modal.NewClient() - if err != nil { - panic(err) - } - tc = c - - // Capture baseline goroutines after client creation - goleakOptions = append(goleakOptions, goleak.IgnoreCurrent()) - - if *checkLeaks { - goleak.VerifyTestMain(m, goleakOptions...) - } else { - code := m.Run() - os.Exit(code) - } -} - -func terminateSandbox(g *gomega.WithT, sb *modal.Sandbox) { - err := sb.Terminate(context.Background()) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) + goleak.VerifyTestMain(m) } diff --git a/modal-go/test/proxy_test.go b/modal-go/test/proxy_test.go index 227d6281..80d13aa9 100644 --- a/modal-go/test/proxy_test.go +++ b/modal-go/test/proxy_test.go @@ -13,6 +13,7 @@ func TestCreateSandboxWithProxy(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -43,6 +44,7 @@ func TestProxyNotFound(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) _, err := tc.Proxies.FromName(ctx, "non-existent-proxy-name", nil) g.Expect(err).Should(gomega.HaveOccurred()) diff --git a/modal-go/test/queue_test.go b/modal-go/test/queue_test.go index 996d09d1..b98108af 100644 --- a/modal-go/test/queue_test.go +++ b/modal-go/test/queue_test.go @@ -18,6 +18,7 @@ import ( func TestQueueInvalidName(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) + tc := newTestClient(t) for _, name := range []string{"has space", "has/slash", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"} { _, err := tc.Queues.FromName(context.Background(), name, nil) @@ -29,6 +30,7 @@ func TestQueueEphemeral(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queue, err := tc.Queues.Ephemeral(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -51,6 +53,7 @@ func TestQueueSuite1(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queue, err := tc.Queues.Ephemeral(ctx, nil) g.Expect(err).ToNot(gomega.HaveOccurred()) @@ -103,6 +106,7 @@ func TestQueueSuite2(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queue, err := tc.Queues.Ephemeral(ctx, nil) g.Expect(err).ToNot(gomega.HaveOccurred()) @@ -138,6 +142,7 @@ func TestQueuePutAndGetMany(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queue, err := tc.Queues.Ephemeral(ctx, nil) g.Expect(err).ToNot(gomega.HaveOccurred()) @@ -158,6 +163,7 @@ func TestQueueNonBlocking(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queue, err := tc.Queues.Ephemeral(ctx, nil) g.Expect(err).ToNot(gomega.HaveOccurred()) @@ -180,6 +186,7 @@ func TestQueueNonEphemeral(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) queueName := "test-queue-" + strconv.FormatInt(time.Now().UnixNano(), 10) queue1, err := tc.Queues.FromName(ctx, queueName, &modal.QueueFromNameParams{CreateIfMissing: true}) @@ -210,10 +217,7 @@ func TestQueueDeleteSuccess(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/QueueGetOrCreate", @@ -234,6 +238,8 @@ func TestQueueDeleteSuccess(t *testing.T) { err := mock.Queues.Delete(ctx, "test-queue", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestQueueDeleteWithAllowMissing(t *testing.T) { @@ -241,10 +247,7 @@ func TestQueueDeleteWithAllowMissing(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/QueueGetOrCreate", @@ -257,6 +260,8 @@ func TestQueueDeleteWithAllowMissing(t *testing.T) { AllowMissing: true, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestQueueDeleteWithAllowMissingFalseThrows(t *testing.T) { @@ -264,10 +269,7 @@ func TestQueueDeleteWithAllowMissingFalseThrows(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/QueueGetOrCreate", @@ -280,4 +282,6 @@ func TestQueueDeleteWithAllowMissingFalseThrows(t *testing.T) { AllowMissing: false, }) g.Expect(err).Should(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } diff --git a/modal-go/test/retries_test.go b/modal-go/test/retries_test.go index 1969cbc8..1eb32940 100644 --- a/modal-go/test/retries_test.go +++ b/modal-go/test/retries_test.go @@ -9,6 +9,7 @@ import ( ) func TestRetriesConstructor(t *testing.T) { + t.Parallel() g := gomega.NewWithT(t) backoff := float32(2.0) diff --git a/modal-go/test/sandbox_filesystem_snapshot_test.go b/modal-go/test/sandbox_filesystem_snapshot_test.go index e7707a88..d6af885b 100644 --- a/modal-go/test/sandbox_filesystem_snapshot_test.go +++ b/modal-go/test/sandbox_filesystem_snapshot_test.go @@ -14,6 +14,7 @@ func TestSnapshotFilesystem(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/sandbox_filesystem_test.go b/modal-go/test/sandbox_filesystem_test.go index 48a2a8e4..ffb969b4 100644 --- a/modal-go/test/sandbox_filesystem_test.go +++ b/modal-go/test/sandbox_filesystem_test.go @@ -10,8 +10,8 @@ import ( "github.com/onsi/gomega" ) -func createSandbox(g *gomega.WithT) *modal.Sandbox { - ctx := context.Background() +func createSandbox(ctx context.Context, g *gomega.WithT, tc *modal.Client) *modal.Sandbox { + g.THelper() app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -27,9 +27,10 @@ func createSandbox(g *gomega.WithT) *modal.Sandbox { func TestSandboxWriteAndReadBinaryFile(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) - sb := createSandbox(g) - defer terminateSandbox(g, sb) ctx := context.Background() + tc := newTestClient(t) + sb := createSandbox(ctx, g, tc) + defer terminateSandbox(g, sb) writer, err := sb.Open(ctx, "/tmp/test.bin", "w") g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -56,10 +57,11 @@ func TestSandboxWriteAndReadBinaryFile(t *testing.T) { func TestSandboxAppendToFileBinary(t *testing.T) { t.Parallel() + ctx := context.Background() g := gomega.NewWithT(t) - sb := createSandbox(g) + c := newTestClient(t) + sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - ctx := context.Background() writer, err := sb.Open(ctx, "/tmp/append.txt", "w") g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -87,12 +89,14 @@ func TestSandboxAppendToFileBinary(t *testing.T) { err = reader.Close() g.Expect(err).ShouldNot(gomega.HaveOccurred()) } + func TestSandboxFileFlush(t *testing.T) { t.Parallel() + ctx := context.Background() g := gomega.NewWithT(t) - sb := createSandbox(g) + c := newTestClient(t) + sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - ctx := context.Background() writer, err := sb.Open(ctx, "/tmp/flush.txt", "w") g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -119,10 +123,11 @@ func TestSandboxFileFlush(t *testing.T) { func TestSandboxMultipleFileOperations(t *testing.T) { t.Parallel() + ctx := context.Background() g := gomega.NewWithT(t) - sb := createSandbox(g) + c := newTestClient(t) + sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - ctx := context.Background() content1 := []byte("File 1 content") writer, err := sb.Open(ctx, "/tmp/file1.txt", "w") @@ -158,15 +163,15 @@ func TestSandboxMultipleFileOperations(t *testing.T) { g.Expect(readContent1).Should(gomega.Equal(content1)) g.Expect(readContent2).Should(gomega.Equal(content2)) - } func TestSandboxFileOpenModes(t *testing.T) { t.Parallel() + ctx := context.Background() g := gomega.NewWithT(t) - sb := createSandbox(g) + c := newTestClient(t) + sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - ctx := context.Background() // Test write mode (truncates) content1 := []byte("Initial content") @@ -210,10 +215,11 @@ func TestSandboxFileOpenModes(t *testing.T) { func TestSandboxLargeFileOperations(t *testing.T) { t.Parallel() + ctx := context.Background() g := gomega.NewWithT(t) - sb := createSandbox(g) + c := newTestClient(t) + sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - ctx := context.Background() xByte := []byte{'x'} largeData := bytes.Repeat(xByte, 1000) diff --git a/modal-go/test/sandbox_test.go b/modal-go/test/sandbox_test.go index a3ad238a..5f9a518c 100644 --- a/modal-go/test/sandbox_test.go +++ b/modal-go/test/sandbox_test.go @@ -16,6 +16,7 @@ func TestCreateOneSandbox(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -40,6 +41,7 @@ func TestPassCatToStdin(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -64,6 +66,7 @@ func TestIgnoreLargeStdout(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -91,6 +94,7 @@ func TestSandboxCreateOptions(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{ CreateIfMissing: true, @@ -132,6 +136,7 @@ func TestSandboxExecOptions(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -162,6 +167,7 @@ func TestSandboxWithVolume(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{ CreateIfMissing: true, @@ -194,6 +200,7 @@ func TestSandboxWithReadOnlyVolume(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{ CreateIfMissing: true, @@ -232,6 +239,7 @@ func TestSandboxWithTunnels(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{ CreateIfMissing: true, @@ -280,6 +288,7 @@ func TestCreateSandboxWithSecrets(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) secret, err := tc.Secrets.FromName(ctx, "libmodal-test-secret", &modal.SecretFromNameParams{RequiredKeys: []string{"c"}}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -296,10 +305,12 @@ func TestCreateSandboxWithSecrets(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(string(output)).To(gomega.Equal("hello world\n")) } + func TestSandboxPollAndReturnCode(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -333,6 +344,7 @@ func TestSandboxPollAfterFailure(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -358,6 +370,7 @@ func TestCreateSandboxWithNetworkAccessParams(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{ CreateIfMissing: true, @@ -400,6 +413,7 @@ func TestSandboxExecSecret(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -428,6 +442,7 @@ func TestSandboxFromId(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -449,6 +464,7 @@ func TestSandboxWithWorkdir(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -481,6 +497,7 @@ func TestSandboxSetTagsAndList(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -519,6 +536,7 @@ func TestSandboxTags(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -576,6 +594,7 @@ func TestSandboxListByAppId(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -604,6 +623,7 @@ func TestNamedSandbox(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -641,6 +661,7 @@ func TestNamedSandboxNotFound(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) _, err := tc.Sandboxes.FromName(ctx, "libmodal-test", "non-existent-sandbox", nil) g.Expect(err).Should(gomega.HaveOccurred()) diff --git a/modal-go/test/secret_test.go b/modal-go/test/secret_test.go index 19177e73..a803ddfe 100644 --- a/modal-go/test/secret_test.go +++ b/modal-go/test/secret_test.go @@ -16,6 +16,7 @@ func TestSecretFromName(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) secret, err := tc.Secrets.FromName(ctx, "libmodal-test-secret", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -30,6 +31,7 @@ func TestSecretFromNameWithRequiredKeys(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) secret, err := tc.Secrets.FromName(ctx, "libmodal-test-secret", &modal.SecretFromNameParams{ RequiredKeys: []string{"a", "b", "c"}, @@ -47,6 +49,7 @@ func TestSecretFromMap(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -70,10 +73,7 @@ func TestSecretDeleteSuccess(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/SecretGetOrCreate", @@ -94,6 +94,8 @@ func TestSecretDeleteSuccess(t *testing.T) { err := mock.Secrets.Delete(ctx, "test-secret", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestSecretDeleteWithAllowMissing(t *testing.T) { @@ -101,10 +103,7 @@ func TestSecretDeleteWithAllowMissing(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/SecretGetOrCreate", @@ -117,6 +116,8 @@ func TestSecretDeleteWithAllowMissing(t *testing.T) { AllowMissing: true, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestSecretDeleteWithAllowMissingFalseThrows(t *testing.T) { @@ -124,10 +125,7 @@ func TestSecretDeleteWithAllowMissingFalseThrows(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/SecretGetOrCreate", @@ -142,4 +140,6 @@ func TestSecretDeleteWithAllowMissingFalseThrows(t *testing.T) { g.Expect(err).Should(gomega.HaveOccurred()) var notFoundErr modal.NotFoundError g.Expect(err).Should(gomega.BeAssignableToTypeOf(notFoundErr)) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } diff --git a/modal-go/test/testutils_test.go b/modal-go/test/testutils_test.go new file mode 100644 index 00000000..f284bcbf --- /dev/null +++ b/modal-go/test/testutils_test.go @@ -0,0 +1,46 @@ +package test + +import ( + "context" + "net/http" + "testing" + + modal "github.com/modal-labs/libmodal/modal-go" + "github.com/modal-labs/libmodal/modal-go/internal/grpcmock" + "github.com/onsi/gomega" +) + +func newTestClient(t *testing.T) *modal.Client { + t.Helper() + + c, err := modal.NewClient() + if err != nil { + t.Fatal(err) + } + + t.Cleanup(func() { + c.Close() + + // Close idle http connections to silence goleak. + http.DefaultClient.CloseIdleConnections() + }) + + return c +} + +func newGRPCMockClient(t *testing.T) *grpcmock.MockClient { + t.Helper() + + mock := grpcmock.NewMockClient() + + t.Cleanup(func() { + mock.Close() + }) + + return mock +} + +func terminateSandbox(g *gomega.WithT, sb *modal.Sandbox) { + err := sb.Terminate(context.Background()) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) +} diff --git a/modal-go/test/volume_test.go b/modal-go/test/volume_test.go index 5a331cff..2ba5e5d7 100644 --- a/modal-go/test/volume_test.go +++ b/modal-go/test/volume_test.go @@ -15,6 +15,7 @@ func TestVolumeFromName(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) volume, err := tc.Volumes.FromName(ctx, "libmodal-test-volume", &modal.VolumeFromNameParams{ CreateIfMissing: true, @@ -32,6 +33,7 @@ func TestVolumeReadOnly(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) ctx := context.Background() + tc := newTestClient(t) volume, err := tc.Volumes.FromName(ctx, "libmodal-test-volume", &modal.VolumeFromNameParams{ CreateIfMissing: true, @@ -51,6 +53,7 @@ func TestVolumeReadOnly(t *testing.T) { func TestVolumeEphemeral(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) + tc := newTestClient(t) volume, err := tc.Volumes.Ephemeral(context.Background(), nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -66,10 +69,7 @@ func TestVolumeDeleteSuccess(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/VolumeGetOrCreate", @@ -90,6 +90,8 @@ func TestVolumeDeleteSuccess(t *testing.T) { err := mock.Volumes.Delete(ctx, "test-volume", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestVolumeDeleteWithAllowMissing(t *testing.T) { @@ -97,10 +99,7 @@ func TestVolumeDeleteWithAllowMissing(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/VolumeGetOrCreate", @@ -113,6 +112,8 @@ func TestVolumeDeleteWithAllowMissing(t *testing.T) { AllowMissing: true, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } func TestVolumeDeleteWithAllowMissingFalseThrows(t *testing.T) { @@ -120,10 +121,7 @@ func TestVolumeDeleteWithAllowMissingFalseThrows(t *testing.T) { g := gomega.NewWithT(t) ctx := context.Background() - mock := grpcmock.NewMockClient() - defer func() { - g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) - }() + mock := newGRPCMockClient(t) grpcmock.HandleUnary( mock, "/VolumeGetOrCreate", @@ -138,4 +136,6 @@ func TestVolumeDeleteWithAllowMissingFalseThrows(t *testing.T) { g.Expect(err).Should(gomega.HaveOccurred()) var notFoundErr modal.NotFoundError g.Expect(err).Should(gomega.BeAssignableToTypeOf(notFoundErr)) + + g.Expect(mock.AssertExhausted()).ShouldNot(gomega.HaveOccurred()) } From c0d30ad2fe9d81f53094bfd96f1eda5ea10b6d06 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 13 Nov 2025 10:11:59 +0100 Subject: [PATCH 48/59] Remove log statements from tests (#213) * Remove log statements from tests * Use mock JWT token with exp, to silence warnings in tests Without it we get warnings like: ``` msg="x-modal-auth-token does not contain exp field" ``` --- modal-go/test/function_test.go | 25 ++----------------------- modal-go/test/grpc_test.go | 5 ++++- modal-js/test/function.test.ts | 15 --------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/modal-go/test/function_test.go b/modal-go/test/function_test.go index 4ba6f86e..afbc087e 100644 --- a/modal-go/test/function_test.go +++ b/modal-go/test/function_test.go @@ -57,20 +57,14 @@ func TestFunctionCallGoMap(t *testing.T) { function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Represent Python kwargs. inputArg := map[string]any{"s": "hello"} result, err := function.Remote(ctx, []any{inputArg}, nil) - t.Log("result", result) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // "Explode" result into two parts, assuming it's a slice/array of length 2. resultSlice, ok := result.([]any) g.Expect(ok).Should(gomega.BeTrue()) g.Expect(len(resultSlice)).Should(gomega.Equal(2)) - // Assert and type the first element as string - identityResult := resultSlice[0] - // Use custom comparison for deep equality ignoring concrete types (e.g. map[string]interface{} vs map[string]any) - g.Expect(compareFlexible(identityResult, inputArg)).Should(gomega.BeTrue()) + g.Expect(compareFlexible(resultSlice[0], inputArg)).Should(gomega.BeTrue()) reprResult, ok := resultSlice[1].(string) g.Expect(ok).Should(gomega.BeTrue()) @@ -86,7 +80,6 @@ func TestFunctionCallDateTimeRoundtrip(t *testing.T) { function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Test: Send a Go time.Time to Python and see how it's represented testTime := time.Date(2024, 1, 15, 10, 30, 45, 123456789, time.UTC) result, err := function.Remote(ctx, []any{testTime}, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -96,32 +89,19 @@ func TestFunctionCallDateTimeRoundtrip(t *testing.T) { g.Expect(ok).Should(gomega.BeTrue()) g.Expect(len(resultSlice)).Should(gomega.Equal(2)) - // Check what we got back (should be the original time, potentially with precision loss) - identityResult := resultSlice[0] - t.Logf("Go sent: %s", testTime.String()) - t.Logf("Go received back: %+v (type: %T)", identityResult, identityResult) - - // Check the Python representation reprResult, ok := resultSlice[1].(string) g.Expect(ok).Should(gomega.BeTrue()) - t.Logf("Python repr: %s", reprResult) g.Expect(reprResult).Should(gomega.ContainSubstring("datetime.datetime")) g.Expect(reprResult).Should(gomega.ContainSubstring("2024")) - t.Logf("✅ SUCCESS: Go time.Time was received as Python datetime.datetime") - // Verify the roundtrip - we should get back a time.Time - receivedTime, ok := identityResult.(time.Time) + receivedTime, ok := resultSlice[0].(time.Time) g.Expect(ok).Should(gomega.BeTrue()) - // Check precision timeDiff := testTime.Sub(receivedTime) if timeDiff < 0 { timeDiff = -timeDiff } - t.Logf("Original time: %v", testTime) - t.Logf("Received time: %v", receivedTime) - t.Logf("Time difference after roundtrip: %v (%v nanoseconds)", timeDiff, timeDiff.Nanoseconds()) // Python's datetime has microsecond precision (not nanosecond) // CBOR encodes time.Time with TimeRFC3339Nano (nanosecond precision) @@ -134,7 +114,6 @@ func TestFunctionCallDateTimeRoundtrip(t *testing.T) { // So we should lose exactly 789 nanoseconds g.Expect(timeDiff).Should(gomega.BeNumerically("<", time.Microsecond)) - // Verify the times are equal when truncated to microseconds g.Expect(receivedTime.Truncate(time.Microsecond)).Should(gomega.Equal(testTime.Truncate(time.Microsecond))) } diff --git a/modal-go/test/grpc_test.go b/modal-go/test/grpc_test.go index c3bdd805..33d25758 100644 --- a/modal-go/test/grpc_test.go +++ b/modal-go/test/grpc_test.go @@ -32,7 +32,10 @@ func (s *slowModalServer) AppGetOrCreate(ctx context.Context, req *pb.AppGetOrCr } func (s *slowModalServer) AuthTokenGet(ctx context.Context, req *pb.AuthTokenGetRequest) (*pb.AuthTokenGetResponse, error) { - return pb.AuthTokenGetResponse_builder{Token: "test-token"}.Build(), nil + // Mock JWT with "x" mock header, base64 enc of {"exp":9999999999}, and "x" mock signature, + // since AuthTokenManager.FetchToken() warns if the JWT doesn't have an "exp" field. + const mockJWT = "x.eyJleHAiOjk5OTk5OTk5OTl9.x" + return pb.AuthTokenGetResponse_builder{Token: mockJWT}.Build(), nil } func TestClientRespectsContextDeadline(t *testing.T) { diff --git a/modal-js/test/function.test.ts b/modal-js/test/function.test.ts index 3f01de3b..284d4a97 100644 --- a/modal-js/test/function.test.ts +++ b/modal-js/test/function.test.ts @@ -10,11 +10,9 @@ test("FunctionCall", async () => { "echo_string", ); - // Represent Python kwargs. const resultKwargs = await function_.remote([], { s: "hello" }); expect(resultKwargs).toBe("output: hello"); - // Try the same, but with args. const resultArgs = await function_.remote(["hello"]); expect(resultArgs).toBe("output: hello"); }); @@ -25,7 +23,6 @@ test("FunctionCallJsMap", async () => { "identity_with_repr", ); - // Represent Python kwargs. const resultKwargs = await function_.remote([new Map([["a", "b"]])]); expect(resultKwargs).toStrictEqual([{ a: "b" }, "{'a': 'b'}"]); }); @@ -36,26 +33,17 @@ test("FunctionCallDateTimeRoundtrip", async () => { "identity_with_repr", ); - // Test: Send a JS Date to Python and see how it's represented const testDate = new Date("2024-01-15T10:30:45.123Z"); const result = await function_.remote([testDate]); - // Parse the result - identity_with_repr returns [input, repr(input)] expect(Array.isArray(result)).toBe(true); expect(result).toHaveLength(2); const [identityResult, reprResult] = result as [unknown, string]; - console.log("JS sent:", testDate.toISOString()); - console.log("JS received back:", identityResult); - console.log("Python repr:", reprResult); - - // Check the Python representation expect(reprResult).toContain("datetime.datetime"); expect(reprResult).toContain("2024"); - console.log("✅ SUCCESS: JS Date was received as Python datetime.datetime"); - // Verify the roundtrip - we should get back a Date expect(identityResult).toBeInstanceOf(Date); const receivedDate = identityResult as Date; @@ -63,9 +51,6 @@ test("FunctionCallDateTimeRoundtrip", async () => { // Python datetime has microsecond precision // We should get back millisecond precision (lose sub-millisecond) const timeDiff = Math.abs(testDate.getTime() - receivedDate.getTime()); - console.log( - `Time difference after roundtrip: ${timeDiff}ms (${timeDiff * 1000000}ns)`, - ); // JavaScript Date only has millisecond precision, so we should have no loss expect(timeDiff).toBeLessThan(1); // Less than 1 millisecond From fb4200e22920e720af1528bce8e7880673f584cc Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 13 Nov 2025 10:21:04 +0100 Subject: [PATCH 49/59] Use fmt instead of log for example output in Go (#214) --- modal-go/examples/cls-call-with-options/main.go | 5 +++-- modal-go/examples/cls-call/main.go | 5 +++-- modal-go/examples/function-call/main.go | 5 +++-- modal-go/examples/function-spawn/main.go | 3 ++- modal-go/examples/sandbox-cloud-bucket/main.go | 5 +++-- modal-go/examples/sandbox-exec/main.go | 9 +++++---- .../examples/sandbox-filesystem-snapshot/main.go | 13 +++++++------ modal-go/examples/sandbox-filesystem/main.go | 4 ++-- modal-go/examples/sandbox-gpu/main.go | 7 ++++--- modal-go/examples/sandbox-prewarm/main.go | 5 +++-- modal-go/examples/sandbox-private-image/main.go | 5 +++-- modal-go/examples/sandbox-proxy/main.go | 7 ++++--- modal-go/examples/sandbox-secrets/main.go | 5 +++-- modal-go/examples/sandbox-tunnels/main.go | 16 ++++++++-------- modal-go/examples/sandbox/main.go | 7 ++++--- 15 files changed, 57 insertions(+), 44 deletions(-) diff --git a/modal-go/examples/cls-call-with-options/main.go b/modal-go/examples/cls-call-with-options/main.go index 67f2264a..d913f6c5 100644 --- a/modal-go/examples/cls-call-with-options/main.go +++ b/modal-go/examples/cls-call-with-options/main.go @@ -5,6 +5,7 @@ package main import ( "context" + "fmt" "log" "github.com/modal-labs/libmodal/modal-go" @@ -59,12 +60,12 @@ func main() { if err != nil { log.Fatalf("Failed to call Cls method: %v", err) } - log.Println(result) + fmt.Println(result) // Call the Cls function with overrides, and confirm that the Secret is set. result, err = methodWithOptions.Remote(ctx, []any{"SECRET_MESSAGE"}, nil) if err != nil { log.Fatalf("Failed to call Cls method with options: %v", err) } - log.Println(result) + fmt.Println(result) } diff --git a/modal-go/examples/cls-call/main.go b/modal-go/examples/cls-call/main.go index 986d3090..58b2e912 100644 --- a/modal-go/examples/cls-call/main.go +++ b/modal-go/examples/cls-call/main.go @@ -4,6 +4,7 @@ package main import ( "context" + "fmt" "log" "github.com/modal-labs/libmodal/modal-go" @@ -36,12 +37,12 @@ func main() { if err != nil { log.Fatalf("Failed to call Cls method: %v", err) } - log.Println("Response:", result) + fmt.Println("Response:", result) // Call the Cls function with kwargs. result, err = function.Remote(ctx, nil, map[string]any{"s": "Hello world!"}) if err != nil { log.Fatalf("Failed to call Cls method: %v", err) } - log.Println("Response:", result) + fmt.Println("Response:", result) } diff --git a/modal-go/examples/function-call/main.go b/modal-go/examples/function-call/main.go index 7aad705b..68dd57b5 100644 --- a/modal-go/examples/function-call/main.go +++ b/modal-go/examples/function-call/main.go @@ -4,6 +4,7 @@ package main import ( "context" + "fmt" "log" "github.com/modal-labs/libmodal/modal-go" @@ -25,11 +26,11 @@ func main() { if err != nil { log.Fatalf("Failed to call Function: %v", err) } - log.Println("Response:", ret) + fmt.Println("Response:", ret) ret, err = echo.Remote(ctx, nil, map[string]any{"s": "Hello world!"}) if err != nil { log.Fatalf("Failed to call Function with kwargs: %v", err) } - log.Println("Response:", ret) + fmt.Println("Response:", ret) } diff --git a/modal-go/examples/function-spawn/main.go b/modal-go/examples/function-spawn/main.go index c8b2aa88..d4cf7177 100644 --- a/modal-go/examples/function-spawn/main.go +++ b/modal-go/examples/function-spawn/main.go @@ -5,6 +5,7 @@ package main import ( "context" + "fmt" "log" "github.com/modal-labs/libmodal/modal-go" @@ -31,5 +32,5 @@ func main() { if err != nil { log.Fatalf("Failed to get Function results: %v", err) } - log.Println("Response:", ret) + fmt.Println("Response:", ret) } diff --git a/modal-go/examples/sandbox-cloud-bucket/main.go b/modal-go/examples/sandbox-cloud-bucket/main.go index f61ef983..486d7538 100644 --- a/modal-go/examples/sandbox-cloud-bucket/main.go +++ b/modal-go/examples/sandbox-cloud-bucket/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -52,12 +53,12 @@ func main() { } }() - log.Printf("S3 Sandbox: %s", sb.SandboxID) + fmt.Printf("S3 Sandbox: %s\n", sb.SandboxID) output, err := io.ReadAll(sb.Stdout) if err != nil { log.Fatalf("Failed to read from Sandbox stdout: %v", err) } - log.Printf("Sandbox directory listing of /mnt/s3-bucket:\n%s", string(output)) + fmt.Printf("Sandbox directory listing of /mnt/s3-bucket:\n%s\n", string(output)) } diff --git a/modal-go/examples/sandbox-exec/main.go b/modal-go/examples/sandbox-exec/main.go index 1d65d309..bd3c9489 100644 --- a/modal-go/examples/sandbox-exec/main.go +++ b/modal-go/examples/sandbox-exec/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -26,7 +27,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Println("Started Sandbox:", sb.SandboxID) + fmt.Println("Started Sandbox:", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -61,12 +62,12 @@ for i in range(50000): log.Fatalf("Failed to read stderr: %v", err) } - log.Printf("Got %d bytes stdout and %d bytes stderr\n", len(contentStdout), len(contentStderr)) + fmt.Printf("Got %d bytes stdout and %d bytes stderr\n", len(contentStdout), len(contentStderr)) returnCode, err := p.Wait(ctx) if err != nil { log.Fatalf("Failed to wait for process completion: %v", err) } - log.Println("Return code:", returnCode) + fmt.Println("Return code:", returnCode) secret, err := mc.Secrets.FromName(ctx, "libmodal-test-secret", &modal.SecretFromNameParams{RequiredKeys: []string{"c"}}) if err != nil { @@ -83,5 +84,5 @@ for i in range(50000): if err != nil { log.Fatalf("Failed to read stdout: %v", err) } - log.Printf("Got environment variable c=%v", string(secretStdout)) + fmt.Printf("Got environment variable c=%v\n", string(secretStdout)) } diff --git a/modal-go/examples/sandbox-filesystem-snapshot/main.go b/modal-go/examples/sandbox-filesystem-snapshot/main.go index 08c45e70..7731748c 100644 --- a/modal-go/examples/sandbox-filesystem-snapshot/main.go +++ b/modal-go/examples/sandbox-filesystem-snapshot/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" "time" @@ -27,7 +28,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("Started Sandbox: %s", sb.SandboxID) + fmt.Printf("Started Sandbox: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -43,26 +44,26 @@ func main() { if err != nil { log.Fatalf("Failed to create file: %v", err) } - log.Printf("Created file in first Sandbox") + fmt.Println("Created file in first Sandbox") snapshotImage, err := sb.SnapshotFilesystem(ctx, 55*time.Second) if err != nil { log.Fatalf("Failed to snapshot filesystem: %v", err) } - log.Printf("Filesystem snapshot created with Image ID: %s", snapshotImage.ImageID) + fmt.Printf("Filesystem snapshot created with Image ID: %s\n", snapshotImage.ImageID) err = sb.Terminate(ctx) if err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) } - log.Printf("Terminated first Sandbox") + fmt.Println("Terminated first Sandbox") // Create new Sandbox from snapshot Image sb2, err := mc.Sandboxes.Create(ctx, app, snapshotImage, nil) if err != nil { log.Fatalf("Failed to create Sandbox from snapshot: %v", err) } - log.Printf("Started new Sandbox from snapshot: %s", sb2.SandboxID) + fmt.Printf("Started new Sandbox from snapshot: %s\n", sb2.SandboxID) defer func() { if err := sb2.Terminate(context.Background()); err != nil { @@ -79,5 +80,5 @@ func main() { if err != nil { log.Fatalf("Failed to read output: %v", err) } - log.Printf("File data read in second Sandbox: %s", string(content)) + fmt.Printf("File data read in second Sandbox: %s\n", string(content)) } diff --git a/modal-go/examples/sandbox-filesystem/main.go b/modal-go/examples/sandbox-filesystem/main.go index c9fece9f..4e97008e 100644 --- a/modal-go/examples/sandbox-filesystem/main.go +++ b/modal-go/examples/sandbox-filesystem/main.go @@ -27,7 +27,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("Started Sandbox: %s", sb.SandboxID) + fmt.Printf("Started Sandbox: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { @@ -61,7 +61,7 @@ func main() { log.Fatalf("Failed to read file: %v", err) } - fmt.Printf("File content:\n%s", string(content)) + fmt.Printf("File content:\n%s\n", string(content)) if err := reader.Close(); err != nil { log.Fatalf("Failed to close file: %v", err) } diff --git a/modal-go/examples/sandbox-gpu/main.go b/modal-go/examples/sandbox-gpu/main.go index d429a429..4d0b8d25 100644 --- a/modal-go/examples/sandbox-gpu/main.go +++ b/modal-go/examples/sandbox-gpu/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -28,14 +29,14 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("Started Sandbox with A10G GPU: %s", sb.SandboxID) + fmt.Printf("Started Sandbox with A10G GPU: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) } }() - log.Println("Running `nvidia-smi` in Sandbox:") + fmt.Println("Running `nvidia-smi` in Sandbox:") p, err := sb.Exec(ctx, []string{"nvidia-smi"}, nil) if err != nil { @@ -47,5 +48,5 @@ func main() { log.Fatalf("Failed to read stdout: %v", err) } - log.Printf("%s", string(output)) + fmt.Printf("%s\n", string(output)) } diff --git a/modal-go/examples/sandbox-prewarm/main.go b/modal-go/examples/sandbox-prewarm/main.go index c643f529..b45359ba 100644 --- a/modal-go/examples/sandbox-prewarm/main.go +++ b/modal-go/examples/sandbox-prewarm/main.go @@ -5,6 +5,7 @@ package main import ( "context" + "fmt" "log" "github.com/modal-labs/libmodal/modal-go" @@ -28,7 +29,7 @@ func main() { if err != nil { log.Fatalf("Unable to build Image: %v", err) } - log.Printf("Image has ID: %v", image.ImageID) + fmt.Printf("Image has ID: %v\n", image.ImageID) // You can save the ImageId and create a new Image object that referes to it. imageID := image.ImageID @@ -48,5 +49,5 @@ func main() { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) } }() - log.Printf("Sandbox: %s\n", sb.SandboxID) + fmt.Printf("Sandbox: %s\n", sb.SandboxID) } diff --git a/modal-go/examples/sandbox-private-image/main.go b/modal-go/examples/sandbox-private-image/main.go index ef28aad9..7b4cc63e 100644 --- a/modal-go/examples/sandbox-private-image/main.go +++ b/modal-go/examples/sandbox-private-image/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -35,7 +36,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("Sandbox: %s\n", sb.SandboxID) + fmt.Printf("Sandbox: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -56,5 +57,5 @@ func main() { log.Fatalf("Failed to read from Sandbox stdout: %v", err) } - log.Printf("output: %s\n", string(output)) + fmt.Printf("output: %s\n", string(output)) } diff --git a/modal-go/examples/sandbox-proxy/main.go b/modal-go/examples/sandbox-proxy/main.go index ef603970..09c04d33 100644 --- a/modal-go/examples/sandbox-proxy/main.go +++ b/modal-go/examples/sandbox-proxy/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -26,7 +27,7 @@ func main() { if err != nil { log.Fatalf("Failed to get Proxy: %v", err) } - log.Printf("Using Proxy: %s", proxy.ProxyID) + fmt.Printf("Using Proxy: %s\n", proxy.ProxyID) sb, err := mc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Proxy: proxy, @@ -34,7 +35,7 @@ func main() { if err != nil { log.Fatalf("Failed to create sandbox: %v", err) } - log.Printf("Created sandbox with proxy: %s", sb.SandboxID) + fmt.Printf("Created sandbox with proxy: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -51,5 +52,5 @@ func main() { log.Fatalf("Failed to read IP output: %v", err) } - log.Printf("External IP: %s", string(ip)) + fmt.Printf("External IP: %s\n", string(ip)) } diff --git a/modal-go/examples/sandbox-secrets/main.go b/modal-go/examples/sandbox-secrets/main.go index 2a7f9e49..6c748608 100644 --- a/modal-go/examples/sandbox-secrets/main.go +++ b/modal-go/examples/sandbox-secrets/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -39,7 +40,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("Sandbox created: %s\n", sb.SandboxID) + fmt.Printf("Sandbox created: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -50,5 +51,5 @@ func main() { if err != nil { log.Fatalf("Failed to read output: %v", err) } - log.Printf("Sandbox environment variables from Secrets:\n%v", string(output)) + fmt.Printf("Sandbox environment variables from Secrets:\n%v\n", string(output)) } diff --git a/modal-go/examples/sandbox-tunnels/main.go b/modal-go/examples/sandbox-tunnels/main.go index 9ba5f368..c5ae1b98 100644 --- a/modal-go/examples/sandbox-tunnels/main.go +++ b/modal-go/examples/sandbox-tunnels/main.go @@ -41,12 +41,12 @@ func main() { } }() - log.Printf("Sandbox created: %s", sandbox.SandboxID) + fmt.Printf("Sandbox created: %s\n", sandbox.SandboxID) - log.Printf("Waiting for server to start...") + fmt.Println("Waiting for server to start...") time.Sleep(3 * time.Second) - log.Printf("Getting tunnel information...") + fmt.Println("Getting tunnel information...") tunnels, err := sandbox.Tunnels(ctx, 30*time.Second) if err != nil { log.Fatalf("Failed to get tunnels: %v", err) @@ -57,11 +57,11 @@ func main() { log.Fatalf("No tunnel found for port 8000") } - log.Printf("Tunnel information:") - log.Printf(" URL: %s", tunnel.URL()) - log.Printf(" Port: %d", tunnel.Port) + fmt.Println("Tunnel information:") + fmt.Printf(" URL: %s\n", tunnel.URL()) + fmt.Printf(" Port: %d\n", tunnel.Port) - log.Printf("\nMaking GET request to the tunneled server at %s", tunnel.URL()) + fmt.Printf("\nMaking GET request to the tunneled server at %s\n", tunnel.URL()) // Make a GET request to the tunneled server resp, err := http.Get(tunnel.URL()) @@ -87,5 +87,5 @@ func main() { fmt.Printf("\nDirectory listing from server (first 500 chars):\n%s\n", bodyStr) - log.Printf("\n✅ Successfully connected to the tunneled server!") + fmt.Println("\n✅ Successfully connected to the tunneled server!") } diff --git a/modal-go/examples/sandbox/main.go b/modal-go/examples/sandbox/main.go index 353dab06..dbb79e48 100644 --- a/modal-go/examples/sandbox/main.go +++ b/modal-go/examples/sandbox/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "io" "log" @@ -28,7 +29,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - log.Printf("sandbox: %s\n", sb.SandboxID) + fmt.Printf("sandbox: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) @@ -39,7 +40,7 @@ func main() { if err != nil { log.Fatalf("Failed to get Sandbox with ID: %v", err) } - log.Printf("Queried Sandbox with ID: %v", sbFromID.SandboxID) + fmt.Printf("Queried Sandbox with ID: %v\n", sbFromID.SandboxID) _, err = sb.Stdin.Write([]byte("this is input that should be mirrored by cat")) if err != nil { @@ -55,5 +56,5 @@ func main() { log.Fatalf("Failed to read from Sandbox stdout: %v", err) } - log.Printf("output: %s\n", string(output)) + fmt.Printf("output: %s\n", string(output)) } From 428842eb67548dfee2cc9c2a13e2f89694b8aa9d Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Thu, 13 Nov 2025 10:53:00 +0100 Subject: [PATCH 50/59] Add more JS linting (#215) * Enable and fix eslint/await-thenable lint * Enable and fix eslint/no-deprecated lint * Enable and fix no-console lint --- modal-js/eslint.config.js | 17 +++++++++++++- modal-js/src/app.ts | 1 + modal-js/src/client.ts | 1 + modal-js/src/cloud_bucket_mount.ts | 1 + modal-js/src/logger.ts | 1 + modal-js/test/function.test.ts | 4 ++-- modal-js/test/image.test.ts | 34 ++++++++++++++++------------ modal-js/test/legacy/image.test.ts | 6 ++--- modal-js/test/legacy/sandbox.test.ts | 2 +- modal-js/test/legacy/secret.test.ts | 2 +- modal-js/test/queue.test.ts | 2 +- modal-js/test/sandbox.test.ts | 34 ++++++++++++++-------------- 12 files changed, 64 insertions(+), 41 deletions(-) diff --git a/modal-js/eslint.config.js b/modal-js/eslint.config.js index 06c06412..1f086f22 100644 --- a/modal-js/eslint.config.js +++ b/modal-js/eslint.config.js @@ -40,7 +40,22 @@ export default defineConfig([ // We added this lint because `tsx` gets confused when you export types // without using the `type` keyword. "@typescript-eslint/consistent-type-exports": "error", - "object-shorthand": "warn", + "object-shorthand": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-deprecated": "error", + "no-console": "error", + }, + }, + { + files: ["test/legacy/**/*.{ts,mts,cts}"], + rules: { + "@typescript-eslint/no-deprecated": "off", + }, + }, + { + files: ["examples/**/*.{ts,mts,cts}"], + rules: { + "no-console": "off", }, }, ]); diff --git a/modal-js/src/app.ts b/modal-js/src/app.ts index d947f067..5787a3fb 100644 --- a/modal-js/src/app.ts +++ b/modal-js/src/app.ts @@ -117,6 +117,7 @@ export class App { /** * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. */ + // eslint-disable-next-line @typescript-eslint/no-deprecated static async lookup(name: string, options: LookupOptions = {}): Promise { return getDefaultClient().apps.fromName(name, options); } diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index cab9a545..38daa541 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -469,6 +469,7 @@ export type ClientOptions = { /** * @deprecated Use {@link ModalClient `new ModalClient()`} instead. */ +// eslint-disable-next-line @typescript-eslint/no-deprecated export function initializeClient(options: ClientOptions) { defaultClientOptions = { tokenId: options.tokenId, diff --git a/modal-js/src/cloud_bucket_mount.ts b/modal-js/src/cloud_bucket_mount.ts index ad0ad4b3..a1d7ec28 100644 --- a/modal-js/src/cloud_bucket_mount.ts +++ b/modal-js/src/cloud_bucket_mount.ts @@ -39,6 +39,7 @@ export class CloudBucketMount { !url.hostname.endsWith("r2.cloudflarestorage.com") && !url.hostname.endsWith("storage.googleapis.com") ) { + // eslint-disable-next-line no-console console.warn( "CloudBucketMount received unrecognized bucket endpoint URL. " + "Assuming AWS S3 configuration as fallback.", diff --git a/modal-js/src/logger.ts b/modal-js/src/logger.ts index 89651c25..dac14d0e 100644 --- a/modal-js/src/logger.ts +++ b/modal-js/src/logger.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ export type LogLevel = "debug" | "info" | "warn" | "error"; const LOG_LEVELS: Record = { diff --git a/modal-js/test/function.test.ts b/modal-js/test/function.test.ts index 284d4a97..5ec1dfa0 100644 --- a/modal-js/test/function.test.ts +++ b/modal-js/test/function.test.ts @@ -18,7 +18,7 @@ test("FunctionCall", async () => { }); test("FunctionCallJsMap", async () => { - const function_ = await Function_.lookup( + const function_ = await tc.functions.fromName( "libmodal-test-support", "identity_with_repr", ); @@ -28,7 +28,7 @@ test("FunctionCallJsMap", async () => { }); test("FunctionCallDateTimeRoundtrip", async () => { - const function_ = await Function_.lookup( + const function_ = await tc.functions.fromName( "libmodal-test-support", "identity_with_repr", ); diff --git a/modal-js/test/image.test.ts b/modal-js/test/image.test.ts index d1312422..77c60498 100644 --- a/modal-js/test/image.test.ts +++ b/modal-js/test/image.test.ts @@ -59,12 +59,14 @@ test("ImageFromAwsEcr", async () => { }); expect(app.appId).toBeTruthy(); - const image = await app.imageFromAwsEcr( - "459781239556.dkr.ecr.us-east-1.amazonaws.com/ecr-private-registry-test-7522615:python", - await tc.secrets.fromName("libmodal-aws-ecr-test", { - requiredKeys: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"], - }), - ); + const image = await tc.images + .fromAwsEcr( + "459781239556.dkr.ecr.us-east-1.amazonaws.com/ecr-private-registry-test-7522615:python", + await tc.secrets.fromName("libmodal-aws-ecr-test", { + requiredKeys: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"], + }), + ) + .build(app); expect(image.imageId).toBeTruthy(); expect(image.imageId).toMatch(/^im-/); }); @@ -75,12 +77,14 @@ test("ImageFromGcpArtifactRegistry", { timeout: 30_000 }, async () => { }); expect(app.appId).toBeTruthy(); - const image = await app.imageFromGcpArtifactRegistry( - "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", - await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { - requiredKeys: ["SERVICE_ACCOUNT_JSON"], - }), - ); + const image = await tc.images + .fromGcpArtifactRegistry( + "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", + await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { + requiredKeys: ["SERVICE_ACCOUNT_JSON"], + }), + ) + .build(app); expect(image.imageId).toBeTruthy(); expect(image.imageId).toMatch(/^im-/); }); @@ -107,7 +111,7 @@ test("CreateOneSandboxTopLevelImageAPISecret", async () => { }); expect(app.appId).toBeTruthy(); - const image = await tc.images.fromRegistry( + const image = tc.images.fromRegistry( "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { requiredKeys: ["REGISTRY_USERNAME", "REGISTRY_PASSWORD"], @@ -128,7 +132,7 @@ test("ImageFromAwsEcrTopLevel", async () => { }); expect(app.appId).toBeTruthy(); - const image = await tc.images.fromAwsEcr( + const image = tc.images.fromAwsEcr( "459781239556.dkr.ecr.us-east-1.amazonaws.com/ecr-private-registry-test-7522615:python", await tc.secrets.fromName("libmodal-aws-ecr-test", { requiredKeys: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"], @@ -149,7 +153,7 @@ test("ImageFromGcpEcrTopLevel", async () => { }); expect(app.appId).toBeTruthy(); - const image = await tc.images.fromGcpArtifactRegistry( + const image = tc.images.fromGcpArtifactRegistry( "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { requiredKeys: ["SERVICE_ACCOUNT_JSON"], diff --git a/modal-js/test/legacy/image.test.ts b/modal-js/test/legacy/image.test.ts index d50962cf..a8413978 100644 --- a/modal-js/test/legacy/image.test.ts +++ b/modal-js/test/legacy/image.test.ts @@ -89,7 +89,7 @@ test("CreateOneSandboxTopLevelImageAPISecret", async () => { const app = await App.lookup("libmodal-test", { createIfMissing: true }); expect(app.appId).toBeTruthy(); - const image = await Image.fromRegistry( + const image = Image.fromRegistry( "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", await Secret.fromName("libmodal-gcp-artifact-registry-test", { requiredKeys: ["REGISTRY_USERNAME", "REGISTRY_PASSWORD"], @@ -108,7 +108,7 @@ test("ImageFromAwsEcrTopLevel", async () => { const app = await App.lookup("libmodal-test", { createIfMissing: true }); expect(app.appId).toBeTruthy(); - const image = await Image.fromAwsEcr( + const image = Image.fromAwsEcr( "459781239556.dkr.ecr.us-east-1.amazonaws.com/ecr-private-registry-test-7522615:python", await Secret.fromName("libmodal-aws-ecr-test", { requiredKeys: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"], @@ -127,7 +127,7 @@ test("ImageFromGcpEcrTopLevel", async () => { const app = await App.lookup("libmodal-test", { createIfMissing: true }); expect(app.appId).toBeTruthy(); - const image = await Image.fromGcpArtifactRegistry( + const image = Image.fromGcpArtifactRegistry( "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", await Secret.fromName("libmodal-gcp-artifact-registry-test", { requiredKeys: ["SERVICE_ACCOUNT_JSON"], diff --git a/modal-js/test/legacy/sandbox.test.ts b/modal-js/test/legacy/sandbox.test.ts index d641b110..33ba1a46 100644 --- a/modal-js/test/legacy/sandbox.test.ts +++ b/modal-js/test/legacy/sandbox.test.ts @@ -176,7 +176,7 @@ test("SandboxWithVolume", async () => { test("SandboxWithReadOnlyVolume", async () => { const app = await App.lookup("libmodal-test", { createIfMissing: true }); - const image = await Image.fromRegistry("alpine:3.21"); + const image = Image.fromRegistry("alpine:3.21"); const volume = await Volume.fromName("libmodal-test-sandbox-volume", { createIfMissing: true, diff --git a/modal-js/test/legacy/secret.test.ts b/modal-js/test/legacy/secret.test.ts index af506f05..6c7a1da0 100644 --- a/modal-js/test/legacy/secret.test.ts +++ b/modal-js/test/legacy/secret.test.ts @@ -33,7 +33,7 @@ test("SecretFromObject", async () => { expect(secret).toBeDefined(); const app = await App.lookup("libmodal-test", { createIfMissing: true }); - const image = await Image.fromRegistry("alpine:3.21"); + const image = Image.fromRegistry("alpine:3.21"); const sandbox = await app.createSandbox(image, { command: ["printenv", "key"], diff --git a/modal-js/test/queue.test.ts b/modal-js/test/queue.test.ts index 34bffd5d..1e3d9a90 100644 --- a/modal-js/test/queue.test.ts +++ b/modal-js/test/queue.test.ts @@ -89,7 +89,7 @@ test("QueueNonEphemeral", async () => { onTestFinished(async () => { await tc.queues.delete(queueName); - await expect(Queue.lookup(queueName)).rejects.toThrow(); // confirm deletion + await expect(tc.queues.fromName(queueName)).rejects.toThrow(); // confirm deletion }); await queue1.put("data"); diff --git a/modal-js/test/sandbox.test.ts b/modal-js/test/sandbox.test.ts index e1c86b85..d4afd96e 100644 --- a/modal-js/test/sandbox.test.ts +++ b/modal-js/test/sandbox.test.ts @@ -63,7 +63,7 @@ test("SandboxCreateOptions", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sandbox = await tc.sandboxes.create(app, image, { command: ["echo", "hello, params"], @@ -99,7 +99,7 @@ test("SandboxExecOptions", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); try { @@ -167,7 +167,7 @@ test("SandboxWithVolume", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const volume = await tc.volumes.fromName("libmodal-test-sandbox-volume", { createIfMissing: true, @@ -189,7 +189,7 @@ test("SandboxWithReadOnlyVolume", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const volume = await tc.volumes.fromName("libmodal-test-sandbox-volume", { createIfMissing: true, @@ -213,7 +213,7 @@ test("SandboxWithTunnels", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sandbox = await tc.sandboxes.create(app, image, { command: ["cat"], @@ -253,7 +253,7 @@ test("CreateSandboxWithSecrets", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const secret = await tc.secrets.fromName("libmodal-test-secret", { requiredKeys: ["c"], @@ -274,7 +274,7 @@ test("CreateSandboxWithNetworkAccessParams", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image, { command: ["echo", "hello, network access"], @@ -313,7 +313,7 @@ test("SandboxPollAndReturnCode", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sandbox = await tc.sandboxes.create(app, image, { command: ["cat"] }); @@ -331,7 +331,7 @@ test("SandboxPollAfterFailure", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sandbox = await tc.sandboxes.create(app, image, { command: ["sh", "-c", "exit 42"], @@ -345,7 +345,7 @@ test("SandboxExecSecret", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); expect(sb.sandboxId).toBeTruthy(); @@ -370,7 +370,7 @@ test("SandboxFromId", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); onTestFinished(async () => { @@ -384,7 +384,7 @@ test("SandboxWithWorkdir", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image, { command: ["pwd"], @@ -402,7 +402,7 @@ test("SandboxWithWorkdirValidation", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); await expect( tc.sandboxes.create(app, image, { @@ -415,7 +415,7 @@ test("SandboxSetTagsAndList", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); onTestFinished(async () => { @@ -443,7 +443,7 @@ test("SandboxSetMultipleTagsAndList", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); onTestFinished(async () => { @@ -491,7 +491,7 @@ test("SandboxListByAppId", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); onTestFinished(async () => { @@ -511,7 +511,7 @@ test("NamedSandbox", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - const image = await tc.images.fromRegistry("alpine:3.21"); + const image = tc.images.fromRegistry("alpine:3.21"); const sandboxName = `test-sandbox-${Math.random().toString().substring(2, 10)}`; From 2cbb80af71405c04a993a1ed0c6baa32b36dab62 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Fri, 14 Nov 2025 10:53:21 +0100 Subject: [PATCH 51/59] Change JS API for Cloud Bucket Mounts to use the Client (#216) * Refactor Cloud Bucket Mounts in Go to enable debug logging * Refactor Cloud Bucket Mounts in JS as a Client service --- CHANGELOG.md | 2 + modal-go/cloud_bucket_mount.go | 46 ++--- modal-go/cloud_bucket_mount_test.go | 26 +-- modal-js/examples/sandbox-cloud-bucket.ts | 4 +- modal-js/src/client.ts | 3 + modal-js/src/cloud_bucket_mount.ts | 183 ++++++++++++------ modal-js/src/index.ts | 5 +- modal-js/src/sandbox.ts | 3 +- modal-js/test/cloud_bucket_mount.test.ts | 87 +++++---- .../test/legacy/cloud_bucket_mount.test.ts | 40 +--- 10 files changed, 220 insertions(+), 179 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee8ccde2..4101492e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Both client libraries are pre-1.0, and they have separate versioning. - Enabled goroutine leak detection for all tests by default. - Fixed a few remaining goroutine leaks. +- Added debug logging to `CloudBucketMount` creation in Go, bringing it in line with the JS SDK. +- Updated the API for creating `CloudBucketMount`s in JS, using the same `modal.cloudBucketMounts.create()` pattern as other Modal objects, bringing it in line with the Go SDK. ## modal-js/v0.5.4, modal-go/v0.5.4 diff --git a/modal-go/cloud_bucket_mount.go b/modal-go/cloud_bucket_mount.go index e32355ac..b491880f 100644 --- a/modal-go/cloud_bucket_mount.go +++ b/modal-go/cloud_bucket_mount.go @@ -24,6 +24,7 @@ type CloudBucketMount struct { BucketEndpointURL *string KeyPrefix *string OidcAuthRoleArn *string + bucketType pb.CloudBucketMount_BucketType } // CloudBucketMountParams are options for creating a CloudBucketMount. @@ -53,10 +54,27 @@ func (s *cloudBucketMountServiceImpl) New(bucketName string, params *CloudBucket } if mount.BucketEndpointURL != nil { - _, err := url.Parse(*mount.BucketEndpointURL) + parsedURL, err := url.Parse(*mount.BucketEndpointURL) if err != nil { return nil, fmt.Errorf("invalid bucket endpoint URL: %w", err) } + + hostname := parsedURL.Hostname() + if strings.HasSuffix(hostname, "r2.cloudflarestorage.com") { + mount.bucketType = pb.CloudBucketMount_R2 + } else if strings.HasSuffix(hostname, "storage.googleapis.com") { + mount.bucketType = pb.CloudBucketMount_GCP + } else { + mount.bucketType = pb.CloudBucketMount_S3 + if s.client != nil && s.client.logger != nil { + s.client.logger.Debug( + "CloudBucketMount received unrecognized bucket endpoint URL. Assuming AWS S3 configuration as fallback.", + "BucketEndpointURL", *mount.BucketEndpointURL, + ) + } + } + } else { + mount.bucketType = pb.CloudBucketMount_S3 } if mount.RequesterPays && mount.Secret == nil { @@ -70,42 +88,18 @@ func (s *cloudBucketMountServiceImpl) New(bucketName string, params *CloudBucket return mount, nil } -func getBucketTypeFromEndpointURL(bucketEndpointURL *string) (pb.CloudBucketMount_BucketType, error) { - if bucketEndpointURL == nil { - return pb.CloudBucketMount_S3, nil - } - - parsedURL, err := url.Parse(*bucketEndpointURL) - if err != nil { - return pb.CloudBucketMount_S3, fmt.Errorf("failed to parse bucketEndpointURL '%s': %w", *bucketEndpointURL, err) - } - - hostname := parsedURL.Hostname() - if strings.HasSuffix(hostname, "r2.cloudflarestorage.com") { - return pb.CloudBucketMount_R2, nil - } else if strings.HasSuffix(hostname, "storage.googleapis.com") { - return pb.CloudBucketMount_GCP, nil - } - return pb.CloudBucketMount_S3, nil -} - func (c *CloudBucketMount) toProto(mountPath string) (*pb.CloudBucketMount, error) { credentialsSecretID := "" if c.Secret != nil { credentialsSecretID = c.Secret.SecretID } - bucketType, err := getBucketTypeFromEndpointURL(c.BucketEndpointURL) - if err != nil { - return nil, err - } - return pb.CloudBucketMount_builder{ BucketName: c.BucketName, MountPath: mountPath, CredentialsSecretId: credentialsSecretID, ReadOnly: c.ReadOnly, - BucketType: bucketType, + BucketType: c.bucketType, RequesterPays: c.RequesterPays, BucketEndpointUrl: c.BucketEndpointURL, KeyPrefix: c.KeyPrefix, diff --git a/modal-go/cloud_bucket_mount_test.go b/modal-go/cloud_bucket_mount_test.go index edbc5c47..31ddf636 100644 --- a/modal-go/cloud_bucket_mount_test.go +++ b/modal-go/cloud_bucket_mount_test.go @@ -24,10 +24,7 @@ func TestNewCloudBucketMount_MinimalOptions(t *testing.T) { g.Expect(mount.BucketEndpointURL).Should(gomega.BeNil()) g.Expect(mount.KeyPrefix).Should(gomega.BeNil()) g.Expect(mount.OidcAuthRoleArn).Should(gomega.BeNil()) - - bucketType, err := getBucketTypeFromEndpointURL(mount.BucketEndpointURL) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(bucketType).Should(gomega.Equal(pb.CloudBucketMount_S3)) + g.Expect(mount.bucketType).Should(gomega.Equal(pb.CloudBucketMount_S3)) } func TestNewCloudBucketMount_AllOptions(t *testing.T) { @@ -58,13 +55,10 @@ func TestNewCloudBucketMount_AllOptions(t *testing.T) { g.Expect(*mount.KeyPrefix).Should(gomega.Equal(keyPrefix)) g.Expect(mount.OidcAuthRoleArn).ShouldNot(gomega.BeNil()) g.Expect(*mount.OidcAuthRoleArn).Should(gomega.Equal(oidcRole)) - - bucketType, err := getBucketTypeFromEndpointURL(mount.BucketEndpointURL) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(bucketType).Should(gomega.Equal(pb.CloudBucketMount_R2)) + g.Expect(mount.bucketType).Should(gomega.Equal(pb.CloudBucketMount_R2)) } -func TestGetBucketTypeFromEndpointURL(t *testing.T) { +func TestBucketTypeDetection(t *testing.T) { t.Parallel() testCases := []struct { name string @@ -105,23 +99,21 @@ func TestGetBucketTypeFromEndpointURL(t *testing.T) { mount, err := newTestMount("my-bucket", params) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - - bucketType, err := getBucketTypeFromEndpointURL(mount.BucketEndpointURL) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(bucketType).Should(gomega.Equal(tc.expectedType)) + g.Expect(mount.bucketType).Should(gomega.Equal(tc.expectedType)) }) } } -func TestGetBucketTypeFromEndpointURL_InvalidURL(t *testing.T) { +func TestNewCloudBucketMount_InvalidURL(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) invalidURL := "://invalid-url" - _, err := getBucketTypeFromEndpointURL(&invalidURL) + _, err := newTestMount("my-bucket", &CloudBucketMountParams{ + BucketEndpointURL: &invalidURL, + }) g.Expect(err).Should(gomega.HaveOccurred()) - g.Expect(err.Error()).Should(gomega.ContainSubstring("failed to parse bucketEndpointURL")) - g.Expect(err.Error()).Should(gomega.ContainSubstring(invalidURL)) + g.Expect(err.Error()).Should(gomega.ContainSubstring("invalid bucket endpoint URL")) } func TestNewCloudBucketMount_ValidationRequesterPaysWithoutSecret(t *testing.T) { diff --git a/modal-js/examples/sandbox-cloud-bucket.ts b/modal-js/examples/sandbox-cloud-bucket.ts index 510e010e..32c7a895 100644 --- a/modal-js/examples/sandbox-cloud-bucket.ts +++ b/modal-js/examples/sandbox-cloud-bucket.ts @@ -1,4 +1,4 @@ -import { ModalClient, CloudBucketMount } from "modal"; +import { ModalClient } from "modal"; const modal = new ModalClient(); @@ -12,7 +12,7 @@ const secret = await modal.secrets.fromName("libmodal-aws-bucket-secret"); const sb = await modal.sandboxes.create(app, image, { command: ["sh", "-c", "ls -la /mnt/s3-bucket"], cloudBucketMounts: { - "/mnt/s3-bucket": new CloudBucketMount("my-s3-bucket", { + "/mnt/s3-bucket": modal.cloudBucketMounts.create("my-s3-bucket", { secret, keyPrefix: "data/", readOnly: true, diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index 38daa541..1e21f86e 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -11,6 +11,7 @@ import { Status, } from "nice-grpc"; import { AppService } from "./app"; +import { CloudBucketMountService } from "./cloud_bucket_mount"; import { ClsService } from "./cls"; import { FunctionService } from "./function"; import { FunctionCallService } from "./function_call"; @@ -76,6 +77,7 @@ export type ModalGrpcClient = Client< */ export class ModalClient { readonly apps: AppService; + readonly cloudBucketMounts: CloudBucketMountService; readonly cls: ClsService; readonly functions: FunctionService; readonly functionCalls: FunctionCallService; @@ -123,6 +125,7 @@ export class ModalClient { this.logger.debug("Modal client initialized successfully"); this.apps = new AppService(this); + this.cloudBucketMounts = new CloudBucketMountService(this); this.cls = new ClsService(this); this.functions = new FunctionService(this); this.functionCalls = new FunctionCallService(this); diff --git a/modal-js/src/cloud_bucket_mount.ts b/modal-js/src/cloud_bucket_mount.ts index a1d7ec28..62c3969b 100644 --- a/modal-js/src/cloud_bucket_mount.ts +++ b/modal-js/src/cloud_bucket_mount.ts @@ -2,19 +2,17 @@ import { CloudBucketMount_BucketType, CloudBucketMount as CloudBucketMountProto, } from "../proto/modal_proto/api"; +import { getDefaultClient, ModalClient } from "./client"; import { Secret } from "./secret"; -/** Cloud Bucket Mounts provide access to cloud storage buckets within Modal Functions. */ -export class CloudBucketMount { - readonly bucketName: string; - readonly secret?: Secret; - readonly readOnly: boolean; - readonly requesterPays: boolean; - readonly bucketEndpointUrl?: string; - readonly keyPrefix?: string; - readonly oidcAuthRoleArn?: string; +export class CloudBucketMountService { + readonly #client: ModalClient; - constructor( + constructor(client: ModalClient) { + this.#client = client; + } + + create( bucketName: string, params: { secret?: Secret; @@ -24,71 +22,140 @@ export class CloudBucketMount { keyPrefix?: string; oidcAuthRoleArn?: string; } = {}, - ) { - this.bucketName = bucketName; - this.secret = params.secret; - this.readOnly = params.readOnly ?? false; - this.requesterPays = params.requesterPays ?? false; - this.bucketEndpointUrl = params.bucketEndpointUrl; - this.keyPrefix = params.keyPrefix; - this.oidcAuthRoleArn = params.oidcAuthRoleArn; - - if (this.bucketEndpointUrl) { - const url = new URL(this.bucketEndpointUrl); - if ( - !url.hostname.endsWith("r2.cloudflarestorage.com") && - !url.hostname.endsWith("storage.googleapis.com") - ) { - // eslint-disable-next-line no-console - console.warn( + ): CloudBucketMount { + let bucketType = CloudBucketMount_BucketType.S3; + if (params.bucketEndpointUrl) { + const url = new URL(params.bucketEndpointUrl); + if (url.hostname.endsWith("r2.cloudflarestorage.com")) { + bucketType = CloudBucketMount_BucketType.R2; + } else if (url.hostname.endsWith("storage.googleapis.com")) { + bucketType = CloudBucketMount_BucketType.GCP; + } else { + bucketType = CloudBucketMount_BucketType.S3; + this.#client.logger.debug( "CloudBucketMount received unrecognized bucket endpoint URL. " + "Assuming AWS S3 configuration as fallback.", + "bucketEndpointUrl", + params.bucketEndpointUrl, ); } } - if (this.requesterPays && !this.secret) { + if (params.requesterPays && !params.secret) { throw new Error("Credentials required in order to use Requester Pays."); } - if (this.keyPrefix && !this.keyPrefix.endsWith("/")) { + if (params.keyPrefix && !params.keyPrefix.endsWith("/")) { throw new Error( "keyPrefix will be prefixed to all object paths, so it must end in a '/'", ); } + + return new CloudBucketMount( + bucketName, + params.secret, + params.readOnly ?? false, + params.requesterPays ?? false, + params.bucketEndpointUrl, + params.keyPrefix, + params.oidcAuthRoleArn, + bucketType, + ); } } -export function endpointUrlToBucketType( - bucketEndpointUrl?: string, -): CloudBucketMount_BucketType { - if (!bucketEndpointUrl) { - return CloudBucketMount_BucketType.S3; - } +/** Cloud Bucket Mounts provide access to cloud storage buckets within Modal Functions. */ +export class CloudBucketMount { + readonly bucketName!: string; + readonly secret?: Secret; + readonly readOnly!: boolean; + readonly requesterPays!: boolean; + readonly bucketEndpointUrl?: string; + readonly keyPrefix?: string; + readonly oidcAuthRoleArn?: string; + readonly #bucketType!: CloudBucketMount_BucketType; - const url = new URL(bucketEndpointUrl); - if (url.hostname.endsWith("r2.cloudflarestorage.com")) { - return CloudBucketMount_BucketType.R2; - } else if (url.hostname.endsWith("storage.googleapis.com")) { - return CloudBucketMount_BucketType.GCP; - } else { - return CloudBucketMount_BucketType.S3; + /** + * @deprecated Use {@link CloudBucketMountService#create client.cloudBucketMounts.create()} instead. + */ + constructor( + bucketName: string, + params?: { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }, + ); + /** @ignore */ + constructor( + bucketName: string, + secret: Secret | undefined, + readOnly: boolean, + requesterPays: boolean, + bucketEndpointUrl: string | undefined, + keyPrefix: string | undefined, + oidcAuthRoleArn: string | undefined, + bucketType: CloudBucketMount_BucketType, + ); + constructor( + bucketName: string, + secretOrParams?: + | Secret + | { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }, + readOnly?: boolean, + requesterPays?: boolean, + bucketEndpointUrl?: string, + keyPrefix?: string, + oidcAuthRoleArn?: string, + bucketType?: CloudBucketMount_BucketType, + ) { + if (bucketType !== undefined) { + this.bucketName = bucketName; + this.secret = secretOrParams as Secret | undefined; + this.readOnly = readOnly!; + this.requesterPays = requesterPays!; + this.bucketEndpointUrl = bucketEndpointUrl; + this.keyPrefix = keyPrefix; + this.oidcAuthRoleArn = oidcAuthRoleArn; + this.#bucketType = bucketType; + } else { + const params = + secretOrParams === undefined + ? {} + : (secretOrParams as { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }); + return getDefaultClient().cloudBucketMounts.create(bucketName, params); + } } -} -export function cloudBucketMountToProto( - mount: CloudBucketMount, - mountPath: string, -): CloudBucketMountProto { - return { - bucketName: mount.bucketName, - mountPath, - credentialsSecretId: mount.secret?.secretId ?? "", - readOnly: mount.readOnly, - bucketType: endpointUrlToBucketType(mount.bucketEndpointUrl), - requesterPays: mount.requesterPays, - bucketEndpointUrl: mount.bucketEndpointUrl, - keyPrefix: mount.keyPrefix, - oidcAuthRoleArn: mount.oidcAuthRoleArn, - }; + /** @ignore */ + toProto(mountPath: string): CloudBucketMountProto { + return { + bucketName: this.bucketName, + mountPath, + credentialsSecretId: this.secret?.secretId ?? "", + readOnly: this.readOnly, + bucketType: this.#bucketType, + requesterPays: this.requesterPays, + bucketEndpointUrl: this.bucketEndpointUrl, + keyPrefix: this.keyPrefix, + oidcAuthRoleArn: this.oidcAuthRoleArn, + }; + } } diff --git a/modal-js/src/index.ts b/modal-js/src/index.ts index 59a96b8d..af584a8e 100644 --- a/modal-js/src/index.ts +++ b/modal-js/src/index.ts @@ -86,7 +86,10 @@ export { type VolumeDeleteParams, } from "./volume"; export { Proxy, ProxyService, type ProxyFromNameParams } from "./proxy"; -export { CloudBucketMount } from "./cloud_bucket_mount"; +export { + CloudBucketMount, + CloudBucketMountService, +} from "./cloud_bucket_mount"; export { ModalClient, type ModalClientParams } from "./client"; export { type Profile } from "./config"; export { type Logger, type LogLevel } from "./logger"; diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 5ffa7f27..017ec76f 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -45,7 +45,6 @@ import { Image } from "./image"; import type { Volume } from "./volume"; import type { Proxy } from "./proxy"; import type { CloudBucketMount } from "./cloud_bucket_mount"; -import { cloudBucketMountToProto } from "./cloud_bucket_mount"; import type { App } from "./app"; import { parseGpuConfig } from "./app"; import { checkForRenamedParams } from "./validation"; @@ -184,7 +183,7 @@ export async function buildSandboxCreateRequestProto( const cloudBucketMounts: CloudBucketMountProto[] = params.cloudBucketMounts ? Object.entries(params.cloudBucketMounts).map(([mountPath, mount]) => - cloudBucketMountToProto(mount, mountPath), + mount.toProto(mountPath), ) : []; diff --git a/modal-js/test/cloud_bucket_mount.test.ts b/modal-js/test/cloud_bucket_mount.test.ts index 04b70986..8c833bcc 100644 --- a/modal-js/test/cloud_bucket_mount.test.ts +++ b/modal-js/test/cloud_bucket_mount.test.ts @@ -1,13 +1,10 @@ -import { CloudBucketMount, Secret } from "modal"; -import { - cloudBucketMountToProto, - endpointUrlToBucketType, -} from "../src/cloud_bucket_mount"; +import { tc } from "../test-support/test-client"; +import { Secret } from "modal"; import { CloudBucketMount_BucketType } from "../proto/modal_proto/api"; import { expect, test } from "vitest"; -test("CloudBucketMount constructor with minimal options", () => { - const mount = new CloudBucketMount("my-bucket"); +test("CloudBucketMountService.create() with minimal options", () => { + const mount = tc.cloudBucketMounts.create("my-bucket"); expect(mount.bucketName).toBe("my-bucket"); expect(mount.readOnly).toBe(false); @@ -17,15 +14,13 @@ test("CloudBucketMount constructor with minimal options", () => { expect(mount.keyPrefix).toBeUndefined(); expect(mount.oidcAuthRoleArn).toBeUndefined(); - expect(endpointUrlToBucketType(mount.bucketEndpointUrl)).toBe( - CloudBucketMount_BucketType.S3, - ); + expect(mount.toProto("/").bucketType).toEqual(CloudBucketMount_BucketType.S3); }); -test("CloudBucketMount constructor with all options", () => { +test("CloudBucketMountService.create() with all options", () => { const mockSecret = { secretId: "sec-123" } as Secret; - const mount = new CloudBucketMount("my-bucket", { + const mount = tc.cloudBucketMounts.create("my-bucket", { secret: mockSecret, readOnly: true, requesterPays: true, @@ -44,42 +39,60 @@ test("CloudBucketMount constructor with all options", () => { expect(mount.keyPrefix).toBe("prefix/"); expect(mount.oidcAuthRoleArn).toBe("arn:aws:iam::123456789:role/MyRole"); - expect(endpointUrlToBucketType(mount.bucketEndpointUrl)).toBe( - CloudBucketMount_BucketType.R2, - ); + expect(mount.toProto("/").bucketType).toEqual(CloudBucketMount_BucketType.R2); }); -test("CloudBucketMount bucket type detection from endpoint URLs", () => { - expect(endpointUrlToBucketType("")).toBe(CloudBucketMount_BucketType.S3); +test("CloudBucketMountService.create() bucket type detection from endpoint URLs", () => { + expect( + tc.cloudBucketMounts + .create("my-bucket", { + bucketEndpointUrl: "", + }) + .toProto("/").bucketType, + ).toEqual(CloudBucketMount_BucketType.S3); expect( - endpointUrlToBucketType("https://my-bucket.r2.cloudflarestorage.com"), - ).toBe(CloudBucketMount_BucketType.R2); + tc.cloudBucketMounts + .create("my-bucket", { + bucketEndpointUrl: "https://my-bucket.r2.cloudflarestorage.com", + }) + .toProto("/").bucketType, + ).toEqual(CloudBucketMount_BucketType.R2); expect( - endpointUrlToBucketType("https://storage.googleapis.com/my-bucket"), - ).toBe(CloudBucketMount_BucketType.GCP); + tc.cloudBucketMounts + .create("my-bucket", { + bucketEndpointUrl: "https://storage.googleapis.com/my-bucket", + }) + .toProto("/").bucketType, + ).toEqual(CloudBucketMount_BucketType.GCP); expect( - endpointUrlToBucketType("https://unknown-endpoint.com/my-bucket"), - ).toBe(CloudBucketMount_BucketType.S3); + tc.cloudBucketMounts + .create("my-bucket", { + bucketEndpointUrl: "https://unknown-endpoint.com/my-bucket", + }) + .toProto("/").bucketType, + ).toEqual(CloudBucketMount_BucketType.S3); expect(() => { - endpointUrlToBucketType("://invalid-url"); + tc.cloudBucketMounts.create("my-bucket", { + bucketEndpointUrl: "://invalid-url", + }); }).toThrowError("Invalid URL"); }); -test("CloudBucketMount validation: requesterPays without secret", () => { +test("CloudBucketMountService.create() validation: requesterPays without secret", () => { expect(() => { - new CloudBucketMount("my-bucket", { + tc.cloudBucketMounts.create("my-bucket", { requesterPays: true, }); }).toThrowError("Credentials required in order to use Requester Pays."); }); -test("CloudBucketMount validation: keyPrefix without trailing slash", () => { +test("CloudBucketMountService.create() validation: keyPrefix without trailing slash", () => { expect(() => { - new CloudBucketMount("my-bucket", { + tc.cloudBucketMounts.create("my-bucket", { keyPrefix: "prefix", }); }).toThrowError( @@ -87,9 +100,9 @@ test("CloudBucketMount validation: keyPrefix without trailing slash", () => { ); }); -test("cloudBucketMountToProto with minimal options", () => { - const mount = new CloudBucketMount("my-bucket"); - const proto = cloudBucketMountToProto(mount, "/mnt/bucket"); +test("cloudBucketMount.toProto() with minimal options", () => { + const mount = tc.cloudBucketMounts.create("my-bucket"); + const proto = mount.toProto("/mnt/bucket"); expect(proto.bucketName).toBe("my-bucket"); expect(proto.mountPath).toBe("/mnt/bucket"); @@ -102,28 +115,28 @@ test("cloudBucketMountToProto with minimal options", () => { expect(proto.oidcAuthRoleArn).toBeUndefined(); }); -test("cloudBucketMountToProto with all options", () => { +test("cloudBucketMount.toProto() with all options", () => { const mockSecret = { secretId: "sec-123" } as Secret; - const mount = new CloudBucketMount("my-bucket", { + const mount = tc.cloudBucketMounts.create("my-bucket", { secret: mockSecret, readOnly: true, requesterPays: true, - bucketEndpointUrl: "https://my-bucket.r2.cloudflarestorage.com", + bucketEndpointUrl: "https://storage.googleapis.com/my-bucket", keyPrefix: "prefix/", oidcAuthRoleArn: "arn:aws:iam::123456789:role/MyRole", }); - const proto = cloudBucketMountToProto(mount, "/mnt/bucket"); + const proto = mount.toProto("/mnt/bucket"); expect(proto.bucketName).toBe("my-bucket"); expect(proto.mountPath).toBe("/mnt/bucket"); expect(proto.credentialsSecretId).toBe("sec-123"); expect(proto.readOnly).toBe(true); - expect(proto.bucketType).toBe(CloudBucketMount_BucketType.R2); + expect(proto.bucketType).toBe(CloudBucketMount_BucketType.GCP); expect(proto.requesterPays).toBe(true); expect(proto.bucketEndpointUrl).toBe( - "https://my-bucket.r2.cloudflarestorage.com", + "https://storage.googleapis.com/my-bucket", ); expect(proto.keyPrefix).toBe("prefix/"); expect(proto.oidcAuthRoleArn).toBe("arn:aws:iam::123456789:role/MyRole"); diff --git a/modal-js/test/legacy/cloud_bucket_mount.test.ts b/modal-js/test/legacy/cloud_bucket_mount.test.ts index 2b3f7265..f11c03bd 100644 --- a/modal-js/test/legacy/cloud_bucket_mount.test.ts +++ b/modal-js/test/legacy/cloud_bucket_mount.test.ts @@ -1,8 +1,4 @@ import { CloudBucketMount, Secret } from "modal"; -import { - cloudBucketMountToProto, - endpointUrlToBucketType, -} from "../../src/cloud_bucket_mount"; import { CloudBucketMount_BucketType } from "../../proto/modal_proto/api"; import { expect, test } from "vitest"; @@ -16,10 +12,6 @@ test("CloudBucketMount constructor with minimal options", () => { expect(mount.bucketEndpointUrl).toBeUndefined(); expect(mount.keyPrefix).toBeUndefined(); expect(mount.oidcAuthRoleArn).toBeUndefined(); - - expect(endpointUrlToBucketType(mount.bucketEndpointUrl)).toBe( - CloudBucketMount_BucketType.S3, - ); }); test("CloudBucketMount constructor with all options", () => { @@ -43,30 +35,6 @@ test("CloudBucketMount constructor with all options", () => { ); expect(mount.keyPrefix).toBe("prefix/"); expect(mount.oidcAuthRoleArn).toBe("arn:aws:iam::123456789:role/MyRole"); - - expect(endpointUrlToBucketType(mount.bucketEndpointUrl)).toBe( - CloudBucketMount_BucketType.R2, - ); -}); - -test("CloudBucketMount bucket type detection from endpoint URLs", () => { - expect(endpointUrlToBucketType("")).toBe(CloudBucketMount_BucketType.S3); - - expect( - endpointUrlToBucketType("https://my-bucket.r2.cloudflarestorage.com"), - ).toBe(CloudBucketMount_BucketType.R2); - - expect( - endpointUrlToBucketType("https://storage.googleapis.com/my-bucket"), - ).toBe(CloudBucketMount_BucketType.GCP); - - expect( - endpointUrlToBucketType("https://unknown-endpoint.com/my-bucket"), - ).toBe(CloudBucketMount_BucketType.S3); - - expect(() => { - endpointUrlToBucketType("://invalid-url"); - }).toThrowError("Invalid URL"); }); test("CloudBucketMount validation: requesterPays without secret", () => { @@ -87,9 +55,9 @@ test("CloudBucketMount validation: keyPrefix without trailing slash", () => { ); }); -test("cloudBucketMountToProto with minimal options", () => { +test("cloudBucketMount.toProto() with minimal options", () => { const mount = new CloudBucketMount("my-bucket"); - const proto = cloudBucketMountToProto(mount, "/mnt/bucket"); + const proto = mount.toProto("/mnt/bucket"); expect(proto.bucketName).toBe("my-bucket"); expect(proto.mountPath).toBe("/mnt/bucket"); @@ -102,7 +70,7 @@ test("cloudBucketMountToProto with minimal options", () => { expect(proto.oidcAuthRoleArn).toBeUndefined(); }); -test("cloudBucketMountToProto with all options", () => { +test("cloudBucketMount.toProto() with all options", () => { const mockSecret = { secretId: "sec-123" } as Secret; const mount = new CloudBucketMount("my-bucket", { @@ -114,7 +82,7 @@ test("cloudBucketMountToProto with all options", () => { oidcAuthRoleArn: "arn:aws:iam::123456789:role/MyRole", }); - const proto = cloudBucketMountToProto(mount, "/mnt/bucket"); + const proto = mount.toProto("/mnt/bucket"); expect(proto.bucketName).toBe("my-bucket"); expect(proto.mountPath).toBe("/mnt/bucket"); From ac967669ebe99884a5bf0845b0d344fc0836c31d Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Fri, 14 Nov 2025 13:38:20 +0100 Subject: [PATCH 52/59] Test spring cleaning: ensure Sandboxes are terminated, clean out obsolete tests, etc. (#217) * Always terminate Sandboxes in tests * Call closeEphemeral from onTestFinished * Remove irrelevant/unnecessary tests and asserts * Clean up unneccessary comments * Align Sandbox var naming in exampels ... and tests, while we're at it. --- CHANGELOG.md | 1 + modal-go/app_test.go | 5 - modal-go/client_test.go | 1 - modal-go/examples/sandbox-poll/main.go | 20 +-- modal-go/examples/sandbox-proxy/main.go | 4 +- modal-go/examples/sandbox-tunnels/main.go | 10 +- modal-go/examples/sandbox/main.go | 2 +- modal-go/test/auth_token_manager_test.go | 11 -- modal-go/test/cls_test.go | 1 - modal-go/test/function_call_test.go | 2 - modal-go/test/function_test.go | 4 - modal-go/test/image_test.go | 4 - modal-go/test/proxy_test.go | 9 +- modal-go/test/queue_test.go | 3 - .../test/sandbox_filesystem_snapshot_test.go | 3 - modal-go/test/sandbox_filesystem_test.go | 3 - modal-go/test/sandbox_test.go | 47 +++--- modal-go/test/secret_test.go | 1 + modal-js/examples/sandbox-poll.ts | 14 +- modal-js/examples/sandbox-secrets.ts | 6 +- modal-js/examples/sandbox-tunnels.ts | 8 +- modal-js/src/client.ts | 2 +- modal-js/src/sandbox.ts | 4 +- modal-js/test/cls_with_options.test.ts | 9 -- modal-js/test/function_call.test.ts | 15 +- modal-js/test/image.test.ts | 93 +---------- modal-js/test/legacy/cls_with_options.test.ts | 1 - modal-js/test/proxy.test.ts | 8 +- modal-js/test/queue.test.ts | 10 +- modal-js/test/retries.test.ts | 1 - modal-js/test/sandbox.test.ts | 153 +++++++----------- modal-js/test/sandbox_filesystem.test.ts | 40 +---- .../test/sandbox_filesystem_snapshot.test.ts | 13 +- modal-js/test/secret.test.ts | 13 +- modal-js/test/version_tracking.test.ts | 2 - modal-js/test/volume.test.ts | 7 +- 36 files changed, 151 insertions(+), 379 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4101492e..00cf1d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Both client libraries are pre-1.0, and they have separate versioning. - Enabled goroutine leak detection for all tests by default. - Fixed a few remaining goroutine leaks. +- Test clean-ups: ensure we always terminate Sandboxes, close ephemeral objects, etc. - Added debug logging to `CloudBucketMount` creation in Go, bringing it in line with the JS SDK. - Updated the API for creating `CloudBucketMount`s in JS, using the same `modal.cloudBucketMounts.create()` pattern as other Modal objects, bringing it in line with the Go SDK. diff --git a/modal-go/app_test.go b/modal-go/app_test.go index 4de428c1..6123471f 100644 --- a/modal-go/app_test.go +++ b/modal-go/app_test.go @@ -10,12 +10,10 @@ func TestParseGPUConfig(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) - // Test empty string returns nil config, err := parseGPUConfig("") g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(config).Should(gomega.BeNil()) - // Test single GPU type config, err = parseGPUConfig("T4") g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(config.GetCount()).To(gomega.Equal(uint32(1))) @@ -31,7 +29,6 @@ func TestParseGPUConfig(t *testing.T) { g.Expect(config.GetCount()).To(gomega.Equal(uint32(1))) g.Expect(config.GetGpuType()).To(gomega.Equal("A100-80GB")) - // Test GPU type with count config, err = parseGPUConfig("A100-80GB:3") g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(config.GetCount()).To(gomega.Equal(uint32(3))) @@ -42,13 +39,11 @@ func TestParseGPUConfig(t *testing.T) { g.Expect(config.GetCount()).To(gomega.Equal(uint32(2))) g.Expect(config.GetGpuType()).To(gomega.Equal("T4")) - // Test lowercase conversion config, err = parseGPUConfig("a100:4") g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(config.GetCount()).To(gomega.Equal(uint32(4))) g.Expect(config.GetGpuType()).To(gomega.Equal("A100")) - // Test invalid count formats _, err = parseGPUConfig("T4:invalid") g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).To(gomega.ContainSubstring("invalid GPU count: invalid")) diff --git a/modal-go/client_test.go b/modal-go/client_test.go index ef688334..cd4ee110 100644 --- a/modal-go/client_test.go +++ b/modal-go/client_test.go @@ -15,7 +15,6 @@ import ( func TestClientWithLogger(t *testing.T) { g := gomega.NewWithT(t) - // Use a buffer to capture log output r, w, err := os.Pipe() g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/examples/sandbox-poll/main.go b/modal-go/examples/sandbox-poll/main.go index 6edcb867..dc703add 100644 --- a/modal-go/examples/sandbox-poll/main.go +++ b/modal-go/examples/sandbox-poll/main.go @@ -22,43 +22,43 @@ func main() { image := mc.Images.FromRegistry("alpine:3.21", nil) - // Create a sandbox that waits for input, then exits with code 42 - sandbox, err := mc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + // Create a Sandbox that waits for input, then exits with code 42 + sb, err := mc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Command: []string{"sh", "-c", "read line; exit 42"}, }) if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - fmt.Printf("Started Sandbox: %s\n", sandbox.SandboxID) + fmt.Printf("Started Sandbox: %s\n", sb.SandboxID) defer func() { - if err := sandbox.Terminate(context.Background()); err != nil { - log.Fatalf("Failed to terminate Sandbox %s: %v", sandbox.SandboxID, err) + if err := sb.Terminate(context.Background()); err != nil { + log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) } }() - initialPoll, err := sandbox.Poll(ctx) + initialPoll, err := sb.Poll(ctx) if err != nil { log.Fatalf("Failed to poll Sandbox: %v", err) } fmt.Printf("Poll result while running: %v\n", initialPoll) fmt.Println("\nSending input to trigger completion...") - _, err = sandbox.Stdin.Write([]byte("hello, goodbye\n")) + _, err = sb.Stdin.Write([]byte("hello, goodbye\n")) if err != nil { log.Fatalf("Failed to write to stdin: %v", err) } - err = sandbox.Stdin.Close() + err = sb.Stdin.Close() if err != nil { log.Fatalf("Failed to close stdin: %v", err) } - exitCode, err := sandbox.Wait(ctx) + exitCode, err := sb.Wait(ctx) if err != nil { log.Fatalf("Failed to wait for Sandbox: %v", err) } fmt.Printf("\nSandbox completed with exit code: %d\n", exitCode) - finalPoll, err := sandbox.Poll(ctx) + finalPoll, err := sb.Poll(ctx) if err != nil { log.Fatalf("Failed to poll Sandbox after completion: %v", err) } diff --git a/modal-go/examples/sandbox-proxy/main.go b/modal-go/examples/sandbox-proxy/main.go index 09c04d33..65687c91 100644 --- a/modal-go/examples/sandbox-proxy/main.go +++ b/modal-go/examples/sandbox-proxy/main.go @@ -33,9 +33,9 @@ func main() { Proxy: proxy, }) if err != nil { - log.Fatalf("Failed to create sandbox: %v", err) + log.Fatalf("Failed to create Sandbox: %v", err) } - fmt.Printf("Created sandbox with proxy: %s\n", sb.SandboxID) + fmt.Printf("Created Sandbox with proxy: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) diff --git a/modal-go/examples/sandbox-tunnels/main.go b/modal-go/examples/sandbox-tunnels/main.go index c5ae1b98..00cb4395 100644 --- a/modal-go/examples/sandbox-tunnels/main.go +++ b/modal-go/examples/sandbox-tunnels/main.go @@ -26,7 +26,7 @@ func main() { // Create a Sandbox with Python's built-in HTTP server image := mc.Images.FromRegistry("python:3.12-alpine", nil) - sandbox, err := mc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + sb, err := mc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Command: []string{"python3", "-m", "http.server", "8000"}, EncryptedPorts: []int{8000}, Timeout: 1 * time.Minute, @@ -36,18 +36,18 @@ func main() { log.Fatalf("Failed to create Sandbox: %v", err) } defer func() { - if err := sandbox.Terminate(context.Background()); err != nil { - log.Fatalf("Failed to terminate Sandbox %s: %v", sandbox.SandboxID, err) + if err := sb.Terminate(context.Background()); err != nil { + log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) } }() - fmt.Printf("Sandbox created: %s\n", sandbox.SandboxID) + fmt.Printf("Sandbox created: %s\n", sb.SandboxID) fmt.Println("Waiting for server to start...") time.Sleep(3 * time.Second) fmt.Println("Getting tunnel information...") - tunnels, err := sandbox.Tunnels(ctx, 30*time.Second) + tunnels, err := sb.Tunnels(ctx, 30*time.Second) if err != nil { log.Fatalf("Failed to get tunnels: %v", err) } diff --git a/modal-go/examples/sandbox/main.go b/modal-go/examples/sandbox/main.go index dbb79e48..c112287e 100644 --- a/modal-go/examples/sandbox/main.go +++ b/modal-go/examples/sandbox/main.go @@ -29,7 +29,7 @@ func main() { if err != nil { log.Fatalf("Failed to create Sandbox: %v", err) } - fmt.Printf("sandbox: %s\n", sb.SandboxID) + fmt.Printf("Created Sandbox with ID: %s\n", sb.SandboxID) defer func() { if err := sb.Terminate(context.Background()); err != nil { log.Fatalf("Failed to terminate Sandbox %s: %v", sb.SandboxID, err) diff --git a/modal-go/test/auth_token_manager_test.go b/modal-go/test/auth_token_manager_test.go index cd334b6d..a247b431 100644 --- a/modal-go/test/auth_token_manager_test.go +++ b/modal-go/test/auth_token_manager_test.go @@ -32,7 +32,6 @@ func (m *mockAuthClient) AuthTokenGet(ctx context.Context, req *pb.AuthTokenGetR }.Build(), nil } -// Creates a JWT token for testing func createTestJWT(expiry int64) string { token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "exp": expiry, @@ -53,14 +52,12 @@ func TestAuthTokenManager_DecodeJWT(t *testing.T) { validToken := createTestJWT(123456789) mockClient.setAuthToken(validToken) - // FetchToken should decode and store the JWT _, err := manager.FetchToken(context.Background()) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(manager.GetCurrentToken()).Should(gomega.Equal(validToken)) } -// Setting the initial token and having it cached. func TestAuthTokenManager_InitialFetch(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) @@ -89,16 +86,13 @@ func TestAuthTokenManager_IsExpired(t *testing.T) { manager := modal.NewAuthTokenManager(nil, slog.Default()) - // Test not expired manager.SetToken("token", time.Now().Unix()+3600) g.Expect(manager.IsExpired()).Should(gomega.BeFalse()) - // Test expired manager.SetToken("token", time.Now().Unix()-3600) g.Expect(manager.IsExpired()).Should(gomega.BeTrue()) } -// Refreshing an expired token. Unlikely to occur since we refresh in background before expiry. func TestAuthTokenManager_RefreshExpiredToken(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) @@ -113,12 +107,10 @@ func TestAuthTokenManager_RefreshExpiredToken(t *testing.T) { manager.SetToken(expiringToken, now-60) mockClient.setAuthToken(freshToken) - // Start the background refresh goroutine err := manager.Start(context.Background()) g.Expect(err).ToNot(gomega.HaveOccurred()) defer manager.Stop() - // Wait for background goroutine to refresh the token g.Eventually(func() string { return manager.GetCurrentToken() }, "1s", "10ms").Should(gomega.Equal(freshToken)) @@ -138,18 +130,15 @@ func TestAuthTokenManager_RefreshNearExpiryToken(t *testing.T) { manager.SetToken(expiringToken, now+60) mockClient.setAuthToken(freshToken) - // Start the background refresh goroutine err := manager.Start(context.Background()) g.Expect(err).ToNot(gomega.HaveOccurred()) defer manager.Stop() - // Wait for background goroutine to refresh the token g.Eventually(func() string { return manager.GetCurrentToken() }, "1s", "10ms").Should(gomega.Equal(freshToken)) } -// Should error out if no valid token is available. func TestAuthTokenManager_GetToken_ExpiredToken(t *testing.T) { t.Parallel() g := gomega.NewWithT(t) diff --git a/modal-go/test/cls_test.go b/modal-go/test/cls_test.go index 5f16fc00..0510cbf8 100644 --- a/modal-go/test/cls_test.go +++ b/modal-go/test/cls_test.go @@ -20,7 +20,6 @@ func TestClsCall(t *testing.T) { instance, err := cls.Instance(ctx, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Try accessing a non-existent method _, err = instance.Method("nonexistent") g.Expect(err).Should(gomega.BeAssignableToTypeOf(modal.NotFoundError{})) diff --git a/modal-go/test/function_call_test.go b/modal-go/test/function_call_test.go index ec3e30c4..bf920575 100644 --- a/modal-go/test/function_call_test.go +++ b/modal-go/test/function_call_test.go @@ -50,11 +50,9 @@ func TestFunctionSpawn(t *testing.T) { _, err = functionCall.Get(ctx, nil) g.Expect(err).Should(gomega.HaveOccurred()) - // Spawn function with long running input. functionCall, err = sleep.Spawn(ctx, nil, map[string]any{"t": 5}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Get is now expected to timeout. timeout := 1 * time.Second _, err = functionCall.Get(ctx, &modal.FunctionCallGetParams{Timeout: &timeout}) g.Expect(err).Should(gomega.HaveOccurred()) diff --git a/modal-go/test/function_test.go b/modal-go/test/function_test.go index afbc087e..3c9e7726 100644 --- a/modal-go/test/function_test.go +++ b/modal-go/test/function_test.go @@ -21,12 +21,10 @@ func TestFunctionCall(t *testing.T) { function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "echo_string", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Represent Python kwargs. result, err := function.Remote(ctx, nil, map[string]any{"s": "hello"}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(result).Should(gomega.Equal("output: hello")) - // Try the same, but with args. result, err = function.Remote(ctx, []any{"hello"}, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(result).Should(gomega.Equal("output: hello")) @@ -42,7 +40,6 @@ func TestFunctionCallPreCborVersionError(t *testing.T) { function, err := tc.Functions.FromName(ctx, "test-support-1-1", "identity_with_repr", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Represent Python kwargs. _, err = function.Remote(ctx, nil, map[string]any{"s": "hello"}) g.Expect(err).Should(gomega.HaveOccurred()) g.Expect(err.Error()).Should(gomega.ContainSubstring("Redeploy with Modal Python SDK >= 1.2")) @@ -152,7 +149,6 @@ func TestFunctionCallInputPlane(t *testing.T) { function, err := tc.Functions.FromName(ctx, "libmodal-test-support", "input_plane", nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Try the same, but with args. result, err := function.Remote(ctx, []any{"hello"}, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(result).Should(gomega.Equal("output: hello")) diff --git a/modal-go/test/image_test.go b/modal-go/test/image_test.go index 467ab02d..61272a7b 100644 --- a/modal-go/test/image_test.go +++ b/modal-go/test/image_test.go @@ -289,7 +289,6 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { grpcmock.HandleUnary( mock, "ImageGetOrCreate", func(req *pb.ImageGetOrCreateRequest) (*pb.ImageGetOrCreateResponse, error) { - g.Expect(req.GetAppId()).To(gomega.Equal("ap-test")) image := req.GetImage() g.Expect(image.GetDockerfileCommands()).To(gomega.Equal([]string{"FROM alpine:3.21"})) g.Expect(image.GetSecretIds()).To(gomega.BeEmpty()) @@ -307,7 +306,6 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { grpcmock.HandleUnary( mock, "ImageGetOrCreate", func(req *pb.ImageGetOrCreateRequest) (*pb.ImageGetOrCreateResponse, error) { - g.Expect(req.GetAppId()).To(gomega.Equal("ap-test")) image := req.GetImage() g.Expect(image.GetDockerfileCommands()).To(gomega.Equal([]string{"FROM base", "RUN echo layer1"})) g.Expect(image.GetSecretIds()).To(gomega.BeEmpty()) @@ -327,7 +325,6 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { grpcmock.HandleUnary( mock, "ImageGetOrCreate", func(req *pb.ImageGetOrCreateRequest) (*pb.ImageGetOrCreateResponse, error) { - g.Expect(req.GetAppId()).To(gomega.Equal("ap-test")) image := req.GetImage() g.Expect(image.GetDockerfileCommands()).To(gomega.Equal([]string{"FROM base", "RUN echo layer2"})) g.Expect(image.GetSecretIds()).To(gomega.Equal([]string{"sc-test"})) @@ -350,7 +347,6 @@ func TestDockerfileCommandsWithOptions(t *testing.T) { grpcmock.HandleUnary( mock, "ImageGetOrCreate", func(req *pb.ImageGetOrCreateRequest) (*pb.ImageGetOrCreateResponse, error) { - g.Expect(req.GetAppId()).To(gomega.Equal("ap-test")) image := req.GetImage() g.Expect(image.GetDockerfileCommands()).To(gomega.Equal([]string{"FROM base", "RUN echo layer3"})) g.Expect(image.GetSecretIds()).To(gomega.BeEmpty()) diff --git a/modal-go/test/proxy_test.go b/modal-go/test/proxy_test.go index 80d13aa9..c7659226 100644 --- a/modal-go/test/proxy_test.go +++ b/modal-go/test/proxy_test.go @@ -22,7 +22,6 @@ func TestCreateSandboxWithProxy(t *testing.T) { proxy, err := tc.Proxies.FromName(ctx, "libmodal-test-proxy", &modal.ProxyFromNameParams{Environment: "libmodal"}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(proxy.ProxyID).ShouldNot(gomega.BeEmpty()) g.Expect(strings.HasPrefix(proxy.ProxyID, "pr-")).To(gomega.BeTrue()) sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ @@ -30,14 +29,8 @@ func TestCreateSandboxWithProxy(t *testing.T) { Command: []string{"echo", "hello, Sandbox with Proxy"}, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) g.Expect(sb.SandboxID).ShouldNot(gomega.BeEmpty()) - - err = sb.Terminate(ctx) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - - exitcode, err := sb.Wait(ctx) - g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(exitcode).To(gomega.Equal(137)) } func TestProxyNotFound(t *testing.T) { diff --git a/modal-go/test/queue_test.go b/modal-go/test/queue_test.go index b98108af..d8a27e53 100644 --- a/modal-go/test/queue_test.go +++ b/modal-go/test/queue_test.go @@ -59,12 +59,10 @@ func TestQueueSuite1(t *testing.T) { g.Expect(err).ToNot(gomega.HaveOccurred()) defer queue.CloseEphemeral() - // queue.len() == 0 n, err := queue.Len(ctx, nil) g.Expect(err).ToNot(gomega.HaveOccurred()) g.Expect(n).To(gomega.Equal(0)) - // put / len / get g.Expect(queue.Put(ctx, 123, nil)).ToNot(gomega.HaveOccurred()) n, err = queue.Len(ctx, nil) @@ -91,7 +89,6 @@ func TestQueueSuite1(t *testing.T) { g.Expect(err).ToNot(gomega.HaveOccurred()) g.Expect(n).To(gomega.Equal(0)) - // putMany + iterator g.Expect(queue.PutMany(ctx, []any{1, 2, 3}, nil)).ToNot(gomega.HaveOccurred()) results := make([]int64, 0, 3) diff --git a/modal-go/test/sandbox_filesystem_snapshot_test.go b/modal-go/test/sandbox_filesystem_snapshot_test.go index d6af885b..18c79275 100644 --- a/modal-go/test/sandbox_filesystem_snapshot_test.go +++ b/modal-go/test/sandbox_filesystem_snapshot_test.go @@ -39,12 +39,10 @@ func TestSnapshotFilesystem(t *testing.T) { err = sb.Terminate(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Create new Sandbox from snapshot sb2, err := tc.Sandboxes.Create(ctx, app, snapshotImage, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) defer terminateSandbox(g, sb2) - // Verify file exists in snapshot proc, err := sb2.Exec(ctx, []string{"cat", "/tmp/test.txt"}, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -52,7 +50,6 @@ func TestSnapshotFilesystem(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(string(output)).To(gomega.Equal("test content")) - // Verify directory exists in snapshot dirCheck, err := sb2.Exec(ctx, []string{"test", "-d", "/tmp/testdir"}, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/sandbox_filesystem_test.go b/modal-go/test/sandbox_filesystem_test.go index ffb969b4..3a5d55b6 100644 --- a/modal-go/test/sandbox_filesystem_test.go +++ b/modal-go/test/sandbox_filesystem_test.go @@ -173,7 +173,6 @@ func TestSandboxFileOpenModes(t *testing.T) { sb := createSandbox(ctx, g, c) defer terminateSandbox(g, sb) - // Test write mode (truncates) content1 := []byte("Initial content") writer, err := sb.Open(ctx, "/tmp/modes.txt", "w") g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -183,7 +182,6 @@ func TestSandboxFileOpenModes(t *testing.T) { err = writer.Close() g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Test read mode reader1, err := sb.Open(ctx, "/tmp/modes.txt", "r") g.Expect(err).ShouldNot(gomega.HaveOccurred()) readContent1, err := io.ReadAll(reader1) @@ -192,7 +190,6 @@ func TestSandboxFileOpenModes(t *testing.T) { err = reader1.Close() g.Expect(err).ShouldNot(gomega.HaveOccurred()) - // Test append mode content2 := []byte(" appended") appender, err := sb.Open(ctx, "/tmp/modes.txt", "a") g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/sandbox_test.go b/modal-go/test/sandbox_test.go index 5f9a518c..7189ed40 100644 --- a/modal-go/test/sandbox_test.go +++ b/modal-go/test/sandbox_test.go @@ -20,14 +20,13 @@ func TestCreateOneSandbox(t *testing.T) { app, err := tc.Apps.FromName(ctx, "libmodal-test", &modal.AppFromNameParams{CreateIfMissing: true}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(app.Name).To(gomega.Equal("libmodal-test")) image := tc.Images.FromRegistry("alpine:3.21", nil) sb, err := tc.Sandboxes.Create(ctx, app, image, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(sb.SandboxID).ShouldNot(gomega.BeEmpty()) defer terminateSandbox(g, sb) + g.Expect(sb.SandboxID).ShouldNot(gomega.BeEmpty()) err = sb.Terminate(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -110,10 +109,8 @@ func TestSandboxCreateOptions(t *testing.T) { Verbose: true, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(sb).ShouldNot(gomega.BeNil()) - g.Expect(sb.SandboxID).Should(gomega.HavePrefix("sb-")) - defer terminateSandbox(g, sb) + g.Expect(sb.SandboxID).Should(gomega.HavePrefix("sb-")) exitCode, err := sb.Wait(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -147,7 +144,6 @@ func TestSandboxExecOptions(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) defer terminateSandbox(g, sb) - // Test with a custom working directory and timeout. p, err := sb.Exec(ctx, []string{"pwd"}, &modal.SandboxExecParams{ Workdir: "/tmp", Timeout: 5, @@ -181,17 +177,16 @@ func TestSandboxWithVolume(t *testing.T) { }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - sandbox, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Command: []string{"echo", "volume test"}, Volumes: map[string]*modal.Volume{ "/mnt/test": volume, }, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(sandbox).ShouldNot(gomega.BeNil()) - g.Expect(sandbox.SandboxID).Should(gomega.HavePrefix("sb-")) + defer terminateSandbox(g, sb) - exitCode, err := sandbox.Wait(ctx) + exitCode, err := sb.Wait(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(exitCode).Should(gomega.Equal(0)) } @@ -248,17 +243,17 @@ func TestSandboxWithTunnels(t *testing.T) { image := tc.Images.FromRegistry("alpine:3.21", nil) - sandbox, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Command: []string{"cat"}, EncryptedPorts: []int{8443}, UnencryptedPorts: []int{8080}, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - defer terminateSandbox(g, sandbox) + defer terminateSandbox(g, sb) - g.Expect(sandbox.SandboxID).Should(gomega.HavePrefix("sb-")) + g.Expect(sb.SandboxID).Should(gomega.HavePrefix("sb-")) - tunnels, err := sandbox.Tunnels(ctx, 30*time.Second) + tunnels, err := sb.Tunnels(ctx, 30*time.Second) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(tunnels).Should(gomega.HaveLen(2)) @@ -300,6 +295,7 @@ func TestCreateSandboxWithSecrets(t *testing.T) { sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{Secrets: []*modal.Secret{secret}, Command: []string{"printenv", "c"}}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) output, err := io.ReadAll(sb.Stdout) g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -317,24 +313,25 @@ func TestSandboxPollAndReturnCode(t *testing.T) { image := tc.Images.FromRegistry("alpine:3.21", nil) - sandbox, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{Command: []string{"cat"}}) + sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{Command: []string{"cat"}}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) - pollResult, err := sandbox.Poll(ctx) + pollResult, err := sb.Poll(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(pollResult).Should(gomega.BeNil()) // Send input to make the cat command complete - _, err = sandbox.Stdin.Write([]byte("hello, sandbox")) + _, err = sb.Stdin.Write([]byte("hello, Sandbox")) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - err = sandbox.Stdin.Close() + err = sb.Stdin.Close() g.Expect(err).ShouldNot(gomega.HaveOccurred()) - waitResult, err := sandbox.Wait(ctx) + waitResult, err := sb.Wait(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(waitResult).To(gomega.Equal(0)) - pollResult, err = sandbox.Poll(ctx) + pollResult, err = sb.Poll(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(pollResult).ShouldNot(gomega.BeNil()) g.Expect(*pollResult).To(gomega.Equal(0)) @@ -351,16 +348,17 @@ func TestSandboxPollAfterFailure(t *testing.T) { image := tc.Images.FromRegistry("alpine:3.21", nil) - sandbox, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ + sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{ Command: []string{"sh", "-c", "exit 42"}, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) - waitResult, err := sandbox.Wait(ctx) + waitResult, err := sb.Wait(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(waitResult).To(gomega.Equal(42)) - pollResult, err := sandbox.Poll(ctx) + pollResult, err := sb.Poll(ctx) g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(pollResult).ShouldNot(gomega.BeNil()) g.Expect(*pollResult).To(gomega.Equal(42)) @@ -637,9 +635,8 @@ func TestNamedSandbox(t *testing.T) { Command: []string{"sleep", "60"}, }) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(sb.SandboxID).ShouldNot(gomega.BeEmpty()) - defer terminateSandbox(g, sb) + g.Expect(sb.SandboxID).ShouldNot(gomega.BeEmpty()) sb1FromName, err := tc.Sandboxes.FromName(ctx, "libmodal-test", sandboxName, nil) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/test/secret_test.go b/modal-go/test/secret_test.go index a803ddfe..1fe60370 100644 --- a/modal-go/test/secret_test.go +++ b/modal-go/test/secret_test.go @@ -62,6 +62,7 @@ func TestSecretFromMap(t *testing.T) { sb, err := tc.Sandboxes.Create(ctx, app, image, &modal.SandboxCreateParams{Secrets: []*modal.Secret{secret}, Command: []string{"printenv", "key"}}) g.Expect(err).ShouldNot(gomega.HaveOccurred()) + defer terminateSandbox(g, sb) output, err := io.ReadAll(sb.Stdout) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-js/examples/sandbox-poll.ts b/modal-js/examples/sandbox-poll.ts index 196c2343..b5ac704c 100644 --- a/modal-js/examples/sandbox-poll.ts +++ b/modal-js/examples/sandbox-poll.ts @@ -8,18 +8,18 @@ const app = await modal.apps.fromName("libmodal-example", { const image = modal.images.fromRegistry("alpine:3.21"); // Create a Sandbox that waits for input, then exits with code 42 -const sandbox = await modal.sandboxes.create(app, image, { +const sb = await modal.sandboxes.create(app, image, { command: ["sh", "-c", "read line; exit 42"], }); -console.log("Started Sandbox:", sandbox.sandboxId); +console.log("Started Sandbox:", sb.sandboxId); -console.log("Poll result while running:", await sandbox.poll()); +console.log("Poll result while running:", await sb.poll()); console.log("\nSending input to trigger completion..."); -await sandbox.stdin.writeText("hello, goodbye"); -await sandbox.stdin.close(); +await sb.stdin.writeText("hello, goodbye"); +await sb.stdin.close(); -const exitCode = await sandbox.wait(); +const exitCode = await sb.wait(); console.log("\nSandbox completed with exit code:", exitCode); -console.log("Poll result after completion:", await sandbox.poll()); +console.log("Poll result after completion:", await sb.poll()); diff --git a/modal-js/examples/sandbox-secrets.ts b/modal-js/examples/sandbox-secrets.ts index c55edefc..b9f2b813 100644 --- a/modal-js/examples/sandbox-secrets.ts +++ b/modal-js/examples/sandbox-secrets.ts @@ -15,12 +15,12 @@ const ephemeralSecret = await modal.secrets.fromObject({ d: "123", }); -const sandbox = await modal.sandboxes.create(app, image, { +const sb = await modal.sandboxes.create(app, image, { command: ["sh", "-lc", "printenv | grep -E '^c|d='"], secrets: [secret, ephemeralSecret], }); -console.log("Sandbox created:", sandbox.sandboxId); +console.log("Sandbox created:", sb.sandboxId); console.log("Sandbox environment variables from Secrets:"); -console.log(await sandbox.stdout.readText()); +console.log(await sb.stdout.readText()); diff --git a/modal-js/examples/sandbox-tunnels.ts b/modal-js/examples/sandbox-tunnels.ts index e2145c33..ba45b827 100644 --- a/modal-js/examples/sandbox-tunnels.ts +++ b/modal-js/examples/sandbox-tunnels.ts @@ -8,17 +8,17 @@ const app = await modal.apps.fromName("libmodal-example", { // Create a Sandbox with Python's built-in HTTP server const image = modal.images.fromRegistry("python:3.12-alpine"); -const sandbox = await modal.sandboxes.create(app, image, { +const sb = await modal.sandboxes.create(app, image, { command: ["python3", "-m", "http.server", "8000"], encryptedPorts: [8000], timeoutMs: 60000, // 1 minute idleTimeoutMs: 30000, // 30 seconds }); -console.log("Sandbox created:", sandbox.sandboxId); +console.log("Sandbox created:", sb.sandboxId); console.log("Getting tunnel information..."); -const tunnels = await sandbox.tunnels(); +const tunnels = await sb.tunnels(); console.log("Waiting for server to start..."); await new Promise((resolve) => setTimeout(resolve, 3000)); @@ -38,4 +38,4 @@ console.log(html.substring(0, 500)); console.log("\n✅ Successfully connected to the tunneled server!"); -await sandbox.terminate(); +await sb.terminate(); diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index 1e21f86e..a279926a 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -72,7 +72,7 @@ export type ModalGrpcClient = Client< * * const app = await modal.apps.fromName("my-app"); * const image = modal.images.fromRegistry("python:3.13"); - * const sandbox = await modal.sandboxes.create(app, image); + * const sb = await modal.sandboxes.create(app, image); * ``` */ export class ModalClient { diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 017ec76f..1f9961ec 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -84,7 +84,7 @@ export type SandboxCreateParams = { /** Timeout of the Sandbox container in milliseconds, defaults to 10 minutes. */ timeoutMs?: number; - /** The amount of time in milliseconds that a sandbox can be idle before being terminated. */ + /** The amount of time in milliseconds that a Sandbox can be idle before being terminated. */ idleTimeoutMs?: number; /** Working directory of the Sandbox. */ @@ -333,7 +333,7 @@ export async function buildSandboxCreateRequestProto( * Normally only ever accessed via the client as: * ```typescript * const modal = new ModalClient(); - * const sandbox = await modal.sandboxes.create(app, image); + * const sb = await modal.sandboxes.create(app, image); * ``` */ export class SandboxService { diff --git a/modal-js/test/cls_with_options.test.ts b/modal-js/test/cls_with_options.test.ts index c3cc2cbc..81d542d9 100644 --- a/modal-js/test/cls_with_options.test.ts +++ b/modal-js/test/cls_with_options.test.ts @@ -23,9 +23,7 @@ test("Cls.withOptions stacking", async () => { mock.handleUnary("FunctionBindParams", (req: any) => { expect(req).toMatchObject({ functionId: "fid" }); const fo = req.functionOptions; - expect(fo).toBeDefined(); expect(fo.timeoutSecs).toBe(60); - expect(fo.resources).toBeDefined(); expect(fo.resources.milliCpu).toBe(250); expect(fo.resources.memoryMb).toBe(256); expect(fo.resources.gpuConfig).toBeDefined(); @@ -69,7 +67,6 @@ test("Cls.withConcurrency/withConcurrency/withBatching chaining", async () => { mock.handleUnary("FunctionBindParams", (req: any) => { expect(req).toMatchObject({ functionId: "fid" }); const fo = req.functionOptions; - expect(fo).toBeDefined(); expect(fo.timeoutSecs).toBe(60); expect(fo.maxConcurrentInputs).toBe(10); expect(fo.batchMaxSize).toBe(11); @@ -99,7 +96,6 @@ test("Cls.withOptions retries", async () => { mock.handleUnary("FunctionBindParams", (req: any) => { const fo = req.functionOptions; - expect(fo).toBeDefined(); expect(fo.retryPolicy).toMatchObject({ retries: 3, backoffCoefficient: 1.0, @@ -113,7 +109,6 @@ test("Cls.withOptions retries", async () => { mock.handleUnary("FunctionBindParams", (req: any) => { const fo = req.functionOptions; - expect(fo).toBeDefined(); expect(fo.retryPolicy).toMatchObject({ retries: 2, backoffCoefficient: 2.0, @@ -210,8 +205,6 @@ test("withOptions({ cpu, cpuLimit }) sets milliCpu and milliCpuMax", async () => mock.handleUnary("FunctionBindParams", (req: any) => { expect(req).toMatchObject({ functionId: "fid" }); const fo = req.functionOptions; - expect(fo).toBeDefined(); - expect(fo.resources).toBeDefined(); expect(fo.resources.milliCpu).toBe(2000); expect(fo.resources.milliCpuMax).toBe(4500); return { boundFunctionId: "fid-1", handleMetadata: {} }; @@ -266,8 +259,6 @@ test("withOptions({ memory, memoryLimit }) sets memoryMb and memoryMbMax", async mock.handleUnary("FunctionBindParams", (req: any) => { expect(req).toMatchObject({ functionId: "fid" }); const fo = req.functionOptions; - expect(fo).toBeDefined(); - expect(fo.resources).toBeDefined(); expect(fo.resources.memoryMb).toBe(1024); expect(fo.resources.memoryMbMax).toBe(2048); return { boundFunctionId: "fid-1", handleMetadata: {} }; diff --git a/modal-js/test/function_call.test.ts b/modal-js/test/function_call.test.ts index 134f4613..e59df508 100644 --- a/modal-js/test/function_call.test.ts +++ b/modal-js/test/function_call.test.ts @@ -8,26 +8,19 @@ test("FunctionSpawn", async () => { "echo_string", ); - // Spawn function with kwargs. let functionCall = await function_.spawn([], { s: "hello" }); - expect(functionCall.functionCallId).toBeDefined(); + expect(functionCall.functionCallId).toMatch(/^fc-/); - // Get results after spawn. let resultKwargs = await functionCall.get(); expect(resultKwargs).toBe("output: hello"); - // Try the same again; same results should still be available. resultKwargs = await functionCall.get(); expect(resultKwargs).toBe("output: hello"); - // Function that takes a long time to complete. const sleep = await tc.functions.fromName("libmodal-test-support", "sleep"); - - // Spawn with long running input. functionCall = await sleep.spawn([], { t: 5 }); - expect(functionCall.functionCallId).toBeDefined(); + expect(functionCall.functionCallId).toMatch(/^fc-/); - // Getting outputs with timeout raises error. const promise = functionCall.get({ timeoutMs: 1000 }); // 1000ms await expect(promise).rejects.toThrowError(FunctionTimeoutError); }); @@ -42,6 +35,6 @@ test("FunctionCallGet0", async () => { FunctionTimeoutError, ); - expect(await call.get()).toBe(null); // Wait for the function call to finish. - expect(await call.get({ timeoutMs: 0 })).toBe(null); // Now we can get the result. + expect(await call.get()).toBe(null); + expect(await call.get({ timeoutMs: 0 })).toBe(null); }); diff --git a/modal-js/test/image.test.ts b/modal-js/test/image.test.ts index 77c60498..1d34d02e 100644 --- a/modal-js/test/image.test.ts +++ b/modal-js/test/image.test.ts @@ -1,5 +1,5 @@ import { tc } from "../test-support/test-client"; -import { expect, test } from "vitest"; +import { expect, onTestFinished, test } from "vitest"; import { createMockModalClients } from "../test-support/grpc_mock"; import { Secret } from "../src/secret"; import { App } from "../src/app"; @@ -8,7 +8,6 @@ test("ImageFromId", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images.fromRegistry("alpine:3.21").build(app); expect(image.imageId).toBeTruthy(); @@ -23,7 +22,6 @@ test("ImageFromRegistry", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images.fromRegistry("alpine:3.21").build(app); expect(image.imageId).toBeTruthy(); @@ -39,7 +37,6 @@ test("ImageFromRegistryWithSecret", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images .fromRegistry( @@ -57,7 +54,6 @@ test("ImageFromAwsEcr", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images .fromAwsEcr( @@ -75,7 +71,6 @@ test("ImageFromGcpArtifactRegistry", { timeout: 30_000 }, async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images .fromGcpArtifactRegistry( @@ -89,90 +84,10 @@ test("ImageFromGcpArtifactRegistry", { timeout: 30_000 }, async () => { expect(image.imageId).toMatch(/^im-/); }); -test("CreateOneSandboxTopLevelImageAPI", async () => { - const app = await tc.apps.fromName("libmodal-test", { - createIfMissing: true, - }); - expect(app.appId).toBeTruthy(); - - const image = tc.images.fromRegistry("alpine:3.21"); - expect(image.imageId).toBeFalsy(); - - const sb = await tc.sandboxes.create(app, image); - expect(sb.sandboxId).toBeTruthy(); - await sb.terminate(); - - expect(image.imageId).toMatch(/^im-/); -}); - -test("CreateOneSandboxTopLevelImageAPISecret", async () => { - const app = await tc.apps.fromName("libmodal-test", { - createIfMissing: true, - }); - expect(app.appId).toBeTruthy(); - - const image = tc.images.fromRegistry( - "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", - await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { - requiredKeys: ["REGISTRY_USERNAME", "REGISTRY_PASSWORD"], - }), - ); - expect(image.imageId).toBeFalsy(); - - const sb = await tc.sandboxes.create(app, image); - expect(sb.sandboxId).toBeTruthy(); - await sb.terminate(); - - expect(image.imageId).toMatch(/^im-/); -}); - -test("ImageFromAwsEcrTopLevel", async () => { - const app = await tc.apps.fromName("libmodal-test", { - createIfMissing: true, - }); - expect(app.appId).toBeTruthy(); - - const image = tc.images.fromAwsEcr( - "459781239556.dkr.ecr.us-east-1.amazonaws.com/ecr-private-registry-test-7522615:python", - await tc.secrets.fromName("libmodal-aws-ecr-test", { - requiredKeys: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"], - }), - ); - expect(image.imageId).toBeFalsy(); - - const sb = await tc.sandboxes.create(app, image); - expect(sb.sandboxId).toBeTruthy(); - await sb.terminate(); - - expect(image.imageId).toMatch(/^im-/); -}); - -test("ImageFromGcpEcrTopLevel", async () => { - const app = await tc.apps.fromName("libmodal-test", { - createIfMissing: true, - }); - expect(app.appId).toBeTruthy(); - - const image = tc.images.fromGcpArtifactRegistry( - "us-east1-docker.pkg.dev/modal-prod-367916/private-repo-test/my-image", - await tc.secrets.fromName("libmodal-gcp-artifact-registry-test", { - requiredKeys: ["SERVICE_ACCOUNT_JSON"], - }), - ); - expect(image.imageId).toBeFalsy(); - - const sb = await tc.sandboxes.create(app, image); - expect(sb.sandboxId).toBeTruthy(); - await sb.terminate(); - - expect(image.imageId).toMatch(/^im-/); -}); - test("ImageDelete", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); const image = await tc.images.fromRegistry("alpine:3.13").build(app); expect(image.imageId).toBeTruthy(); @@ -208,11 +123,10 @@ test("DockerfileCommands", async () => { const sb = await tc.sandboxes.create(app, image, { command: ["cat", "/root/hello.txt"], }); + onTestFinished(async () => await sb.terminate()); const stdout = await sb.stdout.readText(); expect(stdout).toBe("hey\n"); - - await sb.terminate(); }); test("DockerfileCommandsEmptyArrayNoOp", () => { @@ -242,11 +156,10 @@ test("DockerfileCommandsChaining", async () => { "/root/layer3.txt", ], }); + onTestFinished(async () => await sb.terminate()); const stdout = await sb.stdout.readText(); expect(stdout).toBe("unset\nhello\nunset\n"); - - await sb.terminate(); }); test("DockerfileCommandsCopyCommandValidation", () => { diff --git a/modal-js/test/legacy/cls_with_options.test.ts b/modal-js/test/legacy/cls_with_options.test.ts index 7b717f89..f588842d 100644 --- a/modal-js/test/legacy/cls_with_options.test.ts +++ b/modal-js/test/legacy/cls_with_options.test.ts @@ -23,7 +23,6 @@ test("Cls.withOptions stacking", async () => { mock.handleUnary("FunctionBindParams", (req: any) => { expect(req).toMatchObject({ functionId: "fid" }); const fo = req.functionOptions; - expect(fo).toBeDefined(); expect(fo.timeoutSecs).toBe(60); expect(fo.resources).toBeDefined(); expect(fo.resources.milliCpu).toBe(250); diff --git a/modal-js/test/proxy.test.ts b/modal-js/test/proxy.test.ts index c91fdede..f72414fc 100644 --- a/modal-js/test/proxy.test.ts +++ b/modal-js/test/proxy.test.ts @@ -1,5 +1,5 @@ import { tc } from "../test-support/test-client"; -import { expect, test } from "vitest"; +import { expect, onTestFinished, test } from "vitest"; test("CreateSandboxWithProxy", async () => { const app = await tc.apps.fromName("libmodal-test", { @@ -15,12 +15,10 @@ test("CreateSandboxWithProxy", async () => { const sb = await tc.sandboxes.create(app, image, { proxy, - command: ["echo", "hello, sandbox with proxy"], + command: ["echo", "hello, Sandbox with proxy"], }); + onTestFinished(async () => await sb.terminate()); expect(sb.sandboxId).toBeTruthy(); - - await sb.terminate(); - expect(await sb.wait()).toBe(137); }); test("ProxyNotFound", async () => { diff --git a/modal-js/test/queue.test.ts b/modal-js/test/queue.test.ts index 1e3d9a90..90728db6 100644 --- a/modal-js/test/queue.test.ts +++ b/modal-js/test/queue.test.ts @@ -13,15 +13,16 @@ test("QueueInvalidName", async () => { test("QueueEphemeral", async () => { const queue = await tc.queues.ephemeral(); + onTestFinished(() => queue.closeEphemeral()); expect(queue.name).toBeUndefined(); await queue.put(123); expect(await queue.len()).toBe(1); expect(await queue.get()).toBe(123); - queue.closeEphemeral(); }); test("QueueSuite1", async () => { const queue = await tc.queues.ephemeral(); + onTestFinished(() => queue.closeEphemeral()); expect(await queue.len()).toBe(0); await queue.put(123); @@ -40,7 +41,6 @@ test("QueueSuite1", async () => { results.push(item); } expect(results).toEqual([1, 2, 3]); - queue.closeEphemeral(); }); test("QueueSuite2", async () => { @@ -58,27 +58,27 @@ test("QueueSuite2", async () => { }; const queue = await tc.queues.ephemeral(); + onTestFinished(() => queue.closeEphemeral()); await Promise.all([producer(queue), consumer(queue)]); expect(results).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); - queue.closeEphemeral(); }); test("QueuePutAndGetMany", async () => { const queue = await tc.queues.ephemeral(); + onTestFinished(() => queue.closeEphemeral()); await queue.putMany([1, 2, 3]); expect(await queue.len()).toBe(3); expect(await queue.getMany(3)).toEqual([1, 2, 3]); - queue.closeEphemeral(); }); test("QueueNonBlocking", async () => { // Assuming the queue is available, these operations // Should succeed immediately. const queue = await tc.queues.ephemeral(); + onTestFinished(() => queue.closeEphemeral()); await queue.put(123, { timeoutMs: 0 }); expect(await queue.len()).toBe(1); expect(await queue.get({ timeoutMs: 0 })).toBe(123); - queue.closeEphemeral(); }); test("QueueNonEphemeral", async () => { diff --git a/modal-js/test/retries.test.ts b/modal-js/test/retries.test.ts index aaf98dee..5d5c74fc 100644 --- a/modal-js/test/retries.test.ts +++ b/modal-js/test/retries.test.ts @@ -4,7 +4,6 @@ import { parseRetries } from "../src/retries"; test("parseRetries", async () => { const r = parseRetries(3)!; - expect(r).toBeDefined(); expect(r.maxRetries).toBe(3); expect(r.backoffCoefficient).toBe(1.0); expect(r.initialDelayMs).toBe(1000); diff --git a/modal-js/test/sandbox.test.ts b/modal-js/test/sandbox.test.ts index d4afd96e..82c815cf 100644 --- a/modal-js/test/sandbox.test.ts +++ b/modal-js/test/sandbox.test.ts @@ -9,15 +9,14 @@ test("CreateOneSandbox", async () => { const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); - expect(app.appId).toBeTruthy(); - expect(app.name).toBe("libmodal-test"); - const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); + onTestFinished(async () => { + await sb.terminate(); + expect(await sb.wait()).toBe(137); + }); expect(sb.sandboxId).toBeTruthy(); - await sb.terminate(); - expect(await sb.wait()).toBe(137); }); test("PassCatToStdin", async () => { @@ -26,18 +25,14 @@ test("PassCatToStdin", async () => { }); const image = tc.images.fromRegistry("alpine:3.21"); - // Spawn a sandbox running the "cat" command. const sb = await tc.sandboxes.create(app, image, { command: ["cat"] }); + onTestFinished(async () => await sb.terminate()); - // Write to the sandbox's stdin and read from its stdout. await sb.stdin.writeText("this is input that should be mirrored by cat"); await sb.stdin.close(); expect(await sb.stdout.readText()).toBe( "this is input that should be mirrored by cat", ); - - // Terminate the sandbox. - await sb.terminate(); }); test("IgnoreLargeStdout", async () => { @@ -47,16 +42,14 @@ test("IgnoreLargeStdout", async () => { const image = tc.images.fromRegistry("python:3.13-alpine"); const sb = await tc.sandboxes.create(app, image); - try { - const p = await sb.exec(["python", "-c", `print("a" * 1_000_000)`], { - stdout: "ignore", - }); - expect(await p.stdout.readText()).toBe(""); // Stdout is ignored - // Stdout should be consumed after cancel, without blocking the process. - expect(await p.wait()).toBe(0); - } finally { - await sb.terminate(); - } + onTestFinished(async () => await sb.terminate()); + + const p = await sb.exec(["python", "-c", `print("a" * 1_000_000)`], { + stdout: "ignore", + }); + expect(await p.stdout.readText()).toBe(""); // Stdout is ignored + // Stdout should be consumed after cancel, without blocking the process. + expect(await p.wait()).toBe(0); }); test("SandboxCreateOptions", async () => { @@ -65,21 +58,17 @@ test("SandboxCreateOptions", async () => { }); const image = tc.images.fromRegistry("alpine:3.21"); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["echo", "hello, params"], cloud: "aws", regions: ["us-east-1", "us-west-2"], verbose: true, }); + onTestFinished(async () => await sb.terminate()); - onTestFinished(async () => { - await sandbox.terminate(); - }); - - expect(sandbox).toBeDefined(); - expect(sandbox.sandboxId).toMatch(/^sb-/); + expect(sb.sandboxId).toMatch(/^sb-/); - const exitCode = await sandbox.wait(); + const exitCode = await sb.wait(); expect(exitCode).toBe(0); await expect( @@ -102,18 +91,14 @@ test("SandboxExecOptions", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - try { - // Test with a custom working directory and timeout. - const p = await sb.exec(["pwd"], { - workdir: "/tmp", - timeoutMs: 5000, - }); - - expect(await p.stdout.readText()).toBe("/tmp\n"); - expect(await p.wait()).toBe(0); - } finally { - await sb.terminate(); - } + onTestFinished(async () => await sb.terminate()); + const p = await sb.exec(["pwd"], { + workdir: "/tmp", + timeoutMs: 5000, + }); + + expect(await p.stdout.readText()).toBe("/tmp\n"); + expect(await p.wait()).toBe(0); }); test("parseGpuConfig", () => { @@ -173,15 +158,15 @@ test("SandboxWithVolume", async () => { createIfMissing: true, }); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["echo", "volume test"], volumes: { "/mnt/test": volume }, }); + onTestFinished(async () => await sb.terminate()); - expect(sandbox).toBeDefined(); - expect(sandbox.sandboxId).toMatch(/^sb-/); + expect(sb.sandboxId).toMatch(/^sb-/); - const exitCode = await sandbox.wait(); + const exitCode = await sb.wait(); expect(exitCode).toBe(0); }); @@ -202,11 +187,10 @@ test("SandboxWithReadOnlyVolume", async () => { command: ["sh", "-c", "echo 'test' > /mnt/test/test.txt"], volumes: { "/mnt/test": readOnlyVolume }, }); + onTestFinished(async () => await sb.terminate()); expect(await sb.wait()).toBe(1); expect(await sb.stderr.readText()).toContain("Read-only file system"); - - await sb.terminate(); }); test("SandboxWithTunnels", async () => { @@ -215,16 +199,16 @@ test("SandboxWithTunnels", async () => { }); const image = tc.images.fromRegistry("alpine:3.21"); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["cat"], encryptedPorts: [8443], unencryptedPorts: [8080], }); + onTestFinished(async () => await sb.terminate()); - expect(sandbox).toBeDefined(); - expect(sandbox.sandboxId).toMatch(/^sb-/); + expect(sb.sandboxId).toMatch(/^sb-/); - const tunnels = await sandbox.tunnels(); + const tunnels = await sb.tunnels(); expect(Object.keys(tunnels)).toHaveLength(2); // Test encrypted tunnel (port 8443) @@ -245,8 +229,6 @@ test("SandboxWithTunnels", async () => { unencryptedTunnel.unencryptedHost, unencryptedTunnel.unencryptedPort, ]); - - await sandbox.terminate(); }); test("CreateSandboxWithSecrets", async () => { @@ -258,15 +240,14 @@ test("CreateSandboxWithSecrets", async () => { const secret = await tc.secrets.fromName("libmodal-test-secret", { requiredKeys: ["c"], }); - expect(secret).toBeDefined(); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["printenv", "c"], secrets: [secret], }); - expect(sandbox).toBeDefined(); + onTestFinished(async () => await sb.terminate()); - const result = await sandbox.stdout.readText(); + const result = await sb.stdout.readText(); expect(result).toBe("hello world\n"); }); @@ -281,12 +262,8 @@ test("CreateSandboxWithNetworkAccessParams", async () => { blockNetwork: false, cidrAllowlist: ["10.0.0.0/8", "192.168.0.0/16"], }); + onTestFinished(async () => await sb.terminate()); - onTestFinished(async () => { - await sb.terminate(); - }); - - expect(sb).toBeDefined(); expect(sb.sandboxId).toMatch(/^sb-/); const exitCode = await sb.wait(); @@ -315,16 +292,17 @@ test("SandboxPollAndReturnCode", async () => { }); const image = tc.images.fromRegistry("alpine:3.21"); - const sandbox = await tc.sandboxes.create(app, image, { command: ["cat"] }); + const sb = await tc.sandboxes.create(app, image, { command: ["cat"] }); + onTestFinished(async () => await sb.terminate()); - expect(await sandbox.poll()).toBeNull(); + expect(await sb.poll()).toBeNull(); // Send input to make the cat command complete - await sandbox.stdin.writeText("hello, sandbox"); - await sandbox.stdin.close(); + await sb.stdin.writeText("hello, Sandbox"); + await sb.stdin.close(); - expect(await sandbox.wait()).toBe(0); - expect(await sandbox.poll()).toBe(0); + expect(await sb.wait()).toBe(0); + expect(await sb.poll()).toBe(0); }); test("SandboxPollAfterFailure", async () => { @@ -333,12 +311,13 @@ test("SandboxPollAfterFailure", async () => { }); const image = tc.images.fromRegistry("alpine:3.21"); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["sh", "-c", "exit 42"], }); + onTestFinished(async () => await sb.terminate()); - expect(await sandbox.wait()).toBe(42); - expect(await sandbox.poll()).toBe(42); + expect(await sb.wait()).toBe(42); + expect(await sb.poll()).toBe(42); }); test("SandboxExecSecret", async () => { @@ -348,11 +327,7 @@ test("SandboxExecSecret", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - expect(sb.sandboxId).toBeTruthy(); - - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const secret = await tc.secrets.fromName("libmodal-test-secret", { requiredKeys: ["c"], @@ -373,9 +348,8 @@ test("SandboxFromId", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); + const sbFromId = await tc.sandboxes.fromId(sb.sandboxId); expect(sbFromId.sandboxId).toBe(sb.sandboxId); }); @@ -390,10 +364,7 @@ test("SandboxWithWorkdir", async () => { command: ["pwd"], workdir: "/tmp", }); - - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); expect(await sb.stdout.readText()).toBe("/tmp\n"); }); @@ -418,9 +389,7 @@ test("SandboxSetTagsAndList", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const unique = `${Math.random()}`; @@ -446,9 +415,7 @@ test("SandboxSetMultipleTagsAndList", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const tagA = `A-${Math.random()}`; const tagB = `B-${Math.random()}`; @@ -494,9 +461,7 @@ test("SandboxListByAppId", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); let count = 0; for await (const s of tc.sandboxes.list({ appId: app.appId })) { @@ -519,10 +484,7 @@ test("NamedSandbox", async () => { name: sandboxName, command: ["sleep", "60"], }); - - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const sb1FromName = await tc.sandboxes.fromName("libmodal-test", sandboxName); expect(sb1FromName.sandboxId).toBe(sb.sandboxId); @@ -555,7 +517,6 @@ test("buildContainerExecRequestProto with PTY", async () => { }); const ptyInfo = req.ptyInfo!; - expect(ptyInfo).toBeDefined(); expect(ptyInfo.enabled).toBe(true); expect(ptyInfo.winszRows).toBe(24); expect(ptyInfo.winszCols).toBe(80); diff --git a/modal-js/test/sandbox_filesystem.test.ts b/modal-js/test/sandbox_filesystem.test.ts index a806e156..3ee75c43 100644 --- a/modal-js/test/sandbox_filesystem.test.ts +++ b/modal-js/test/sandbox_filesystem.test.ts @@ -7,17 +7,13 @@ test("WriteAndReadBinaryFile", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const testData = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - // Write binary data const writeHandle = await sb.open("/tmp/test.bin", "w"); await writeHandle.write(testData); await writeHandle.close(); - // Read binary data const readHandle = await sb.open("/tmp/test.bin", "r"); const readData = await readHandle.read(); expect(readData).toEqual(testData); @@ -30,23 +26,18 @@ test("AppendToFileBinary", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const testData = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - // Write initial content const writeHandle = await sb.open("/tmp/append.txt", "w"); await writeHandle.write(testData); await writeHandle.close(); - // Append more content const moreTestData = new Uint8Array([7, 8, 9, 10]); const appendHandle = await sb.open("/tmp/append.txt", "a"); await appendHandle.write(moreTestData); await appendHandle.close(); - // Read the entire file const readHandle = await sb.open("/tmp/append.txt", "r"); const content = await readHandle.read(); const expectedData = new Uint8Array([ @@ -62,18 +53,15 @@ test("FileHandleFlush", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); const encodedData = new TextEncoder().encode("Test data"); const handle = await sb.open("/tmp/flush.txt", "w"); await handle.write(encodedData); - await handle.flush(); // Ensure data is written to disk + await handle.flush(); await handle.close(); - // Verify the data was written const readHandle = await sb.open("/tmp/flush.txt", "r"); const content = await readHandle.read(); expect(content).toEqual(encodedData); @@ -86,11 +74,8 @@ test("MultipleFileOperations", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); - // Create multiple files const encoder = new TextEncoder(); const content1 = encoder.encode("File 1 content"); const handle1 = await sb.open("/tmp/file1.txt", "w"); @@ -102,7 +87,6 @@ test("MultipleFileOperations", async () => { await handle2.write(content2); await handle2.close(); - // Read both files const read1 = await sb.open("/tmp/file1.txt", "r"); const readContent1 = await read1.read(); await read1.close(); @@ -121,30 +105,24 @@ test("FileOpenModes", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); - // Test write mode (truncates) const encoder = new TextEncoder(); const content1 = encoder.encode("Initial content"); const writeHandle = await sb.open("/tmp/modes.txt", "w"); await writeHandle.write(content1); await writeHandle.close(); - // Test read mode const readHandle = await sb.open("/tmp/modes.txt", "r"); const readContent1 = await readHandle.read(); expect(readContent1).toEqual(content1); await readHandle.close(); - // Test append mode const appendContent = encoder.encode(" appended"); const appendHandle = await sb.open("/tmp/modes.txt", "a"); await appendHandle.write(appendContent); await appendHandle.close(); - // Verify append worked const expectedContent = encoder.encode("Initial content appended"); const finalRead = await sb.open("/tmp/modes.txt", "r"); const finalContent = await finalRead.read(); @@ -158,11 +136,8 @@ test("LargeFileOperations", async () => { }); const image = await tc.images.fromRegistry("alpine:3.21").build(app); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); - // Create a larger file const encoder = new TextEncoder(); const largeData = encoder.encode("x".repeat(1000)); @@ -170,7 +145,6 @@ test("LargeFileOperations", async () => { await writeHandle.write(largeData); await writeHandle.close(); - // Read it back const readHandle = await sb.open("/tmp/large.txt", "r"); const content = await readHandle.read(); expect(content).toEqual(largeData); diff --git a/modal-js/test/sandbox_filesystem_snapshot.test.ts b/modal-js/test/sandbox_filesystem_snapshot.test.ts index b7f629cd..8f6e396c 100644 --- a/modal-js/test/sandbox_filesystem_snapshot.test.ts +++ b/modal-js/test/sandbox_filesystem_snapshot.test.ts @@ -8,31 +8,24 @@ test("snapshotFilesystem", async () => { const image = tc.images.fromRegistry("alpine:3.21"); const sb = await tc.sandboxes.create(app, image); - onTestFinished(async () => { - await sb.terminate(); - }); + onTestFinished(async () => await sb.terminate()); await sb.exec(["sh", "-c", "echo -n 'test content' > /tmp/test.txt"]); await sb.exec(["mkdir", "-p", "/tmp/testdir"]); const snapshotImage = await sb.snapshotFilesystem(); - expect(snapshotImage).toBeDefined(); expect(snapshotImage.imageId).toMatch(/^im-/); await sb.terminate(); - // Create new sandbox from snapshot + // Create new Sandbox from snapshot const sb2 = await tc.sandboxes.create(app, snapshotImage); - onTestFinished(async () => { - await sb2.terminate(); - }); + onTestFinished(async () => await sb2.terminate()); - // Verify file exists in snapshot const proc = await sb2.exec(["cat", "/tmp/test.txt"]); const output = await proc.stdout.readText(); expect(output).toBe("test content"); - // Verify directory exists in snapshot const dirCheck = await sb2.exec(["test", "-d", "/tmp/testdir"]); expect(await dirCheck.wait()).toBe(0); }); diff --git a/modal-js/test/secret.test.ts b/modal-js/test/secret.test.ts index e13d92ad..66825a4e 100644 --- a/modal-js/test/secret.test.ts +++ b/modal-js/test/secret.test.ts @@ -1,13 +1,11 @@ import { tc } from "../test-support/test-client"; -import { expect, test } from "vitest"; +import { expect, onTestFinished, test } from "vitest"; import { mergeEnvIntoSecrets } from "../src/secret"; import { createMockModalClients } from "../test-support/grpc_mock"; import { NotFoundError } from "../src/errors"; test("SecretFromName", async () => { const secret = await tc.secrets.fromName("libmodal-test-secret"); - expect(secret).toBeDefined(); - expect(secret.secretId).toBeDefined(); expect(secret.secretId).toMatch(/^st-/); expect(secret.name).toBe("libmodal-test-secret"); @@ -21,7 +19,7 @@ test("SecretFromNameWithRequiredKeys", async () => { const secret = await tc.secrets.fromName("libmodal-test-secret", { requiredKeys: ["a", "b", "c"], }); - expect(secret).toBeDefined(); + expect(secret.secretId).toMatch(/^st-/); const promise = tc.secrets.fromName("libmodal-test-secret", { requiredKeys: ["a", "b", "c", "missing-key"], @@ -33,19 +31,20 @@ test("SecretFromNameWithRequiredKeys", async () => { test("SecretFromObject", async () => { const secret = await tc.secrets.fromObject({ key: "value" }); - expect(secret).toBeDefined(); + expect(secret.secretId).toMatch(/^st-/); const app = await tc.apps.fromName("libmodal-test", { createIfMissing: true, }); const image = tc.images.fromRegistry("alpine:3.21"); - const sandbox = await tc.sandboxes.create(app, image, { + const sb = await tc.sandboxes.create(app, image, { command: ["printenv", "key"], secrets: [secret], }); + onTestFinished(async () => await sb.terminate()); - const output = await sandbox.stdout.readText(); + const output = await sb.stdout.readText(); expect(output).toBe("value\n"); }); diff --git a/modal-js/test/version_tracking.test.ts b/modal-js/test/version_tracking.test.ts index 155ddb30..92fee06c 100644 --- a/modal-js/test/version_tracking.test.ts +++ b/modal-js/test/version_tracking.test.ts @@ -4,13 +4,11 @@ import { ModalClient } from "modal"; declare const __MODAL_SDK_VERSION__: string; test("VersionConstantFormat", () => { - expect(__MODAL_SDK_VERSION__).toBeDefined(); expect(__MODAL_SDK_VERSION__).toMatch(/^\d+\.\d+\.\d+(-dev\.\d+)?$/); }); test("ClientVersion", () => { const client = new ModalClient(); - expect(client.version()).toBeDefined(); expect(client.version()).toMatch(/^\d+\.\d+\.\d+(-dev\.\d+)?$/); expect(client.version()).toBe(__MODAL_SDK_VERSION__); client.close(); diff --git a/modal-js/test/volume.test.ts b/modal-js/test/volume.test.ts index 7406d682..618d3355 100644 --- a/modal-js/test/volume.test.ts +++ b/modal-js/test/volume.test.ts @@ -1,5 +1,5 @@ import { tc } from "../test-support/test-client"; -import { expect, test } from "vitest"; +import { expect, onTestFinished, test } from "vitest"; import { createMockModalClients } from "../test-support/grpc_mock"; import { NotFoundError } from "../src/errors"; @@ -7,8 +7,6 @@ test("Volume.fromName", async () => { const volume = await tc.volumes.fromName("libmodal-test-volume", { createIfMissing: true, }); - expect(volume).toBeDefined(); - expect(volume.volumeId).toBeDefined(); expect(volume.volumeId).toMatch(/^vo-/); expect(volume.name).toBe("libmodal-test-volume"); @@ -35,11 +33,12 @@ test("Volume.readOnly", async () => { test("VolumeEphemeral", async () => { const volume = await tc.volumes.ephemeral(); + onTestFinished(() => volume.closeEphemeral()); + expect(volume.name).toBeUndefined(); expect(volume.volumeId).toMatch(/^vo-/); expect(volume.isReadOnly).toBe(false); expect(volume.readOnly().isReadOnly).toBe(true); - volume.closeEphemeral(); }); test("VolumeDelete success", async () => { From b2bca98c0f4171436f41459c20a545489c5af87b Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Tue, 18 Nov 2025 11:21:11 +0100 Subject: [PATCH 53/59] modal-go: enable and fix errcheck lint (#220) *Log errors that were previously ignored * Use t.Setenv in tests * Add usetesting to make sure we use t. utilities when available --- modal-go/.golangci.toml | 9 +++- modal-go/client_test.go | 3 +- modal-go/config_test.go | 22 +-------- modal-go/examples/sandbox-tunnels/main.go | 2 +- modal-go/function.go | 17 ++++--- modal-go/function_call.go | 2 +- modal-go/invocation.go | 33 ++++++++----- modal-go/sandbox.go | 57 ++++++++++++++++------- modal-go/test/grpc_test.go | 9 +++- modal-go/test/sandbox_filesystem_test.go | 4 +- 10 files changed, 98 insertions(+), 60 deletions(-) diff --git a/modal-go/.golangci.toml b/modal-go/.golangci.toml index c49dec71..1e986e9e 100644 --- a/modal-go/.golangci.toml +++ b/modal-go/.golangci.toml @@ -1,7 +1,14 @@ version = "2" [linters] -disable = ["errcheck"] +enable = [ + "errcheck", + "govet", + "ineffassign", + "staticcheck", + "unused", + "usetesting", +] [linters.settings.staticcheck] checks = ["all"] diff --git a/modal-go/client_test.go b/modal-go/client_test.go index cd4ee110..a01ec382 100644 --- a/modal-go/client_test.go +++ b/modal-go/client_test.go @@ -25,7 +25,8 @@ func TestClientWithLogger(t *testing.T) { g.Expect(err).ShouldNot(gomega.HaveOccurred()) g.Expect(client).NotTo(gomega.BeNil()) - w.Close() + err = w.Close() + g.Expect(err).ShouldNot(gomega.HaveOccurred()) output, err := io.ReadAll(r) g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/config_test.go b/modal-go/config_test.go index 0907072f..f9752cb4 100644 --- a/modal-go/config_test.go +++ b/modal-go/config_test.go @@ -11,17 +11,8 @@ import ( func TestGetConfigPath_WithEnvVar(t *testing.T) { g := gomega.NewWithT(t) - originalPath := os.Getenv("MODAL_CONFIG_PATH") - defer func() { - if originalPath != "" { - os.Setenv("MODAL_CONFIG_PATH", originalPath) - } else { - os.Unsetenv("MODAL_CONFIG_PATH") - } - }() - customPath := "/custom/path/to/config.toml" - os.Setenv("MODAL_CONFIG_PATH", customPath) + t.Setenv("MODAL_CONFIG_PATH", customPath) path, err := configFilePath() g.Expect(err).ShouldNot(gomega.HaveOccurred()) @@ -31,16 +22,7 @@ func TestGetConfigPath_WithEnvVar(t *testing.T) { func TestGetConfigPath_WithoutEnvVar(t *testing.T) { g := gomega.NewWithT(t) - originalPath := os.Getenv("MODAL_CONFIG_PATH") - defer func() { - if originalPath != "" { - os.Setenv("MODAL_CONFIG_PATH", originalPath) - } else { - os.Unsetenv("MODAL_CONFIG_PATH") - } - }() - - os.Unsetenv("MODAL_CONFIG_PATH") + t.Setenv("MODAL_CONFIG_PATH", "") path, err := configFilePath() g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/examples/sandbox-tunnels/main.go b/modal-go/examples/sandbox-tunnels/main.go index 00cb4395..26a9c131 100644 --- a/modal-go/examples/sandbox-tunnels/main.go +++ b/modal-go/examples/sandbox-tunnels/main.go @@ -68,7 +68,7 @@ func main() { if err != nil { log.Fatalf("Failed to make GET request: %v", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { log.Fatalf("HTTP error! status: %d", resp.StatusCode) diff --git a/modal-go/function.go b/modal-go/function.go index 1700907b..c1879a52 100644 --- a/modal-go/function.go +++ b/modal-go/function.go @@ -10,6 +10,7 @@ import ( "encoding/base64" "errors" "fmt" + "log/slog" "net/http" "strings" "time" @@ -197,7 +198,7 @@ func (f *Function) createInput(ctx context.Context, args []any, kwargs map[strin dataFormat := pb.DataFormat_DATA_FORMAT_CBOR var argsBlobID *string if len(argsBytes) > maxObjectSizeBytes { - blobID, err := blobUpload(ctx, f.client.cpClient, argsBytes) + blobID, err := blobUpload(ctx, f.client.cpClient, f.client.logger, argsBytes) if err != nil { return nil, err } @@ -308,9 +309,9 @@ func (f *Function) createRemoteInvocation(ctx context.Context, input *pb.Functio if err != nil { return nil, err } - return createInputPlaneInvocation(ctx, ipClient, f.FunctionID, input) + return createInputPlaneInvocation(ctx, ipClient, f.client.logger, f.FunctionID, input) } - return createControlPlaneInvocation(ctx, f.client.cpClient, f.FunctionID, input, pb.FunctionCallInvocationType_FUNCTION_CALL_INVOCATION_TYPE_SYNC) + return createControlPlaneInvocation(ctx, f.client.cpClient, f.client.logger, f.FunctionID, input, pb.FunctionCallInvocationType_FUNCTION_CALL_INVOCATION_TYPE_SYNC) } // Spawn starts running a single input on a remote Function. @@ -323,7 +324,7 @@ func (f *Function) Spawn(ctx context.Context, args []any, kwargs map[string]any) if err != nil { return nil, err } - invocation, err := createControlPlaneInvocation(ctx, f.client.cpClient, f.FunctionID, input, pb.FunctionCallInvocationType_FUNCTION_CALL_INVOCATION_TYPE_SYNC) + invocation, err := createControlPlaneInvocation(ctx, f.client.cpClient, f.client.logger, f.FunctionID, input, pb.FunctionCallInvocationType_FUNCTION_CALL_INVOCATION_TYPE_SYNC) if err != nil { return nil, err } @@ -381,7 +382,7 @@ func (f *Function) GetWebURL() string { } // blobUpload uploads a blob to storage and returns its ID. -func blobUpload(ctx context.Context, client pb.ModalClientClient, data []byte) (string, error) { +func blobUpload(ctx context.Context, client pb.ModalClientClient, logger *slog.Logger, data []byte) (string, error) { md5sum := md5.Sum(data) sha256sum := sha256.Sum256(data) contentMd5 := base64.StdEncoding.EncodeToString(md5sum[:]) @@ -411,7 +412,11 @@ func blobUpload(ctx context.Context, client pb.ModalClientClient, data []byte) ( if err != nil { return "", fmt.Errorf("failed to upload blob: %w", err) } - defer uploadResp.Body.Close() + defer func() { + if err := uploadResp.Body.Close(); err != nil { + logger.DebugContext(ctx, "failed to close upload response body", "error", err.Error()) + } + }() if uploadResp.StatusCode < 200 || uploadResp.StatusCode >= 300 { return "", fmt.Errorf("failed blob upload: %s", uploadResp.Status) } diff --git a/modal-go/function_call.go b/modal-go/function_call.go index cc23e9eb..b608f7f7 100644 --- a/modal-go/function_call.go +++ b/modal-go/function_call.go @@ -47,7 +47,7 @@ func (fc *FunctionCall) Get(ctx context.Context, params *FunctionCallGetParams) if params == nil { params = &FunctionCallGetParams{} } - invocation := controlPlaneInvocationFromFunctionCallID(fc.client.cpClient, fc.FunctionCallID) + invocation := controlPlaneInvocationFromFunctionCallID(fc.client.cpClient, fc.client.logger, fc.FunctionCallID) return invocation.awaitOutput(ctx, params.Timeout) } diff --git a/modal-go/invocation.go b/modal-go/invocation.go index cd40e32d..f155d838 100644 --- a/modal-go/invocation.go +++ b/modal-go/invocation.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "log/slog" "net/http" "time" @@ -24,10 +25,11 @@ type controlPlaneInvocation struct { inputJwt string cpClient pb.ModalClientClient + logger *slog.Logger } // createControlPlaneInvocation executes a function call and returns a new controlPlaneInvocation. -func createControlPlaneInvocation(ctx context.Context, cpClient pb.ModalClientClient, functionID string, input *pb.FunctionInput, invocationType pb.FunctionCallInvocationType) (*controlPlaneInvocation, error) { +func createControlPlaneInvocation(ctx context.Context, cpClient pb.ModalClientClient, logger *slog.Logger, functionID string, input *pb.FunctionInput, invocationType pb.FunctionCallInvocationType) (*controlPlaneInvocation, error) { functionPutInputsItem := pb.FunctionPutInputsItem_builder{ Idx: 0, Input: input, @@ -49,16 +51,17 @@ func createControlPlaneInvocation(ctx context.Context, cpClient pb.ModalClientCl functionCallJwt: functionMapResponse.GetFunctionCallJwt(), inputJwt: functionMapResponse.GetPipelinedInputs()[0].GetInputJwt(), cpClient: cpClient, + logger: logger, }, nil } // controlPlaneInvocationFromFunctionCallID creates a controlPlaneInvocation from a function call ID. -func controlPlaneInvocationFromFunctionCallID(cpClient pb.ModalClientClient, functionCallID string) *controlPlaneInvocation { - return &controlPlaneInvocation{FunctionCallID: functionCallID, cpClient: cpClient} +func controlPlaneInvocationFromFunctionCallID(cpClient pb.ModalClientClient, logger *slog.Logger, functionCallID string) *controlPlaneInvocation { + return &controlPlaneInvocation{FunctionCallID: functionCallID, cpClient: cpClient, logger: logger} } func (c *controlPlaneInvocation) awaitOutput(ctx context.Context, timeout *time.Duration) (any, error) { - return pollFunctionOutput(ctx, c.cpClient, c.getOutput, timeout) + return pollFunctionOutput(ctx, c.cpClient, c.logger, c.getOutput, timeout) } func (c *controlPlaneInvocation) retry(ctx context.Context, retryCount uint32) error { @@ -108,10 +111,11 @@ type inputPlaneInvocation struct { attemptToken string ipClient pb.ModalClientClient + logger *slog.Logger } // createInputPlaneInvocation creates a new InputPlaneInvocation by starting an attempt. -func createInputPlaneInvocation(ctx context.Context, ipClient pb.ModalClientClient, functionID string, input *pb.FunctionInput) (*inputPlaneInvocation, error) { +func createInputPlaneInvocation(ctx context.Context, ipClient pb.ModalClientClient, logger *slog.Logger, functionID string, input *pb.FunctionInput) (*inputPlaneInvocation, error) { functionPutInputsItem := pb.FunctionPutInputsItem_builder{ Idx: 0, Input: input, @@ -128,12 +132,13 @@ func createInputPlaneInvocation(ctx context.Context, ipClient pb.ModalClientClie input: functionPutInputsItem, attemptToken: attemptStartResp.GetAttemptToken(), ipClient: ipClient, + logger: logger, }, nil } // awaitOutput waits for the output with an optional timeout. func (i *inputPlaneInvocation) awaitOutput(ctx context.Context, timeout *time.Duration) (any, error) { - return pollFunctionOutput(ctx, i.ipClient, i.getOutput, timeout) + return pollFunctionOutput(ctx, i.ipClient, i.logger, i.getOutput, timeout) } // getOutput fetches the output for the current attempt. @@ -171,7 +176,7 @@ type getOutput func(ctx context.Context, timeout time.Duration) (*pb.FunctionGet // pollFunctionOutput repeatedly tries to fetch an output using the provided `getOutput` function, and the specified // timeout value. We use a timeout value of 55 seconds if the caller does not specify a timeout value, or if the // specified timeout value is greater than 55 seconds. -func pollFunctionOutput(ctx context.Context, client pb.ModalClientClient, getOutput getOutput, timeout *time.Duration) (any, error) { +func pollFunctionOutput(ctx context.Context, client pb.ModalClientClient, logger *slog.Logger, getOutput getOutput, timeout *time.Duration) (any, error) { startTime := time.Now() pollTimeout := outputsTimeout if timeout != nil { @@ -191,7 +196,7 @@ func pollFunctionOutput(ctx context.Context, client pb.ModalClientClient, getOut // Output serialization may fail if any of the output items can't be deserialized // into a supported Go type. Users are expected to serialize outputs correctly. if output != nil { - return processResult(ctx, client, output.GetResult(), output.GetDataFormat()) + return processResult(ctx, client, logger, output.GetResult(), output.GetDataFormat()) } if timeout != nil { @@ -206,7 +211,7 @@ func pollFunctionOutput(ctx context.Context, client pb.ModalClientClient, getOut } // processResult processes the result from an invocation. -func processResult(ctx context.Context, client pb.ModalClientClient, result *pb.GenericResult, dataFormat pb.DataFormat) (any, error) { +func processResult(ctx context.Context, client pb.ModalClientClient, logger *slog.Logger, result *pb.GenericResult, dataFormat pb.DataFormat) (any, error) { if result == nil { return nil, RemoteError{"Received null result from invocation"} } @@ -217,7 +222,7 @@ func processResult(ctx context.Context, client pb.ModalClientClient, result *pb. case pb.GenericResult_Data_case: data = result.GetData() case pb.GenericResult_DataBlobId_case: - data, err = blobDownload(ctx, client, result.GetDataBlobId()) + data, err = blobDownload(ctx, client, logger, result.GetDataBlobId()) if err != nil { return nil, err } @@ -243,7 +248,7 @@ func processResult(ctx context.Context, client pb.ModalClientClient, result *pb. } // blobDownload downloads a blob by its ID. -func blobDownload(ctx context.Context, client pb.ModalClientClient, blobID string) ([]byte, error) { +func blobDownload(ctx context.Context, client pb.ModalClientClient, logger *slog.Logger, blobID string) ([]byte, error) { resp, err := client.BlobGet(ctx, pb.BlobGetRequest_builder{ BlobId: blobID, }.Build()) @@ -258,7 +263,11 @@ func blobDownload(ctx context.Context, client pb.ModalClientClient, blobID strin if err != nil { return nil, fmt.Errorf("failed to download blob: %w", err) } - defer s3resp.Body.Close() + defer func() { + if err := s3resp.Body.Close(); err != nil { + logger.DebugContext(ctx, "failed to close download response body", "error", err.Error()) + } + }() buf, err := io.ReadAll(s3resp.Body) if err != nil { return nil, fmt.Errorf("failed to read blob data: %w", err) diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index a06c1330..8f31418c 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "iter" + "log/slog" "strings" "sync" "time" @@ -354,12 +355,12 @@ func newSandbox(client *Client, sandboxID string) *Sandbox { sb.Stdin = inputStreamSb(client.cpClient, sandboxID) sb.Stdout = &lazyStreamReader{ initFunc: func() io.ReadCloser { - return outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) + return outputStreamSb(client.cpClient, client.logger, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) }, } sb.Stderr = &lazyStreamReader{ initFunc: func() io.ReadCloser { - return outputStreamSb(client.cpClient, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + return outputStreamSb(client.cpClient, client.logger, sandboxID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) }, } return sb @@ -486,7 +487,7 @@ func (sb *Sandbox) Exec(ctx context.Context, command []string, params *SandboxEx "exec_id", resp.GetExecId(), "sandbox_id", sb.SandboxID, "command", command) - return newContainerProcess(sb.client.cpClient, resp.GetExecId(), *params), nil + return newContainerProcess(sb.client.cpClient, sb.client.logger, resp.GetExecId(), *params), nil } // Open opens a file in the Sandbox filesystem. @@ -760,7 +761,7 @@ type ContainerProcess struct { cpClient pb.ModalClientClient } -func newContainerProcess(cpClient pb.ModalClientClient, execID string, params SandboxExecParams) *ContainerProcess { +func newContainerProcess(cpClient pb.ModalClientClient, logger *slog.Logger, execID string, params SandboxExecParams) *ContainerProcess { stdoutBehavior := Pipe stderrBehavior := Pipe if params.Stdout != "" { @@ -778,7 +779,7 @@ func newContainerProcess(cpClient pb.ModalClientClient, execID string, params Sa } else { cp.Stdout = &lazyStreamReader{ initFunc: func() io.ReadCloser { - return outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) + return outputStreamCp(cpClient, logger, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDOUT) }, } } @@ -787,7 +788,7 @@ func newContainerProcess(cpClient pb.ModalClientClient, execID string, params Sa } else { cp.Stderr = &lazyStreamReader{ initFunc: func() io.ReadCloser { - return outputStreamCp(cpClient, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) + return outputStreamCp(cpClient, logger, execID, pb.FileDescriptor_FILE_DESCRIPTOR_STDERR) }, } } @@ -927,11 +928,15 @@ func (l *lazyStreamReader) Close() error { return nil } -func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileDescriptor) io.ReadCloser { +func outputStreamSb(cpClient pb.ModalClientClient, logger *slog.Logger, sandboxID string, fd pb.FileDescriptor) io.ReadCloser { pr, pw := nio.Pipe(buffer.New(64 * 1024)) ctx, cancel := context.WithCancel(context.Background()) go func() { - defer pw.Close() + defer func() { + if err := pw.Close(); err != nil { + logger.DebugContext(ctx, "failed to close pipe writer", "error", err.Error()) + } + }() defer cancel() lastIndex := "0-0" completed := false @@ -951,7 +956,10 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD retries-- continue } - pw.CloseWithError(fmt.Errorf("error getting output stream: %w", err)) + streamErr := fmt.Errorf("error getting output stream: %w", err) + if closeErr := pw.CloseWithError(streamErr); closeErr != nil { + logger.DebugContext(ctx, "failed to close pipe writer with error", "error", closeErr.Error(), "stream_error", streamErr.Error()) + } return } for { @@ -964,7 +972,10 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD if isRetryableGrpc(err) && retries > 0 { retries-- } else { - pw.CloseWithError(fmt.Errorf("error getting output stream: %w", err)) + streamErr := fmt.Errorf("error getting output stream: %w", err) + if closeErr := pw.CloseWithError(streamErr); closeErr != nil { + logger.DebugContext(ctx, "failed to close pipe writer with error", "error", closeErr.Error(), "stream_error", streamErr.Error()) + } return } } @@ -973,7 +984,9 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD lastIndex = batch.GetEntryId() for _, item := range batch.GetItems() { // On error, writer has been closed. Still consume the rest of the channel. - pw.Write([]byte(item.GetData())) + if _, err := pw.Write([]byte(item.GetData())); err != nil { + logger.DebugContext(ctx, "failed to write to pipe", "error", err.Error()) + } } if batch.GetEof() { completed = true @@ -985,11 +998,15 @@ func outputStreamSb(cpClient pb.ModalClientClient, sandboxID string, fd pb.FileD return &cancelOnCloseReader{ReadCloser: pr, cancel: cancel} } -func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDescriptor) io.ReadCloser { +func outputStreamCp(cpClient pb.ModalClientClient, logger *slog.Logger, execID string, fd pb.FileDescriptor) io.ReadCloser { pr, pw := nio.Pipe(buffer.New(64 * 1024)) ctx, cancel := context.WithCancel(context.Background()) go func() { - defer pw.Close() + defer func() { + if err := pw.Close(); err != nil { + logger.DebugContext(ctx, "failed to close pipe writer", "error", err.Error()) + } + }() defer cancel() var lastIndex uint64 completed := false @@ -1010,7 +1027,10 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc retries-- continue } - pw.CloseWithError(fmt.Errorf("error getting output stream: %w", err)) + streamErr := fmt.Errorf("error getting output stream: %w", err) + if closeErr := pw.CloseWithError(streamErr); closeErr != nil { + logger.DebugContext(ctx, "failed to close pipe writer with error", "error", closeErr.Error(), "stream_error", streamErr.Error()) + } return } for { @@ -1023,7 +1043,10 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc if isRetryableGrpc(err) && retries > 0 { retries-- } else { - pw.CloseWithError(fmt.Errorf("error getting output stream: %w", err)) + streamErr := fmt.Errorf("error getting output stream: %w", err) + if closeErr := pw.CloseWithError(streamErr); closeErr != nil { + logger.DebugContext(ctx, "failed to close pipe writer with error", "error", closeErr.Error(), "stream_error", streamErr.Error()) + } return } } @@ -1032,7 +1055,9 @@ func outputStreamCp(cpClient pb.ModalClientClient, execID string, fd pb.FileDesc lastIndex = batch.GetBatchIndex() for _, item := range batch.GetItems() { // On error, writer has been closed. Still consume the rest of the channel. - pw.Write(item.GetMessageBytes()) + if _, err := pw.Write(item.GetMessageBytes()); err != nil { + logger.DebugContext(ctx, "failed to write to pipe", "error", err.Error()) + } } if batch.HasExitCode() { completed = true diff --git a/modal-go/test/grpc_test.go b/modal-go/test/grpc_test.go index 33d25758..f7c20f4e 100644 --- a/modal-go/test/grpc_test.go +++ b/modal-go/test/grpc_test.go @@ -11,6 +11,7 @@ import ( "github.com/onsi/gomega" "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" "google.golang.org/grpc/test/bufconn" @@ -88,7 +89,13 @@ func TestClientRespectsContextDeadline(t *testing.T) { grpc.WithTransportCredentials(insecure.NewCredentials()), ) g.Expect(err).ShouldNot(gomega.HaveOccurred()) - defer conn.Close() + defer func() { + if conn.GetState() != connectivity.Shutdown { + if err := conn.Close(); err != nil { + t.Errorf("failed to close gRPC connection: %v", err) + } + } + }() client, err := modal.NewClientWithOptions(&modal.ClientParams{ TokenID: "test-token-id", diff --git a/modal-go/test/sandbox_filesystem_test.go b/modal-go/test/sandbox_filesystem_test.go index 3a5d55b6..f0bbcc24 100644 --- a/modal-go/test/sandbox_filesystem_test.go +++ b/modal-go/test/sandbox_filesystem_test.go @@ -76,7 +76,9 @@ func TestSandboxAppendToFileBinary(t *testing.T) { appender, err := sb.Open(ctx, "/tmp/append.txt", "a") g.Expect(err).ShouldNot(gomega.HaveOccurred()) moreText := []byte{7, 8, 9, 10} - appender.Write(moreText) + n, err = appender.Write(moreText) + g.Expect(err).ShouldNot(gomega.HaveOccurred()) + g.Expect(n).Should(gomega.Equal(len(moreText))) reader, err := sb.Open(ctx, "/tmp/append.txt", "r") g.Expect(err).ShouldNot(gomega.HaveOccurred()) From cf880035d181a3748d1bcfaed7f3fecacfe9d5fc Mon Sep 17 00:00:00 2001 From: Egor Gagushin <37989662+eggag32@users.noreply.github.com> Date: Tue, 18 Nov 2025 17:40:39 -0500 Subject: [PATCH 54/59] Set `SchedulerPlacement` to `nil`/`undefined` if `region` is not specified (#221) --- modal-go/sandbox.go | 5 ++++- modal-js/src/sandbox.ts | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index 8f31418c..f124958d 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -153,7 +153,10 @@ func buildSandboxCreateRequestProto(appID, imageID string, params SandboxCreateP }.Build() } - schedulerPlacement := pb.SchedulerPlacement_builder{Regions: params.Regions}.Build() + var schedulerPlacement *pb.SchedulerPlacement + if len(params.Regions) > 0 { + schedulerPlacement = pb.SchedulerPlacement_builder{Regions: params.Regions}.Build() + } var proxyID *string if params.Proxy != nil { diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 1f9961ec..cdab641a 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -239,9 +239,12 @@ export async function buildSandboxCreateRequestProto( }; } - const schedulerPlacement = SchedulerPlacement.create({ - regions: params.regions ?? [], - }); + const schedulerPlacement: SchedulerPlacement | undefined = params.regions + ?.length + ? SchedulerPlacement.create({ + regions: params.regions, + }) + : undefined; let ptyInfo: PTYInfo | undefined; if (params.pty) { From 27711f0cf0a84bf582c65f9b75f58190431dbf44 Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Fri, 21 Nov 2025 16:47:11 +0200 Subject: [PATCH 55/59] Ensure we always use logging methods with Context (#225) * Ensure we always use logging methods with Context * Pass background contexts where we don't accept one from the user May consider changing the API in a future version. --- modal-go/.golangci.toml | 4 ++++ modal-go/app.go | 2 +- modal-go/auth_token_manager.go | 4 ++-- modal-go/client.go | 26 ++++++++++++++------------ modal-go/cloud_bucket_mount.go | 5 ++++- modal-go/function.go | 2 +- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/modal-go/.golangci.toml b/modal-go/.golangci.toml index 1e986e9e..26a4a40c 100644 --- a/modal-go/.golangci.toml +++ b/modal-go/.golangci.toml @@ -5,6 +5,7 @@ enable = [ "errcheck", "govet", "ineffassign", + "sloglint", "staticcheck", "unused", "usetesting", @@ -13,5 +14,8 @@ enable = [ [linters.settings.staticcheck] checks = ["all"] +[linters.settings.sloglint] +context = "all" + [formatters] enable = ["gofmt", "goimports"] diff --git a/modal-go/app.go b/modal-go/app.go index bc49f001..87ddf3dd 100644 --- a/modal-go/app.go +++ b/modal-go/app.go @@ -82,6 +82,6 @@ func (s *appServiceImpl) FromName(ctx context.Context, name string, params *AppF return nil, err } - s.client.logger.Debug("Retrieved App", "app_id", resp.GetAppId(), "app_name", name) + s.client.logger.DebugContext(ctx, "Retrieved App", "app_id", resp.GetAppId(), "app_name", name) return &App{AppID: resp.GetAppId(), Name: name}, nil } diff --git a/modal-go/auth_token_manager.go b/modal-go/auth_token_manager.go index 6d8cd663..cbbb4699 100644 --- a/modal-go/auth_token_manager.go +++ b/modal-go/auth_token_manager.go @@ -108,7 +108,7 @@ func (m *AuthTokenManager) backgroundRefresh(ctx context.Context) { // Refresh the token if _, err := m.FetchToken(ctx); err != nil { - m.logger.Error("Failed to refresh auth token", "error", err) + m.logger.ErrorContext(ctx, "Failed to refresh auth token", "error", err) // Sleep for 5 seconds before trying again on failure select { case <-ctx.Done(): @@ -135,7 +135,7 @@ func (m *AuthTokenManager) FetchToken(ctx context.Context) (string, error) { if exp := m.decodeJWT(token); exp > 0 { expiry = exp } else { - m.logger.Warn("x-modal-auth-token does not contain exp field") + m.logger.WarnContext(ctx, "x-modal-auth-token does not contain exp field") // We'll use the token, and set the expiry to 20 min from now. expiry = time.Now().Unix() + DefaultExpiryOffset } diff --git a/modal-go/client.go b/modal-go/client.go index ad40117b..3a18c5ac 100644 --- a/modal-go/client.go +++ b/modal-go/client.go @@ -112,6 +112,7 @@ type ClientParams struct { // NewClientWithOptions generates a new client and allows overriding options in the default profile configuration. func NewClientWithOptions(params *ClientParams) (*Client, error) { + ctx := context.Background() if params == nil { params = &ClientParams{} } @@ -161,7 +162,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { additionalStreamInterceptors: params.GRPCStreamInterceptors, } - logger.Debug("Initializing Modal client", "version", sdkVersion(), "server_url", profile.ServerURL) + logger.DebugContext(ctx, "Initializing Modal client", "version", sdkVersion(), "server_url", profile.ServerURL) if params.ControlPlaneClient != nil { c.cpClient = &clientWithConn{ @@ -169,7 +170,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { conn: params.ControlPlaneConn, } } else { - conn, client, err := newClient(profile, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) + conn, client, err := newClient(ctx, profile, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) if err != nil { return nil, fmt.Errorf("failed to create control plane client: %w", err) } @@ -181,7 +182,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { return nil, fmt.Errorf("failed to start auth token manager: %w", err) } - logger.Debug("Modal client initialized successfully") + logger.DebugContext(ctx, "Modal client initialized successfully") c.Apps = &appServiceImpl{client: c} c.CloudBucketMounts = &cloudBucketMountServiceImpl{client: c} @@ -200,7 +201,7 @@ func NewClientWithOptions(params *ClientParams) (*Client, error) { // ipClient returns the input plane client for the given server URL. // It creates a new client if one doesn't exist for that specific server URL, otherwise it returns the existing client. -func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { +func (c *Client) ipClient(ctx context.Context, serverURL string) (pb.ModalClientClient, error) { c.mu.RLock() if client, ok := c.ipClients[serverURL]; ok { c.mu.RUnlock() @@ -215,10 +216,10 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { return client, nil } - c.logger.Debug("Creating input plane client", "server_url", serverURL) + c.logger.DebugContext(ctx, "Creating input plane client", "server_url", serverURL) prof := c.profile prof.ServerURL = serverURL - conn, client, err := newClient(prof, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) + conn, client, err := newClient(ctx, prof, c, c.additionalUnaryInterceptors, c.additionalStreamInterceptors) if err != nil { return nil, err } @@ -228,25 +229,26 @@ func (c *Client) ipClient(serverURL string) (pb.ModalClientClient, error) { // Close stops the background auth token refresh and closes all gRPC connections. func (c *Client) Close() { - c.logger.Debug("Closing Modal client") + ctx := context.Background() + c.logger.DebugContext(ctx, "Closing Modal client") c.authTokenManager.Stop() if c.cpClient != nil { if err := c.cpClient.Close(); err != nil { - c.logger.Warn("Failed to close control plane connection", "error", err) + c.logger.WarnContext(ctx, "Failed to close control plane connection", "error", err) } } c.mu.Lock() for serverURL, client := range c.ipClients { if err := client.Close(); err != nil { - c.logger.Warn("Failed to close input plane connection", "server_url", serverURL, "error", err) + c.logger.WarnContext(ctx, "Failed to close input plane connection", "server_url", serverURL, "error", err) } } c.ipClients = map[string]*clientWithConn{} c.mu.Unlock() - c.logger.Debug("Modal client closed") + c.logger.DebugContext(ctx, "Modal client closed") } // Version returns the SDK version. @@ -298,7 +300,7 @@ func isRetryableGrpc(err error) bool { // newClient dials the given server URL with auth/timeout/retry interceptors installed. // It returns (conn, stub). Close the conn when done. -func newClient(profile Profile, c *Client, customUnaryInterceptors []grpc.UnaryClientInterceptor, customStreamInterceptors []grpc.StreamClientInterceptor) (*grpc.ClientConn, pb.ModalClientClient, error) { +func newClient(ctx context.Context, profile Profile, c *Client, customUnaryInterceptors []grpc.UnaryClientInterceptor, customStreamInterceptors []grpc.StreamClientInterceptor) (*grpc.ClientConn, pb.ModalClientClient, error) { var target string var creds credentials.TransportCredentials var scheme string @@ -314,7 +316,7 @@ func newClient(profile Profile, c *Client, customUnaryInterceptors []grpc.UnaryC return nil, nil, status.Errorf(codes.InvalidArgument, "invalid server URL: %s", profile.ServerURL) } - c.logger.Debug("Connecting to Modal server", "target", target, "scheme", scheme) + c.logger.DebugContext(ctx, "Connecting to Modal server", "target", target, "scheme", scheme) unaryInterceptors := []grpc.UnaryClientInterceptor{ headerInjectorUnaryInterceptor(profile, c.sdkVersion), diff --git a/modal-go/cloud_bucket_mount.go b/modal-go/cloud_bucket_mount.go index b491880f..3fcaac42 100644 --- a/modal-go/cloud_bucket_mount.go +++ b/modal-go/cloud_bucket_mount.go @@ -1,6 +1,7 @@ package modal import ( + "context" "fmt" "net/url" "strings" @@ -39,6 +40,7 @@ type CloudBucketMountParams struct { // New creates a new CloudBucketMount. func (s *cloudBucketMountServiceImpl) New(bucketName string, params *CloudBucketMountParams) (*CloudBucketMount, error) { + ctx := context.Background() if params == nil { params = &CloudBucketMountParams{} } @@ -67,7 +69,8 @@ func (s *cloudBucketMountServiceImpl) New(bucketName string, params *CloudBucket } else { mount.bucketType = pb.CloudBucketMount_S3 if s.client != nil && s.client.logger != nil { - s.client.logger.Debug( + s.client.logger.DebugContext( + ctx, "CloudBucketMount received unrecognized bucket endpoint URL. Assuming AWS S3 configuration as fallback.", "BucketEndpointURL", *mount.BucketEndpointURL, ) diff --git a/modal-go/function.go b/modal-go/function.go index c1879a52..45f69fb8 100644 --- a/modal-go/function.go +++ b/modal-go/function.go @@ -305,7 +305,7 @@ func (f *Function) createRemoteInvocation(ctx context.Context, input *pb.Functio } inputPlaneURL := metadata.GetInputPlaneUrl() if inputPlaneURL != "" { - ipClient, err := f.client.ipClient(inputPlaneURL) + ipClient, err := f.client.ipClient(ctx, inputPlaneURL) if err != nil { return nil, err } From ef8a1573210c7b398ab89d67bd3b5269359bbe4b Mon Sep 17 00:00:00 2001 From: Eric Hansander Date: Fri, 21 Nov 2025 17:15:01 +0200 Subject: [PATCH 56/59] Align null handling in protos with Python SDK (#223) * Send environment with FunctionBindParams * Send empty GPUConfig protos when no GPU specified * Send an empty list of PortSpecs if non specified To mimic the Python SDK behavior. --- CHANGELOG.md | 3 ++- modal-go/app.go | 4 +-- modal-go/app_test.go | 4 ++- modal-go/cls.go | 1 + modal-go/sandbox.go | 11 +++----- modal-js/src/app.ts | 11 ++++---- modal-js/src/cls.ts | 1 + modal-js/src/sandbox.ts | 40 +++++++++++++++++----------- modal-js/test/legacy/sandbox.test.ts | 4 +-- modal-js/test/sandbox.test.ts | 4 +-- 10 files changed, 46 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00cf1d35..0ddf091c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Both client libraries are pre-1.0, and they have separate versioning. - Test clean-ups: ensure we always terminate Sandboxes, close ephemeral objects, etc. - Added debug logging to `CloudBucketMount` creation in Go, bringing it in line with the JS SDK. - Updated the API for creating `CloudBucketMount`s in JS, using the same `modal.cloudBucketMounts.create()` pattern as other Modal objects, bringing it in line with the Go SDK. +- Aligned the way the JS/Go SDKs handle empty/missing fields in gRPC messages, so the behavior is identical to the Python SDK. ## modal-js/v0.5.4, modal-go/v0.5.4 @@ -29,7 +30,7 @@ Both client libraries are pre-1.0, and they have separate versioning. - All Go SDK functions that take a Context will respect the timeout of the context. - Improved the error message when calling a webhook Function as a normal Function. - Allow customizing the config file path via `MODAL_CONFIG_PATH` environment variable (defaults to `~/.modal.toml`). -- Add support for passing `MODAL_LOGLEVEL=debug` environment variable to also log debug logs, incl. all GRPC calls, etc. +- Add support for passing `MODAL_LOGLEVEL=debug` environment variable to also log debug logs, incl. all gRPC calls, etc. ## modal-js/v0.5.0, modal-go/v0.5.0 diff --git a/modal-go/app.go b/modal-go/app.go index 87ddf3dd..edbebc43 100644 --- a/modal-go/app.go +++ b/modal-go/app.go @@ -26,10 +26,10 @@ type App struct { // parseGPUConfig parses a GPU configuration string into a GPUConfig object. // The GPU string format is "type" or "type:count" (e.g. "T4", "A100:2"). -// Returns nil if gpu is empty, or an error if the format is invalid. +// Returns an empty config if gpu is empty, or an error if the format is invalid. func parseGPUConfig(gpu string) (*pb.GPUConfig, error) { if gpu == "" { - return nil, nil + return pb.GPUConfig_builder{}.Build(), nil } gpuType := gpu diff --git a/modal-go/app_test.go b/modal-go/app_test.go index 6123471f..3bc735b3 100644 --- a/modal-go/app_test.go +++ b/modal-go/app_test.go @@ -12,7 +12,9 @@ func TestParseGPUConfig(t *testing.T) { config, err := parseGPUConfig("") g.Expect(err).ShouldNot(gomega.HaveOccurred()) - g.Expect(config).Should(gomega.BeNil()) + g.Expect(config).ShouldNot(gomega.BeNil()) + g.Expect(config.GetCount()).To(gomega.Equal(uint32(0))) + g.Expect(config.GetGpuType()).To(gomega.Equal("")) config, err = parseGPUConfig("T4") g.Expect(err).ShouldNot(gomega.HaveOccurred()) diff --git a/modal-go/cls.go b/modal-go/cls.go index b2c20a55..2a970d9e 100644 --- a/modal-go/cls.go +++ b/modal-go/cls.go @@ -291,6 +291,7 @@ func (c *Cls) bindParameters(ctx context.Context, parameters map[string]any, opt FunctionId: c.serviceFunctionID, SerializedParams: serializedParams, FunctionOptions: functionOptions, + EnvironmentName: environmentName("", c.client.profile), }.Build()) if err != nil { return "", fmt.Errorf("failed to bind parameters: %w", err) diff --git a/modal-go/sandbox.go b/modal-go/sandbox.go index f124958d..e0295038 100644 --- a/modal-go/sandbox.go +++ b/modal-go/sandbox.go @@ -97,7 +97,7 @@ func buildSandboxCreateRequestProto(appID, imageID string, params SandboxCreateP ptyInfo = defaultSandboxPTYInfo() } - var openPorts []*pb.PortSpec + openPorts := make([]*pb.PortSpec, 0) for _, port := range params.EncryptedPorts { openPorts = append(openPorts, pb.PortSpec_builder{ Port: uint32(port), @@ -118,12 +118,9 @@ func buildSandboxCreateRequestProto(appID, imageID string, params SandboxCreateP }.Build()) } - var portSpecs *pb.PortSpecs - if len(openPorts) > 0 { - portSpecs = pb.PortSpecs_builder{ - Ports: openPorts, - }.Build() - } + portSpecs := pb.PortSpecs_builder{ + Ports: openPorts, + }.Build() secretIds := []string{} for _, secret := range params.Secrets { diff --git a/modal-js/src/app.ts b/modal-js/src/app.ts index 5787a3fb..39291165 100644 --- a/modal-js/src/app.ts +++ b/modal-js/src/app.ts @@ -75,11 +75,11 @@ export type EphemeralOptions = { /** * Parse a GPU configuration string into a GPUConfig object. * @param gpu - GPU string in format "type" or "type:count" (e.g. "T4", "A100:2") - * @returns GPUConfig object or undefined if no GPU specified + * @returns GPUConfig object (empty config if no GPU specified) */ -export function parseGpuConfig(gpu: string | undefined): GPUConfig | undefined { +export function parseGpuConfig(gpu: string | undefined): GPUConfig { if (!gpu) { - return undefined; + return GPUConfig.create({}); } let gpuType = gpu; @@ -96,11 +96,10 @@ export function parseGpuConfig(gpu: string | undefined): GPUConfig | undefined { } } - return { - type: 0, // Deprecated field, but required by proto + return GPUConfig.create({ count, gpuType: gpuType.toUpperCase(), - }; + }); } /** Represents a deployed Modal App. */ diff --git a/modal-js/src/cls.ts b/modal-js/src/cls.ts index 58871c5d..129eba83 100644 --- a/modal-js/src/cls.ts +++ b/modal-js/src/cls.ts @@ -238,6 +238,7 @@ export class Cls { functionId: this.#serviceFunctionId, serializedParams, functionOptions, + environmentName: this.#client.environmentName(), }); return bindResp.boundFunctionId; } diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index cdab641a..617c7cb5 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -15,6 +15,8 @@ import { SchedulerPlacement, TunnelType, PortSpec, + Resources, + PortSpecs, } from "../proto/modal_proto/api"; import { getDefaultClient, @@ -190,27 +192,33 @@ export async function buildSandboxCreateRequestProto( const openPorts: PortSpec[] = []; if (params.encryptedPorts) { openPorts.push( - ...params.encryptedPorts.map((port) => ({ - port, - unencrypted: false, - })), + ...params.encryptedPorts.map((port) => + PortSpec.create({ + port, + unencrypted: false, + }), + ), ); } if (params.h2Ports) { openPorts.push( - ...params.h2Ports.map((port) => ({ - port, - unencrypted: false, - tunnelType: TunnelType.TUNNEL_TYPE_H2, - })), + ...params.h2Ports.map((port) => + PortSpec.create({ + port, + unencrypted: false, + tunnelType: TunnelType.TUNNEL_TYPE_H2, + }), + ), ); } if (params.unencryptedPorts) { openPorts.push( - ...params.unencryptedPorts.map((port) => ({ - port, - unencrypted: true, - })), + ...params.unencryptedPorts.map((port) => + PortSpec.create({ + port, + unencrypted: true, + }), + ), ); } @@ -309,18 +317,18 @@ export async function buildSandboxCreateRequestProto( : undefined, workdir: params.workdir ?? undefined, networkAccess, - resources: { + resources: Resources.create({ milliCpu, milliCpuMax, memoryMb, memoryMbMax, gpuConfig, - }, + }), volumeMounts, cloudBucketMounts, ptyInfo, secretIds, - openPorts: openPorts.length > 0 ? { ports: openPorts } : undefined, + openPorts: PortSpecs.create({ ports: openPorts }), cloudProviderStr: params.cloud ?? "", schedulerPlacement, verbose: params.verbose ?? false, diff --git a/modal-js/test/legacy/sandbox.test.ts b/modal-js/test/legacy/sandbox.test.ts index 33ba1a46..85993f43 100644 --- a/modal-js/test/legacy/sandbox.test.ts +++ b/modal-js/test/legacy/sandbox.test.ts @@ -3,7 +3,7 @@ import { parseGpuConfig } from "../../src/app"; import { buildSandboxCreateRequestProto } from "../../src/sandbox"; import { expect, test, onTestFinished } from "vitest"; import { buildContainerExecRequestProto } from "../../src/sandbox"; -import { PTYInfo_PTYType } from "../../proto/modal_proto/api"; +import { GPUConfig, PTYInfo_PTYType } from "../../proto/modal_proto/api"; test("CreateOneSandbox", async () => { const app = await App.lookup("libmodal-test", { createIfMissing: true }); @@ -108,7 +108,7 @@ test("SandboxExecOptions", async () => { }); test("parseGpuConfig", () => { - expect(parseGpuConfig(undefined)).toBeUndefined(); + expect(parseGpuConfig(undefined)).toEqual(GPUConfig.create({})); expect(parseGpuConfig("T4")).toEqual({ type: 0, count: 1, diff --git a/modal-js/test/sandbox.test.ts b/modal-js/test/sandbox.test.ts index 82c815cf..445548ba 100644 --- a/modal-js/test/sandbox.test.ts +++ b/modal-js/test/sandbox.test.ts @@ -3,7 +3,7 @@ import { parseGpuConfig } from "../src/app"; import { buildSandboxCreateRequestProto } from "../src/sandbox"; import { expect, test, onTestFinished } from "vitest"; import { buildContainerExecRequestProto } from "../src/sandbox"; -import { PTYInfo_PTYType } from "../proto/modal_proto/api"; +import { GPUConfig, PTYInfo_PTYType } from "../proto/modal_proto/api"; test("CreateOneSandbox", async () => { const app = await tc.apps.fromName("libmodal-test", { @@ -102,7 +102,7 @@ test("SandboxExecOptions", async () => { }); test("parseGpuConfig", () => { - expect(parseGpuConfig(undefined)).toBeUndefined(); + expect(parseGpuConfig(undefined)).toEqual(GPUConfig.create({})); expect(parseGpuConfig("T4")).toEqual({ type: 0, count: 1, From 423b1b6453aac61469ae8c90b6086ef69225b7d7 Mon Sep 17 00:00:00 2001 From: "libmodal-release-workflow[bot]" <230031804+libmodal-release-workflow[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:50:23 +0100 Subject: [PATCH 57/59] [RELEASE] Prepare release for modal-js/v0.5.5, modal-go/v0.5.5 (#226) Co-authored-by: ehdr --- CHANGELOG.md | 4 ++++ modal-js/package-lock.json | 4 ++-- modal-js/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ddf091c..abc8ac8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Both client libraries are pre-1.0, and they have separate versioning. ## Unreleased +No unreleased changes. + +## modal-js/v0.5.5, modal-go/v0.5.5 + - Enabled goroutine leak detection for all tests by default. - Fixed a few remaining goroutine leaks. - Test clean-ups: ensure we always terminate Sandboxes, close ephemeral objects, etc. diff --git a/modal-js/package-lock.json b/modal-js/package-lock.json index 8e20b77e..26e9c8f7 100644 --- a/modal-js/package-lock.json +++ b/modal-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "modal", - "version": "0.5.4", + "version": "0.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modal", - "version": "0.5.4", + "version": "0.5.5", "license": "Apache-2.0", "dependencies": { "cbor-x": "^1.6.0", diff --git a/modal-js/package.json b/modal-js/package.json index 87b0cab8..df67298f 100644 --- a/modal-js/package.json +++ b/modal-js/package.json @@ -1,6 +1,6 @@ { "name": "modal", - "version": "0.5.4", + "version": "0.5.5", "description": "Modal SDK for JavaScript/TypeScript", "license": "Apache-2.0", "homepage": "https://modal.com/docs/guide/sdk-javascript-go", From 5f512266ecbb1e453ffee84dc7a1cdcbeee064d4 Mon Sep 17 00:00:00 2001 From: Conor Branagan <472446+conorbranagan@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:42:11 +0000 Subject: [PATCH 58/59] Add sandbox memory snapshots and connect tokens support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add experimental memory snapshot support (experimentalEnableSnapshot, experimentalSnapshot()) - Add Sandbox.createConnectToken() method for authenticated HTTP/WebSocket access - Add SandboxSnapshot class and SandboxSnapshotService - Add SandboxService.experimentalFromSnapshot() for restoring from snapshots - Export new types: ConnectToken, CreateConnectTokenParams, SandboxRestoreParams, etc. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- modal-js/src/client.ts | 3 + modal-js/src/index.ts | 5 + modal-js/src/sandbox.ts | 200 ++++++++++++++++++++++++++++++- modal-js/src/sandbox_snapshot.ts | 47 ++++++++ 4 files changed, 250 insertions(+), 5 deletions(-) create mode 100644 modal-js/src/sandbox_snapshot.ts diff --git a/modal-js/src/client.ts b/modal-js/src/client.ts index a279926a..8d9c7bf1 100644 --- a/modal-js/src/client.ts +++ b/modal-js/src/client.ts @@ -19,6 +19,7 @@ import { ImageService } from "./image"; import { ProxyService } from "./proxy"; import { QueueService } from "./queue"; import { SandboxService } from "./sandbox"; +import { SandboxSnapshotService } from "./sandbox_snapshot"; import { SecretService } from "./secret"; import { VolumeService } from "./volume"; @@ -85,6 +86,7 @@ export class ModalClient { readonly proxies: ProxyService; readonly queues: QueueService; readonly sandboxes: SandboxService; + readonly sandboxSnapshots: SandboxSnapshotService; readonly secrets: SecretService; readonly volumes: VolumeService; @@ -133,6 +135,7 @@ export class ModalClient { this.proxies = new ProxyService(this); this.queues = new QueueService(this); this.sandboxes = new SandboxService(this); + this.sandboxSnapshots = new SandboxSnapshotService(this); this.secrets = new SecretService(this); this.volumes = new VolumeService(this); } diff --git a/modal-js/src/index.ts b/modal-js/src/index.ts index af584a8e..b2ccc47d 100644 --- a/modal-js/src/index.ts +++ b/modal-js/src/index.ts @@ -61,14 +61,19 @@ export { export { Retries } from "./retries"; export type { SandboxExecParams, + SandboxFromIdParams, SandboxFromNameParams, + SandboxRestoreParams, StdioBehavior, StreamMode, Tunnel, SandboxListParams, SandboxCreateParams, + CreateConnectTokenParams, + ConnectToken, } from "./sandbox"; export { ContainerProcess, Sandbox, SandboxService } from "./sandbox"; +export { SandboxSnapshot, SandboxSnapshotService } from "./sandbox_snapshot"; export type { ModalReadStream, ModalWriteStream } from "./streams"; export { Secret, diff --git a/modal-js/src/sandbox.ts b/modal-js/src/sandbox.ts index 617c7cb5..18c5031f 100644 --- a/modal-js/src/sandbox.ts +++ b/modal-js/src/sandbox.ts @@ -17,7 +17,9 @@ import { PortSpec, Resources, PortSpecs, + SandboxRestoreRequest_SandboxNameOverrideType, } from "../proto/modal_proto/api"; +import { SandboxSnapshot } from "./sandbox_snapshot"; import { getDefaultClient, type ModalClient, @@ -142,6 +144,12 @@ export type SandboxCreateParams = { /** Optional name for the Sandbox. Unique within an App. */ name?: string; + + /** Experimental options for the sandbox. */ + experimentalOptions?: Record; + + /** Enable memory snapshot support (experimental). */ + experimentalEnableSnapshot?: boolean; }; export async function buildSandboxCreateRequestProto( @@ -334,6 +342,8 @@ export async function buildSandboxCreateRequestProto( verbose: params.verbose ?? false, proxyId: params.proxy?.proxyId, name: params.name, + experimentalOptions: params.experimentalOptions, + enableSnapshot: params.experimentalEnableSnapshot ?? false, }, }); } @@ -394,14 +404,20 @@ export class SandboxService { "sandbox_id", createResp.sandboxId, ); - return new Sandbox(this.#client, createResp.sandboxId); + const memorySnapshotsEnabled = params.experimentalEnableSnapshot ?? false; + return new Sandbox(this.#client, createResp.sandboxId, { + memorySnapshotsEnabled, + }); } /** Returns a running {@link Sandbox} object from an ID. * * @returns Sandbox with ID */ - async fromId(sandboxId: string): Promise { + async fromId( + sandboxId: string, + params?: SandboxFromIdParams, + ): Promise { try { await this.#client.cpClient.sandboxWait({ sandboxId, @@ -413,7 +429,9 @@ export class SandboxService { throw err; } - return new Sandbox(this.#client, sandboxId); + return new Sandbox(this.#client, sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled, + }); } /** Get a running {@link Sandbox} by name from a deployed {@link App}. @@ -437,7 +455,9 @@ export class SandboxService { appName, environmentName: this.#client.environmentName(params?.environment), }); - return new Sandbox(this.#client, resp.sandboxId); + return new Sandbox(this.#client, resp.sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled, + }); } catch (err) { if (err instanceof ClientError && err.code === Status.NOT_FOUND) throw new NotFoundError( @@ -447,6 +467,55 @@ export class SandboxService { } } + /** + * Restore a {@link Sandbox} from a {@link SandboxSnapshot} (experimental). + * + * @param snapshot - The snapshot to restore from + * @param params - Optional parameters for restoring the Sandbox + * @returns Promise that resolves to a Sandbox + */ + async experimentalFromSnapshot( + snapshot: SandboxSnapshot, + params: SandboxRestoreParams = {}, + ): Promise { + let sandboxNameOverrideType = + SandboxRestoreRequest_SandboxNameOverrideType.SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED; + let sandboxNameOverride = ""; + + if (params.name === null) { + sandboxNameOverrideType = + SandboxRestoreRequest_SandboxNameOverrideType.SANDBOX_NAME_OVERRIDE_TYPE_NONE; + } else if (params.name) { + sandboxNameOverrideType = + SandboxRestoreRequest_SandboxNameOverrideType.SANDBOX_NAME_OVERRIDE_TYPE_STRING; + sandboxNameOverride = params.name; + } + + let restoreResp; + try { + restoreResp = await this.#client.cpClient.sandboxRestore({ + snapshotId: snapshot.snapshotId, + sandboxNameOverride, + sandboxNameOverrideType, + }); + } catch (err) { + if (err instanceof ClientError && err.code === Status.ALREADY_EXISTS) { + throw new AlreadyExistsError(err.details || err.message); + } + throw err; + } + + await this.#client.cpClient.sandboxGetTaskId({ + sandboxId: restoreResp.sandboxId, + waitUntilReady: true, + timeout: 55, + }); + + return new Sandbox(this.#client, restoreResp.sandboxId, { + memorySnapshotsEnabled: true, + }); + } + /** * List all {@link Sandbox}es for the current Environment or App ID (if specified). * If tags are specified, only Sandboxes that have at least those tags are returned. @@ -502,9 +571,47 @@ export type SandboxListParams = { environment?: string; }; +/** Optional parameters for {@link SandboxService#fromId client.sandboxes.fromId()}. */ +export type SandboxFromIdParams = { + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; + /** Optional parameters for {@link SandboxService#fromName client.sandboxes.fromName()}. */ export type SandboxFromNameParams = { environment?: string; + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; + +/** Optional parameters for {@link SandboxService#experimentalFromSnapshot client.sandboxes.experimentalFromSnapshot()}. */ +export type SandboxRestoreParams = { + /** Optional sandbox name override. Use null to clear name. */ + name?: string | null; +}; + +/** Optional parameters for {@link Sandbox#createConnectToken Sandbox.createConnectToken()}. */ +export type CreateConnectTokenParams = { + /** + * Optional user metadata to attach to the token. Must be JSON-serializable. + * When a request arrives with a valid token, the service receives an + * `X-Verified-User-Data` header with this data as a JSON-serialized string. + * Serialized metadata cannot exceed 512 characters. + */ + userMetadata?: Record; +}; + +/** + * A connect token for a Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. + */ +export type ConnectToken = { + /** The URL to connect to the Sandbox service. */ + url: string; + /** The authentication token. */ + token: string; }; /** Optional parameters for {@link Sandbox#exec Sandbox.exec()}. */ @@ -599,6 +706,10 @@ export async function buildContainerExecRequestProto( }); } +type SandboxConstructorOptions = { + memorySnapshotsEnabled?: boolean; +}; + /** Sandboxes are secure, isolated containers in Modal that boot in seconds. */ export class Sandbox { readonly #client: ModalClient; @@ -609,11 +720,17 @@ export class Sandbox { #taskId: string | undefined; #tunnels: Record | undefined; + #memorySnapshotsEnabled: boolean; /** @ignore */ - constructor(client: ModalClient, sandboxId: string) { + constructor( + client: ModalClient, + sandboxId: string, + options: SandboxConstructorOptions = {}, + ) { this.#client = client; this.sandboxId = sandboxId; + this.#memorySnapshotsEnabled = options.memorySnapshotsEnabled ?? false; this.stdin = toModalWriteStream(inputStreamSb(client.cpClient, sandboxId)); this.stdout = toModalReadStream( @@ -874,6 +991,47 @@ export class Sandbox { return new Image(this.#client, resp.imageId, ""); } + /** + * Take a memory snapshot of the Sandbox (experimental). + * + * Returns a {@link SandboxSnapshot} object which can be used to restore a new Sandbox. + * + * @returns Promise that resolves to a {@link SandboxSnapshot} + */ + async experimentalSnapshot(): Promise { + if (!this.#memorySnapshotsEnabled) { + throw new InvalidError( + "Memory snapshots are not supported for this sandbox. Enable them by setting `experimentalEnableSnapshot: true` when creating the sandbox.", + ); + } + + await this.#getTaskId(); + + const snapshotResp = await this.#client.cpClient.sandboxSnapshot({ + sandboxId: this.sandboxId, + }); + + const snapshotId = snapshotResp.snapshotId; + if (!snapshotId) { + throw new Error("Sandbox snapshot response missing `snapshotId`"); + } + + const waitResp = await this.#client.cpClient.sandboxSnapshotWait({ + snapshotId, + timeout: 55, + }); + const result = waitResp.result; + if ( + result && + result.status !== GenericResult_GenericStatus.GENERIC_STATUS_SUCCESS && + result.status !== GenericResult_GenericStatus.GENERIC_STATUS_UNSPECIFIED + ) { + throw new Error(result.exception || "Sandbox snapshot failed"); + } + + return new SandboxSnapshot(this.#client, snapshotId); + } + /** * Check if the Sandbox has finished running. * @@ -888,6 +1046,38 @@ export class Sandbox { return Sandbox.#getReturnCode(resp.result); } + /** + * Create a connect token for this Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. The token can be transmitted via: + * - Authorization header: `Authorization: Bearer {token}` + * - Query parameter: `_modal_connect_token` in the URL + * - Cookie: `_modal_connect_token` as a cookie + * + * The service inside the container must listen on port 8080. + * + * @param params - Optional parameters for the connect token + * @returns Promise that resolves to a {@link ConnectToken} + */ + async createConnectToken( + params: CreateConnectTokenParams = {}, + ): Promise { + const userMetadata = params.userMetadata + ? JSON.stringify(params.userMetadata) + : ""; + + const resp = await this.#client.cpClient.sandboxCreateConnectToken({ + sandboxId: this.sandboxId, + userMetadata, + }); + + return { + url: resp.url, + token: resp.token, + }; + } + /** * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. */ diff --git a/modal-js/src/sandbox_snapshot.ts b/modal-js/src/sandbox_snapshot.ts new file mode 100644 index 00000000..d70eb0ca --- /dev/null +++ b/modal-js/src/sandbox_snapshot.ts @@ -0,0 +1,47 @@ +import { getDefaultClient, ModalClient } from "./client"; + +/** + * Represents a memory snapshot of a Sandbox. + * This is an experimental feature. + */ +export class SandboxSnapshot { + readonly snapshotId: string; + + /** @ignore */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + constructor(client: ModalClient, snapshotId: string) { + this.snapshotId = snapshotId; + } + + /** + * @deprecated Use {@link SandboxSnapshotService#fromId client.sandboxSnapshots.fromId()} instead. + */ + static async fromId(snapshotId: string): Promise { + return getDefaultClient().sandboxSnapshots.fromId(snapshotId); + } +} + +/** + * Service for managing {@link SandboxSnapshot}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const snapshot = await modal.sandboxSnapshots.fromId("..."); + * ``` + */ +export class SandboxSnapshotService { + readonly #client: ModalClient; + + constructor(client: ModalClient) { + this.#client = client; + } + + /** + * Get a {@link SandboxSnapshot} by ID. + */ + async fromId(snapshotId: string): Promise { + await this.#client.cpClient.sandboxSnapshotGet({ snapshotId }); + return new SandboxSnapshot(this.#client, snapshotId); + } +} From 1edd86238d141a41901db82b31efa628590a9b41 Mon Sep 17 00:00:00 2001 From: Conor Branagan <472446+conorbranagan@users.noreply.github.com> Date: Thu, 27 Nov 2025 00:24:50 +0000 Subject: [PATCH 59/59] Add built dist files for direct npm installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- modal-js/.gitignore | 1 - modal-js/dist/index.cjs | 47489 ++++++++++++++++++++++++++++++++++++ modal-js/dist/index.d.cts | 6246 +++++ modal-js/dist/index.d.ts | 6246 +++++ modal-js/dist/index.js | 47418 +++++++++++++++++++++++++++++++++++ 5 files changed, 107399 insertions(+), 1 deletion(-) create mode 100644 modal-js/dist/index.cjs create mode 100644 modal-js/dist/index.d.cts create mode 100644 modal-js/dist/index.d.ts create mode 100644 modal-js/dist/index.js diff --git a/modal-js/.gitignore b/modal-js/.gitignore index 59550492..e2d517d1 100644 --- a/modal-js/.gitignore +++ b/modal-js/.gitignore @@ -1,4 +1,3 @@ node_modules/ -dist/ proto/ docs/ diff --git a/modal-js/dist/index.cjs b/modal-js/dist/index.cjs new file mode 100644 index 00000000..98b321d7 --- /dev/null +++ b/modal-js/dist/index.cjs @@ -0,0 +1,47489 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var index_exports = {}; +__export(index_exports, { + AlreadyExistsError: () => AlreadyExistsError, + App: () => App2, + AppService: () => AppService, + CloudBucketMount: () => CloudBucketMount2, + CloudBucketMountService: () => CloudBucketMountService, + Cls: () => Cls, + ClsInstance: () => ClsInstance, + ClsService: () => ClsService, + ContainerProcess: () => ContainerProcess, + FunctionCall: () => FunctionCall, + FunctionCallService: () => FunctionCallService, + FunctionService: () => FunctionService, + FunctionTimeoutError: () => FunctionTimeoutError, + Function_: () => Function_, + Image: () => Image2, + ImageService: () => ImageService, + InternalFailure: () => InternalFailure, + InvalidError: () => InvalidError, + ModalClient: () => ModalClient3, + NotFoundError: () => NotFoundError, + Proxy: () => Proxy3, + ProxyService: () => ProxyService, + Queue: () => Queue, + QueueEmptyError: () => QueueEmptyError, + QueueFullError: () => QueueFullError, + QueueService: () => QueueService, + RemoteError: () => RemoteError, + Retries: () => Retries, + Sandbox: () => Sandbox2, + SandboxFile: () => SandboxFile, + SandboxService: () => SandboxService, + SandboxSnapshot: () => SandboxSnapshot, + SandboxSnapshotService: () => SandboxSnapshotService, + SandboxTimeoutError: () => SandboxTimeoutError, + Secret: () => Secret, + SecretService: () => SecretService, + Volume: () => Volume, + VolumeService: () => VolumeService, + checkForRenamedParams: () => checkForRenamedParams, + close: () => close, + initializeClient: () => initializeClient +}); +module.exports = __toCommonJS(index_exports); + +// src/app.ts +var import_nice_grpc11 = require("nice-grpc"); + +// node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +function varint64read() { + let lowBits = 0; + let highBits = 0; + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 127) << shift; + if ((b & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + let middleByte = this.buf[this.pos++]; + lowBits |= (middleByte & 15) << 28; + highBits = (middleByte & 112) >> 4; + if ((middleByte & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 127) << shift; + if ((b & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + throw new Error("invalid varint"); +} +function varint64write(lo, hi, bytes) { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 128 : shift) & 255; + bytes.push(byte); + if (!hasNext) { + return; + } + } + const splitBits = lo >>> 28 & 15 | (hi & 7) << 4; + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255); + if (!hasMoreBits) { + return; + } + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 128 : shift) & 255; + bytes.push(byte); + if (!hasNext) { + return; + } + } + bytes.push(hi >>> 31 & 1); +} +var TWO_PWR_32_DBL = 4294967296; +function int64FromString(dec) { + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + const base = 1e6; + let lowBits = 0; + let highBits = 0; + function add1e6digit(begin, end) { + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} +function int64ToString(lo, hi) { + let bits = newBits(lo, hi); + const negative = bits.hi & 2147483648; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} +function uInt64ToString(lo, hi) { + ({ lo, hi } = toUnsigned(lo, hi)); + if (hi <= 2097151) { + return String(TWO_PWR_32_DBL * hi + lo); + } + const low = lo & 16777215; + const mid = (lo >>> 24 | hi << 8) & 16777215; + const high = hi >> 16 & 65535; + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + const base = 1e7; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA); +} +function toUnsigned(lo, hi) { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} +function newBits(lo, hi) { + return { lo: lo | 0, hi: hi | 0 }; +} +function negate(lowBits, highBits) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + highBits += 1; + } + return newBits(lowBits, highBits); +} +var decimalFrom1e7WithLeadingZeros = (digit1e7) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; +function varint32write(value, bytes) { + if (value >= 0) { + while (value > 127) { + bytes.push(value & 127 | 128); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push(value & 127 | 128); + value = value >> 7; + } + bytes.push(1); + } +} +function varint32read() { + let b = this.buf[this.pos++]; + let result = b & 127; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 7; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 14; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 21; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 15) << 28; + for (let readBytes = 5; (b & 128) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + if ((b & 128) != 0) + throw new Error("invalid varint"); + this.assertBounds(); + return result >>> 0; +} + +// node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +var protoInt64 = /* @__PURE__ */ makeInt64Support(); +function makeInt64Support() { + const dv = new DataView(new ArrayBuffer(8)); + const ok = typeof BigInt === "function" && typeof dv.getBigInt64 === "function" && typeof dv.getBigUint64 === "function" && typeof dv.setBigInt64 === "function" && typeof dv.setBigUint64 === "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1"); + if (ok) { + const MIN = BigInt("-9223372036854775808"), MAX = BigInt("9223372036854775807"), UMIN = BigInt("0"), UMAX = BigInt("18446744073709551615"); + return { + zero: BigInt(0), + supported: true, + parse(value) { + const bi = typeof value == "bigint" ? value : BigInt(value); + if (bi > MAX || bi < MIN) { + throw new Error(`invalid int64: ${value}`); + } + return bi; + }, + uParse(value) { + const bi = typeof value == "bigint" ? value : BigInt(value); + if (bi > UMAX || bi < UMIN) { + throw new Error(`invalid uint64: ${value}`); + } + return bi; + }, + enc(value) { + dv.setBigInt64(0, this.parse(value), true); + return { + lo: dv.getInt32(0, true), + hi: dv.getInt32(4, true) + }; + }, + uEnc(value) { + dv.setBigInt64(0, this.uParse(value), true); + return { + lo: dv.getInt32(0, true), + hi: dv.getInt32(4, true) + }; + }, + dec(lo, hi) { + dv.setInt32(0, lo, true); + dv.setInt32(4, hi, true); + return dv.getBigInt64(0, true); + }, + uDec(lo, hi) { + dv.setInt32(0, lo, true); + dv.setInt32(4, hi, true); + return dv.getBigUint64(0, true); + } + }; + } + return { + zero: "0", + supported: false, + parse(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertInt64String(value); + return value; + }, + uParse(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertUInt64String(value); + return value; + }, + enc(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertInt64String(value); + return int64FromString(value); + }, + uEnc(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertUInt64String(value); + return int64FromString(value); + }, + dec(lo, hi) { + return int64ToString(lo, hi); + }, + uDec(lo, hi) { + return uInt64ToString(lo, hi); + } + }; +} +function assertInt64String(value) { + if (!/^-?[0-9]+$/.test(value)) { + throw new Error("invalid int64: " + value); + } +} +function assertUInt64String(value) { + if (!/^[0-9]+$/.test(value)) { + throw new Error("invalid uint64: " + value); + } +} + +// node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +var symbol = Symbol.for("@bufbuild/protobuf/text-encoding"); +function getTextEncoding() { + if (globalThis[symbol] == void 0) { + const te = new globalThis.TextEncoder(); + const td = new globalThis.TextDecoder(); + globalThis[symbol] = { + encodeUtf8(text) { + return te.encode(text); + }, + decodeUtf8(bytes) { + return td.decode(bytes); + }, + checkUtf8(text) { + try { + encodeURIComponent(text); + return true; + } catch (e) { + return false; + } + } + }; + } + return globalThis[symbol]; +} + +// node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +var WireType; +(function(WireType2) { + WireType2[WireType2["Varint"] = 0] = "Varint"; + WireType2[WireType2["Bit64"] = 1] = "Bit64"; + WireType2[WireType2["LengthDelimited"] = 2] = "LengthDelimited"; + WireType2[WireType2["StartGroup"] = 3] = "StartGroup"; + WireType2[WireType2["EndGroup"] = 4] = "EndGroup"; + WireType2[WireType2["Bit32"] = 5] = "Bit32"; +})(WireType || (WireType = {})); +var FLOAT32_MAX = 34028234663852886e22; +var FLOAT32_MIN = -34028234663852886e22; +var UINT32_MAX = 4294967295; +var INT32_MAX = 2147483647; +var INT32_MIN = -2147483648; +var BinaryWriter = class { + constructor(encodeUtf8 = getTextEncoding().encodeUtf8) { + this.encodeUtf8 = encodeUtf8; + this.stack = []; + this.chunks = []; + this.buf = []; + } + /** + * Return all bytes written and reset this writer. + */ + finish() { + if (this.buf.length) { + this.chunks.push(new Uint8Array(this.buf)); + this.buf = []; + } + let len = 0; + for (let i = 0; i < this.chunks.length; i++) + len += this.chunks[i].length; + let bytes = new Uint8Array(len); + let offset = 0; + for (let i = 0; i < this.chunks.length; i++) { + bytes.set(this.chunks[i], offset); + offset += this.chunks[i].length; + } + this.chunks = []; + return bytes; + } + /** + * Start a new fork for length-delimited data like a message + * or a packed repeated field. + * + * Must be joined later with `join()`. + */ + fork() { + this.stack.push({ chunks: this.chunks, buf: this.buf }); + this.chunks = []; + this.buf = []; + return this; + } + /** + * Join the last fork. Write its length and bytes, then + * return to the previous state. + */ + join() { + let chunk = this.finish(); + let prev = this.stack.pop(); + if (!prev) + throw new Error("invalid state, fork stack empty"); + this.chunks = prev.chunks; + this.buf = prev.buf; + this.uint32(chunk.byteLength); + return this.raw(chunk); + } + /** + * Writes a tag (field number and wire type). + * + * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`. + * + * Generated code should compute the tag ahead of time and call `uint32()`. + */ + tag(fieldNo, type) { + return this.uint32((fieldNo << 3 | type) >>> 0); + } + /** + * Write a chunk of raw bytes. + */ + raw(chunk) { + if (this.buf.length) { + this.chunks.push(new Uint8Array(this.buf)); + this.buf = []; + } + this.chunks.push(chunk); + return this; + } + /** + * Write a `uint32` value, an unsigned 32 bit varint. + */ + uint32(value) { + assertUInt32(value); + while (value > 127) { + this.buf.push(value & 127 | 128); + value = value >>> 7; + } + this.buf.push(value); + return this; + } + /** + * Write a `int32` value, a signed 32 bit varint. + */ + int32(value) { + assertInt32(value); + varint32write(value, this.buf); + return this; + } + /** + * Write a `bool` value, a variant. + */ + bool(value) { + this.buf.push(value ? 1 : 0); + return this; + } + /** + * Write a `bytes` value, length-delimited arbitrary data. + */ + bytes(value) { + this.uint32(value.byteLength); + return this.raw(value); + } + /** + * Write a `string` value, length-delimited data converted to UTF-8 text. + */ + string(value) { + let chunk = this.encodeUtf8(value); + this.uint32(chunk.byteLength); + return this.raw(chunk); + } + /** + * Write a `float` value, 32-bit floating point number. + */ + float(value) { + assertFloat32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setFloat32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `double` value, a 64-bit floating point number. + */ + double(value) { + let chunk = new Uint8Array(8); + new DataView(chunk.buffer).setFloat64(0, value, true); + return this.raw(chunk); + } + /** + * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer. + */ + fixed32(value) { + assertUInt32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setUint32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `sfixed32` value, a signed, fixed-length 32-bit integer. + */ + sfixed32(value) { + assertInt32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setInt32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint. + */ + sint32(value) { + assertInt32(value); + value = (value << 1 ^ value >> 31) >>> 0; + varint32write(value, this.buf); + return this; + } + /** + * Write a `fixed64` value, a signed, fixed-length 64-bit integer. + */ + sfixed64(value) { + let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.enc(value); + view.setInt32(0, tc.lo, true); + view.setInt32(4, tc.hi, true); + return this.raw(chunk); + } + /** + * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer. + */ + fixed64(value) { + let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.uEnc(value); + view.setInt32(0, tc.lo, true); + view.setInt32(4, tc.hi, true); + return this.raw(chunk); + } + /** + * Write a `int64` value, a signed 64-bit varint. + */ + int64(value) { + let tc = protoInt64.enc(value); + varint64write(tc.lo, tc.hi, this.buf); + return this; + } + /** + * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint. + */ + sint64(value) { + let tc = protoInt64.enc(value), sign = tc.hi >> 31, lo = tc.lo << 1 ^ sign, hi = (tc.hi << 1 | tc.lo >>> 31) ^ sign; + varint64write(lo, hi, this.buf); + return this; + } + /** + * Write a `uint64` value, an unsigned 64-bit varint. + */ + uint64(value) { + let tc = protoInt64.uEnc(value); + varint64write(tc.lo, tc.hi, this.buf); + return this; + } +}; +var BinaryReader = class { + constructor(buf, decodeUtf8 = getTextEncoding().decodeUtf8) { + this.decodeUtf8 = decodeUtf8; + this.varint64 = varint64read; + this.uint32 = varint32read; + this.buf = buf; + this.len = buf.length; + this.pos = 0; + this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength); + } + /** + * Reads a tag - field number and wire type. + */ + tag() { + let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType); + return [fieldNo, wireType]; + } + /** + * Skip one element and return the skipped data. + * + * When skipping StartGroup, provide the tags field number to check for + * matching field number in the EndGroup tag. + */ + skip(wireType, fieldNo) { + let start = this.pos; + switch (wireType) { + case WireType.Varint: + while (this.buf[this.pos++] & 128) { + } + break; + // eslint-disable-next-line + // @ts-expect-error TS7029: Fallthrough case in switch + case WireType.Bit64: + this.pos += 4; + // eslint-disable-next-line no-fallthrough + case WireType.Bit32: + this.pos += 4; + break; + case WireType.LengthDelimited: + let len = this.uint32(); + this.pos += len; + break; + case WireType.StartGroup: + for (; ; ) { + const [fn, wt] = this.tag(); + if (wt === WireType.EndGroup) { + if (fieldNo !== void 0 && fn !== fieldNo) { + throw new Error("invalid end group tag"); + } + break; + } + this.skip(wt, fn); + } + break; + default: + throw new Error("cant skip wire type " + wireType); + } + this.assertBounds(); + return this.buf.subarray(start, this.pos); + } + /** + * Throws error if position in byte array is out of range. + */ + assertBounds() { + if (this.pos > this.len) + throw new RangeError("premature EOF"); + } + /** + * Read a `int32` field, a signed 32 bit varint. + */ + int32() { + return this.uint32() | 0; + } + /** + * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint. + */ + sint32() { + let zze = this.uint32(); + return zze >>> 1 ^ -(zze & 1); + } + /** + * Read a `int64` field, a signed 64-bit varint. + */ + int64() { + return protoInt64.dec(...this.varint64()); + } + /** + * Read a `uint64` field, an unsigned 64-bit varint. + */ + uint64() { + return protoInt64.uDec(...this.varint64()); + } + /** + * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint. + */ + sint64() { + let [lo, hi] = this.varint64(); + let s = -(lo & 1); + lo = (lo >>> 1 | (hi & 1) << 31) ^ s; + hi = hi >>> 1 ^ s; + return protoInt64.dec(lo, hi); + } + /** + * Read a `bool` field, a variant. + */ + bool() { + let [lo, hi] = this.varint64(); + return lo !== 0 || hi !== 0; + } + /** + * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer. + */ + fixed32() { + return this.view.getUint32((this.pos += 4) - 4, true); + } + /** + * Read a `sfixed32` field, a signed, fixed-length 32-bit integer. + */ + sfixed32() { + return this.view.getInt32((this.pos += 4) - 4, true); + } + /** + * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer. + */ + fixed64() { + return protoInt64.uDec(this.sfixed32(), this.sfixed32()); + } + /** + * Read a `fixed64` field, a signed, fixed-length 64-bit integer. + */ + sfixed64() { + return protoInt64.dec(this.sfixed32(), this.sfixed32()); + } + /** + * Read a `float` field, 32-bit floating point number. + */ + float() { + return this.view.getFloat32((this.pos += 4) - 4, true); + } + /** + * Read a `double` field, a 64-bit floating point number. + */ + double() { + return this.view.getFloat64((this.pos += 8) - 8, true); + } + /** + * Read a `bytes` field, length-delimited arbitrary data. + */ + bytes() { + let len = this.uint32(), start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + /** + * Read a `string` field, length-delimited data converted to UTF-8 text. + */ + string() { + return this.decodeUtf8(this.bytes()); + } +}; +function assertInt32(arg) { + if (typeof arg == "string") { + arg = Number(arg); + } else if (typeof arg != "number") { + throw new Error("invalid int32: " + typeof arg); + } + if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN) + throw new Error("invalid int32: " + arg); +} +function assertUInt32(arg) { + if (typeof arg == "string") { + arg = Number(arg); + } else if (typeof arg != "number") { + throw new Error("invalid uint32: " + typeof arg); + } + if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0) + throw new Error("invalid uint32: " + arg); +} +function assertFloat32(arg) { + if (typeof arg == "string") { + const o = arg; + arg = Number(arg); + if (isNaN(arg) && o !== "NaN") { + throw new Error("invalid float32: " + o); + } + } else if (typeof arg != "number") { + throw new Error("invalid float32: " + typeof arg); + } + if (Number.isFinite(arg) && (arg > FLOAT32_MAX || arg < FLOAT32_MIN)) + throw new Error("invalid float32: " + arg); +} + +// proto/google/protobuf/empty.ts +function createBaseEmpty() { + return {}; +} +var Empty = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return Empty.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmpty(); + return message; + } +}; + +// proto/google/protobuf/struct.ts +function nullValueFromJSON(object) { + switch (object) { + case 0: + case "NULL_VALUE": + return 0 /* NULL_VALUE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function nullValueToJSON(object) { + switch (object) { + case 0 /* NULL_VALUE */: + return "NULL_VALUE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function createBaseStruct() { + return { fields: {} }; +} +var Struct = { + encode(message, writer = new BinaryWriter()) { + Object.entries(message.fields).forEach(([key, value]) => { + if (value !== void 0) { + Struct_FieldsEntry.encode({ key, value }, writer.uint32(10).fork()).join(); + } + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStruct(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32()); + if (entry1.value !== void 0) { + message.fields[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fields: isObject(object.fields) ? Object.entries(object.fields).reduce((acc, [key, value]) => { + acc[key] = value; + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.fields) { + const entries = Object.entries(message.fields); + if (entries.length > 0) { + obj.fields = {}; + entries.forEach(([k, v]) => { + obj.fields[k] = v; + }); + } + } + return obj; + }, + create(base) { + return Struct.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStruct(); + message.fields = Object.entries(object.fields ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = value; + } + return acc; + }, + {} + ); + return message; + }, + wrap(object) { + const struct = createBaseStruct(); + if (object !== void 0) { + for (const key of Object.keys(object)) { + struct.fields[key] = object[key]; + } + } + return struct; + }, + unwrap(message) { + const object = {}; + if (message.fields) { + for (const key of Object.keys(message.fields)) { + object[key] = message.fields[key]; + } + } + return object; + } +}; +function createBaseStruct_FieldsEntry() { + return { key: "", value: void 0 }; +} +var Struct_FieldsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStruct_FieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object?.value) ? object.value : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Struct_FieldsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStruct_FieldsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseValue() { + return { + nullValue: void 0, + numberValue: void 0, + stringValue: void 0, + boolValue: void 0, + structValue: void 0, + listValue: void 0 + }; +} +var Value = { + encode(message, writer = new BinaryWriter()) { + if (message.nullValue !== void 0) { + writer.uint32(8).int32(message.nullValue); + } + if (message.numberValue !== void 0) { + writer.uint32(17).double(message.numberValue); + } + if (message.stringValue !== void 0) { + writer.uint32(26).string(message.stringValue); + } + if (message.boolValue !== void 0) { + writer.uint32(32).bool(message.boolValue); + } + if (message.structValue !== void 0) { + Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).join(); + } + if (message.listValue !== void 0) { + ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.nullValue = reader.int32(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.numberValue = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stringValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.boolValue = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : void 0, + numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : void 0, + stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : void 0, + boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0, + structValue: isObject(object.structValue) ? object.structValue : void 0, + listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.nullValue !== void 0) { + obj.nullValue = nullValueToJSON(message.nullValue); + } + if (message.numberValue !== void 0) { + obj.numberValue = message.numberValue; + } + if (message.stringValue !== void 0) { + obj.stringValue = message.stringValue; + } + if (message.boolValue !== void 0) { + obj.boolValue = message.boolValue; + } + if (message.structValue !== void 0) { + obj.structValue = message.structValue; + } + if (message.listValue !== void 0) { + obj.listValue = message.listValue; + } + return obj; + }, + create(base) { + return Value.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValue(); + message.nullValue = object.nullValue ?? void 0; + message.numberValue = object.numberValue ?? void 0; + message.stringValue = object.stringValue ?? void 0; + message.boolValue = object.boolValue ?? void 0; + message.structValue = object.structValue ?? void 0; + message.listValue = object.listValue ?? void 0; + return message; + }, + wrap(value) { + const result = createBaseValue(); + if (value === null) { + result.nullValue = 0 /* NULL_VALUE */; + } else if (typeof value === "boolean") { + result.boolValue = value; + } else if (typeof value === "number") { + result.numberValue = value; + } else if (typeof value === "string") { + result.stringValue = value; + } else if (globalThis.Array.isArray(value)) { + result.listValue = value; + } else if (typeof value === "object") { + result.structValue = value; + } else if (typeof value !== "undefined") { + throw new globalThis.Error("Unsupported any value type: " + typeof value); + } + return result; + }, + unwrap(message) { + if (message.stringValue !== void 0) { + return message.stringValue; + } else if (message?.numberValue !== void 0) { + return message.numberValue; + } else if (message?.boolValue !== void 0) { + return message.boolValue; + } else if (message?.structValue !== void 0) { + return message.structValue; + } else if (message?.listValue !== void 0) { + return message.listValue; + } else if (message?.nullValue !== void 0) { + return null; + } + return void 0; + } +}; +function createBaseListValue() { + return { values: [] }; +} +var ListValue = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.values) { + Value.encode(Value.wrap(v), writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseListValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.values.push(Value.unwrap(Value.decode(reader, reader.uint32()))); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + create(base) { + return ListValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseListValue(); + message.values = object.values?.map((e) => e) || []; + return message; + }, + wrap(array) { + const result = createBaseListValue(); + result.values = array ?? []; + return result; + }, + unwrap(message) { + if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) { + return message.values; + } else { + return message; + } + } +}; +function isObject(value) { + return typeof value === "object" && value !== null; +} +function isSet(value) { + return value !== null && value !== void 0; +} + +// proto/google/protobuf/timestamp.ts +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +var Timestamp = { + encode(message, writer = new BinaryWriter()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet2(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet2(object.nanos) ? globalThis.Number(object.nanos) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + create(base) { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + } +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet2(value) { + return value !== null && value !== void 0; +} + +// proto/google/protobuf/wrappers.ts +function createBaseStringValue() { + return { value: "" }; +} +var StringValue = { + encode(message, writer = new BinaryWriter()) { + if (message.value !== "") { + writer.uint32(10).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStringValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { value: isSet3(object.value) ? globalThis.String(object.value) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return StringValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStringValue(); + message.value = object.value ?? ""; + return message; + } +}; +function isSet3(value) { + return value !== null && value !== void 0; +} + +// proto/modal_proto/api.ts +function appDeployVisibilityFromJSON(object) { + switch (object) { + case 0: + case "APP_DEPLOY_VISIBILITY_UNSPECIFIED": + return 0 /* APP_DEPLOY_VISIBILITY_UNSPECIFIED */; + case 1: + case "APP_DEPLOY_VISIBILITY_WORKSPACE": + return 1 /* APP_DEPLOY_VISIBILITY_WORKSPACE */; + case 2: + case "APP_DEPLOY_VISIBILITY_PUBLIC": + return 2 /* APP_DEPLOY_VISIBILITY_PUBLIC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appDeployVisibilityToJSON(object) { + switch (object) { + case 0 /* APP_DEPLOY_VISIBILITY_UNSPECIFIED */: + return "APP_DEPLOY_VISIBILITY_UNSPECIFIED"; + case 1 /* APP_DEPLOY_VISIBILITY_WORKSPACE */: + return "APP_DEPLOY_VISIBILITY_WORKSPACE"; + case 2 /* APP_DEPLOY_VISIBILITY_PUBLIC */: + return "APP_DEPLOY_VISIBILITY_PUBLIC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appDisconnectReasonFromJSON(object) { + switch (object) { + case 0: + case "APP_DISCONNECT_REASON_UNSPECIFIED": + return 0 /* APP_DISCONNECT_REASON_UNSPECIFIED */; + case 1: + case "APP_DISCONNECT_REASON_LOCAL_EXCEPTION": + return 1 /* APP_DISCONNECT_REASON_LOCAL_EXCEPTION */; + case 2: + case "APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT": + return 2 /* APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT */; + case 3: + case "APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED": + return 3 /* APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED */; + case 4: + case "APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION": + return 4 /* APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION */; + case 5: + case "APP_DISCONNECT_REASON_REMOTE_EXCEPTION": + return 5 /* APP_DISCONNECT_REASON_REMOTE_EXCEPTION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appDisconnectReasonToJSON(object) { + switch (object) { + case 0 /* APP_DISCONNECT_REASON_UNSPECIFIED */: + return "APP_DISCONNECT_REASON_UNSPECIFIED"; + case 1 /* APP_DISCONNECT_REASON_LOCAL_EXCEPTION */: + return "APP_DISCONNECT_REASON_LOCAL_EXCEPTION"; + case 2 /* APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT */: + return "APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT"; + case 3 /* APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED */: + return "APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED"; + case 4 /* APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION */: + return "APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION"; + case 5 /* APP_DISCONNECT_REASON_REMOTE_EXCEPTION */: + return "APP_DISCONNECT_REASON_REMOTE_EXCEPTION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appStateFromJSON(object) { + switch (object) { + case 0: + case "APP_STATE_UNSPECIFIED": + return 0 /* APP_STATE_UNSPECIFIED */; + case 1: + case "APP_STATE_EPHEMERAL": + return 1 /* APP_STATE_EPHEMERAL */; + case 2: + case "APP_STATE_DETACHED": + return 2 /* APP_STATE_DETACHED */; + case 3: + case "APP_STATE_DEPLOYED": + return 3 /* APP_STATE_DEPLOYED */; + case 4: + case "APP_STATE_STOPPING": + return 4 /* APP_STATE_STOPPING */; + case 5: + case "APP_STATE_STOPPED": + return 5 /* APP_STATE_STOPPED */; + case 6: + case "APP_STATE_INITIALIZING": + return 6 /* APP_STATE_INITIALIZING */; + case 7: + case "APP_STATE_DISABLED": + return 7 /* APP_STATE_DISABLED */; + case 8: + case "APP_STATE_DETACHED_DISCONNECTED": + return 8 /* APP_STATE_DETACHED_DISCONNECTED */; + case 9: + case "APP_STATE_DERIVED": + return 9 /* APP_STATE_DERIVED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appStateToJSON(object) { + switch (object) { + case 0 /* APP_STATE_UNSPECIFIED */: + return "APP_STATE_UNSPECIFIED"; + case 1 /* APP_STATE_EPHEMERAL */: + return "APP_STATE_EPHEMERAL"; + case 2 /* APP_STATE_DETACHED */: + return "APP_STATE_DETACHED"; + case 3 /* APP_STATE_DEPLOYED */: + return "APP_STATE_DEPLOYED"; + case 4 /* APP_STATE_STOPPING */: + return "APP_STATE_STOPPING"; + case 5 /* APP_STATE_STOPPED */: + return "APP_STATE_STOPPED"; + case 6 /* APP_STATE_INITIALIZING */: + return "APP_STATE_INITIALIZING"; + case 7 /* APP_STATE_DISABLED */: + return "APP_STATE_DISABLED"; + case 8 /* APP_STATE_DETACHED_DISCONNECTED */: + return "APP_STATE_DETACHED_DISCONNECTED"; + case 9 /* APP_STATE_DERIVED */: + return "APP_STATE_DERIVED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appStopSourceFromJSON(object) { + switch (object) { + case 0: + case "APP_STOP_SOURCE_UNSPECIFIED": + return 0 /* APP_STOP_SOURCE_UNSPECIFIED */; + case 1: + case "APP_STOP_SOURCE_CLI": + return 1 /* APP_STOP_SOURCE_CLI */; + case 2: + case "APP_STOP_SOURCE_PYTHON_CLIENT": + return 2 /* APP_STOP_SOURCE_PYTHON_CLIENT */; + case 3: + case "APP_STOP_SOURCE_WEB": + return 3 /* APP_STOP_SOURCE_WEB */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appStopSourceToJSON(object) { + switch (object) { + case 0 /* APP_STOP_SOURCE_UNSPECIFIED */: + return "APP_STOP_SOURCE_UNSPECIFIED"; + case 1 /* APP_STOP_SOURCE_CLI */: + return "APP_STOP_SOURCE_CLI"; + case 2 /* APP_STOP_SOURCE_PYTHON_CLIENT */: + return "APP_STOP_SOURCE_PYTHON_CLIENT"; + case 3 /* APP_STOP_SOURCE_WEB */: + return "APP_STOP_SOURCE_WEB"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function certificateStatusFromJSON(object) { + switch (object) { + case 0: + case "CERTIFICATE_STATUS_PENDING": + return 0 /* CERTIFICATE_STATUS_PENDING */; + case 1: + case "CERTIFICATE_STATUS_ISSUED": + return 1 /* CERTIFICATE_STATUS_ISSUED */; + case 2: + case "CERTIFICATE_STATUS_FAILED": + return 2 /* CERTIFICATE_STATUS_FAILED */; + case 3: + case "CERTIFICATE_STATUS_REVOKED": + return 3 /* CERTIFICATE_STATUS_REVOKED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function certificateStatusToJSON(object) { + switch (object) { + case 0 /* CERTIFICATE_STATUS_PENDING */: + return "CERTIFICATE_STATUS_PENDING"; + case 1 /* CERTIFICATE_STATUS_ISSUED */: + return "CERTIFICATE_STATUS_ISSUED"; + case 2 /* CERTIFICATE_STATUS_FAILED */: + return "CERTIFICATE_STATUS_FAILED"; + case 3 /* CERTIFICATE_STATUS_REVOKED */: + return "CERTIFICATE_STATUS_REVOKED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function checkpointStatusFromJSON(object) { + switch (object) { + case 0: + case "CHECKPOINT_STATUS_UNSPECIFIED": + return 0 /* CHECKPOINT_STATUS_UNSPECIFIED */; + case 1: + case "CHECKPOINT_STATUS_PENDING": + return 1 /* CHECKPOINT_STATUS_PENDING */; + case 2: + case "CHECKPOINT_STATUS_PROCESSING": + return 2 /* CHECKPOINT_STATUS_PROCESSING */; + case 3: + case "CHECKPOINT_STATUS_READY": + return 3 /* CHECKPOINT_STATUS_READY */; + case 4: + case "CHECKPOINT_STATUS_FAILED": + return 4 /* CHECKPOINT_STATUS_FAILED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function checkpointStatusToJSON(object) { + switch (object) { + case 0 /* CHECKPOINT_STATUS_UNSPECIFIED */: + return "CHECKPOINT_STATUS_UNSPECIFIED"; + case 1 /* CHECKPOINT_STATUS_PENDING */: + return "CHECKPOINT_STATUS_PENDING"; + case 2 /* CHECKPOINT_STATUS_PROCESSING */: + return "CHECKPOINT_STATUS_PROCESSING"; + case 3 /* CHECKPOINT_STATUS_READY */: + return "CHECKPOINT_STATUS_READY"; + case 4 /* CHECKPOINT_STATUS_FAILED */: + return "CHECKPOINT_STATUS_FAILED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function cloudProviderFromJSON(object) { + switch (object) { + case 0: + case "CLOUD_PROVIDER_UNSPECIFIED": + return 0 /* CLOUD_PROVIDER_UNSPECIFIED */; + case 1: + case "CLOUD_PROVIDER_AWS": + return 1 /* CLOUD_PROVIDER_AWS */; + case 2: + case "CLOUD_PROVIDER_GCP": + return 2 /* CLOUD_PROVIDER_GCP */; + case 3: + case "CLOUD_PROVIDER_AUTO": + return 3 /* CLOUD_PROVIDER_AUTO */; + case 4: + case "CLOUD_PROVIDER_OCI": + return 4 /* CLOUD_PROVIDER_OCI */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function cloudProviderToJSON(object) { + switch (object) { + case 0 /* CLOUD_PROVIDER_UNSPECIFIED */: + return "CLOUD_PROVIDER_UNSPECIFIED"; + case 1 /* CLOUD_PROVIDER_AWS */: + return "CLOUD_PROVIDER_AWS"; + case 2 /* CLOUD_PROVIDER_GCP */: + return "CLOUD_PROVIDER_GCP"; + case 3 /* CLOUD_PROVIDER_AUTO */: + return "CLOUD_PROVIDER_AUTO"; + case 4 /* CLOUD_PROVIDER_OCI */: + return "CLOUD_PROVIDER_OCI"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function dNSRecordTypeFromJSON(object) { + switch (object) { + case 0: + case "DNS_RECORD_TYPE_A": + return 0 /* DNS_RECORD_TYPE_A */; + case 1: + case "DNS_RECORD_TYPE_TXT": + return 1 /* DNS_RECORD_TYPE_TXT */; + case 2: + case "DNS_RECORD_TYPE_CNAME": + return 2 /* DNS_RECORD_TYPE_CNAME */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function dNSRecordTypeToJSON(object) { + switch (object) { + case 0 /* DNS_RECORD_TYPE_A */: + return "DNS_RECORD_TYPE_A"; + case 1 /* DNS_RECORD_TYPE_TXT */: + return "DNS_RECORD_TYPE_TXT"; + case 2 /* DNS_RECORD_TYPE_CNAME */: + return "DNS_RECORD_TYPE_CNAME"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function dataFormatFromJSON(object) { + switch (object) { + case 0: + case "DATA_FORMAT_UNSPECIFIED": + return 0 /* DATA_FORMAT_UNSPECIFIED */; + case 1: + case "DATA_FORMAT_PICKLE": + return 1 /* DATA_FORMAT_PICKLE */; + case 2: + case "DATA_FORMAT_ASGI": + return 2 /* DATA_FORMAT_ASGI */; + case 3: + case "DATA_FORMAT_GENERATOR_DONE": + return 3 /* DATA_FORMAT_GENERATOR_DONE */; + case 4: + case "DATA_FORMAT_CBOR": + return 4 /* DATA_FORMAT_CBOR */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function dataFormatToJSON(object) { + switch (object) { + case 0 /* DATA_FORMAT_UNSPECIFIED */: + return "DATA_FORMAT_UNSPECIFIED"; + case 1 /* DATA_FORMAT_PICKLE */: + return "DATA_FORMAT_PICKLE"; + case 2 /* DATA_FORMAT_ASGI */: + return "DATA_FORMAT_ASGI"; + case 3 /* DATA_FORMAT_GENERATOR_DONE */: + return "DATA_FORMAT_GENERATOR_DONE"; + case 4 /* DATA_FORMAT_CBOR */: + return "DATA_FORMAT_CBOR"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function deploymentNamespaceFromJSON(object) { + switch (object) { + case 0: + case "DEPLOYMENT_NAMESPACE_UNSPECIFIED": + return 0 /* DEPLOYMENT_NAMESPACE_UNSPECIFIED */; + case 1: + case "DEPLOYMENT_NAMESPACE_WORKSPACE": + return 1 /* DEPLOYMENT_NAMESPACE_WORKSPACE */; + case 3: + case "DEPLOYMENT_NAMESPACE_GLOBAL": + return 3 /* DEPLOYMENT_NAMESPACE_GLOBAL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function deploymentNamespaceToJSON(object) { + switch (object) { + case 0 /* DEPLOYMENT_NAMESPACE_UNSPECIFIED */: + return "DEPLOYMENT_NAMESPACE_UNSPECIFIED"; + case 1 /* DEPLOYMENT_NAMESPACE_WORKSPACE */: + return "DEPLOYMENT_NAMESPACE_WORKSPACE"; + case 3 /* DEPLOYMENT_NAMESPACE_GLOBAL */: + return "DEPLOYMENT_NAMESPACE_GLOBAL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function execOutputOptionFromJSON(object) { + switch (object) { + case 0: + case "EXEC_OUTPUT_OPTION_UNSPECIFIED": + return 0 /* EXEC_OUTPUT_OPTION_UNSPECIFIED */; + case 1: + case "EXEC_OUTPUT_OPTION_DEVNULL": + return 1 /* EXEC_OUTPUT_OPTION_DEVNULL */; + case 2: + case "EXEC_OUTPUT_OPTION_PIPE": + return 2 /* EXEC_OUTPUT_OPTION_PIPE */; + case 3: + case "EXEC_OUTPUT_OPTION_STDOUT": + return 3 /* EXEC_OUTPUT_OPTION_STDOUT */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function execOutputOptionToJSON(object) { + switch (object) { + case 0 /* EXEC_OUTPUT_OPTION_UNSPECIFIED */: + return "EXEC_OUTPUT_OPTION_UNSPECIFIED"; + case 1 /* EXEC_OUTPUT_OPTION_DEVNULL */: + return "EXEC_OUTPUT_OPTION_DEVNULL"; + case 2 /* EXEC_OUTPUT_OPTION_PIPE */: + return "EXEC_OUTPUT_OPTION_PIPE"; + case 3 /* EXEC_OUTPUT_OPTION_STDOUT */: + return "EXEC_OUTPUT_OPTION_STDOUT"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function fileDescriptorFromJSON(object) { + switch (object) { + case 0: + case "FILE_DESCRIPTOR_UNSPECIFIED": + return 0 /* FILE_DESCRIPTOR_UNSPECIFIED */; + case 1: + case "FILE_DESCRIPTOR_STDOUT": + return 1 /* FILE_DESCRIPTOR_STDOUT */; + case 2: + case "FILE_DESCRIPTOR_STDERR": + return 2 /* FILE_DESCRIPTOR_STDERR */; + case 3: + case "FILE_DESCRIPTOR_INFO": + return 3 /* FILE_DESCRIPTOR_INFO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function fileDescriptorToJSON(object) { + switch (object) { + case 0 /* FILE_DESCRIPTOR_UNSPECIFIED */: + return "FILE_DESCRIPTOR_UNSPECIFIED"; + case 1 /* FILE_DESCRIPTOR_STDOUT */: + return "FILE_DESCRIPTOR_STDOUT"; + case 2 /* FILE_DESCRIPTOR_STDERR */: + return "FILE_DESCRIPTOR_STDERR"; + case 3 /* FILE_DESCRIPTOR_INFO */: + return "FILE_DESCRIPTOR_INFO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionCallInvocationTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY": + return 1 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY */; + case 2: + case "FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY": + return 2 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY */; + case 3: + case "FUNCTION_CALL_INVOCATION_TYPE_ASYNC": + return 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */; + case 4: + case "FUNCTION_CALL_INVOCATION_TYPE_SYNC": + return 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionCallInvocationTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED */: + return "FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY */: + return "FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY"; + case 2 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY */: + return "FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY"; + case 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */: + return "FUNCTION_CALL_INVOCATION_TYPE_ASYNC"; + case 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */: + return "FUNCTION_CALL_INVOCATION_TYPE_SYNC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionCallTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_CALL_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_CALL_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_CALL_TYPE_UNARY": + return 1 /* FUNCTION_CALL_TYPE_UNARY */; + case 2: + case "FUNCTION_CALL_TYPE_MAP": + return 2 /* FUNCTION_CALL_TYPE_MAP */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionCallTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_CALL_TYPE_UNSPECIFIED */: + return "FUNCTION_CALL_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_CALL_TYPE_UNARY */: + return "FUNCTION_CALL_TYPE_UNARY"; + case 2 /* FUNCTION_CALL_TYPE_MAP */: + return "FUNCTION_CALL_TYPE_MAP"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function gPUTypeFromJSON(object) { + switch (object) { + case 0: + case "GPU_TYPE_UNSPECIFIED": + return 0 /* GPU_TYPE_UNSPECIFIED */; + case 1: + case "GPU_TYPE_T4": + return 1 /* GPU_TYPE_T4 */; + case 2: + case "GPU_TYPE_A100": + return 2 /* GPU_TYPE_A100 */; + case 3: + case "GPU_TYPE_A10G": + return 3 /* GPU_TYPE_A10G */; + case 4: + case "GPU_TYPE_ANY": + return 4 /* GPU_TYPE_ANY */; + case 8: + case "GPU_TYPE_A100_80GB": + return 8 /* GPU_TYPE_A100_80GB */; + case 9: + case "GPU_TYPE_L4": + return 9 /* GPU_TYPE_L4 */; + case 10: + case "GPU_TYPE_H100": + return 10 /* GPU_TYPE_H100 */; + case 11: + case "GPU_TYPE_L40S": + return 11 /* GPU_TYPE_L40S */; + case 12: + case "GPU_TYPE_H200": + return 12 /* GPU_TYPE_H200 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function gPUTypeToJSON(object) { + switch (object) { + case 0 /* GPU_TYPE_UNSPECIFIED */: + return "GPU_TYPE_UNSPECIFIED"; + case 1 /* GPU_TYPE_T4 */: + return "GPU_TYPE_T4"; + case 2 /* GPU_TYPE_A100 */: + return "GPU_TYPE_A100"; + case 3 /* GPU_TYPE_A10G */: + return "GPU_TYPE_A10G"; + case 4 /* GPU_TYPE_ANY */: + return "GPU_TYPE_ANY"; + case 8 /* GPU_TYPE_A100_80GB */: + return "GPU_TYPE_A100_80GB"; + case 9 /* GPU_TYPE_L4 */: + return "GPU_TYPE_L4"; + case 10 /* GPU_TYPE_H100 */: + return "GPU_TYPE_H100"; + case 11 /* GPU_TYPE_L40S */: + return "GPU_TYPE_L40S"; + case 12 /* GPU_TYPE_H200 */: + return "GPU_TYPE_H200"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function objectCreationTypeFromJSON(object) { + switch (object) { + case 0: + case "OBJECT_CREATION_TYPE_UNSPECIFIED": + return 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */; + case 1: + case "OBJECT_CREATION_TYPE_CREATE_IF_MISSING": + return 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */; + case 2: + case "OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS": + return 2 /* OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS */; + case 3: + case "OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS": + return 3 /* OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS */; + case 4: + case "OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP": + return 4 /* OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */; + case 5: + case "OBJECT_CREATION_TYPE_EPHEMERAL": + return 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function objectCreationTypeToJSON(object) { + switch (object) { + case 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */: + return "OBJECT_CREATION_TYPE_UNSPECIFIED"; + case 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */: + return "OBJECT_CREATION_TYPE_CREATE_IF_MISSING"; + case 2 /* OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS */: + return "OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS"; + case 3 /* OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS */: + return "OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS"; + case 4 /* OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */: + return "OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP"; + case 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */: + return "OBJECT_CREATION_TYPE_EPHEMERAL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function parameterTypeFromJSON(object) { + switch (object) { + case 0: + case "PARAM_TYPE_UNSPECIFIED": + return 0 /* PARAM_TYPE_UNSPECIFIED */; + case 1: + case "PARAM_TYPE_STRING": + return 1 /* PARAM_TYPE_STRING */; + case 2: + case "PARAM_TYPE_INT": + return 2 /* PARAM_TYPE_INT */; + case 3: + case "PARAM_TYPE_PICKLE": + return 3 /* PARAM_TYPE_PICKLE */; + case 4: + case "PARAM_TYPE_BYTES": + return 4 /* PARAM_TYPE_BYTES */; + case 5: + case "PARAM_TYPE_UNKNOWN": + return 5 /* PARAM_TYPE_UNKNOWN */; + case 6: + case "PARAM_TYPE_LIST": + return 6 /* PARAM_TYPE_LIST */; + case 7: + case "PARAM_TYPE_DICT": + return 7 /* PARAM_TYPE_DICT */; + case 8: + case "PARAM_TYPE_NONE": + return 8 /* PARAM_TYPE_NONE */; + case 9: + case "PARAM_TYPE_BOOL": + return 9 /* PARAM_TYPE_BOOL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function parameterTypeToJSON(object) { + switch (object) { + case 0 /* PARAM_TYPE_UNSPECIFIED */: + return "PARAM_TYPE_UNSPECIFIED"; + case 1 /* PARAM_TYPE_STRING */: + return "PARAM_TYPE_STRING"; + case 2 /* PARAM_TYPE_INT */: + return "PARAM_TYPE_INT"; + case 3 /* PARAM_TYPE_PICKLE */: + return "PARAM_TYPE_PICKLE"; + case 4 /* PARAM_TYPE_BYTES */: + return "PARAM_TYPE_BYTES"; + case 5 /* PARAM_TYPE_UNKNOWN */: + return "PARAM_TYPE_UNKNOWN"; + case 6 /* PARAM_TYPE_LIST */: + return "PARAM_TYPE_LIST"; + case 7 /* PARAM_TYPE_DICT */: + return "PARAM_TYPE_DICT"; + case 8 /* PARAM_TYPE_NONE */: + return "PARAM_TYPE_NONE"; + case 9 /* PARAM_TYPE_BOOL */: + return "PARAM_TYPE_BOOL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function progressTypeFromJSON(object) { + switch (object) { + case 0: + case "IMAGE_SNAPSHOT_UPLOAD": + return 0 /* IMAGE_SNAPSHOT_UPLOAD */; + case 1: + case "FUNCTION_QUEUED": + return 1 /* FUNCTION_QUEUED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function progressTypeToJSON(object) { + switch (object) { + case 0 /* IMAGE_SNAPSHOT_UPLOAD */: + return "IMAGE_SNAPSHOT_UPLOAD"; + case 1 /* FUNCTION_QUEUED */: + return "FUNCTION_QUEUED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function proxyIpStatusFromJSON(object) { + switch (object) { + case 0: + case "PROXY_IP_STATUS_UNSPECIFIED": + return 0 /* PROXY_IP_STATUS_UNSPECIFIED */; + case 1: + case "PROXY_IP_STATUS_CREATING": + return 1 /* PROXY_IP_STATUS_CREATING */; + case 2: + case "PROXY_IP_STATUS_ONLINE": + return 2 /* PROXY_IP_STATUS_ONLINE */; + case 3: + case "PROXY_IP_STATUS_TERMINATED": + return 3 /* PROXY_IP_STATUS_TERMINATED */; + case 4: + case "PROXY_IP_STATUS_UNHEALTHY": + return 4 /* PROXY_IP_STATUS_UNHEALTHY */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function proxyIpStatusToJSON(object) { + switch (object) { + case 0 /* PROXY_IP_STATUS_UNSPECIFIED */: + return "PROXY_IP_STATUS_UNSPECIFIED"; + case 1 /* PROXY_IP_STATUS_CREATING */: + return "PROXY_IP_STATUS_CREATING"; + case 2 /* PROXY_IP_STATUS_ONLINE */: + return "PROXY_IP_STATUS_ONLINE"; + case 3 /* PROXY_IP_STATUS_TERMINATED */: + return "PROXY_IP_STATUS_TERMINATED"; + case 4 /* PROXY_IP_STATUS_UNHEALTHY */: + return "PROXY_IP_STATUS_UNHEALTHY"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function rateLimitIntervalFromJSON(object) { + switch (object) { + case 0: + case "RATE_LIMIT_INTERVAL_UNSPECIFIED": + return 0 /* RATE_LIMIT_INTERVAL_UNSPECIFIED */; + case 1: + case "RATE_LIMIT_INTERVAL_SECOND": + return 1 /* RATE_LIMIT_INTERVAL_SECOND */; + case 2: + case "RATE_LIMIT_INTERVAL_MINUTE": + return 2 /* RATE_LIMIT_INTERVAL_MINUTE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function rateLimitIntervalToJSON(object) { + switch (object) { + case 0 /* RATE_LIMIT_INTERVAL_UNSPECIFIED */: + return "RATE_LIMIT_INTERVAL_UNSPECIFIED"; + case 1 /* RATE_LIMIT_INTERVAL_SECOND */: + return "RATE_LIMIT_INTERVAL_SECOND"; + case 2 /* RATE_LIMIT_INTERVAL_MINUTE */: + return "RATE_LIMIT_INTERVAL_MINUTE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function registryAuthTypeFromJSON(object) { + switch (object) { + case 0: + case "REGISTRY_AUTH_TYPE_UNSPECIFIED": + return 0 /* REGISTRY_AUTH_TYPE_UNSPECIFIED */; + case 1: + case "REGISTRY_AUTH_TYPE_AWS": + return 1 /* REGISTRY_AUTH_TYPE_AWS */; + case 2: + case "REGISTRY_AUTH_TYPE_GCP": + return 2 /* REGISTRY_AUTH_TYPE_GCP */; + case 3: + case "REGISTRY_AUTH_TYPE_PUBLIC": + return 3 /* REGISTRY_AUTH_TYPE_PUBLIC */; + case 4: + case "REGISTRY_AUTH_TYPE_STATIC_CREDS": + return 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function registryAuthTypeToJSON(object) { + switch (object) { + case 0 /* REGISTRY_AUTH_TYPE_UNSPECIFIED */: + return "REGISTRY_AUTH_TYPE_UNSPECIFIED"; + case 1 /* REGISTRY_AUTH_TYPE_AWS */: + return "REGISTRY_AUTH_TYPE_AWS"; + case 2 /* REGISTRY_AUTH_TYPE_GCP */: + return "REGISTRY_AUTH_TYPE_GCP"; + case 3 /* REGISTRY_AUTH_TYPE_PUBLIC */: + return "REGISTRY_AUTH_TYPE_PUBLIC"; + case 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */: + return "REGISTRY_AUTH_TYPE_STATIC_CREDS"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function seekWhenceFromJSON(object) { + switch (object) { + case 0: + case "SEEK_SET": + return 0 /* SEEK_SET */; + case 1: + case "SEEK_CUR": + return 1 /* SEEK_CUR */; + case 2: + case "SEEK_END": + return 2 /* SEEK_END */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function seekWhenceToJSON(object) { + switch (object) { + case 0 /* SEEK_SET */: + return "SEEK_SET"; + case 1 /* SEEK_CUR */: + return "SEEK_CUR"; + case 2 /* SEEK_END */: + return "SEEK_END"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function systemErrorCodeFromJSON(object) { + switch (object) { + case 0: + case "SYSTEM_ERROR_CODE_UNSPECIFIED": + return 0 /* SYSTEM_ERROR_CODE_UNSPECIFIED */; + case 1: + case "SYSTEM_ERROR_CODE_PERM": + return 1 /* SYSTEM_ERROR_CODE_PERM */; + case 2: + case "SYSTEM_ERROR_CODE_NOENT": + return 2 /* SYSTEM_ERROR_CODE_NOENT */; + case 5: + case "SYSTEM_ERROR_CODE_IO": + return 5 /* SYSTEM_ERROR_CODE_IO */; + case 6: + case "SYSTEM_ERROR_CODE_NXIO": + return 6 /* SYSTEM_ERROR_CODE_NXIO */; + case 12: + case "SYSTEM_ERROR_CODE_NOMEM": + return 12 /* SYSTEM_ERROR_CODE_NOMEM */; + case 13: + case "SYSTEM_ERROR_CODE_ACCES": + return 13 /* SYSTEM_ERROR_CODE_ACCES */; + case 17: + case "SYSTEM_ERROR_CODE_EXIST": + return 17 /* SYSTEM_ERROR_CODE_EXIST */; + case 20: + case "SYSTEM_ERROR_CODE_NOTDIR": + return 20 /* SYSTEM_ERROR_CODE_NOTDIR */; + case 21: + case "SYSTEM_ERROR_CODE_ISDIR": + return 21 /* SYSTEM_ERROR_CODE_ISDIR */; + case 22: + case "SYSTEM_ERROR_CODE_INVAL": + return 22 /* SYSTEM_ERROR_CODE_INVAL */; + case 24: + case "SYSTEM_ERROR_CODE_MFILE": + return 24 /* SYSTEM_ERROR_CODE_MFILE */; + case 27: + case "SYSTEM_ERROR_CODE_FBIG": + return 27 /* SYSTEM_ERROR_CODE_FBIG */; + case 28: + case "SYSTEM_ERROR_CODE_NOSPC": + return 28 /* SYSTEM_ERROR_CODE_NOSPC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function systemErrorCodeToJSON(object) { + switch (object) { + case 0 /* SYSTEM_ERROR_CODE_UNSPECIFIED */: + return "SYSTEM_ERROR_CODE_UNSPECIFIED"; + case 1 /* SYSTEM_ERROR_CODE_PERM */: + return "SYSTEM_ERROR_CODE_PERM"; + case 2 /* SYSTEM_ERROR_CODE_NOENT */: + return "SYSTEM_ERROR_CODE_NOENT"; + case 5 /* SYSTEM_ERROR_CODE_IO */: + return "SYSTEM_ERROR_CODE_IO"; + case 6 /* SYSTEM_ERROR_CODE_NXIO */: + return "SYSTEM_ERROR_CODE_NXIO"; + case 12 /* SYSTEM_ERROR_CODE_NOMEM */: + return "SYSTEM_ERROR_CODE_NOMEM"; + case 13 /* SYSTEM_ERROR_CODE_ACCES */: + return "SYSTEM_ERROR_CODE_ACCES"; + case 17 /* SYSTEM_ERROR_CODE_EXIST */: + return "SYSTEM_ERROR_CODE_EXIST"; + case 20 /* SYSTEM_ERROR_CODE_NOTDIR */: + return "SYSTEM_ERROR_CODE_NOTDIR"; + case 21 /* SYSTEM_ERROR_CODE_ISDIR */: + return "SYSTEM_ERROR_CODE_ISDIR"; + case 22 /* SYSTEM_ERROR_CODE_INVAL */: + return "SYSTEM_ERROR_CODE_INVAL"; + case 24 /* SYSTEM_ERROR_CODE_MFILE */: + return "SYSTEM_ERROR_CODE_MFILE"; + case 27 /* SYSTEM_ERROR_CODE_FBIG */: + return "SYSTEM_ERROR_CODE_FBIG"; + case 28 /* SYSTEM_ERROR_CODE_NOSPC */: + return "SYSTEM_ERROR_CODE_NOSPC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function taskSnapshotBehaviorFromJSON(object) { + switch (object) { + case 0: + case "TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED": + return 0 /* TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED */; + case 1: + case "TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT": + return 1 /* TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT */; + case 2: + case "TASK_SNAPSHOT_BEHAVIOR_RESTORE": + return 2 /* TASK_SNAPSHOT_BEHAVIOR_RESTORE */; + case 3: + case "TASK_SNAPSHOT_BEHAVIOR_NONE": + return 3 /* TASK_SNAPSHOT_BEHAVIOR_NONE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function taskSnapshotBehaviorToJSON(object) { + switch (object) { + case 0 /* TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED */: + return "TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED"; + case 1 /* TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT */: + return "TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT"; + case 2 /* TASK_SNAPSHOT_BEHAVIOR_RESTORE */: + return "TASK_SNAPSHOT_BEHAVIOR_RESTORE"; + case 3 /* TASK_SNAPSHOT_BEHAVIOR_NONE */: + return "TASK_SNAPSHOT_BEHAVIOR_NONE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function taskStateFromJSON(object) { + switch (object) { + case 0: + case "TASK_STATE_UNSPECIFIED": + return 0 /* TASK_STATE_UNSPECIFIED */; + case 6: + case "TASK_STATE_CREATED": + return 6 /* TASK_STATE_CREATED */; + case 1: + case "TASK_STATE_QUEUED": + return 1 /* TASK_STATE_QUEUED */; + case 2: + case "TASK_STATE_WORKER_ASSIGNED": + return 2 /* TASK_STATE_WORKER_ASSIGNED */; + case 3: + case "TASK_STATE_LOADING_IMAGE": + return 3 /* TASK_STATE_LOADING_IMAGE */; + case 4: + case "TASK_STATE_ACTIVE": + return 4 /* TASK_STATE_ACTIVE */; + case 5: + case "TASK_STATE_COMPLETED": + return 5 /* TASK_STATE_COMPLETED */; + case 7: + case "TASK_STATE_CREATING_CONTAINER": + return 7 /* TASK_STATE_CREATING_CONTAINER */; + case 8: + case "TASK_STATE_IDLE": + return 8 /* TASK_STATE_IDLE */; + case 9: + case "TASK_STATE_PREEMPTIBLE": + return 9 /* TASK_STATE_PREEMPTIBLE */; + case 10: + case "TASK_STATE_PREEMPTED": + return 10 /* TASK_STATE_PREEMPTED */; + case 11: + case "TASK_STATE_LOADING_CHECKPOINT_IMAGE": + return 11 /* TASK_STATE_LOADING_CHECKPOINT_IMAGE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function taskStateToJSON(object) { + switch (object) { + case 0 /* TASK_STATE_UNSPECIFIED */: + return "TASK_STATE_UNSPECIFIED"; + case 6 /* TASK_STATE_CREATED */: + return "TASK_STATE_CREATED"; + case 1 /* TASK_STATE_QUEUED */: + return "TASK_STATE_QUEUED"; + case 2 /* TASK_STATE_WORKER_ASSIGNED */: + return "TASK_STATE_WORKER_ASSIGNED"; + case 3 /* TASK_STATE_LOADING_IMAGE */: + return "TASK_STATE_LOADING_IMAGE"; + case 4 /* TASK_STATE_ACTIVE */: + return "TASK_STATE_ACTIVE"; + case 5 /* TASK_STATE_COMPLETED */: + return "TASK_STATE_COMPLETED"; + case 7 /* TASK_STATE_CREATING_CONTAINER */: + return "TASK_STATE_CREATING_CONTAINER"; + case 8 /* TASK_STATE_IDLE */: + return "TASK_STATE_IDLE"; + case 9 /* TASK_STATE_PREEMPTIBLE */: + return "TASK_STATE_PREEMPTIBLE"; + case 10 /* TASK_STATE_PREEMPTED */: + return "TASK_STATE_PREEMPTED"; + case 11 /* TASK_STATE_LOADING_CHECKPOINT_IMAGE */: + return "TASK_STATE_LOADING_CHECKPOINT_IMAGE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function tunnelTypeFromJSON(object) { + switch (object) { + case 0: + case "TUNNEL_TYPE_UNSPECIFIED": + return 0 /* TUNNEL_TYPE_UNSPECIFIED */; + case 1: + case "TUNNEL_TYPE_H2": + return 1 /* TUNNEL_TYPE_H2 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function tunnelTypeToJSON(object) { + switch (object) { + case 0 /* TUNNEL_TYPE_UNSPECIFIED */: + return "TUNNEL_TYPE_UNSPECIFIED"; + case 1 /* TUNNEL_TYPE_H2 */: + return "TUNNEL_TYPE_H2"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function volumeFsVersionFromJSON(object) { + switch (object) { + case 0: + case "VOLUME_FS_VERSION_UNSPECIFIED": + return 0 /* VOLUME_FS_VERSION_UNSPECIFIED */; + case 1: + case "VOLUME_FS_VERSION_V1": + return 1 /* VOLUME_FS_VERSION_V1 */; + case 2: + case "VOLUME_FS_VERSION_V2": + return 2 /* VOLUME_FS_VERSION_V2 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function volumeFsVersionToJSON(object) { + switch (object) { + case 0 /* VOLUME_FS_VERSION_UNSPECIFIED */: + return "VOLUME_FS_VERSION_UNSPECIFIED"; + case 1 /* VOLUME_FS_VERSION_V1 */: + return "VOLUME_FS_VERSION_V1"; + case 2 /* VOLUME_FS_VERSION_V2 */: + return "VOLUME_FS_VERSION_V2"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function webhookAsyncModeFromJSON(object) { + switch (object) { + case 0: + case "WEBHOOK_ASYNC_MODE_UNSPECIFIED": + return 0 /* WEBHOOK_ASYNC_MODE_UNSPECIFIED */; + case 2: + case "WEBHOOK_ASYNC_MODE_DISABLED": + return 2 /* WEBHOOK_ASYNC_MODE_DISABLED */; + case 3: + case "WEBHOOK_ASYNC_MODE_TRIGGER": + return 3 /* WEBHOOK_ASYNC_MODE_TRIGGER */; + case 4: + case "WEBHOOK_ASYNC_MODE_AUTO": + return 4 /* WEBHOOK_ASYNC_MODE_AUTO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function webhookAsyncModeToJSON(object) { + switch (object) { + case 0 /* WEBHOOK_ASYNC_MODE_UNSPECIFIED */: + return "WEBHOOK_ASYNC_MODE_UNSPECIFIED"; + case 2 /* WEBHOOK_ASYNC_MODE_DISABLED */: + return "WEBHOOK_ASYNC_MODE_DISABLED"; + case 3 /* WEBHOOK_ASYNC_MODE_TRIGGER */: + return "WEBHOOK_ASYNC_MODE_TRIGGER"; + case 4 /* WEBHOOK_ASYNC_MODE_AUTO */: + return "WEBHOOK_ASYNC_MODE_AUTO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function webhookTypeFromJSON(object) { + switch (object) { + case 0: + case "WEBHOOK_TYPE_UNSPECIFIED": + return 0 /* WEBHOOK_TYPE_UNSPECIFIED */; + case 1: + case "WEBHOOK_TYPE_ASGI_APP": + return 1 /* WEBHOOK_TYPE_ASGI_APP */; + case 2: + case "WEBHOOK_TYPE_FUNCTION": + return 2 /* WEBHOOK_TYPE_FUNCTION */; + case 3: + case "WEBHOOK_TYPE_WSGI_APP": + return 3 /* WEBHOOK_TYPE_WSGI_APP */; + case 4: + case "WEBHOOK_TYPE_WEB_SERVER": + return 4 /* WEBHOOK_TYPE_WEB_SERVER */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function webhookTypeToJSON(object) { + switch (object) { + case 0 /* WEBHOOK_TYPE_UNSPECIFIED */: + return "WEBHOOK_TYPE_UNSPECIFIED"; + case 1 /* WEBHOOK_TYPE_ASGI_APP */: + return "WEBHOOK_TYPE_ASGI_APP"; + case 2 /* WEBHOOK_TYPE_FUNCTION */: + return "WEBHOOK_TYPE_FUNCTION"; + case 3 /* WEBHOOK_TYPE_WSGI_APP */: + return "WEBHOOK_TYPE_WSGI_APP"; + case 4 /* WEBHOOK_TYPE_WEB_SERVER */: + return "WEBHOOK_TYPE_WEB_SERVER"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function classParameterInfo_ParameterSerializationFormatFromJSON(object) { + switch (object) { + case 0: + case "PARAM_SERIALIZATION_FORMAT_UNSPECIFIED": + return 0 /* PARAM_SERIALIZATION_FORMAT_UNSPECIFIED */; + case 1: + case "PARAM_SERIALIZATION_FORMAT_PICKLE": + return 1 /* PARAM_SERIALIZATION_FORMAT_PICKLE */; + case 2: + case "PARAM_SERIALIZATION_FORMAT_PROTO": + return 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function classParameterInfo_ParameterSerializationFormatToJSON(object) { + switch (object) { + case 0 /* PARAM_SERIALIZATION_FORMAT_UNSPECIFIED */: + return "PARAM_SERIALIZATION_FORMAT_UNSPECIFIED"; + case 1 /* PARAM_SERIALIZATION_FORMAT_PICKLE */: + return "PARAM_SERIALIZATION_FORMAT_PICKLE"; + case 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */: + return "PARAM_SERIALIZATION_FORMAT_PROTO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function cloudBucketMount_BucketTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "S3": + return 1 /* S3 */; + case 2: + case "R2": + return 2 /* R2 */; + case 3: + case "GCP": + return 3 /* GCP */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function cloudBucketMount_BucketTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* S3 */: + return "S3"; + case 2 /* R2 */: + return "R2"; + case 3 /* GCP */: + return "GCP"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function fileEntry_FileTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "FILE": + return 1 /* FILE */; + case 2: + case "DIRECTORY": + return 2 /* DIRECTORY */; + case 3: + case "SYMLINK": + return 3 /* SYMLINK */; + case 4: + case "FIFO": + return 4 /* FIFO */; + case 5: + case "SOCKET": + return 5 /* SOCKET */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function fileEntry_FileTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* FILE */: + return "FILE"; + case 2 /* DIRECTORY */: + return "DIRECTORY"; + case 3 /* SYMLINK */: + return "SYMLINK"; + case 4 /* FIFO */: + return "FIFO"; + case 5 /* SOCKET */: + return "SOCKET"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function function_DefinitionTypeFromJSON(object) { + switch (object) { + case 0: + case "DEFINITION_TYPE_UNSPECIFIED": + return 0 /* DEFINITION_TYPE_UNSPECIFIED */; + case 1: + case "DEFINITION_TYPE_SERIALIZED": + return 1 /* DEFINITION_TYPE_SERIALIZED */; + case 2: + case "DEFINITION_TYPE_FILE": + return 2 /* DEFINITION_TYPE_FILE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function function_DefinitionTypeToJSON(object) { + switch (object) { + case 0 /* DEFINITION_TYPE_UNSPECIFIED */: + return "DEFINITION_TYPE_UNSPECIFIED"; + case 1 /* DEFINITION_TYPE_SERIALIZED */: + return "DEFINITION_TYPE_SERIALIZED"; + case 2 /* DEFINITION_TYPE_FILE */: + return "DEFINITION_TYPE_FILE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function function_FunctionTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_TYPE_GENERATOR": + return 1 /* FUNCTION_TYPE_GENERATOR */; + case 2: + case "FUNCTION_TYPE_FUNCTION": + return 2 /* FUNCTION_TYPE_FUNCTION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function function_FunctionTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_TYPE_UNSPECIFIED */: + return "FUNCTION_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_TYPE_GENERATOR */: + return "FUNCTION_TYPE_GENERATOR"; + case 2 /* FUNCTION_TYPE_FUNCTION */: + return "FUNCTION_TYPE_FUNCTION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionSchema_FunctionSchemaTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_SCHEMA_UNSPECIFIED": + return 0 /* FUNCTION_SCHEMA_UNSPECIFIED */; + case 1: + case "FUNCTION_SCHEMA_V1": + return 1 /* FUNCTION_SCHEMA_V1 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionSchema_FunctionSchemaTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_SCHEMA_UNSPECIFIED */: + return "FUNCTION_SCHEMA_UNSPECIFIED"; + case 1 /* FUNCTION_SCHEMA_V1 */: + return "FUNCTION_SCHEMA_V1"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function genericResult_GenericStatusFromJSON(object) { + switch (object) { + case 0: + case "GENERIC_STATUS_UNSPECIFIED": + return 0 /* GENERIC_STATUS_UNSPECIFIED */; + case 1: + case "GENERIC_STATUS_SUCCESS": + return 1 /* GENERIC_STATUS_SUCCESS */; + case 2: + case "GENERIC_STATUS_FAILURE": + return 2 /* GENERIC_STATUS_FAILURE */; + case 3: + case "GENERIC_STATUS_TERMINATED": + return 3 /* GENERIC_STATUS_TERMINATED */; + case 4: + case "GENERIC_STATUS_TIMEOUT": + return 4 /* GENERIC_STATUS_TIMEOUT */; + case 5: + case "GENERIC_STATUS_INIT_FAILURE": + return 5 /* GENERIC_STATUS_INIT_FAILURE */; + case 6: + case "GENERIC_STATUS_INTERNAL_FAILURE": + return 6 /* GENERIC_STATUS_INTERNAL_FAILURE */; + case 7: + case "GENERIC_STATUS_IDLE_TIMEOUT": + return 7 /* GENERIC_STATUS_IDLE_TIMEOUT */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function genericResult_GenericStatusToJSON(object) { + switch (object) { + case 0 /* GENERIC_STATUS_UNSPECIFIED */: + return "GENERIC_STATUS_UNSPECIFIED"; + case 1 /* GENERIC_STATUS_SUCCESS */: + return "GENERIC_STATUS_SUCCESS"; + case 2 /* GENERIC_STATUS_FAILURE */: + return "GENERIC_STATUS_FAILURE"; + case 3 /* GENERIC_STATUS_TERMINATED */: + return "GENERIC_STATUS_TERMINATED"; + case 4 /* GENERIC_STATUS_TIMEOUT */: + return "GENERIC_STATUS_TIMEOUT"; + case 5 /* GENERIC_STATUS_INIT_FAILURE */: + return "GENERIC_STATUS_INIT_FAILURE"; + case 6 /* GENERIC_STATUS_INTERNAL_FAILURE */: + return "GENERIC_STATUS_INTERNAL_FAILURE"; + case 7 /* GENERIC_STATUS_IDLE_TIMEOUT */: + return "GENERIC_STATUS_IDLE_TIMEOUT"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function networkAccess_NetworkAccessTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "OPEN": + return 1 /* OPEN */; + case 2: + case "BLOCKED": + return 2 /* BLOCKED */; + case 3: + case "ALLOWLIST": + return 3 /* ALLOWLIST */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function networkAccess_NetworkAccessTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* OPEN */: + return "OPEN"; + case 2 /* BLOCKED */: + return "BLOCKED"; + case 3 /* ALLOWLIST */: + return "ALLOWLIST"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function pTYInfo_PTYTypeFromJSON(object) { + switch (object) { + case 0: + case "PTY_TYPE_UNSPECIFIED": + return 0 /* PTY_TYPE_UNSPECIFIED */; + case 1: + case "PTY_TYPE_FUNCTION": + return 1 /* PTY_TYPE_FUNCTION */; + case 2: + case "PTY_TYPE_SHELL": + return 2 /* PTY_TYPE_SHELL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function pTYInfo_PTYTypeToJSON(object) { + switch (object) { + case 0 /* PTY_TYPE_UNSPECIFIED */: + return "PTY_TYPE_UNSPECIFIED"; + case 1 /* PTY_TYPE_FUNCTION */: + return "PTY_TYPE_FUNCTION"; + case 2 /* PTY_TYPE_SHELL */: + return "PTY_TYPE_SHELL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(object) { + switch (object) { + case 0: + case "SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED": + return 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */; + case 1: + case "SANDBOX_NAME_OVERRIDE_TYPE_NONE": + return 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */; + case 2: + case "SANDBOX_NAME_OVERRIDE_TYPE_STRING": + return 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function sandboxRestoreRequest_SandboxNameOverrideTypeToJSON(object) { + switch (object) { + case 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */: + return "SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED"; + case 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */: + return "SANDBOX_NAME_OVERRIDE_TYPE_NONE"; + case 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */: + return "SANDBOX_NAME_OVERRIDE_TYPE_STRING"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function warning_WarningTypeFromJSON(object) { + switch (object) { + case 0: + case "WARNING_TYPE_UNSPECIFIED": + return 0 /* WARNING_TYPE_UNSPECIFIED */; + case 1: + case "WARNING_TYPE_CLIENT_DEPRECATION": + return 1 /* WARNING_TYPE_CLIENT_DEPRECATION */; + case 2: + case "WARNING_TYPE_RESOURCE_LIMIT": + return 2 /* WARNING_TYPE_RESOURCE_LIMIT */; + case 3: + case "WARNING_TYPE_FUNCTION_CONFIGURATION": + return 3 /* WARNING_TYPE_FUNCTION_CONFIGURATION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function warning_WarningTypeToJSON(object) { + switch (object) { + case 0 /* WARNING_TYPE_UNSPECIFIED */: + return "WARNING_TYPE_UNSPECIFIED"; + case 1 /* WARNING_TYPE_CLIENT_DEPRECATION */: + return "WARNING_TYPE_CLIENT_DEPRECATION"; + case 2 /* WARNING_TYPE_RESOURCE_LIMIT */: + return "WARNING_TYPE_RESOURCE_LIMIT"; + case 3 /* WARNING_TYPE_FUNCTION_CONFIGURATION */: + return "WARNING_TYPE_FUNCTION_CONFIGURATION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function createBaseAppClientDisconnectRequest() { + return { appId: "", reason: 0, exception: "" }; +} +var AppClientDisconnectRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.reason !== 0) { + writer.uint32(16).int32(message.reason); + } + if (message.exception !== "") { + writer.uint32(26).string(message.exception); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppClientDisconnectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.reason = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.exception = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + reason: isSet4(object.reason) ? appDisconnectReasonFromJSON(object.reason) : 0, + exception: isSet4(object.exception) ? globalThis.String(object.exception) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.reason !== 0) { + obj.reason = appDisconnectReasonToJSON(message.reason); + } + if (message.exception !== "") { + obj.exception = message.exception; + } + return obj; + }, + create(base) { + return AppClientDisconnectRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppClientDisconnectRequest(); + message.appId = object.appId ?? ""; + message.reason = object.reason ?? 0; + message.exception = object.exception ?? ""; + return message; + } +}; +function createBaseAppCreateRequest() { + return { clientId: "", description: "", environmentName: "", appState: 0 }; +} +var AppCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.environmentName !== "") { + writer.uint32(42).string(message.environmentName); + } + if (message.appState !== 0) { + writer.uint32(48).int32(message.appState); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clientId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.appState = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clientId: isSet4(object.clientId) ? globalThis.String(object.clientId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + appState: isSet4(object.appState) ? appStateFromJSON(object.appState) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.appState !== 0) { + obj.appState = appStateToJSON(message.appState); + } + return obj; + }, + create(base) { + return AppCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppCreateRequest(); + message.clientId = object.clientId ?? ""; + message.description = object.description ?? ""; + message.environmentName = object.environmentName ?? ""; + message.appState = object.appState ?? 0; + return message; + } +}; +function createBaseAppCreateResponse() { + return { appId: "", appPageUrl: "", appLogsUrl: "" }; +} +var AppCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.appPageUrl !== "") { + writer.uint32(18).string(message.appPageUrl); + } + if (message.appLogsUrl !== "") { + writer.uint32(26).string(message.appLogsUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appPageUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appLogsUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + appPageUrl: isSet4(object.appPageUrl) ? globalThis.String(object.appPageUrl) : "", + appLogsUrl: isSet4(object.appLogsUrl) ? globalThis.String(object.appLogsUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.appPageUrl !== "") { + obj.appPageUrl = message.appPageUrl; + } + if (message.appLogsUrl !== "") { + obj.appLogsUrl = message.appLogsUrl; + } + return obj; + }, + create(base) { + return AppCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppCreateResponse(); + message.appId = object.appId ?? ""; + message.appPageUrl = object.appPageUrl ?? ""; + message.appLogsUrl = object.appLogsUrl ?? ""; + return message; + } +}; +function createBaseAppDeployRequest() { + return { appId: "", name: "", objectEntity: "", visibility: 0, tag: "" }; +} +var AppDeployRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.objectEntity !== "") { + writer.uint32(34).string(message.objectEntity); + } + if (message.visibility !== 0) { + writer.uint32(40).int32(message.visibility); + } + if (message.tag !== "") { + writer.uint32(50).string(message.tag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeployRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.objectEntity = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.visibility = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "", + objectEntity: isSet4(object.objectEntity) ? globalThis.String(object.objectEntity) : "", + visibility: isSet4(object.visibility) ? appDeployVisibilityFromJSON(object.visibility) : 0, + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.objectEntity !== "") { + obj.objectEntity = message.objectEntity; + } + if (message.visibility !== 0) { + obj.visibility = appDeployVisibilityToJSON(message.visibility); + } + if (message.tag !== "") { + obj.tag = message.tag; + } + return obj; + }, + create(base) { + return AppDeployRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeployRequest(); + message.appId = object.appId ?? ""; + message.name = object.name ?? ""; + message.objectEntity = object.objectEntity ?? ""; + message.visibility = object.visibility ?? 0; + message.tag = object.tag ?? ""; + return message; + } +}; +function createBaseAppDeployResponse() { + return { url: "" }; +} +var AppDeployResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeployResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return AppDeployResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeployResponse(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseAppDeploymentHistory() { + return { + appId: "", + version: 0, + clientVersion: "", + deployedAt: 0, + deployedBy: "", + deployedByAvatarUrl: "", + tag: "", + rollbackVersion: 0, + rollbackAllowed: false, + commitInfo: void 0 + }; +} +var AppDeploymentHistory = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + if (message.clientVersion !== "") { + writer.uint32(26).string(message.clientVersion); + } + if (message.deployedAt !== 0) { + writer.uint32(33).double(message.deployedAt); + } + if (message.deployedBy !== "") { + writer.uint32(42).string(message.deployedBy); + } + if (message.deployedByAvatarUrl !== "") { + writer.uint32(74).string(message.deployedByAvatarUrl); + } + if (message.tag !== "") { + writer.uint32(50).string(message.tag); + } + if (message.rollbackVersion !== 0) { + writer.uint32(56).uint32(message.rollbackVersion); + } + if (message.rollbackAllowed !== false) { + writer.uint32(64).bool(message.rollbackAllowed); + } + if (message.commitInfo !== void 0) { + CommitInfo.encode(message.commitInfo, writer.uint32(82).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistory(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clientVersion = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.deployedAt = reader.double(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.deployedBy = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.deployedByAvatarUrl = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tag = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.rollbackVersion = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rollbackAllowed = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.commitInfo = CommitInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? globalThis.Number(object.version) : 0, + clientVersion: isSet4(object.clientVersion) ? globalThis.String(object.clientVersion) : "", + deployedAt: isSet4(object.deployedAt) ? globalThis.Number(object.deployedAt) : 0, + deployedBy: isSet4(object.deployedBy) ? globalThis.String(object.deployedBy) : "", + deployedByAvatarUrl: isSet4(object.deployedByAvatarUrl) ? globalThis.String(object.deployedByAvatarUrl) : "", + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "", + rollbackVersion: isSet4(object.rollbackVersion) ? globalThis.Number(object.rollbackVersion) : 0, + rollbackAllowed: isSet4(object.rollbackAllowed) ? globalThis.Boolean(object.rollbackAllowed) : false, + commitInfo: isSet4(object.commitInfo) ? CommitInfo.fromJSON(object.commitInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.clientVersion !== "") { + obj.clientVersion = message.clientVersion; + } + if (message.deployedAt !== 0) { + obj.deployedAt = message.deployedAt; + } + if (message.deployedBy !== "") { + obj.deployedBy = message.deployedBy; + } + if (message.deployedByAvatarUrl !== "") { + obj.deployedByAvatarUrl = message.deployedByAvatarUrl; + } + if (message.tag !== "") { + obj.tag = message.tag; + } + if (message.rollbackVersion !== 0) { + obj.rollbackVersion = Math.round(message.rollbackVersion); + } + if (message.rollbackAllowed !== false) { + obj.rollbackAllowed = message.rollbackAllowed; + } + if (message.commitInfo !== void 0) { + obj.commitInfo = CommitInfo.toJSON(message.commitInfo); + } + return obj; + }, + create(base) { + return AppDeploymentHistory.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistory(); + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + message.clientVersion = object.clientVersion ?? ""; + message.deployedAt = object.deployedAt ?? 0; + message.deployedBy = object.deployedBy ?? ""; + message.deployedByAvatarUrl = object.deployedByAvatarUrl ?? ""; + message.tag = object.tag ?? ""; + message.rollbackVersion = object.rollbackVersion ?? 0; + message.rollbackAllowed = object.rollbackAllowed ?? false; + message.commitInfo = object.commitInfo !== void 0 && object.commitInfo !== null ? CommitInfo.fromPartial(object.commitInfo) : void 0; + return message; + } +}; +function createBaseAppDeploymentHistoryRequest() { + return { appId: "" }; +} +var AppDeploymentHistoryRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppDeploymentHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistoryRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppDeploymentHistoryResponse() { + return { appDeploymentHistories: [] }; +} +var AppDeploymentHistoryResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.appDeploymentHistories) { + AppDeploymentHistory.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appDeploymentHistories.push(AppDeploymentHistory.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appDeploymentHistories: globalThis.Array.isArray(object?.appDeploymentHistories) ? object.appDeploymentHistories.map((e) => AppDeploymentHistory.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appDeploymentHistories?.length) { + obj.appDeploymentHistories = message.appDeploymentHistories.map((e) => AppDeploymentHistory.toJSON(e)); + } + return obj; + }, + create(base) { + return AppDeploymentHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistoryResponse(); + message.appDeploymentHistories = object.appDeploymentHistories?.map((e) => AppDeploymentHistory.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppGetByDeploymentNameRequest() { + return { name: "", environmentName: "" }; +} +var AppGetByDeploymentNameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetByDeploymentNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppGetByDeploymentNameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetByDeploymentNameRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppGetByDeploymentNameResponse() { + return { appId: "" }; +} +var AppGetByDeploymentNameResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetByDeploymentNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetByDeploymentNameResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetByDeploymentNameResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetLayoutRequest() { + return { appId: "" }; +} +var AppGetLayoutRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLayoutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetLayoutRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLayoutRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetLayoutResponse() { + return { appLayout: void 0 }; +} +var AppGetLayoutResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appLayout !== void 0) { + AppLayout.encode(message.appLayout, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLayoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appLayout = AppLayout.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appLayout: isSet4(object.appLayout) ? AppLayout.fromJSON(object.appLayout) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.appLayout !== void 0) { + obj.appLayout = AppLayout.toJSON(message.appLayout); + } + return obj; + }, + create(base) { + return AppGetLayoutResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLayoutResponse(); + message.appLayout = object.appLayout !== void 0 && object.appLayout !== null ? AppLayout.fromPartial(object.appLayout) : void 0; + return message; + } +}; +function createBaseAppGetLogsRequest() { + return { + appId: "", + timeout: 0, + lastEntryId: "", + functionId: "", + inputId: "", + taskId: "", + functionCallId: "", + fileDescriptor: 0, + sandboxId: "" + }; +} +var AppGetLogsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(34).string(message.lastEntryId); + } + if (message.functionId !== "") { + writer.uint32(42).string(message.functionId); + } + if (message.inputId !== "") { + writer.uint32(50).string(message.inputId); + } + if (message.taskId !== "") { + writer.uint32(58).string(message.taskId); + } + if (message.functionCallId !== "") { + writer.uint32(74).string(message.functionCallId); + } + if (message.fileDescriptor !== 0) { + writer.uint32(64).int32(message.fileDescriptor); + } + if (message.sandboxId !== "") { + writer.uint32(82).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLogsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.functionId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.inputId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.taskId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return AppGetLogsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLogsRequest(); + message.appId = object.appId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.functionId = object.functionId ?? ""; + message.inputId = object.inputId ?? ""; + message.taskId = object.taskId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseAppGetObjectsItem() { + return { tag: "", object: void 0 }; +} +var AppGetObjectsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.tag !== "") { + writer.uint32(10).string(message.tag); + } + if (message.object !== void 0) { + Object_.encode(message.object, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tag = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.object = Object_.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "", + object: isSet4(object.object) ? Object_.fromJSON(object.object) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.tag !== "") { + obj.tag = message.tag; + } + if (message.object !== void 0) { + obj.object = Object_.toJSON(message.object); + } + return obj; + }, + create(base) { + return AppGetObjectsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsItem(); + message.tag = object.tag ?? ""; + message.object = object.object !== void 0 && object.object !== null ? Object_.fromPartial(object.object) : void 0; + return message; + } +}; +function createBaseAppGetObjectsRequest() { + return { appId: "", includeUnindexed: false, onlyClassFunction: false }; +} +var AppGetObjectsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.includeUnindexed !== false) { + writer.uint32(16).bool(message.includeUnindexed); + } + if (message.onlyClassFunction !== false) { + writer.uint32(24).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.includeUnindexed = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + includeUnindexed: isSet4(object.includeUnindexed) ? globalThis.Boolean(object.includeUnindexed) : false, + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.includeUnindexed !== false) { + obj.includeUnindexed = message.includeUnindexed; + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return AppGetObjectsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsRequest(); + message.appId = object.appId ?? ""; + message.includeUnindexed = object.includeUnindexed ?? false; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseAppGetObjectsResponse() { + return { items: [] }; +} +var AppGetObjectsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + AppGetObjectsItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.items.push(AppGetObjectsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => AppGetObjectsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => AppGetObjectsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return AppGetObjectsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsResponse(); + message.items = object.items?.map((e) => AppGetObjectsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppGetOrCreateRequest() { + return { appName: "", environmentName: "", objectCreationType: 0 }; +} +var AppGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(24).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return AppGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetOrCreateRequest(); + message.appName = object.appName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseAppGetOrCreateResponse() { + return { appId: "" }; +} +var AppGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetOrCreateResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetTagsRequest() { + return { appId: "" }; +} +var AppGetTagsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetTagsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetTagsResponse() { + return { tags: {} }; +} +var AppGetTagsResponse = { + encode(message, writer = new BinaryWriter()) { + Object.entries(message.tags).forEach(([key, value]) => { + AppGetTagsResponse_TagsEntry.encode({ key, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + const entry1 = AppGetTagsResponse_TagsEntry.decode(reader, reader.uint32()); + if (entry1.value !== void 0) { + message.tags[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppGetTagsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsResponse(); + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppGetTagsResponse_TagsEntry() { + return { key: "", value: "" }; +} +var AppGetTagsResponse_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsResponse_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppGetTagsResponse_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsResponse_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppHeartbeatRequest() { + return { appId: "" }; +} +var AppHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppHeartbeatRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppLayout() { + return { objects: [], functionIds: {}, classIds: {} }; +} +var AppLayout = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.objects) { + Object_.encode(v, writer.uint32(10).fork()).join(); + } + Object.entries(message.functionIds).forEach(([key, value]) => { + AppLayout_FunctionIdsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + Object.entries(message.classIds).forEach(([key, value]) => { + AppLayout_ClassIdsEntry.encode({ key, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objects.push(Object_.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppLayout_FunctionIdsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.functionIds[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + const entry3 = AppLayout_ClassIdsEntry.decode(reader, reader.uint32()); + if (entry3.value !== void 0) { + message.classIds[entry3.key] = entry3.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objects: globalThis.Array.isArray(object?.objects) ? object.objects.map((e) => Object_.fromJSON(e)) : [], + functionIds: isObject2(object.functionIds) ? Object.entries(object.functionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + classIds: isObject2(object.classIds) ? Object.entries(object.classIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.objects?.length) { + obj.objects = message.objects.map((e) => Object_.toJSON(e)); + } + if (message.functionIds) { + const entries = Object.entries(message.functionIds); + if (entries.length > 0) { + obj.functionIds = {}; + entries.forEach(([k, v]) => { + obj.functionIds[k] = v; + }); + } + } + if (message.classIds) { + const entries = Object.entries(message.classIds); + if (entries.length > 0) { + obj.classIds = {}; + entries.forEach(([k, v]) => { + obj.classIds[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppLayout.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout(); + message.objects = object.objects?.map((e) => Object_.fromPartial(e)) || []; + message.functionIds = Object.entries(object.functionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.classIds = Object.entries(object.classIds ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppLayout_FunctionIdsEntry() { + return { key: "", value: "" }; +} +var AppLayout_FunctionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout_FunctionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppLayout_FunctionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout_FunctionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppLayout_ClassIdsEntry() { + return { key: "", value: "" }; +} +var AppLayout_ClassIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout_ClassIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppLayout_ClassIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout_ClassIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppListRequest() { + return { environmentName: "" }; +} +var AppListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppListResponse() { + return { apps: [] }; +} +var AppListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.apps) { + AppListResponse_AppListItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.apps.push(AppListResponse_AppListItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + apps: globalThis.Array.isArray(object?.apps) ? object.apps.map((e) => AppListResponse_AppListItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.apps?.length) { + obj.apps = message.apps.map((e) => AppListResponse_AppListItem.toJSON(e)); + } + return obj; + }, + create(base) { + return AppListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListResponse(); + message.apps = object.apps?.map((e) => AppListResponse_AppListItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppListResponse_AppListItem() { + return { appId: "", description: "", state: 0, createdAt: 0, stoppedAt: 0, nRunningTasks: 0, name: "" }; +} +var AppListResponse_AppListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.createdAt !== 0) { + writer.uint32(41).double(message.createdAt); + } + if (message.stoppedAt !== 0) { + writer.uint32(49).double(message.stoppedAt); + } + if (message.nRunningTasks !== 0) { + writer.uint32(64).int32(message.nRunningTasks); + } + if (message.name !== "") { + writer.uint32(82).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListResponse_AppListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.description = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.state = reader.int32(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.stoppedAt = reader.double(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.nRunningTasks = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + state: isSet4(object.state) ? appStateFromJSON(object.state) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + stoppedAt: isSet4(object.stoppedAt) ? globalThis.Number(object.stoppedAt) : 0, + nRunningTasks: isSet4(object.nRunningTasks) ? globalThis.Number(object.nRunningTasks) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.state !== 0) { + obj.state = appStateToJSON(message.state); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.stoppedAt !== 0) { + obj.stoppedAt = message.stoppedAt; + } + if (message.nRunningTasks !== 0) { + obj.nRunningTasks = Math.round(message.nRunningTasks); + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return AppListResponse_AppListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListResponse_AppListItem(); + message.appId = object.appId ?? ""; + message.description = object.description ?? ""; + message.state = object.state ?? 0; + message.createdAt = object.createdAt ?? 0; + message.stoppedAt = object.stoppedAt ?? 0; + message.nRunningTasks = object.nRunningTasks ?? 0; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseAppLookupRequest() { + return { appName: "", environmentName: "" }; +} +var AppLookupRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLookupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.appName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppLookupRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLookupRequest(); + message.appName = object.appName ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppLookupResponse() { + return { appId: "" }; +} +var AppLookupResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLookupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppLookupResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLookupResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppPublishRequest() { + return { + appId: "", + name: "", + deploymentTag: "", + appState: 0, + functionIds: {}, + classIds: {}, + definitionIds: {}, + rollbackVersion: 0, + clientVersion: "", + commitInfo: void 0, + tags: {} + }; +} +var AppPublishRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.deploymentTag !== "") { + writer.uint32(26).string(message.deploymentTag); + } + if (message.appState !== 0) { + writer.uint32(32).int32(message.appState); + } + Object.entries(message.functionIds).forEach(([key, value]) => { + AppPublishRequest_FunctionIdsEntry.encode({ key, value }, writer.uint32(42).fork()).join(); + }); + Object.entries(message.classIds).forEach(([key, value]) => { + AppPublishRequest_ClassIdsEntry.encode({ key, value }, writer.uint32(50).fork()).join(); + }); + Object.entries(message.definitionIds).forEach(([key, value]) => { + AppPublishRequest_DefinitionIdsEntry.encode({ key, value }, writer.uint32(58).fork()).join(); + }); + if (message.rollbackVersion !== 0) { + writer.uint32(64).uint32(message.rollbackVersion); + } + if (message.clientVersion !== "") { + writer.uint32(74).string(message.clientVersion); + } + if (message.commitInfo !== void 0) { + CommitInfo.encode(message.commitInfo, writer.uint32(82).fork()).join(); + } + Object.entries(message.tags).forEach(([key, value]) => { + AppPublishRequest_TagsEntry.encode({ key, value }, writer.uint32(90).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.deploymentTag = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.appState = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + const entry5 = AppPublishRequest_FunctionIdsEntry.decode(reader, reader.uint32()); + if (entry5.value !== void 0) { + message.functionIds[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + const entry6 = AppPublishRequest_ClassIdsEntry.decode(reader, reader.uint32()); + if (entry6.value !== void 0) { + message.classIds[entry6.key] = entry6.value; + } + continue; + } + case 7: { + if (tag !== 58) { + break; + } + const entry7 = AppPublishRequest_DefinitionIdsEntry.decode(reader, reader.uint32()); + if (entry7.value !== void 0) { + message.definitionIds[entry7.key] = entry7.value; + } + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rollbackVersion = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.clientVersion = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.commitInfo = CommitInfo.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + const entry11 = AppPublishRequest_TagsEntry.decode(reader, reader.uint32()); + if (entry11.value !== void 0) { + message.tags[entry11.key] = entry11.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "", + deploymentTag: isSet4(object.deploymentTag) ? globalThis.String(object.deploymentTag) : "", + appState: isSet4(object.appState) ? appStateFromJSON(object.appState) : 0, + functionIds: isObject2(object.functionIds) ? Object.entries(object.functionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + classIds: isObject2(object.classIds) ? Object.entries(object.classIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + definitionIds: isObject2(object.definitionIds) ? Object.entries(object.definitionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + rollbackVersion: isSet4(object.rollbackVersion) ? globalThis.Number(object.rollbackVersion) : 0, + clientVersion: isSet4(object.clientVersion) ? globalThis.String(object.clientVersion) : "", + commitInfo: isSet4(object.commitInfo) ? CommitInfo.fromJSON(object.commitInfo) : void 0, + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.deploymentTag !== "") { + obj.deploymentTag = message.deploymentTag; + } + if (message.appState !== 0) { + obj.appState = appStateToJSON(message.appState); + } + if (message.functionIds) { + const entries = Object.entries(message.functionIds); + if (entries.length > 0) { + obj.functionIds = {}; + entries.forEach(([k, v]) => { + obj.functionIds[k] = v; + }); + } + } + if (message.classIds) { + const entries = Object.entries(message.classIds); + if (entries.length > 0) { + obj.classIds = {}; + entries.forEach(([k, v]) => { + obj.classIds[k] = v; + }); + } + } + if (message.definitionIds) { + const entries = Object.entries(message.definitionIds); + if (entries.length > 0) { + obj.definitionIds = {}; + entries.forEach(([k, v]) => { + obj.definitionIds[k] = v; + }); + } + } + if (message.rollbackVersion !== 0) { + obj.rollbackVersion = Math.round(message.rollbackVersion); + } + if (message.clientVersion !== "") { + obj.clientVersion = message.clientVersion; + } + if (message.commitInfo !== void 0) { + obj.commitInfo = CommitInfo.toJSON(message.commitInfo); + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppPublishRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest(); + message.appId = object.appId ?? ""; + message.name = object.name ?? ""; + message.deploymentTag = object.deploymentTag ?? ""; + message.appState = object.appState ?? 0; + message.functionIds = Object.entries(object.functionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.classIds = Object.entries(object.classIds ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.definitionIds = Object.entries(object.definitionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.rollbackVersion = object.rollbackVersion ?? 0; + message.clientVersion = object.clientVersion ?? ""; + message.commitInfo = object.commitInfo !== void 0 && object.commitInfo !== null ? CommitInfo.fromPartial(object.commitInfo) : void 0; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppPublishRequest_FunctionIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_FunctionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_FunctionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_FunctionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_FunctionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_ClassIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_ClassIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_ClassIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_ClassIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_ClassIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_DefinitionIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_DefinitionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_DefinitionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_DefinitionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_DefinitionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_TagsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishResponse() { + return { url: "", serverWarnings: [] }; +} +var AppPublishResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + url: isSet4(object.url) ? globalThis.String(object.url) : "", + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return AppPublishResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishResponse(); + message.url = object.url ?? ""; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppRollbackRequest() { + return { appId: "", version: 0 }; +} +var AppRollbackRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppRollbackRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? globalThis.Number(object.version) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + create(base) { + return AppRollbackRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppRollbackRequest(); + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + return message; + } +}; +function createBaseAppSetObjectsRequest() { + return { appId: "", indexedObjectIds: {}, clientId: "", unindexedObjectIds: [], newAppState: 0 }; +} +var AppSetObjectsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + Object.entries(message.indexedObjectIds).forEach(([key, value]) => { + AppSetObjectsRequest_IndexedObjectIdsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + if (message.clientId !== "") { + writer.uint32(26).string(message.clientId); + } + for (const v of message.unindexedObjectIds) { + writer.uint32(34).string(v); + } + if (message.newAppState !== 0) { + writer.uint32(40).int32(message.newAppState); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetObjectsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppSetObjectsRequest_IndexedObjectIdsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.indexedObjectIds[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clientId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.unindexedObjectIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.newAppState = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + indexedObjectIds: isObject2(object.indexedObjectIds) ? Object.entries(object.indexedObjectIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + clientId: isSet4(object.clientId) ? globalThis.String(object.clientId) : "", + unindexedObjectIds: globalThis.Array.isArray(object?.unindexedObjectIds) ? object.unindexedObjectIds.map((e) => globalThis.String(e)) : [], + newAppState: isSet4(object.newAppState) ? appStateFromJSON(object.newAppState) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.indexedObjectIds) { + const entries = Object.entries(message.indexedObjectIds); + if (entries.length > 0) { + obj.indexedObjectIds = {}; + entries.forEach(([k, v]) => { + obj.indexedObjectIds[k] = v; + }); + } + } + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.unindexedObjectIds?.length) { + obj.unindexedObjectIds = message.unindexedObjectIds; + } + if (message.newAppState !== 0) { + obj.newAppState = appStateToJSON(message.newAppState); + } + return obj; + }, + create(base) { + return AppSetObjectsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetObjectsRequest(); + message.appId = object.appId ?? ""; + message.indexedObjectIds = Object.entries(object.indexedObjectIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.clientId = object.clientId ?? ""; + message.unindexedObjectIds = object.unindexedObjectIds?.map((e) => e) || []; + message.newAppState = object.newAppState ?? 0; + return message; + } +}; +function createBaseAppSetObjectsRequest_IndexedObjectIdsEntry() { + return { key: "", value: "" }; +} +var AppSetObjectsRequest_IndexedObjectIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetObjectsRequest_IndexedObjectIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppSetObjectsRequest_IndexedObjectIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetObjectsRequest_IndexedObjectIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppSetTagsRequest() { + return { appId: "", tags: {} }; +} +var AppSetTagsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + Object.entries(message.tags).forEach(([key, value]) => { + AppSetTagsRequest_TagsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetTagsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppSetTagsRequest_TagsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.tags[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppSetTagsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetTagsRequest(); + message.appId = object.appId ?? ""; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppSetTagsRequest_TagsEntry() { + return { key: "", value: "" }; +} +var AppSetTagsRequest_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetTagsRequest_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppSetTagsRequest_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetTagsRequest_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppStopRequest() { + return { appId: "", source: 0 }; +} +var AppStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.source !== 0) { + writer.uint32(16).int32(message.source); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.source = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + source: isSet4(object.source) ? appStopSourceFromJSON(object.source) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.source !== 0) { + obj.source = appStopSourceToJSON(message.source); + } + return obj; + }, + create(base) { + return AppStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppStopRequest(); + message.appId = object.appId ?? ""; + message.source = object.source ?? 0; + return message; + } +}; +function createBaseAttemptAwaitRequest() { + return { attemptToken: "", requestedAt: 0, timeoutSecs: 0 }; +} +var AttemptAwaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + if (message.requestedAt !== 0) { + writer.uint32(17).double(message.requestedAt); + } + if (message.timeoutSecs !== 0) { + writer.uint32(29).float(message.timeoutSecs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptAwaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeoutSecs = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "", + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = message.timeoutSecs; + } + return obj; + }, + create(base) { + return AttemptAwaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptAwaitRequest(); + message.attemptToken = object.attemptToken ?? ""; + message.requestedAt = object.requestedAt ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + return message; + } +}; +function createBaseAttemptAwaitResponse() { + return { output: void 0 }; +} +var AttemptAwaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.output !== void 0) { + FunctionGetOutputsItem.encode(message.output, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptAwaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.output = FunctionGetOutputsItem.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { output: isSet4(object.output) ? FunctionGetOutputsItem.fromJSON(object.output) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.output !== void 0) { + obj.output = FunctionGetOutputsItem.toJSON(message.output); + } + return obj; + }, + create(base) { + return AttemptAwaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptAwaitResponse(); + message.output = object.output !== void 0 && object.output !== null ? FunctionGetOutputsItem.fromPartial(object.output) : void 0; + return message; + } +}; +function createBaseAttemptRetryRequest() { + return { functionId: "", parentInputId: "", input: void 0, attemptToken: "" }; +} +var AttemptRetryRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(26).fork()).join(); + } + if (message.attemptToken !== "") { + writer.uint32(34).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptRetryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return AttemptRetryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptRetryRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseAttemptRetryResponse() { + return { attemptToken: "" }; +} +var AttemptRetryResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptRetryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return AttemptRetryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptRetryResponse(); + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseAttemptStartRequest() { + return { functionId: "", parentInputId: "", input: void 0 }; +} +var AttemptStartRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptStartRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + return obj; + }, + create(base) { + return AttemptStartRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptStartRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseAttemptStartResponse() { + return { attemptToken: "", retryPolicy: void 0 }; +} +var AttemptStartResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptStartResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "", + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + return obj; + }, + create(base) { + return AttemptStartResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptStartResponse(); + message.attemptToken = object.attemptToken ?? ""; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + return message; + } +}; +function createBaseAuthTokenGetRequest() { + return {}; +} +var AuthTokenGetRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAuthTokenGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return AuthTokenGetRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseAuthTokenGetRequest(); + return message; + } +}; +function createBaseAuthTokenGetResponse() { + return { token: "" }; +} +var AuthTokenGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAuthTokenGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { token: isSet4(object.token) ? globalThis.String(object.token) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + create(base) { + return AuthTokenGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAuthTokenGetResponse(); + message.token = object.token ?? ""; + return message; + } +}; +function createBaseAutoscalerSettings() { + return { + minContainers: void 0, + maxContainers: void 0, + bufferContainers: void 0, + scaleupWindow: void 0, + scaledownWindow: void 0 + }; +} +var AutoscalerSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.minContainers !== void 0) { + writer.uint32(8).uint32(message.minContainers); + } + if (message.maxContainers !== void 0) { + writer.uint32(16).uint32(message.maxContainers); + } + if (message.bufferContainers !== void 0) { + writer.uint32(24).uint32(message.bufferContainers); + } + if (message.scaleupWindow !== void 0) { + writer.uint32(32).uint32(message.scaleupWindow); + } + if (message.scaledownWindow !== void 0) { + writer.uint32(40).uint32(message.scaledownWindow); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAutoscalerSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.minContainers = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.maxContainers = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.bufferContainers = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.scaleupWindow = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.scaledownWindow = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minContainers: isSet4(object.minContainers) ? globalThis.Number(object.minContainers) : void 0, + maxContainers: isSet4(object.maxContainers) ? globalThis.Number(object.maxContainers) : void 0, + bufferContainers: isSet4(object.bufferContainers) ? globalThis.Number(object.bufferContainers) : void 0, + scaleupWindow: isSet4(object.scaleupWindow) ? globalThis.Number(object.scaleupWindow) : void 0, + scaledownWindow: isSet4(object.scaledownWindow) ? globalThis.Number(object.scaledownWindow) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.minContainers !== void 0) { + obj.minContainers = Math.round(message.minContainers); + } + if (message.maxContainers !== void 0) { + obj.maxContainers = Math.round(message.maxContainers); + } + if (message.bufferContainers !== void 0) { + obj.bufferContainers = Math.round(message.bufferContainers); + } + if (message.scaleupWindow !== void 0) { + obj.scaleupWindow = Math.round(message.scaleupWindow); + } + if (message.scaledownWindow !== void 0) { + obj.scaledownWindow = Math.round(message.scaledownWindow); + } + return obj; + }, + create(base) { + return AutoscalerSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAutoscalerSettings(); + message.minContainers = object.minContainers ?? void 0; + message.maxContainers = object.maxContainers ?? void 0; + message.bufferContainers = object.bufferContainers ?? void 0; + message.scaleupWindow = object.scaleupWindow ?? void 0; + message.scaledownWindow = object.scaledownWindow ?? void 0; + return message; + } +}; +function createBaseAutoscalingMetrics() { + return { cpuUsagePercent: 0, memoryUsagePercent: 0, concurrentRequests: 0, timestamp: 0 }; +} +var AutoscalingMetrics = { + encode(message, writer = new BinaryWriter()) { + if (message.cpuUsagePercent !== 0) { + writer.uint32(9).double(message.cpuUsagePercent); + } + if (message.memoryUsagePercent !== 0) { + writer.uint32(17).double(message.memoryUsagePercent); + } + if (message.concurrentRequests !== 0) { + writer.uint32(24).uint32(message.concurrentRequests); + } + if (message.timestamp !== 0) { + writer.uint32(33).double(message.timestamp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAutoscalingMetrics(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + message.cpuUsagePercent = reader.double(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.memoryUsagePercent = reader.double(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.concurrentRequests = reader.uint32(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.timestamp = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cpuUsagePercent: isSet4(object.cpuUsagePercent) ? globalThis.Number(object.cpuUsagePercent) : 0, + memoryUsagePercent: isSet4(object.memoryUsagePercent) ? globalThis.Number(object.memoryUsagePercent) : 0, + concurrentRequests: isSet4(object.concurrentRequests) ? globalThis.Number(object.concurrentRequests) : 0, + timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cpuUsagePercent !== 0) { + obj.cpuUsagePercent = message.cpuUsagePercent; + } + if (message.memoryUsagePercent !== 0) { + obj.memoryUsagePercent = message.memoryUsagePercent; + } + if (message.concurrentRequests !== 0) { + obj.concurrentRequests = Math.round(message.concurrentRequests); + } + if (message.timestamp !== 0) { + obj.timestamp = message.timestamp; + } + return obj; + }, + create(base) { + return AutoscalingMetrics.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAutoscalingMetrics(); + message.cpuUsagePercent = object.cpuUsagePercent ?? 0; + message.memoryUsagePercent = object.memoryUsagePercent ?? 0; + message.concurrentRequests = object.concurrentRequests ?? 0; + message.timestamp = object.timestamp ?? 0; + return message; + } +}; +function createBaseBaseImage() { + return { imageId: "", dockerTag: "" }; +} +var BaseImage = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.dockerTag !== "") { + writer.uint32(18).string(message.dockerTag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBaseImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dockerTag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + dockerTag: isSet4(object.dockerTag) ? globalThis.String(object.dockerTag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.dockerTag !== "") { + obj.dockerTag = message.dockerTag; + } + return obj; + }, + create(base) { + return BaseImage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBaseImage(); + message.imageId = object.imageId ?? ""; + message.dockerTag = object.dockerTag ?? ""; + return message; + } +}; +function createBaseBlobCreateRequest() { + return { contentMd5: "", contentSha256Base64: "", contentLength: 0 }; +} +var BlobCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.contentMd5 !== "") { + writer.uint32(10).string(message.contentMd5); + } + if (message.contentSha256Base64 !== "") { + writer.uint32(18).string(message.contentSha256Base64); + } + if (message.contentLength !== 0) { + writer.uint32(24).int64(message.contentLength); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentMd5 = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contentSha256Base64 = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.contentLength = longToNumber2(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentMd5: isSet4(object.contentMd5) ? globalThis.String(object.contentMd5) : "", + contentSha256Base64: isSet4(object.contentSha256Base64) ? globalThis.String(object.contentSha256Base64) : "", + contentLength: isSet4(object.contentLength) ? globalThis.Number(object.contentLength) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentMd5 !== "") { + obj.contentMd5 = message.contentMd5; + } + if (message.contentSha256Base64 !== "") { + obj.contentSha256Base64 = message.contentSha256Base64; + } + if (message.contentLength !== 0) { + obj.contentLength = Math.round(message.contentLength); + } + return obj; + }, + create(base) { + return BlobCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobCreateRequest(); + message.contentMd5 = object.contentMd5 ?? ""; + message.contentSha256Base64 = object.contentSha256Base64 ?? ""; + message.contentLength = object.contentLength ?? 0; + return message; + } +}; +function createBaseBlobCreateResponse() { + return { + blobId: "", + uploadUrl: void 0, + multipart: void 0, + blobIds: [], + uploadUrls: void 0, + multiparts: void 0 + }; +} +var BlobCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.blobId !== "") { + writer.uint32(18).string(message.blobId); + } + if (message.uploadUrl !== void 0) { + writer.uint32(10).string(message.uploadUrl); + } + if (message.multipart !== void 0) { + MultiPartUpload.encode(message.multipart, writer.uint32(26).fork()).join(); + } + for (const v of message.blobIds) { + writer.uint32(34).string(v); + } + if (message.uploadUrls !== void 0) { + UploadUrlList.encode(message.uploadUrls, writer.uint32(42).fork()).join(); + } + if (message.multiparts !== void 0) { + MultiPartUploadList.encode(message.multiparts, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.blobId = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + message.uploadUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.multipart = MultiPartUpload.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.blobIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uploadUrls = UploadUrlList.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.multiparts = MultiPartUploadList.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blobId: isSet4(object.blobId) ? globalThis.String(object.blobId) : "", + uploadUrl: isSet4(object.uploadUrl) ? globalThis.String(object.uploadUrl) : void 0, + multipart: isSet4(object.multipart) ? MultiPartUpload.fromJSON(object.multipart) : void 0, + blobIds: globalThis.Array.isArray(object?.blobIds) ? object.blobIds.map((e) => globalThis.String(e)) : [], + uploadUrls: isSet4(object.uploadUrls) ? UploadUrlList.fromJSON(object.uploadUrls) : void 0, + multiparts: isSet4(object.multiparts) ? MultiPartUploadList.fromJSON(object.multiparts) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.blobId !== "") { + obj.blobId = message.blobId; + } + if (message.uploadUrl !== void 0) { + obj.uploadUrl = message.uploadUrl; + } + if (message.multipart !== void 0) { + obj.multipart = MultiPartUpload.toJSON(message.multipart); + } + if (message.blobIds?.length) { + obj.blobIds = message.blobIds; + } + if (message.uploadUrls !== void 0) { + obj.uploadUrls = UploadUrlList.toJSON(message.uploadUrls); + } + if (message.multiparts !== void 0) { + obj.multiparts = MultiPartUploadList.toJSON(message.multiparts); + } + return obj; + }, + create(base) { + return BlobCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobCreateResponse(); + message.blobId = object.blobId ?? ""; + message.uploadUrl = object.uploadUrl ?? void 0; + message.multipart = object.multipart !== void 0 && object.multipart !== null ? MultiPartUpload.fromPartial(object.multipart) : void 0; + message.blobIds = object.blobIds?.map((e) => e) || []; + message.uploadUrls = object.uploadUrls !== void 0 && object.uploadUrls !== null ? UploadUrlList.fromPartial(object.uploadUrls) : void 0; + message.multiparts = object.multiparts !== void 0 && object.multiparts !== null ? MultiPartUploadList.fromPartial(object.multiparts) : void 0; + return message; + } +}; +function createBaseBlobGetRequest() { + return { blobId: "" }; +} +var BlobGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.blobId !== "") { + writer.uint32(10).string(message.blobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.blobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { blobId: isSet4(object.blobId) ? globalThis.String(object.blobId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.blobId !== "") { + obj.blobId = message.blobId; + } + return obj; + }, + create(base) { + return BlobGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobGetRequest(); + message.blobId = object.blobId ?? ""; + return message; + } +}; +function createBaseBlobGetResponse() { + return { downloadUrl: "" }; +} +var BlobGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.downloadUrl !== "") { + writer.uint32(10).string(message.downloadUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.downloadUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { downloadUrl: isSet4(object.downloadUrl) ? globalThis.String(object.downloadUrl) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.downloadUrl !== "") { + obj.downloadUrl = message.downloadUrl; + } + return obj; + }, + create(base) { + return BlobGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobGetResponse(); + message.downloadUrl = object.downloadUrl ?? ""; + return message; + } +}; +function createBaseBuildFunction() { + return { definition: "", globals: new Uint8Array(0), input: void 0 }; +} +var BuildFunction = { + encode(message, writer = new BinaryWriter()) { + if (message.definition !== "") { + writer.uint32(10).string(message.definition); + } + if (message.globals.length !== 0) { + writer.uint32(18).bytes(message.globals); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBuildFunction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.definition = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.globals = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + definition: isSet4(object.definition) ? globalThis.String(object.definition) : "", + globals: isSet4(object.globals) ? bytesFromBase64(object.globals) : new Uint8Array(0), + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.definition !== "") { + obj.definition = message.definition; + } + if (message.globals.length !== 0) { + obj.globals = base64FromBytes(message.globals); + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + return obj; + }, + create(base) { + return BuildFunction.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBuildFunction(); + message.definition = object.definition ?? ""; + message.globals = object.globals ?? new Uint8Array(0); + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseCancelInputEvent() { + return { inputIds: [], terminateContainers: false }; +} +var CancelInputEvent = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputIds) { + writer.uint32(10).string(v); + } + if (message.terminateContainers !== false) { + writer.uint32(16).bool(message.terminateContainers); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCancelInputEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputIds.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.terminateContainers = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputIds: globalThis.Array.isArray(object?.inputIds) ? object.inputIds.map((e) => globalThis.String(e)) : [], + terminateContainers: isSet4(object.terminateContainers) ? globalThis.Boolean(object.terminateContainers) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputIds?.length) { + obj.inputIds = message.inputIds; + } + if (message.terminateContainers !== false) { + obj.terminateContainers = message.terminateContainers; + } + return obj; + }, + create(base) { + return CancelInputEvent.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCancelInputEvent(); + message.inputIds = object.inputIds?.map((e) => e) || []; + message.terminateContainers = object.terminateContainers ?? false; + return message; + } +}; +function createBaseCheckpointInfo() { + return { + checksum: "", + status: 0, + checkpointId: "", + runtimeFingerprint: "", + size: 0, + checksumIsFileIndex: false, + originalTaskId: "", + runscRuntimeVersion: "" + }; +} +var CheckpointInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.checksum !== "") { + writer.uint32(10).string(message.checksum); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.checkpointId !== "") { + writer.uint32(26).string(message.checkpointId); + } + if (message.runtimeFingerprint !== "") { + writer.uint32(34).string(message.runtimeFingerprint); + } + if (message.size !== 0) { + writer.uint32(40).int64(message.size); + } + if (message.checksumIsFileIndex !== false) { + writer.uint32(48).bool(message.checksumIsFileIndex); + } + if (message.originalTaskId !== "") { + writer.uint32(58).string(message.originalTaskId); + } + if (message.runscRuntimeVersion !== "") { + writer.uint32(74).string(message.runscRuntimeVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCheckpointInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.checksum = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.checkpointId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.runtimeFingerprint = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.size = longToNumber2(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.checksumIsFileIndex = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.originalTaskId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.runscRuntimeVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + checksum: isSet4(object.checksum) ? globalThis.String(object.checksum) : "", + status: isSet4(object.status) ? checkpointStatusFromJSON(object.status) : 0, + checkpointId: isSet4(object.checkpointId) ? globalThis.String(object.checkpointId) : "", + runtimeFingerprint: isSet4(object.runtimeFingerprint) ? globalThis.String(object.runtimeFingerprint) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + checksumIsFileIndex: isSet4(object.checksumIsFileIndex) ? globalThis.Boolean(object.checksumIsFileIndex) : false, + originalTaskId: isSet4(object.originalTaskId) ? globalThis.String(object.originalTaskId) : "", + runscRuntimeVersion: isSet4(object.runscRuntimeVersion) ? globalThis.String(object.runscRuntimeVersion) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.checksum !== "") { + obj.checksum = message.checksum; + } + if (message.status !== 0) { + obj.status = checkpointStatusToJSON(message.status); + } + if (message.checkpointId !== "") { + obj.checkpointId = message.checkpointId; + } + if (message.runtimeFingerprint !== "") { + obj.runtimeFingerprint = message.runtimeFingerprint; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.checksumIsFileIndex !== false) { + obj.checksumIsFileIndex = message.checksumIsFileIndex; + } + if (message.originalTaskId !== "") { + obj.originalTaskId = message.originalTaskId; + } + if (message.runscRuntimeVersion !== "") { + obj.runscRuntimeVersion = message.runscRuntimeVersion; + } + return obj; + }, + create(base) { + return CheckpointInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCheckpointInfo(); + message.checksum = object.checksum ?? ""; + message.status = object.status ?? 0; + message.checkpointId = object.checkpointId ?? ""; + message.runtimeFingerprint = object.runtimeFingerprint ?? ""; + message.size = object.size ?? 0; + message.checksumIsFileIndex = object.checksumIsFileIndex ?? false; + message.originalTaskId = object.originalTaskId ?? ""; + message.runscRuntimeVersion = object.runscRuntimeVersion ?? ""; + return message; + } +}; +function createBaseClassCreateRequest() { + return { appId: "", existingClassId: "", methods: [], onlyClassFunction: false }; +} +var ClassCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.existingClassId !== "") { + writer.uint32(18).string(message.existingClassId); + } + for (const v of message.methods) { + ClassMethod.encode(v, writer.uint32(26).fork()).join(); + } + if (message.onlyClassFunction !== false) { + writer.uint32(40).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.existingClassId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.methods.push(ClassMethod.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + existingClassId: isSet4(object.existingClassId) ? globalThis.String(object.existingClassId) : "", + methods: globalThis.Array.isArray(object?.methods) ? object.methods.map((e) => ClassMethod.fromJSON(e)) : [], + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.existingClassId !== "") { + obj.existingClassId = message.existingClassId; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => ClassMethod.toJSON(e)); + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return ClassCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassCreateRequest(); + message.appId = object.appId ?? ""; + message.existingClassId = object.existingClassId ?? ""; + message.methods = object.methods?.map((e) => ClassMethod.fromPartial(e)) || []; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseClassCreateResponse() { + return { classId: "", handleMetadata: void 0 }; +} +var ClassCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.handleMetadata !== void 0) { + ClassHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet4(object.classId) ? globalThis.String(object.classId) : "", + handleMetadata: isSet4(object.handleMetadata) ? ClassHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = ClassHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return ClassCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassCreateResponse(); + message.classId = object.classId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? ClassHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseClassGetRequest() { + return { appName: "", objectTag: "", environmentName: "", onlyClassFunction: false }; +} +var ClassGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.objectTag !== "") { + writer.uint32(18).string(message.objectTag); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.onlyClassFunction !== false) { + writer.uint32(80).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.objectTag = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + objectTag: isSet4(object.objectTag) ? globalThis.String(object.objectTag) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.objectTag !== "") { + obj.objectTag = message.objectTag; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return ClassGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassGetRequest(); + message.appName = object.appName ?? ""; + message.objectTag = object.objectTag ?? ""; + message.environmentName = object.environmentName ?? ""; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseClassGetResponse() { + return { classId: "", handleMetadata: void 0, serverWarnings: [] }; +} +var ClassGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.handleMetadata !== void 0) { + ClassHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet4(object.classId) ? globalThis.String(object.classId) : "", + handleMetadata: isSet4(object.handleMetadata) ? ClassHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = ClassHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassGetResponse(); + message.classId = object.classId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? ClassHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassHandleMetadata() { + return { methods: [], classFunctionId: "", classFunctionMetadata: void 0 }; +} +var ClassHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.methods) { + ClassMethod.encode(v, writer.uint32(10).fork()).join(); + } + if (message.classFunctionId !== "") { + writer.uint32(18).string(message.classFunctionId); + } + if (message.classFunctionMetadata !== void 0) { + FunctionHandleMetadata.encode(message.classFunctionMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.methods.push(ClassMethod.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classFunctionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.classFunctionMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + methods: globalThis.Array.isArray(object?.methods) ? object.methods.map((e) => ClassMethod.fromJSON(e)) : [], + classFunctionId: isSet4(object.classFunctionId) ? globalThis.String(object.classFunctionId) : "", + classFunctionMetadata: isSet4(object.classFunctionMetadata) ? FunctionHandleMetadata.fromJSON(object.classFunctionMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.methods?.length) { + obj.methods = message.methods.map((e) => ClassMethod.toJSON(e)); + } + if (message.classFunctionId !== "") { + obj.classFunctionId = message.classFunctionId; + } + if (message.classFunctionMetadata !== void 0) { + obj.classFunctionMetadata = FunctionHandleMetadata.toJSON(message.classFunctionMetadata); + } + return obj; + }, + create(base) { + return ClassHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassHandleMetadata(); + message.methods = object.methods?.map((e) => ClassMethod.fromPartial(e)) || []; + message.classFunctionId = object.classFunctionId ?? ""; + message.classFunctionMetadata = object.classFunctionMetadata !== void 0 && object.classFunctionMetadata !== null ? FunctionHandleMetadata.fromPartial(object.classFunctionMetadata) : void 0; + return message; + } +}; +function createBaseClassMethod() { + return { functionName: "", functionId: "", functionHandleMetadata: void 0 }; +} +var ClassMethod = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(10).string(message.functionName); + } + if (message.functionId !== "") { + writer.uint32(18).string(message.functionId); + } + if (message.functionHandleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.functionHandleMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassMethod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionHandleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionHandleMetadata: isSet4(object.functionHandleMetadata) ? FunctionHandleMetadata.fromJSON(object.functionHandleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionHandleMetadata !== void 0) { + obj.functionHandleMetadata = FunctionHandleMetadata.toJSON(message.functionHandleMetadata); + } + return obj; + }, + create(base) { + return ClassMethod.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassMethod(); + message.functionName = object.functionName ?? ""; + message.functionId = object.functionId ?? ""; + message.functionHandleMetadata = object.functionHandleMetadata !== void 0 && object.functionHandleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.functionHandleMetadata) : void 0; + return message; + } +}; +function createBaseClassParameterInfo() { + return { format: 0, schema: [] }; +} +var ClassParameterInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.format !== 0) { + writer.uint32(8).int32(message.format); + } + for (const v of message.schema) { + ClassParameterSpec.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.format = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.schema.push(ClassParameterSpec.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + format: isSet4(object.format) ? classParameterInfo_ParameterSerializationFormatFromJSON(object.format) : 0, + schema: globalThis.Array.isArray(object?.schema) ? object.schema.map((e) => ClassParameterSpec.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.format !== 0) { + obj.format = classParameterInfo_ParameterSerializationFormatToJSON(message.format); + } + if (message.schema?.length) { + obj.schema = message.schema.map((e) => ClassParameterSpec.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassParameterInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterInfo(); + message.format = object.format ?? 0; + message.schema = object.schema?.map((e) => ClassParameterSpec.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassParameterSet() { + return { parameters: [] }; +} +var ClassParameterSet = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.parameters) { + ClassParameterValue.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.parameters.push(ClassParameterValue.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + parameters: globalThis.Array.isArray(object?.parameters) ? object.parameters.map((e) => ClassParameterValue.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.parameters?.length) { + obj.parameters = message.parameters.map((e) => ClassParameterValue.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassParameterSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterSet(); + message.parameters = object.parameters?.map((e) => ClassParameterValue.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassParameterSpec() { + return { + name: "", + type: 0, + hasDefault: false, + stringDefault: void 0, + intDefault: void 0, + pickleDefault: void 0, + bytesDefault: void 0, + boolDefault: void 0, + fullType: void 0 + }; +} +var ClassParameterSpec = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.hasDefault !== false) { + writer.uint32(24).bool(message.hasDefault); + } + if (message.stringDefault !== void 0) { + writer.uint32(34).string(message.stringDefault); + } + if (message.intDefault !== void 0) { + writer.uint32(40).int64(message.intDefault); + } + if (message.pickleDefault !== void 0) { + writer.uint32(50).bytes(message.pickleDefault); + } + if (message.bytesDefault !== void 0) { + writer.uint32(58).bytes(message.bytesDefault); + } + if (message.boolDefault !== void 0) { + writer.uint32(72).bool(message.boolDefault); + } + if (message.fullType !== void 0) { + GenericPayloadType.encode(message.fullType, writer.uint32(66).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.hasDefault = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.stringDefault = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.intDefault = longToNumber2(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.pickleDefault = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.bytesDefault = reader.bytes(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.boolDefault = reader.bool(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.fullType = GenericPayloadType.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + type: isSet4(object.type) ? parameterTypeFromJSON(object.type) : 0, + hasDefault: isSet4(object.hasDefault) ? globalThis.Boolean(object.hasDefault) : false, + stringDefault: isSet4(object.stringDefault) ? globalThis.String(object.stringDefault) : void 0, + intDefault: isSet4(object.intDefault) ? globalThis.Number(object.intDefault) : void 0, + pickleDefault: isSet4(object.pickleDefault) ? bytesFromBase64(object.pickleDefault) : void 0, + bytesDefault: isSet4(object.bytesDefault) ? bytesFromBase64(object.bytesDefault) : void 0, + boolDefault: isSet4(object.boolDefault) ? globalThis.Boolean(object.boolDefault) : void 0, + fullType: isSet4(object.fullType) ? GenericPayloadType.fromJSON(object.fullType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== 0) { + obj.type = parameterTypeToJSON(message.type); + } + if (message.hasDefault !== false) { + obj.hasDefault = message.hasDefault; + } + if (message.stringDefault !== void 0) { + obj.stringDefault = message.stringDefault; + } + if (message.intDefault !== void 0) { + obj.intDefault = Math.round(message.intDefault); + } + if (message.pickleDefault !== void 0) { + obj.pickleDefault = base64FromBytes(message.pickleDefault); + } + if (message.bytesDefault !== void 0) { + obj.bytesDefault = base64FromBytes(message.bytesDefault); + } + if (message.boolDefault !== void 0) { + obj.boolDefault = message.boolDefault; + } + if (message.fullType !== void 0) { + obj.fullType = GenericPayloadType.toJSON(message.fullType); + } + return obj; + }, + create(base) { + return ClassParameterSpec.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterSpec(); + message.name = object.name ?? ""; + message.type = object.type ?? 0; + message.hasDefault = object.hasDefault ?? false; + message.stringDefault = object.stringDefault ?? void 0; + message.intDefault = object.intDefault ?? void 0; + message.pickleDefault = object.pickleDefault ?? void 0; + message.bytesDefault = object.bytesDefault ?? void 0; + message.boolDefault = object.boolDefault ?? void 0; + message.fullType = object.fullType !== void 0 && object.fullType !== null ? GenericPayloadType.fromPartial(object.fullType) : void 0; + return message; + } +}; +function createBaseClassParameterValue() { + return { + name: "", + type: 0, + stringValue: void 0, + intValue: void 0, + pickleValue: void 0, + bytesValue: void 0, + boolValue: void 0 + }; +} +var ClassParameterValue = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.stringValue !== void 0) { + writer.uint32(26).string(message.stringValue); + } + if (message.intValue !== void 0) { + writer.uint32(32).int64(message.intValue); + } + if (message.pickleValue !== void 0) { + writer.uint32(42).bytes(message.pickleValue); + } + if (message.bytesValue !== void 0) { + writer.uint32(50).bytes(message.bytesValue); + } + if (message.boolValue !== void 0) { + writer.uint32(56).bool(message.boolValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stringValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.intValue = longToNumber2(reader.int64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pickleValue = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.bytesValue = reader.bytes(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.boolValue = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + type: isSet4(object.type) ? parameterTypeFromJSON(object.type) : 0, + stringValue: isSet4(object.stringValue) ? globalThis.String(object.stringValue) : void 0, + intValue: isSet4(object.intValue) ? globalThis.Number(object.intValue) : void 0, + pickleValue: isSet4(object.pickleValue) ? bytesFromBase64(object.pickleValue) : void 0, + bytesValue: isSet4(object.bytesValue) ? bytesFromBase64(object.bytesValue) : void 0, + boolValue: isSet4(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== 0) { + obj.type = parameterTypeToJSON(message.type); + } + if (message.stringValue !== void 0) { + obj.stringValue = message.stringValue; + } + if (message.intValue !== void 0) { + obj.intValue = Math.round(message.intValue); + } + if (message.pickleValue !== void 0) { + obj.pickleValue = base64FromBytes(message.pickleValue); + } + if (message.bytesValue !== void 0) { + obj.bytesValue = base64FromBytes(message.bytesValue); + } + if (message.boolValue !== void 0) { + obj.boolValue = message.boolValue; + } + return obj; + }, + create(base) { + return ClassParameterValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterValue(); + message.name = object.name ?? ""; + message.type = object.type ?? 0; + message.stringValue = object.stringValue ?? void 0; + message.intValue = object.intValue ?? void 0; + message.pickleValue = object.pickleValue ?? void 0; + message.bytesValue = object.bytesValue ?? void 0; + message.boolValue = object.boolValue ?? void 0; + return message; + } +}; +function createBaseClientHelloResponse() { + return { warning: "", imageBuilderVersion: "", serverWarnings: [] }; +} +var ClientHelloResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.warning !== "") { + writer.uint32(10).string(message.warning); + } + if (message.imageBuilderVersion !== "") { + writer.uint32(18).string(message.imageBuilderVersion); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClientHelloResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.warning = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + warning: isSet4(object.warning) ? globalThis.String(object.warning) : "", + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : "", + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.warning !== "") { + obj.warning = message.warning; + } + if (message.imageBuilderVersion !== "") { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return ClientHelloResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClientHelloResponse(); + message.warning = object.warning ?? ""; + message.imageBuilderVersion = object.imageBuilderVersion ?? ""; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseCloudBucketMount() { + return { + bucketName: "", + mountPath: "", + credentialsSecretId: "", + readOnly: false, + bucketType: 0, + requesterPays: false, + bucketEndpointUrl: void 0, + keyPrefix: void 0, + oidcAuthRoleArn: void 0 + }; +} +var CloudBucketMount = { + encode(message, writer = new BinaryWriter()) { + if (message.bucketName !== "") { + writer.uint32(10).string(message.bucketName); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.credentialsSecretId !== "") { + writer.uint32(26).string(message.credentialsSecretId); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + if (message.bucketType !== 0) { + writer.uint32(40).int32(message.bucketType); + } + if (message.requesterPays !== false) { + writer.uint32(48).bool(message.requesterPays); + } + if (message.bucketEndpointUrl !== void 0) { + writer.uint32(58).string(message.bucketEndpointUrl); + } + if (message.keyPrefix !== void 0) { + writer.uint32(66).string(message.keyPrefix); + } + if (message.oidcAuthRoleArn !== void 0) { + writer.uint32(74).string(message.oidcAuthRoleArn); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCloudBucketMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.bucketName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.credentialsSecretId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.bucketType = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.requesterPays = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.bucketEndpointUrl = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.keyPrefix = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.oidcAuthRoleArn = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + bucketName: isSet4(object.bucketName) ? globalThis.String(object.bucketName) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + credentialsSecretId: isSet4(object.credentialsSecretId) ? globalThis.String(object.credentialsSecretId) : "", + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + bucketType: isSet4(object.bucketType) ? cloudBucketMount_BucketTypeFromJSON(object.bucketType) : 0, + requesterPays: isSet4(object.requesterPays) ? globalThis.Boolean(object.requesterPays) : false, + bucketEndpointUrl: isSet4(object.bucketEndpointUrl) ? globalThis.String(object.bucketEndpointUrl) : void 0, + keyPrefix: isSet4(object.keyPrefix) ? globalThis.String(object.keyPrefix) : void 0, + oidcAuthRoleArn: isSet4(object.oidcAuthRoleArn) ? globalThis.String(object.oidcAuthRoleArn) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.bucketName !== "") { + obj.bucketName = message.bucketName; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.credentialsSecretId !== "") { + obj.credentialsSecretId = message.credentialsSecretId; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.bucketType !== 0) { + obj.bucketType = cloudBucketMount_BucketTypeToJSON(message.bucketType); + } + if (message.requesterPays !== false) { + obj.requesterPays = message.requesterPays; + } + if (message.bucketEndpointUrl !== void 0) { + obj.bucketEndpointUrl = message.bucketEndpointUrl; + } + if (message.keyPrefix !== void 0) { + obj.keyPrefix = message.keyPrefix; + } + if (message.oidcAuthRoleArn !== void 0) { + obj.oidcAuthRoleArn = message.oidcAuthRoleArn; + } + return obj; + }, + create(base) { + return CloudBucketMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCloudBucketMount(); + message.bucketName = object.bucketName ?? ""; + message.mountPath = object.mountPath ?? ""; + message.credentialsSecretId = object.credentialsSecretId ?? ""; + message.readOnly = object.readOnly ?? false; + message.bucketType = object.bucketType ?? 0; + message.requesterPays = object.requesterPays ?? false; + message.bucketEndpointUrl = object.bucketEndpointUrl ?? void 0; + message.keyPrefix = object.keyPrefix ?? void 0; + message.oidcAuthRoleArn = object.oidcAuthRoleArn ?? void 0; + return message; + } +}; +function createBaseClusterGetRequest() { + return { clusterId: "" }; +} +var ClusterGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.clusterId !== "") { + writer.uint32(10).string(message.clusterId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusterId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + return obj; + }, + create(base) { + return ClusterGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterGetRequest(); + message.clusterId = object.clusterId ?? ""; + return message; + } +}; +function createBaseClusterGetResponse() { + return { cluster: void 0 }; +} +var ClusterGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cluster !== void 0) { + ClusterStats.encode(message.cluster, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cluster = ClusterStats.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { cluster: isSet4(object.cluster) ? ClusterStats.fromJSON(object.cluster) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.cluster !== void 0) { + obj.cluster = ClusterStats.toJSON(message.cluster); + } + return obj; + }, + create(base) { + return ClusterGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterGetResponse(); + message.cluster = object.cluster !== void 0 && object.cluster !== null ? ClusterStats.fromPartial(object.cluster) : void 0; + return message; + } +}; +function createBaseClusterListRequest() { + return { environmentName: "" }; +} +var ClusterListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ClusterListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseClusterListResponse() { + return { clusters: [] }; +} +var ClusterListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.clusters) { + ClusterStats.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusters.push(ClusterStats.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clusters: globalThis.Array.isArray(object?.clusters) ? object.clusters.map((e) => ClusterStats.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.clusters?.length) { + obj.clusters = message.clusters.map((e) => ClusterStats.toJSON(e)); + } + return obj; + }, + create(base) { + return ClusterListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterListResponse(); + message.clusters = object.clusters?.map((e) => ClusterStats.fromPartial(e)) || []; + return message; + } +}; +function createBaseClusterStats() { + return { appId: "", taskIds: [], clusterId: "", startedAt: 0 }; +} +var ClusterStats = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + for (const v of message.taskIds) { + writer.uint32(18).string(v); + } + if (message.clusterId !== "") { + writer.uint32(26).string(message.clusterId); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clusterId = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + taskIds: globalThis.Array.isArray(object?.taskIds) ? object.taskIds.map((e) => globalThis.String(e)) : [], + clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.taskIds?.length) { + obj.taskIds = message.taskIds; + } + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + return obj; + }, + create(base) { + return ClusterStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterStats(); + message.appId = object.appId ?? ""; + message.taskIds = object.taskIds?.map((e) => e) || []; + message.clusterId = object.clusterId ?? ""; + message.startedAt = object.startedAt ?? 0; + return message; + } +}; +function createBaseCommitInfo() { + return { + vcs: "", + branch: "", + commitHash: "", + commitTimestamp: 0, + dirty: false, + authorName: "", + authorEmail: "", + repoUrl: "" + }; +} +var CommitInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.vcs !== "") { + writer.uint32(10).string(message.vcs); + } + if (message.branch !== "") { + writer.uint32(18).string(message.branch); + } + if (message.commitHash !== "") { + writer.uint32(26).string(message.commitHash); + } + if (message.commitTimestamp !== 0) { + writer.uint32(32).int64(message.commitTimestamp); + } + if (message.dirty !== false) { + writer.uint32(40).bool(message.dirty); + } + if (message.authorName !== "") { + writer.uint32(50).string(message.authorName); + } + if (message.authorEmail !== "") { + writer.uint32(58).string(message.authorEmail); + } + if (message.repoUrl !== "") { + writer.uint32(66).string(message.repoUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.vcs = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.branch = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.commitHash = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.commitTimestamp = longToNumber2(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.dirty = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.authorName = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.authorEmail = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.repoUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + vcs: isSet4(object.vcs) ? globalThis.String(object.vcs) : "", + branch: isSet4(object.branch) ? globalThis.String(object.branch) : "", + commitHash: isSet4(object.commitHash) ? globalThis.String(object.commitHash) : "", + commitTimestamp: isSet4(object.commitTimestamp) ? globalThis.Number(object.commitTimestamp) : 0, + dirty: isSet4(object.dirty) ? globalThis.Boolean(object.dirty) : false, + authorName: isSet4(object.authorName) ? globalThis.String(object.authorName) : "", + authorEmail: isSet4(object.authorEmail) ? globalThis.String(object.authorEmail) : "", + repoUrl: isSet4(object.repoUrl) ? globalThis.String(object.repoUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.vcs !== "") { + obj.vcs = message.vcs; + } + if (message.branch !== "") { + obj.branch = message.branch; + } + if (message.commitHash !== "") { + obj.commitHash = message.commitHash; + } + if (message.commitTimestamp !== 0) { + obj.commitTimestamp = Math.round(message.commitTimestamp); + } + if (message.dirty !== false) { + obj.dirty = message.dirty; + } + if (message.authorName !== "") { + obj.authorName = message.authorName; + } + if (message.authorEmail !== "") { + obj.authorEmail = message.authorEmail; + } + if (message.repoUrl !== "") { + obj.repoUrl = message.repoUrl; + } + return obj; + }, + create(base) { + return CommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitInfo(); + message.vcs = object.vcs ?? ""; + message.branch = object.branch ?? ""; + message.commitHash = object.commitHash ?? ""; + message.commitTimestamp = object.commitTimestamp ?? 0; + message.dirty = object.dirty ?? false; + message.authorName = object.authorName ?? ""; + message.authorEmail = object.authorEmail ?? ""; + message.repoUrl = object.repoUrl ?? ""; + return message; + } +}; +function createBaseContainerCheckpointRequest() { + return { checkpointId: "" }; +} +var ContainerCheckpointRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.checkpointId !== "") { + writer.uint32(10).string(message.checkpointId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerCheckpointRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.checkpointId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { checkpointId: isSet4(object.checkpointId) ? globalThis.String(object.checkpointId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.checkpointId !== "") { + obj.checkpointId = message.checkpointId; + } + return obj; + }, + create(base) { + return ContainerCheckpointRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerCheckpointRequest(); + message.checkpointId = object.checkpointId ?? ""; + return message; + } +}; +function createBaseContainerExecGetOutputRequest() { + return { execId: "", timeout: 0, lastBatchIndex: 0, fileDescriptor: 0, getRawBytes: false }; +} +var ContainerExecGetOutputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastBatchIndex !== 0) { + writer.uint32(24).uint64(message.lastBatchIndex); + } + if (message.fileDescriptor !== 0) { + writer.uint32(32).int32(message.fileDescriptor); + } + if (message.getRawBytes !== false) { + writer.uint32(40).bool(message.getRawBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecGetOutputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.lastBatchIndex = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.getRawBytes = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastBatchIndex: isSet4(object.lastBatchIndex) ? globalThis.Number(object.lastBatchIndex) : 0, + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + getRawBytes: isSet4(object.getRawBytes) ? globalThis.Boolean(object.getRawBytes) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastBatchIndex !== 0) { + obj.lastBatchIndex = Math.round(message.lastBatchIndex); + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.getRawBytes !== false) { + obj.getRawBytes = message.getRawBytes; + } + return obj; + }, + create(base) { + return ContainerExecGetOutputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecGetOutputRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastBatchIndex = object.lastBatchIndex ?? 0; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.getRawBytes = object.getRawBytes ?? false; + return message; + } +}; +function createBaseContainerExecPutInputRequest() { + return { execId: "", input: void 0 }; +} +var ContainerExecPutInputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.input !== void 0) { + RuntimeInputMessage.encode(message.input, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecPutInputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = RuntimeInputMessage.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + input: isSet4(object.input) ? RuntimeInputMessage.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.input !== void 0) { + obj.input = RuntimeInputMessage.toJSON(message.input); + } + return obj; + }, + create(base) { + return ContainerExecPutInputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecPutInputRequest(); + message.execId = object.execId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? RuntimeInputMessage.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseContainerExecRequest() { + return { + taskId: "", + command: [], + ptyInfo: void 0, + terminateContainerOnExit: false, + runtimeDebug: false, + stdoutOutput: 0, + stderrOutput: 0, + timeoutSecs: 0, + workdir: void 0, + secretIds: [] + }; +} +var ContainerExecRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + for (const v of message.command) { + writer.uint32(18).string(v); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(26).fork()).join(); + } + if (message.terminateContainerOnExit !== false) { + writer.uint32(32).bool(message.terminateContainerOnExit); + } + if (message.runtimeDebug !== false) { + writer.uint32(40).bool(message.runtimeDebug); + } + if (message.stdoutOutput !== 0) { + writer.uint32(48).int32(message.stdoutOutput); + } + if (message.stderrOutput !== 0) { + writer.uint32(56).int32(message.stderrOutput); + } + if (message.timeoutSecs !== 0) { + writer.uint32(64).uint32(message.timeoutSecs); + } + if (message.workdir !== void 0) { + writer.uint32(74).string(message.workdir); + } + for (const v of message.secretIds) { + writer.uint32(82).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.command.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.terminateContainerOnExit = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.stdoutOutput = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.stderrOutput = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.workdir = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + command: globalThis.Array.isArray(object?.command) ? object.command.map((e) => globalThis.String(e)) : [], + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + terminateContainerOnExit: isSet4(object.terminateContainerOnExit) ? globalThis.Boolean(object.terminateContainerOnExit) : false, + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + stdoutOutput: isSet4(object.stdoutOutput) ? execOutputOptionFromJSON(object.stdoutOutput) : 0, + stderrOutput: isSet4(object.stderrOutput) ? execOutputOptionFromJSON(object.stderrOutput) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.command?.length) { + obj.command = message.command; + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.terminateContainerOnExit !== false) { + obj.terminateContainerOnExit = message.terminateContainerOnExit; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.stdoutOutput !== 0) { + obj.stdoutOutput = execOutputOptionToJSON(message.stdoutOutput); + } + if (message.stderrOutput !== 0) { + obj.stderrOutput = execOutputOptionToJSON(message.stderrOutput); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + return obj; + }, + create(base) { + return ContainerExecRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecRequest(); + message.taskId = object.taskId ?? ""; + message.command = object.command?.map((e) => e) || []; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.terminateContainerOnExit = object.terminateContainerOnExit ?? false; + message.runtimeDebug = object.runtimeDebug ?? false; + message.stdoutOutput = object.stdoutOutput ?? 0; + message.stderrOutput = object.stderrOutput ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.workdir = object.workdir ?? void 0; + message.secretIds = object.secretIds?.map((e) => e) || []; + return message; + } +}; +function createBaseContainerExecResponse() { + return { execId: "" }; +} +var ContainerExecResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { execId: isSet4(object.execId) ? globalThis.String(object.execId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + return obj; + }, + create(base) { + return ContainerExecResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecResponse(); + message.execId = object.execId ?? ""; + return message; + } +}; +function createBaseContainerExecWaitRequest() { + return { execId: "", timeout: 0 }; +} +var ContainerExecWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return ContainerExecWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecWaitRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseContainerExecWaitResponse() { + return { exitCode: void 0, completed: false }; +} +var ContainerExecWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exitCode !== void 0) { + writer.uint32(8).int32(message.exitCode); + } + if (message.completed !== false) { + writer.uint32(16).bool(message.completed); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exitCode = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.completed = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + exitCode: isSet4(object.exitCode) ? globalThis.Number(object.exitCode) : void 0, + completed: isSet4(object.completed) ? globalThis.Boolean(object.completed) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.exitCode !== void 0) { + obj.exitCode = Math.round(message.exitCode); + } + if (message.completed !== false) { + obj.completed = message.completed; + } + return obj; + }, + create(base) { + return ContainerExecWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecWaitResponse(); + message.exitCode = object.exitCode ?? void 0; + message.completed = object.completed ?? false; + return message; + } +}; +function createBaseContainerFileCloseRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileCloseRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileCloseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileCloseRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileCloseRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileDeleteBytesRequest() { + return { fileDescriptor: "", startInclusive: void 0, endExclusive: void 0 }; +} +var ContainerFileDeleteBytesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.startInclusive !== void 0) { + writer.uint32(16).uint32(message.startInclusive); + } + if (message.endExclusive !== void 0) { + writer.uint32(24).uint32(message.endExclusive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileDeleteBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.startInclusive = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.endExclusive = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + startInclusive: isSet4(object.startInclusive) ? globalThis.Number(object.startInclusive) : void 0, + endExclusive: isSet4(object.endExclusive) ? globalThis.Number(object.endExclusive) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.startInclusive !== void 0) { + obj.startInclusive = Math.round(message.startInclusive); + } + if (message.endExclusive !== void 0) { + obj.endExclusive = Math.round(message.endExclusive); + } + return obj; + }, + create(base) { + return ContainerFileDeleteBytesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileDeleteBytesRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.startInclusive = object.startInclusive ?? void 0; + message.endExclusive = object.endExclusive ?? void 0; + return message; + } +}; +function createBaseContainerFileFlushRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileFlushRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileFlushRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileFlushRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileFlushRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileLsRequest() { + return { path: "" }; +} +var ContainerFileLsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileLsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { path: isSet4(object.path) ? globalThis.String(object.path) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return ContainerFileLsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileLsRequest(); + message.path = object.path ?? ""; + return message; + } +}; +function createBaseContainerFileMkdirRequest() { + return { path: "", makeParents: false }; +} +var ContainerFileMkdirRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.makeParents !== false) { + writer.uint32(16).bool(message.makeParents); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileMkdirRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.makeParents = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + makeParents: isSet4(object.makeParents) ? globalThis.Boolean(object.makeParents) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.makeParents !== false) { + obj.makeParents = message.makeParents; + } + return obj; + }, + create(base) { + return ContainerFileMkdirRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileMkdirRequest(); + message.path = object.path ?? ""; + message.makeParents = object.makeParents ?? false; + return message; + } +}; +function createBaseContainerFileOpenRequest() { + return { fileDescriptor: void 0, path: "", mode: "" }; +} +var ContainerFileOpenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== void 0) { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.mode !== "") { + writer.uint32(26).string(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileOpenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.mode = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : void 0, + path: isSet4(object.path) ? globalThis.String(object.path) : "", + mode: isSet4(object.mode) ? globalThis.String(object.mode) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== void 0) { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.mode !== "") { + obj.mode = message.mode; + } + return obj; + }, + create(base) { + return ContainerFileOpenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileOpenRequest(); + message.fileDescriptor = object.fileDescriptor ?? void 0; + message.path = object.path ?? ""; + message.mode = object.mode ?? ""; + return message; + } +}; +function createBaseContainerFileReadLineRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileReadLineRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileReadLineRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileReadLineRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileReadLineRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileReadRequest() { + return { fileDescriptor: "", n: void 0 }; +} +var ContainerFileReadRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.n !== void 0) { + writer.uint32(16).uint32(message.n); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileReadRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.n = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + n: isSet4(object.n) ? globalThis.Number(object.n) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.n !== void 0) { + obj.n = Math.round(message.n); + } + return obj; + }, + create(base) { + return ContainerFileReadRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileReadRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.n = object.n ?? void 0; + return message; + } +}; +function createBaseContainerFileRmRequest() { + return { path: "", recursive: false }; +} +var ContainerFileRmRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(16).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileRmRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return ContainerFileRmRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileRmRequest(); + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseContainerFileSeekRequest() { + return { fileDescriptor: "", offset: 0, whence: 0 }; +} +var ContainerFileSeekRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.offset !== 0) { + writer.uint32(16).int32(message.offset); + } + if (message.whence !== 0) { + writer.uint32(24).int32(message.whence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileSeekRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.offset = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.whence = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + offset: isSet4(object.offset) ? globalThis.Number(object.offset) : 0, + whence: isSet4(object.whence) ? seekWhenceFromJSON(object.whence) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.whence !== 0) { + obj.whence = seekWhenceToJSON(message.whence); + } + return obj; + }, + create(base) { + return ContainerFileSeekRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileSeekRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.offset = object.offset ?? 0; + message.whence = object.whence ?? 0; + return message; + } +}; +function createBaseContainerFileWatchRequest() { + return { path: "", recursive: false, timeoutSecs: void 0 }; +} +var ContainerFileWatchRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(16).bool(message.recursive); + } + if (message.timeoutSecs !== void 0) { + writer.uint32(24).uint64(message.timeoutSecs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.timeoutSecs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.timeoutSecs !== void 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + return obj; + }, + create(base) { + return ContainerFileWatchRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWatchRequest(); + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.timeoutSecs = object.timeoutSecs ?? void 0; + return message; + } +}; +function createBaseContainerFileWriteReplaceBytesRequest() { + return { fileDescriptor: "", data: new Uint8Array(0), startInclusive: void 0, endExclusive: void 0 }; +} +var ContainerFileWriteReplaceBytesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.startInclusive !== void 0) { + writer.uint32(24).uint32(message.startInclusive); + } + if (message.endExclusive !== void 0) { + writer.uint32(32).uint32(message.endExclusive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWriteReplaceBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.startInclusive = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.endExclusive = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + startInclusive: isSet4(object.startInclusive) ? globalThis.Number(object.startInclusive) : void 0, + endExclusive: isSet4(object.endExclusive) ? globalThis.Number(object.endExclusive) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.startInclusive !== void 0) { + obj.startInclusive = Math.round(message.startInclusive); + } + if (message.endExclusive !== void 0) { + obj.endExclusive = Math.round(message.endExclusive); + } + return obj; + }, + create(base) { + return ContainerFileWriteReplaceBytesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWriteReplaceBytesRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.startInclusive = object.startInclusive ?? void 0; + message.endExclusive = object.endExclusive ?? void 0; + return message; + } +}; +function createBaseContainerFileWriteRequest() { + return { fileDescriptor: "", data: new Uint8Array(0) }; +} +var ContainerFileWriteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWriteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return ContainerFileWriteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWriteRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + } +}; +function createBaseContainerFilesystemExecGetOutputRequest() { + return { execId: "", timeout: 0 }; +} +var ContainerFilesystemExecGetOutputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecGetOutputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecGetOutputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecGetOutputRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseContainerFilesystemExecRequest() { + return { + fileOpenRequest: void 0, + fileWriteRequest: void 0, + fileReadRequest: void 0, + fileFlushRequest: void 0, + fileReadLineRequest: void 0, + fileSeekRequest: void 0, + fileDeleteBytesRequest: void 0, + fileWriteReplaceBytesRequest: void 0, + fileCloseRequest: void 0, + fileLsRequest: void 0, + fileMkdirRequest: void 0, + fileRmRequest: void 0, + fileWatchRequest: void 0, + taskId: "" + }; +} +var ContainerFilesystemExecRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileOpenRequest !== void 0) { + ContainerFileOpenRequest.encode(message.fileOpenRequest, writer.uint32(10).fork()).join(); + } + if (message.fileWriteRequest !== void 0) { + ContainerFileWriteRequest.encode(message.fileWriteRequest, writer.uint32(18).fork()).join(); + } + if (message.fileReadRequest !== void 0) { + ContainerFileReadRequest.encode(message.fileReadRequest, writer.uint32(26).fork()).join(); + } + if (message.fileFlushRequest !== void 0) { + ContainerFileFlushRequest.encode(message.fileFlushRequest, writer.uint32(34).fork()).join(); + } + if (message.fileReadLineRequest !== void 0) { + ContainerFileReadLineRequest.encode(message.fileReadLineRequest, writer.uint32(42).fork()).join(); + } + if (message.fileSeekRequest !== void 0) { + ContainerFileSeekRequest.encode(message.fileSeekRequest, writer.uint32(50).fork()).join(); + } + if (message.fileDeleteBytesRequest !== void 0) { + ContainerFileDeleteBytesRequest.encode(message.fileDeleteBytesRequest, writer.uint32(58).fork()).join(); + } + if (message.fileWriteReplaceBytesRequest !== void 0) { + ContainerFileWriteReplaceBytesRequest.encode(message.fileWriteReplaceBytesRequest, writer.uint32(66).fork()).join(); + } + if (message.fileCloseRequest !== void 0) { + ContainerFileCloseRequest.encode(message.fileCloseRequest, writer.uint32(74).fork()).join(); + } + if (message.fileLsRequest !== void 0) { + ContainerFileLsRequest.encode(message.fileLsRequest, writer.uint32(90).fork()).join(); + } + if (message.fileMkdirRequest !== void 0) { + ContainerFileMkdirRequest.encode(message.fileMkdirRequest, writer.uint32(98).fork()).join(); + } + if (message.fileRmRequest !== void 0) { + ContainerFileRmRequest.encode(message.fileRmRequest, writer.uint32(106).fork()).join(); + } + if (message.fileWatchRequest !== void 0) { + ContainerFileWatchRequest.encode(message.fileWatchRequest, writer.uint32(114).fork()).join(); + } + if (message.taskId !== "") { + writer.uint32(82).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileOpenRequest = ContainerFileOpenRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fileWriteRequest = ContainerFileWriteRequest.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.fileReadRequest = ContainerFileReadRequest.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.fileFlushRequest = ContainerFileFlushRequest.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.fileReadLineRequest = ContainerFileReadLineRequest.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.fileSeekRequest = ContainerFileSeekRequest.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.fileDeleteBytesRequest = ContainerFileDeleteBytesRequest.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.fileWriteReplaceBytesRequest = ContainerFileWriteReplaceBytesRequest.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.fileCloseRequest = ContainerFileCloseRequest.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.fileLsRequest = ContainerFileLsRequest.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.fileMkdirRequest = ContainerFileMkdirRequest.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.fileRmRequest = ContainerFileRmRequest.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.fileWatchRequest = ContainerFileWatchRequest.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileOpenRequest: isSet4(object.fileOpenRequest) ? ContainerFileOpenRequest.fromJSON(object.fileOpenRequest) : void 0, + fileWriteRequest: isSet4(object.fileWriteRequest) ? ContainerFileWriteRequest.fromJSON(object.fileWriteRequest) : void 0, + fileReadRequest: isSet4(object.fileReadRequest) ? ContainerFileReadRequest.fromJSON(object.fileReadRequest) : void 0, + fileFlushRequest: isSet4(object.fileFlushRequest) ? ContainerFileFlushRequest.fromJSON(object.fileFlushRequest) : void 0, + fileReadLineRequest: isSet4(object.fileReadLineRequest) ? ContainerFileReadLineRequest.fromJSON(object.fileReadLineRequest) : void 0, + fileSeekRequest: isSet4(object.fileSeekRequest) ? ContainerFileSeekRequest.fromJSON(object.fileSeekRequest) : void 0, + fileDeleteBytesRequest: isSet4(object.fileDeleteBytesRequest) ? ContainerFileDeleteBytesRequest.fromJSON(object.fileDeleteBytesRequest) : void 0, + fileWriteReplaceBytesRequest: isSet4(object.fileWriteReplaceBytesRequest) ? ContainerFileWriteReplaceBytesRequest.fromJSON(object.fileWriteReplaceBytesRequest) : void 0, + fileCloseRequest: isSet4(object.fileCloseRequest) ? ContainerFileCloseRequest.fromJSON(object.fileCloseRequest) : void 0, + fileLsRequest: isSet4(object.fileLsRequest) ? ContainerFileLsRequest.fromJSON(object.fileLsRequest) : void 0, + fileMkdirRequest: isSet4(object.fileMkdirRequest) ? ContainerFileMkdirRequest.fromJSON(object.fileMkdirRequest) : void 0, + fileRmRequest: isSet4(object.fileRmRequest) ? ContainerFileRmRequest.fromJSON(object.fileRmRequest) : void 0, + fileWatchRequest: isSet4(object.fileWatchRequest) ? ContainerFileWatchRequest.fromJSON(object.fileWatchRequest) : void 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileOpenRequest !== void 0) { + obj.fileOpenRequest = ContainerFileOpenRequest.toJSON(message.fileOpenRequest); + } + if (message.fileWriteRequest !== void 0) { + obj.fileWriteRequest = ContainerFileWriteRequest.toJSON(message.fileWriteRequest); + } + if (message.fileReadRequest !== void 0) { + obj.fileReadRequest = ContainerFileReadRequest.toJSON(message.fileReadRequest); + } + if (message.fileFlushRequest !== void 0) { + obj.fileFlushRequest = ContainerFileFlushRequest.toJSON(message.fileFlushRequest); + } + if (message.fileReadLineRequest !== void 0) { + obj.fileReadLineRequest = ContainerFileReadLineRequest.toJSON(message.fileReadLineRequest); + } + if (message.fileSeekRequest !== void 0) { + obj.fileSeekRequest = ContainerFileSeekRequest.toJSON(message.fileSeekRequest); + } + if (message.fileDeleteBytesRequest !== void 0) { + obj.fileDeleteBytesRequest = ContainerFileDeleteBytesRequest.toJSON(message.fileDeleteBytesRequest); + } + if (message.fileWriteReplaceBytesRequest !== void 0) { + obj.fileWriteReplaceBytesRequest = ContainerFileWriteReplaceBytesRequest.toJSON( + message.fileWriteReplaceBytesRequest + ); + } + if (message.fileCloseRequest !== void 0) { + obj.fileCloseRequest = ContainerFileCloseRequest.toJSON(message.fileCloseRequest); + } + if (message.fileLsRequest !== void 0) { + obj.fileLsRequest = ContainerFileLsRequest.toJSON(message.fileLsRequest); + } + if (message.fileMkdirRequest !== void 0) { + obj.fileMkdirRequest = ContainerFileMkdirRequest.toJSON(message.fileMkdirRequest); + } + if (message.fileRmRequest !== void 0) { + obj.fileRmRequest = ContainerFileRmRequest.toJSON(message.fileRmRequest); + } + if (message.fileWatchRequest !== void 0) { + obj.fileWatchRequest = ContainerFileWatchRequest.toJSON(message.fileWatchRequest); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecRequest(); + message.fileOpenRequest = object.fileOpenRequest !== void 0 && object.fileOpenRequest !== null ? ContainerFileOpenRequest.fromPartial(object.fileOpenRequest) : void 0; + message.fileWriteRequest = object.fileWriteRequest !== void 0 && object.fileWriteRequest !== null ? ContainerFileWriteRequest.fromPartial(object.fileWriteRequest) : void 0; + message.fileReadRequest = object.fileReadRequest !== void 0 && object.fileReadRequest !== null ? ContainerFileReadRequest.fromPartial(object.fileReadRequest) : void 0; + message.fileFlushRequest = object.fileFlushRequest !== void 0 && object.fileFlushRequest !== null ? ContainerFileFlushRequest.fromPartial(object.fileFlushRequest) : void 0; + message.fileReadLineRequest = object.fileReadLineRequest !== void 0 && object.fileReadLineRequest !== null ? ContainerFileReadLineRequest.fromPartial(object.fileReadLineRequest) : void 0; + message.fileSeekRequest = object.fileSeekRequest !== void 0 && object.fileSeekRequest !== null ? ContainerFileSeekRequest.fromPartial(object.fileSeekRequest) : void 0; + message.fileDeleteBytesRequest = object.fileDeleteBytesRequest !== void 0 && object.fileDeleteBytesRequest !== null ? ContainerFileDeleteBytesRequest.fromPartial(object.fileDeleteBytesRequest) : void 0; + message.fileWriteReplaceBytesRequest = object.fileWriteReplaceBytesRequest !== void 0 && object.fileWriteReplaceBytesRequest !== null ? ContainerFileWriteReplaceBytesRequest.fromPartial(object.fileWriteReplaceBytesRequest) : void 0; + message.fileCloseRequest = object.fileCloseRequest !== void 0 && object.fileCloseRequest !== null ? ContainerFileCloseRequest.fromPartial(object.fileCloseRequest) : void 0; + message.fileLsRequest = object.fileLsRequest !== void 0 && object.fileLsRequest !== null ? ContainerFileLsRequest.fromPartial(object.fileLsRequest) : void 0; + message.fileMkdirRequest = object.fileMkdirRequest !== void 0 && object.fileMkdirRequest !== null ? ContainerFileMkdirRequest.fromPartial(object.fileMkdirRequest) : void 0; + message.fileRmRequest = object.fileRmRequest !== void 0 && object.fileRmRequest !== null ? ContainerFileRmRequest.fromPartial(object.fileRmRequest) : void 0; + message.fileWatchRequest = object.fileWatchRequest !== void 0 && object.fileWatchRequest !== null ? ContainerFileWatchRequest.fromPartial(object.fileWatchRequest) : void 0; + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerFilesystemExecResponse() { + return { execId: "", fileDescriptor: void 0 }; +} +var ContainerFilesystemExecResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.fileDescriptor !== void 0) { + writer.uint32(18).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.fileDescriptor !== void 0) { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecResponse(); + message.execId = object.execId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? void 0; + return message; + } +}; +function createBaseContainerHeartbeatRequest() { + return { canceledInputsReturnOutputs: false, canceledInputsReturnOutputsV2: false }; +} +var ContainerHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.canceledInputsReturnOutputs !== false) { + writer.uint32(32).bool(message.canceledInputsReturnOutputs); + } + if (message.canceledInputsReturnOutputsV2 !== false) { + writer.uint32(40).bool(message.canceledInputsReturnOutputsV2); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 32) { + break; + } + message.canceledInputsReturnOutputs = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.canceledInputsReturnOutputsV2 = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + canceledInputsReturnOutputs: isSet4(object.canceledInputsReturnOutputs) ? globalThis.Boolean(object.canceledInputsReturnOutputs) : false, + canceledInputsReturnOutputsV2: isSet4(object.canceledInputsReturnOutputsV2) ? globalThis.Boolean(object.canceledInputsReturnOutputsV2) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.canceledInputsReturnOutputs !== false) { + obj.canceledInputsReturnOutputs = message.canceledInputsReturnOutputs; + } + if (message.canceledInputsReturnOutputsV2 !== false) { + obj.canceledInputsReturnOutputsV2 = message.canceledInputsReturnOutputsV2; + } + return obj; + }, + create(base) { + return ContainerHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerHeartbeatRequest(); + message.canceledInputsReturnOutputs = object.canceledInputsReturnOutputs ?? false; + message.canceledInputsReturnOutputsV2 = object.canceledInputsReturnOutputsV2 ?? false; + return message; + } +}; +function createBaseContainerHeartbeatResponse() { + return { cancelInputEvent: void 0 }; +} +var ContainerHeartbeatResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cancelInputEvent !== void 0) { + CancelInputEvent.encode(message.cancelInputEvent, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerHeartbeatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cancelInputEvent = CancelInputEvent.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cancelInputEvent: isSet4(object.cancelInputEvent) ? CancelInputEvent.fromJSON(object.cancelInputEvent) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cancelInputEvent !== void 0) { + obj.cancelInputEvent = CancelInputEvent.toJSON(message.cancelInputEvent); + } + return obj; + }, + create(base) { + return ContainerHeartbeatResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerHeartbeatResponse(); + message.cancelInputEvent = object.cancelInputEvent !== void 0 && object.cancelInputEvent !== null ? CancelInputEvent.fromPartial(object.cancelInputEvent) : void 0; + return message; + } +}; +function createBaseContainerLogRequest() { + return { logs: [] }; +} +var ContainerLogRequest = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.logs) { + TaskLogs.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerLogRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.logs.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e) => TaskLogs.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.logs?.length) { + obj.logs = message.logs.map((e) => TaskLogs.toJSON(e)); + } + return obj; + }, + create(base) { + return ContainerLogRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerLogRequest(); + message.logs = object.logs?.map((e) => TaskLogs.fromPartial(e)) || []; + return message; + } +}; +function createBaseContainerReloadVolumesRequest() { + return { taskId: "" }; +} +var ContainerReloadVolumesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerReloadVolumesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerReloadVolumesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerReloadVolumesRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerReloadVolumesResponse() { + return {}; +} +var ContainerReloadVolumesResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerReloadVolumesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return ContainerReloadVolumesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseContainerReloadVolumesResponse(); + return message; + } +}; +function createBaseContainerStopRequest() { + return { taskId: "" }; +} +var ContainerStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerStopRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerStopResponse() { + return {}; +} +var ContainerStopResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerStopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return ContainerStopResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseContainerStopResponse(); + return message; + } +}; +function createBaseCreationInfo() { + return { createdAt: 0, createdBy: "" }; +} +var CreationInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.createdAt !== 0) { + writer.uint32(9).double(message.createdAt); + } + if (message.createdBy !== "") { + writer.uint32(18).string(message.createdBy); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCreationInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.createdBy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + createdBy: isSet4(object.createdBy) ? globalThis.String(object.createdBy) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.createdBy !== "") { + obj.createdBy = message.createdBy; + } + return obj; + }, + create(base) { + return CreationInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCreationInfo(); + message.createdAt = object.createdAt ?? 0; + message.createdBy = object.createdBy ?? ""; + return message; + } +}; +function createBaseCustomDomainConfig() { + return { name: "" }; +} +var CustomDomainConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCustomDomainConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return CustomDomainConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomDomainConfig(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseCustomDomainInfo() { + return { url: "" }; +} +var CustomDomainInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCustomDomainInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return CustomDomainInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomDomainInfo(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseDNSRecord() { + return { type: 0, name: "", value: "" }; +} +var DNSRecord = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDNSRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? dNSRecordTypeFromJSON(object.type) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = dNSRecordTypeToJSON(message.type); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return DNSRecord.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDNSRecord(); + message.type = object.type ?? 0; + message.name = object.name ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseDataChunk() { + return { dataFormat: 0, data: void 0, dataBlobId: void 0, index: 0 }; +} +var DataChunk = { + encode(message, writer = new BinaryWriter()) { + if (message.dataFormat !== 0) { + writer.uint32(8).int32(message.dataFormat); + } + if (message.data !== void 0) { + writer.uint32(18).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(26).string(message.dataBlobId); + } + if (message.index !== 0) { + writer.uint32(32).uint64(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDataChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.index = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + index: isSet4(object.index) ? globalThis.Number(object.index) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + create(base) { + return DataChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataChunk(); + message.dataFormat = object.dataFormat ?? 0; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.index = object.index ?? 0; + return message; + } +}; +function createBaseDictClearRequest() { + return { dictId: "" }; +} +var DictClearRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictClearRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictClearRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictClearRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictContainsRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictContainsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContainsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictContainsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContainsRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictContainsResponse() { + return { found: false }; +} +var DictContainsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContainsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { found: isSet4(object.found) ? globalThis.Boolean(object.found) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + return obj; + }, + create(base) { + return DictContainsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContainsResponse(); + message.found = object.found ?? false; + return message; + } +}; +function createBaseDictContentsRequest() { + return { dictId: "", keys: false, values: false }; +} +var DictContentsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.keys !== false) { + writer.uint32(16).bool(message.keys); + } + if (message.values !== false) { + writer.uint32(24).bool(message.values); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.keys = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.values = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + keys: isSet4(object.keys) ? globalThis.Boolean(object.keys) : false, + values: isSet4(object.values) ? globalThis.Boolean(object.values) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.keys !== false) { + obj.keys = message.keys; + } + if (message.values !== false) { + obj.values = message.values; + } + return obj; + }, + create(base) { + return DictContentsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContentsRequest(); + message.dictId = object.dictId ?? ""; + message.keys = object.keys ?? false; + message.values = object.values ?? false; + return message; + } +}; +function createBaseDictDeleteRequest() { + return { dictId: "" }; +} +var DictDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictDeleteRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictEntry() { + return { key: new Uint8Array(0), value: new Uint8Array(0) }; +} +var DictEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet4(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictEntry(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, data: [] }; +} +var DictGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + for (const v of message.data) { + DictEntry.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.data.push(DictEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => DictEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.data?.length) { + obj.data = message.data.map((e) => DictEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return DictGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.data = object.data?.map((e) => DictEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseDictGetOrCreateResponse() { + return { dictId: "", metadata: void 0 }; +} +var DictGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.metadata !== void 0) { + DictMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = DictMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + metadata: isSet4(object.metadata) ? DictMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.metadata !== void 0) { + obj.metadata = DictMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return DictGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetOrCreateResponse(); + message.dictId = object.dictId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? DictMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseDictGetRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictGetResponse() { + return { found: false, value: void 0 }; +} +var DictGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + if (message.value !== void 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + found: isSet4(object.found) ? globalThis.Boolean(object.found) : false, + value: isSet4(object.value) ? bytesFromBase64(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + if (message.value !== void 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetResponse(); + message.found = object.found ?? false; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseDictHeartbeatRequest() { + return { dictId: "" }; +} +var DictHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictHeartbeatRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictLenRequest() { + return { dictId: "" }; +} +var DictLenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictLenRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictLenResponse() { + return { len: 0 }; +} +var DictLenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).int32(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { len: isSet4(object.len) ? globalThis.Number(object.len) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return DictLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictLenResponse(); + message.len = object.len ?? 0; + return message; + } +}; +function createBaseDictListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var DictListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return DictListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseDictListResponse() { + return { dicts: [], environmentName: "" }; +} +var DictListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.dicts) { + DictListResponse_DictInfo.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dicts.push(DictListResponse_DictInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dicts: globalThis.Array.isArray(object?.dicts) ? object.dicts.map((e) => DictListResponse_DictInfo.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.dicts?.length) { + obj.dicts = message.dicts.map((e) => DictListResponse_DictInfo.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return DictListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListResponse(); + message.dicts = object.dicts?.map((e) => DictListResponse_DictInfo.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseDictListResponse_DictInfo() { + return { name: "", createdAt: 0, dictId: "", metadata: void 0 }; +} +var DictListResponse_DictInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.dictId !== "") { + writer.uint32(26).string(message.dictId); + } + if (message.metadata !== void 0) { + DictMetadata.encode(message.metadata, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListResponse_DictInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dictId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.metadata = DictMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + metadata: isSet4(object.metadata) ? DictMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.metadata !== void 0) { + obj.metadata = DictMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return DictListResponse_DictInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListResponse_DictInfo(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.dictId = object.dictId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? DictMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseDictMetadata() { + return { name: "", creationInfo: void 0 }; +} +var DictMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return DictMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseDictPopRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictPopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictPopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictPopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictPopRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictPopResponse() { + return { found: false, value: void 0 }; +} +var DictPopResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + if (message.value !== void 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictPopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + found: isSet4(object.found) ? globalThis.Boolean(object.found) : false, + value: isSet4(object.value) ? bytesFromBase64(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + if (message.value !== void 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictPopResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictPopResponse(); + message.found = object.found ?? false; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseDictUpdateRequest() { + return { dictId: "", updates: [], ifNotExists: false }; +} +var DictUpdateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + for (const v of message.updates) { + DictEntry.encode(v, writer.uint32(18).fork()).join(); + } + if (message.ifNotExists !== false) { + writer.uint32(24).bool(message.ifNotExists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.updates.push(DictEntry.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ifNotExists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + updates: globalThis.Array.isArray(object?.updates) ? object.updates.map((e) => DictEntry.fromJSON(e)) : [], + ifNotExists: isSet4(object.ifNotExists) ? globalThis.Boolean(object.ifNotExists) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.updates?.length) { + obj.updates = message.updates.map((e) => DictEntry.toJSON(e)); + } + if (message.ifNotExists !== false) { + obj.ifNotExists = message.ifNotExists; + } + return obj; + }, + create(base) { + return DictUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictUpdateRequest(); + message.dictId = object.dictId ?? ""; + message.updates = object.updates?.map((e) => DictEntry.fromPartial(e)) || []; + message.ifNotExists = object.ifNotExists ?? false; + return message; + } +}; +function createBaseDictUpdateResponse() { + return { created: false }; +} +var DictUpdateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.created !== false) { + writer.uint32(8).bool(message.created); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictUpdateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.created = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { created: isSet4(object.created) ? globalThis.Boolean(object.created) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.created !== false) { + obj.created = message.created; + } + return obj; + }, + create(base) { + return DictUpdateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictUpdateResponse(); + message.created = object.created ?? false; + return message; + } +}; +function createBaseDomain() { + return { domainId: "", domainName: "", createdAt: 0, certificateStatus: 0, dnsRecords: [] }; +} +var Domain = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + if (message.domainName !== "") { + writer.uint32(18).string(message.domainName); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.certificateStatus !== 0) { + writer.uint32(32).int32(message.certificateStatus); + } + for (const v of message.dnsRecords) { + DNSRecord.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.domainName = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.certificateStatus = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dnsRecords.push(DNSRecord.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "", + domainName: isSet4(object.domainName) ? globalThis.String(object.domainName) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + certificateStatus: isSet4(object.certificateStatus) ? certificateStatusFromJSON(object.certificateStatus) : 0, + dnsRecords: globalThis.Array.isArray(object?.dnsRecords) ? object.dnsRecords.map((e) => DNSRecord.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + if (message.domainName !== "") { + obj.domainName = message.domainName; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.certificateStatus !== 0) { + obj.certificateStatus = certificateStatusToJSON(message.certificateStatus); + } + if (message.dnsRecords?.length) { + obj.dnsRecords = message.dnsRecords.map((e) => DNSRecord.toJSON(e)); + } + return obj; + }, + create(base) { + return Domain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomain(); + message.domainId = object.domainId ?? ""; + message.domainName = object.domainName ?? ""; + message.createdAt = object.createdAt ?? 0; + message.certificateStatus = object.certificateStatus ?? 0; + message.dnsRecords = object.dnsRecords?.map((e) => DNSRecord.fromPartial(e)) || []; + return message; + } +}; +function createBaseDomainCertificateVerifyRequest() { + return { domainId: "" }; +} +var DomainCertificateVerifyRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCertificateVerifyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + return obj; + }, + create(base) { + return DomainCertificateVerifyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCertificateVerifyRequest(); + message.domainId = object.domainId ?? ""; + return message; + } +}; +function createBaseDomainCertificateVerifyResponse() { + return { domain: void 0 }; +} +var DomainCertificateVerifyResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.domain !== void 0) { + Domain.encode(message.domain, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCertificateVerifyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domain = Domain.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domain: isSet4(object.domain) ? Domain.fromJSON(object.domain) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.domain !== void 0) { + obj.domain = Domain.toJSON(message.domain); + } + return obj; + }, + create(base) { + return DomainCertificateVerifyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCertificateVerifyResponse(); + message.domain = object.domain !== void 0 && object.domain !== null ? Domain.fromPartial(object.domain) : void 0; + return message; + } +}; +function createBaseDomainCreateRequest() { + return { domainName: "" }; +} +var DomainCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.domainName !== "") { + writer.uint32(10).string(message.domainName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domainName: isSet4(object.domainName) ? globalThis.String(object.domainName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.domainName !== "") { + obj.domainName = message.domainName; + } + return obj; + }, + create(base) { + return DomainCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCreateRequest(); + message.domainName = object.domainName ?? ""; + return message; + } +}; +function createBaseDomainCreateResponse() { + return { domainId: "", dnsRecords: [] }; +} +var DomainCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + for (const v of message.dnsRecords) { + DNSRecord.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dnsRecords.push(DNSRecord.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "", + dnsRecords: globalThis.Array.isArray(object?.dnsRecords) ? object.dnsRecords.map((e) => DNSRecord.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + if (message.dnsRecords?.length) { + obj.dnsRecords = message.dnsRecords.map((e) => DNSRecord.toJSON(e)); + } + return obj; + }, + create(base) { + return DomainCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCreateResponse(); + message.domainId = object.domainId ?? ""; + message.dnsRecords = object.dnsRecords?.map((e) => DNSRecord.fromPartial(e)) || []; + return message; + } +}; +function createBaseDomainListRequest() { + return {}; +} +var DomainListRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return DomainListRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseDomainListRequest(); + return message; + } +}; +function createBaseDomainListResponse() { + return { domains: [] }; +} +var DomainListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.domains) { + Domain.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domains.push(Domain.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domains: globalThis.Array.isArray(object?.domains) ? object.domains.map((e) => Domain.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domains?.length) { + obj.domains = message.domains.map((e) => Domain.toJSON(e)); + } + return obj; + }, + create(base) { + return DomainListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainListResponse(); + message.domains = object.domains?.map((e) => Domain.fromPartial(e)) || []; + return message; + } +}; +function createBaseEnvironmentCreateRequest() { + return { name: "" }; +} +var EnvironmentCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return EnvironmentCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentCreateRequest(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseEnvironmentDeleteRequest() { + return { name: "" }; +} +var EnvironmentDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return EnvironmentDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentDeleteRequest(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseEnvironmentGetOrCreateRequest() { + return { deploymentName: "", objectCreationType: 0 }; +} +var EnvironmentGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(16).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return EnvironmentGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseEnvironmentGetOrCreateResponse() { + return { environmentId: "", metadata: void 0 }; +} +var EnvironmentGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentId !== "") { + writer.uint32(10).string(message.environmentId); + } + if (message.metadata !== void 0) { + EnvironmentMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = EnvironmentMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentId: isSet4(object.environmentId) ? globalThis.String(object.environmentId) : "", + metadata: isSet4(object.metadata) ? EnvironmentMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentId !== "") { + obj.environmentId = message.environmentId; + } + if (message.metadata !== void 0) { + obj.metadata = EnvironmentMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return EnvironmentGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentGetOrCreateResponse(); + message.environmentId = object.environmentId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? EnvironmentMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseEnvironmentListItem() { + return { name: "", webhookSuffix: "", createdAt: 0, default: false, isManaged: false, environmentId: "" }; +} +var EnvironmentListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.webhookSuffix !== "") { + writer.uint32(18).string(message.webhookSuffix); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.default !== false) { + writer.uint32(32).bool(message.default); + } + if (message.isManaged !== false) { + writer.uint32(40).bool(message.isManaged); + } + if (message.environmentId !== "") { + writer.uint32(50).string(message.environmentId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webhookSuffix = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.default = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.isManaged = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.environmentId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + webhookSuffix: isSet4(object.webhookSuffix) ? globalThis.String(object.webhookSuffix) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + default: isSet4(object.default) ? globalThis.Boolean(object.default) : false, + isManaged: isSet4(object.isManaged) ? globalThis.Boolean(object.isManaged) : false, + environmentId: isSet4(object.environmentId) ? globalThis.String(object.environmentId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.webhookSuffix !== "") { + obj.webhookSuffix = message.webhookSuffix; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.default !== false) { + obj.default = message.default; + } + if (message.isManaged !== false) { + obj.isManaged = message.isManaged; + } + if (message.environmentId !== "") { + obj.environmentId = message.environmentId; + } + return obj; + }, + create(base) { + return EnvironmentListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentListItem(); + message.name = object.name ?? ""; + message.webhookSuffix = object.webhookSuffix ?? ""; + message.createdAt = object.createdAt ?? 0; + message.default = object.default ?? false; + message.isManaged = object.isManaged ?? false; + message.environmentId = object.environmentId ?? ""; + return message; + } +}; +function createBaseEnvironmentListResponse() { + return { items: [] }; +} +var EnvironmentListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + EnvironmentListItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.items.push(EnvironmentListItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => EnvironmentListItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => EnvironmentListItem.toJSON(e)); + } + return obj; + }, + create(base) { + return EnvironmentListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentListResponse(); + message.items = object.items?.map((e) => EnvironmentListItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseEnvironmentMetadata() { + return { name: "", settings: void 0 }; +} +var EnvironmentMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.settings !== void 0) { + EnvironmentSettings.encode(message.settings, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.settings = EnvironmentSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + settings: isSet4(object.settings) ? EnvironmentSettings.fromJSON(object.settings) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.settings !== void 0) { + obj.settings = EnvironmentSettings.toJSON(message.settings); + } + return obj; + }, + create(base) { + return EnvironmentMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentMetadata(); + message.name = object.name ?? ""; + message.settings = object.settings !== void 0 && object.settings !== null ? EnvironmentSettings.fromPartial(object.settings) : void 0; + return message; + } +}; +function createBaseEnvironmentSettings() { + return { imageBuilderVersion: "", webhookSuffix: "" }; +} +var EnvironmentSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.imageBuilderVersion !== "") { + writer.uint32(10).string(message.imageBuilderVersion); + } + if (message.webhookSuffix !== "") { + writer.uint32(18).string(message.webhookSuffix); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webhookSuffix = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : "", + webhookSuffix: isSet4(object.webhookSuffix) ? globalThis.String(object.webhookSuffix) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageBuilderVersion !== "") { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + if (message.webhookSuffix !== "") { + obj.webhookSuffix = message.webhookSuffix; + } + return obj; + }, + create(base) { + return EnvironmentSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentSettings(); + message.imageBuilderVersion = object.imageBuilderVersion ?? ""; + message.webhookSuffix = object.webhookSuffix ?? ""; + return message; + } +}; +function createBaseEnvironmentUpdateRequest() { + return { currentName: "", name: void 0, webSuffix: void 0 }; +} +var EnvironmentUpdateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.currentName !== "") { + writer.uint32(10).string(message.currentName); + } + if (message.name !== void 0) { + StringValue.encode({ value: message.name }, writer.uint32(18).fork()).join(); + } + if (message.webSuffix !== void 0) { + StringValue.encode({ value: message.webSuffix }, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.currentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = StringValue.decode(reader, reader.uint32()).value; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.webSuffix = StringValue.decode(reader, reader.uint32()).value; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + currentName: isSet4(object.currentName) ? globalThis.String(object.currentName) : "", + name: isSet4(object.name) ? String(object.name) : void 0, + webSuffix: isSet4(object.webSuffix) ? String(object.webSuffix) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.currentName !== "") { + obj.currentName = message.currentName; + } + if (message.name !== void 0) { + obj.name = message.name; + } + if (message.webSuffix !== void 0) { + obj.webSuffix = message.webSuffix; + } + return obj; + }, + create(base) { + return EnvironmentUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentUpdateRequest(); + message.currentName = object.currentName ?? ""; + message.name = object.name ?? void 0; + message.webSuffix = object.webSuffix ?? void 0; + return message; + } +}; +function createBaseFileEntry() { + return { path: "", type: 0, mtime: 0, size: 0 }; +} +var FileEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.mtime !== 0) { + writer.uint32(24).uint64(message.mtime); + } + if (message.size !== 0) { + writer.uint32(32).uint64(message.size); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFileEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.mtime = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + type: isSet4(object.type) ? fileEntry_FileTypeFromJSON(object.type) : 0, + mtime: isSet4(object.mtime) ? globalThis.Number(object.mtime) : 0, + size: isSet4(object.size) ? globalThis.Number(object.size) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.type !== 0) { + obj.type = fileEntry_FileTypeToJSON(message.type); + } + if (message.mtime !== 0) { + obj.mtime = Math.round(message.mtime); + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + return obj; + }, + create(base) { + return FileEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileEntry(); + message.path = object.path ?? ""; + message.type = object.type ?? 0; + message.mtime = object.mtime ?? 0; + message.size = object.size ?? 0; + return message; + } +}; +function createBaseFilesystemRuntimeOutputBatch() { + return { output: [], error: void 0, batchIndex: 0, eof: false }; +} +var FilesystemRuntimeOutputBatch = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.output) { + writer.uint32(10).bytes(v); + } + if (message.error !== void 0) { + SystemErrorMessage.encode(message.error, writer.uint32(18).fork()).join(); + } + if (message.batchIndex !== 0) { + writer.uint32(24).uint64(message.batchIndex); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFilesystemRuntimeOutputBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.output.push(reader.bytes()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.error = SystemErrorMessage.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.batchIndex = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + output: globalThis.Array.isArray(object?.output) ? object.output.map((e) => bytesFromBase64(e)) : [], + error: isSet4(object.error) ? SystemErrorMessage.fromJSON(object.error) : void 0, + batchIndex: isSet4(object.batchIndex) ? globalThis.Number(object.batchIndex) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.output?.length) { + obj.output = message.output.map((e) => base64FromBytes(e)); + } + if (message.error !== void 0) { + obj.error = SystemErrorMessage.toJSON(message.error); + } + if (message.batchIndex !== 0) { + obj.batchIndex = Math.round(message.batchIndex); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return FilesystemRuntimeOutputBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFilesystemRuntimeOutputBatch(); + message.output = object.output?.map((e) => e) || []; + message.error = object.error !== void 0 && object.error !== null ? SystemErrorMessage.fromPartial(object.error) : void 0; + message.batchIndex = object.batchIndex ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseFlashContainerDeregisterRequest() { + return { serviceName: "" }; +} +var FlashContainerDeregisterRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.serviceName !== "") { + writer.uint32(10).string(message.serviceName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerDeregisterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.serviceName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { serviceName: isSet4(object.serviceName) ? globalThis.String(object.serviceName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.serviceName !== "") { + obj.serviceName = message.serviceName; + } + return obj; + }, + create(base) { + return FlashContainerDeregisterRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerDeregisterRequest(); + message.serviceName = object.serviceName ?? ""; + return message; + } +}; +function createBaseFlashContainerListRequest() { + return { functionId: "" }; +} +var FlashContainerListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FlashContainerListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFlashContainerListResponse() { + return { containers: [] }; +} +var FlashContainerListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.containers) { + FlashContainerListResponse_Container.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.containers.push(FlashContainerListResponse_Container.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + containers: globalThis.Array.isArray(object?.containers) ? object.containers.map((e) => FlashContainerListResponse_Container.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.containers?.length) { + obj.containers = message.containers.map((e) => FlashContainerListResponse_Container.toJSON(e)); + } + return obj; + }, + create(base) { + return FlashContainerListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListResponse(); + message.containers = object.containers?.map((e) => FlashContainerListResponse_Container.fromPartial(e)) || []; + return message; + } +}; +function createBaseFlashContainerListResponse_Container() { + return { taskId: "", host: "", port: 0 }; +} +var FlashContainerListResponse_Container = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.host !== "") { + writer.uint32(18).string(message.host); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListResponse_Container(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.host = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return FlashContainerListResponse_Container.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListResponse_Container(); + message.taskId = object.taskId ?? ""; + message.host = object.host ?? ""; + message.port = object.port ?? 0; + return message; + } +}; +function createBaseFlashContainerRegisterRequest() { + return { serviceName: "", priority: 0, weight: 0, host: "", port: 0 }; +} +var FlashContainerRegisterRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.serviceName !== "") { + writer.uint32(10).string(message.serviceName); + } + if (message.priority !== 0) { + writer.uint32(16).uint32(message.priority); + } + if (message.weight !== 0) { + writer.uint32(24).uint32(message.weight); + } + if (message.host !== "") { + writer.uint32(34).string(message.host); + } + if (message.port !== 0) { + writer.uint32(40).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerRegisterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.serviceName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.priority = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.weight = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.host = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + serviceName: isSet4(object.serviceName) ? globalThis.String(object.serviceName) : "", + priority: isSet4(object.priority) ? globalThis.Number(object.priority) : 0, + weight: isSet4(object.weight) ? globalThis.Number(object.weight) : 0, + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.serviceName !== "") { + obj.serviceName = message.serviceName; + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.weight !== 0) { + obj.weight = Math.round(message.weight); + } + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return FlashContainerRegisterRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerRegisterRequest(); + message.serviceName = object.serviceName ?? ""; + message.priority = object.priority ?? 0; + message.weight = object.weight ?? 0; + message.host = object.host ?? ""; + message.port = object.port ?? 0; + return message; + } +}; +function createBaseFlashContainerRegisterResponse() { + return { url: "" }; +} +var FlashContainerRegisterResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerRegisterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return FlashContainerRegisterResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerRegisterResponse(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseFlashSetTargetSlotsMetricsRequest() { + return { functionId: "", targetSlots: 0 }; +} +var FlashSetTargetSlotsMetricsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.targetSlots !== 0) { + writer.uint32(16).uint32(message.targetSlots); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashSetTargetSlotsMetricsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.targetSlots = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + targetSlots: isSet4(object.targetSlots) ? globalThis.Number(object.targetSlots) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.targetSlots !== 0) { + obj.targetSlots = Math.round(message.targetSlots); + } + return obj; + }, + create(base) { + return FlashSetTargetSlotsMetricsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashSetTargetSlotsMetricsRequest(); + message.functionId = object.functionId ?? ""; + message.targetSlots = object.targetSlots ?? 0; + return message; + } +}; +function createBaseFlashSetTargetSlotsMetricsResponse() { + return {}; +} +var FlashSetTargetSlotsMetricsResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashSetTargetSlotsMetricsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return FlashSetTargetSlotsMetricsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFlashSetTargetSlotsMetricsResponse(); + return message; + } +}; +function createBaseFunctionMessage() { + return { + moduleName: "", + functionName: "", + mountIds: [], + imageId: "", + functionSerialized: new Uint8Array(0), + definitionType: 0, + functionType: 0, + resources: void 0, + secretIds: [], + rateLimit: void 0, + webhookConfig: void 0, + sharedVolumeMounts: [], + proxyId: void 0, + retryPolicy: void 0, + concurrencyLimit: 0, + timeoutSecs: 0, + ptyInfo: void 0, + classSerialized: new Uint8Array(0), + taskIdleTimeoutSecs: 0, + cloudProvider: void 0, + warmPoolSize: 0, + webUrl: "", + webUrlInfo: void 0, + runtime: "", + appName: "", + volumeMounts: [], + maxConcurrentInputs: 0, + customDomainInfo: [], + workerId: "", + runtimeDebug: false, + isBuilderFunction: false, + isAutoSnapshot: false, + isMethod: false, + isCheckpointingFunction: false, + checkpointingEnabled: false, + checkpoint: void 0, + objectDependencies: [], + blockNetwork: false, + maxInputs: 0, + s3Mounts: [], + cloudBucketMounts: [], + schedulerPlacement: void 0, + isClass: false, + useFunctionId: "", + useMethodName: "", + classParameterInfo: void 0, + batchMaxSize: 0, + batchLingerMs: 0, + i6pnEnabled: false, + ExperimentalConcurrentCancellations: false, + targetConcurrentInputs: 0, + ExperimentalTaskTemplatesEnabled: false, + ExperimentalTaskTemplates: [], + ExperimentalGroupSize: 0, + untrusted: false, + ExperimentalBufferContainers: 0, + ExperimentalProxyIp: void 0, + runtimePerfRecord: false, + schedule: void 0, + snapshotDebug: false, + methodDefinitions: {}, + methodDefinitionsSet: false, + ExperimentalCustomScaling: false, + cloudProviderStr: "", + ExperimentalEnableGpuSnapshot: false, + autoscalerSettings: void 0, + functionSchema: void 0, + experimentalOptions: {}, + mountClientDependencies: false, + flashServiceUrls: [], + flashServiceLabel: "", + enableGpuSnapshot: false, + startupTimeoutSecs: 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + for (const v of message.mountIds) { + writer.uint32(26).string(v); + } + if (message.imageId !== "") { + writer.uint32(34).string(message.imageId); + } + if (message.functionSerialized.length !== 0) { + writer.uint32(50).bytes(message.functionSerialized); + } + if (message.definitionType !== 0) { + writer.uint32(56).int32(message.definitionType); + } + if (message.functionType !== 0) { + writer.uint32(64).int32(message.functionType); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(74).fork()).join(); + } + for (const v of message.secretIds) { + writer.uint32(82).string(v); + } + if (message.rateLimit !== void 0) { + RateLimit.encode(message.rateLimit, writer.uint32(90).fork()).join(); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(122).fork()).join(); + } + for (const v of message.sharedVolumeMounts) { + SharedVolumeMount.encode(v, writer.uint32(130).fork()).join(); + } + if (message.proxyId !== void 0) { + writer.uint32(138).string(message.proxyId); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(146).fork()).join(); + } + if (message.concurrencyLimit !== 0) { + writer.uint32(152).uint32(message.concurrencyLimit); + } + if (message.timeoutSecs !== 0) { + writer.uint32(168).uint32(message.timeoutSecs); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(178).fork()).join(); + } + if (message.classSerialized.length !== 0) { + writer.uint32(186).bytes(message.classSerialized); + } + if (message.taskIdleTimeoutSecs !== 0) { + writer.uint32(200).uint32(message.taskIdleTimeoutSecs); + } + if (message.cloudProvider !== void 0) { + writer.uint32(208).int32(message.cloudProvider); + } + if (message.warmPoolSize !== 0) { + writer.uint32(216).uint32(message.warmPoolSize); + } + if (message.webUrl !== "") { + writer.uint32(226).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(234).fork()).join(); + } + if (message.runtime !== "") { + writer.uint32(242).string(message.runtime); + } + if (message.appName !== "") { + writer.uint32(250).string(message.appName); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(266).fork()).join(); + } + if (message.maxConcurrentInputs !== 0) { + writer.uint32(272).uint32(message.maxConcurrentInputs); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(282).fork()).join(); + } + if (message.workerId !== "") { + writer.uint32(290).string(message.workerId); + } + if (message.runtimeDebug !== false) { + writer.uint32(296).bool(message.runtimeDebug); + } + if (message.isBuilderFunction !== false) { + writer.uint32(256).bool(message.isBuilderFunction); + } + if (message.isAutoSnapshot !== false) { + writer.uint32(304).bool(message.isAutoSnapshot); + } + if (message.isMethod !== false) { + writer.uint32(312).bool(message.isMethod); + } + if (message.isCheckpointingFunction !== false) { + writer.uint32(320).bool(message.isCheckpointingFunction); + } + if (message.checkpointingEnabled !== false) { + writer.uint32(328).bool(message.checkpointingEnabled); + } + if (message.checkpoint !== void 0) { + CheckpointInfo.encode(message.checkpoint, writer.uint32(338).fork()).join(); + } + for (const v of message.objectDependencies) { + ObjectDependency.encode(v, writer.uint32(346).fork()).join(); + } + if (message.blockNetwork !== false) { + writer.uint32(352).bool(message.blockNetwork); + } + if (message.maxInputs !== 0) { + writer.uint32(368).uint32(message.maxInputs); + } + for (const v of message.s3Mounts) { + S3Mount.encode(v, writer.uint32(378).fork()).join(); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(410).fork()).join(); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(402).fork()).join(); + } + if (message.isClass !== false) { + writer.uint32(424).bool(message.isClass); + } + if (message.useFunctionId !== "") { + writer.uint32(434).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(442).string(message.useMethodName); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(450).fork()).join(); + } + if (message.batchMaxSize !== 0) { + writer.uint32(480).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + writer.uint32(488).uint64(message.batchLingerMs); + } + if (message.i6pnEnabled !== false) { + writer.uint32(496).bool(message.i6pnEnabled); + } + if (message.ExperimentalConcurrentCancellations !== false) { + writer.uint32(504).bool(message.ExperimentalConcurrentCancellations); + } + if (message.targetConcurrentInputs !== 0) { + writer.uint32(512).uint32(message.targetConcurrentInputs); + } + if (message.ExperimentalTaskTemplatesEnabled !== false) { + writer.uint32(520).bool(message.ExperimentalTaskTemplatesEnabled); + } + for (const v of message.ExperimentalTaskTemplates) { + TaskTemplate.encode(v, writer.uint32(530).fork()).join(); + } + if (message.ExperimentalGroupSize !== 0) { + writer.uint32(536).uint32(message.ExperimentalGroupSize); + } + if (message.untrusted !== false) { + writer.uint32(544).bool(message.untrusted); + } + if (message.ExperimentalBufferContainers !== 0) { + writer.uint32(552).uint32(message.ExperimentalBufferContainers); + } + if (message.ExperimentalProxyIp !== void 0) { + writer.uint32(562).string(message.ExperimentalProxyIp); + } + if (message.runtimePerfRecord !== false) { + writer.uint32(568).bool(message.runtimePerfRecord); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(578).fork()).join(); + } + if (message.snapshotDebug !== false) { + writer.uint32(584).bool(message.snapshotDebug); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + Function_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(594).fork()).join(); + }); + if (message.methodDefinitionsSet !== false) { + writer.uint32(600).bool(message.methodDefinitionsSet); + } + if (message.ExperimentalCustomScaling !== false) { + writer.uint32(608).bool(message.ExperimentalCustomScaling); + } + if (message.cloudProviderStr !== "") { + writer.uint32(618).string(message.cloudProviderStr); + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + writer.uint32(624).bool(message.ExperimentalEnableGpuSnapshot); + } + if (message.autoscalerSettings !== void 0) { + AutoscalerSettings.encode(message.autoscalerSettings, writer.uint32(634).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(642).fork()).join(); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + Function_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(650).fork()).join(); + }); + if (message.mountClientDependencies !== false) { + writer.uint32(656).bool(message.mountClientDependencies); + } + for (const v of message.flashServiceUrls) { + writer.uint32(666).string(v); + } + if (message.flashServiceLabel !== "") { + writer.uint32(674).string(message.flashServiceLabel); + } + if (message.enableGpuSnapshot !== false) { + writer.uint32(680).bool(message.enableGpuSnapshot); + } + if (message.startupTimeoutSecs !== 0) { + writer.uint32(688).uint32(message.startupTimeoutSecs); + } + writer.uint32(698).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(706).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.moduleName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.imageId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.functionSerialized = reader.bytes(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.definitionType = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.rateLimit = RateLimit.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.sharedVolumeMounts.push(SharedVolumeMount.decode(reader, reader.uint32())); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.classSerialized = reader.bytes(); + continue; + } + case 25: { + if (tag !== 200) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 26: { + if (tag !== 208) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 29: { + if (tag !== 234) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + message.runtime = reader.string(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + message.appName = reader.string(); + continue; + } + case 33: { + if (tag !== 266) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + message.workerId = reader.string(); + continue; + } + case 37: { + if (tag !== 296) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 32: { + if (tag !== 256) { + break; + } + message.isBuilderFunction = reader.bool(); + continue; + } + case 38: { + if (tag !== 304) { + break; + } + message.isAutoSnapshot = reader.bool(); + continue; + } + case 39: { + if (tag !== 312) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 40: { + if (tag !== 320) { + break; + } + message.isCheckpointingFunction = reader.bool(); + continue; + } + case 41: { + if (tag !== 328) { + break; + } + message.checkpointingEnabled = reader.bool(); + continue; + } + case 42: { + if (tag !== 338) { + break; + } + message.checkpoint = CheckpointInfo.decode(reader, reader.uint32()); + continue; + } + case 43: { + if (tag !== 346) { + break; + } + message.objectDependencies.push(ObjectDependency.decode(reader, reader.uint32())); + continue; + } + case 44: { + if (tag !== 352) { + break; + } + message.blockNetwork = reader.bool(); + continue; + } + case 46: { + if (tag !== 368) { + break; + } + message.maxInputs = reader.uint32(); + continue; + } + case 47: { + if (tag !== 378) { + break; + } + message.s3Mounts.push(S3Mount.decode(reader, reader.uint32())); + continue; + } + case 51: { + if (tag !== 410) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 53: { + if (tag !== 424) { + break; + } + message.isClass = reader.bool(); + continue; + } + case 54: { + if (tag !== 434) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 55: { + if (tag !== 442) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 56: { + if (tag !== 450) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 60: { + if (tag !== 480) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 61: { + if (tag !== 488) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + case 62: { + if (tag !== 496) { + break; + } + message.i6pnEnabled = reader.bool(); + continue; + } + case 63: { + if (tag !== 504) { + break; + } + message.ExperimentalConcurrentCancellations = reader.bool(); + continue; + } + case 64: { + if (tag !== 512) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 65: { + if (tag !== 520) { + break; + } + message.ExperimentalTaskTemplatesEnabled = reader.bool(); + continue; + } + case 66: { + if (tag !== 530) { + break; + } + message.ExperimentalTaskTemplates.push(TaskTemplate.decode(reader, reader.uint32())); + continue; + } + case 67: { + if (tag !== 536) { + break; + } + message.ExperimentalGroupSize = reader.uint32(); + continue; + } + case 68: { + if (tag !== 544) { + break; + } + message.untrusted = reader.bool(); + continue; + } + case 69: { + if (tag !== 552) { + break; + } + message.ExperimentalBufferContainers = reader.uint32(); + continue; + } + case 70: { + if (tag !== 562) { + break; + } + message.ExperimentalProxyIp = reader.string(); + continue; + } + case 71: { + if (tag !== 568) { + break; + } + message.runtimePerfRecord = reader.bool(); + continue; + } + case 72: { + if (tag !== 578) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 73: { + if (tag !== 584) { + break; + } + message.snapshotDebug = reader.bool(); + continue; + } + case 74: { + if (tag !== 594) { + break; + } + const entry74 = Function_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry74.value !== void 0) { + message.methodDefinitions[entry74.key] = entry74.value; + } + continue; + } + case 75: { + if (tag !== 600) { + break; + } + message.methodDefinitionsSet = reader.bool(); + continue; + } + case 76: { + if (tag !== 608) { + break; + } + message.ExperimentalCustomScaling = reader.bool(); + continue; + } + case 77: { + if (tag !== 618) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 78: { + if (tag !== 624) { + break; + } + message.ExperimentalEnableGpuSnapshot = reader.bool(); + continue; + } + case 79: { + if (tag !== 634) { + break; + } + message.autoscalerSettings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + case 80: { + if (tag !== 642) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 81: { + if (tag !== 650) { + break; + } + const entry81 = Function_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry81.value !== void 0) { + message.experimentalOptions[entry81.key] = entry81.value; + } + continue; + } + case 82: { + if (tag !== 656) { + break; + } + message.mountClientDependencies = reader.bool(); + continue; + } + case 83: { + if (tag !== 666) { + break; + } + message.flashServiceUrls.push(reader.string()); + continue; + } + case 84: { + if (tag !== 674) { + break; + } + message.flashServiceLabel = reader.string(); + continue; + } + case 85: { + if (tag !== 680) { + break; + } + message.enableGpuSnapshot = reader.bool(); + continue; + } + case 86: { + if (tag !== 688) { + break; + } + message.startupTimeoutSecs = reader.uint32(); + continue; + } + case 87: { + if (tag === 696) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 698) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 88: { + if (tag === 704) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 706) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + functionSerialized: isSet4(object.functionSerialized) ? bytesFromBase64(object.functionSerialized) : new Uint8Array(0), + definitionType: isSet4(object.definitionType) ? function_DefinitionTypeFromJSON(object.definitionType) : 0, + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + rateLimit: isSet4(object.rateLimit) ? RateLimit.fromJSON(object.rateLimit) : void 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + sharedVolumeMounts: globalThis.Array.isArray(object?.sharedVolumeMounts) ? object.sharedVolumeMounts.map((e) => SharedVolumeMount.fromJSON(e)) : [], + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : void 0, + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + classSerialized: isSet4(object.classSerialized) ? bytesFromBase64(object.classSerialized) : new Uint8Array(0), + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : void 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : "", + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + isBuilderFunction: isSet4(object.isBuilderFunction) ? globalThis.Boolean(object.isBuilderFunction) : false, + isAutoSnapshot: isSet4(object.isAutoSnapshot) ? globalThis.Boolean(object.isAutoSnapshot) : false, + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + isCheckpointingFunction: isSet4(object.isCheckpointingFunction) ? globalThis.Boolean(object.isCheckpointingFunction) : false, + checkpointingEnabled: isSet4(object.checkpointingEnabled) ? globalThis.Boolean(object.checkpointingEnabled) : false, + checkpoint: isSet4(object.checkpoint) ? CheckpointInfo.fromJSON(object.checkpoint) : void 0, + objectDependencies: globalThis.Array.isArray(object?.objectDependencies) ? object.objectDependencies.map((e) => ObjectDependency.fromJSON(e)) : [], + blockNetwork: isSet4(object.blockNetwork) ? globalThis.Boolean(object.blockNetwork) : false, + maxInputs: isSet4(object.maxInputs) ? globalThis.Number(object.maxInputs) : 0, + s3Mounts: globalThis.Array.isArray(object?.s3Mounts) ? object.s3Mounts.map((e) => S3Mount.fromJSON(e)) : [], + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [], + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + isClass: isSet4(object.isClass) ? globalThis.Boolean(object.isClass) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : 0, + i6pnEnabled: isSet4(object.i6pnEnabled) ? globalThis.Boolean(object.i6pnEnabled) : false, + ExperimentalConcurrentCancellations: isSet4(object.ExperimentalConcurrentCancellations) ? globalThis.Boolean(object.ExperimentalConcurrentCancellations) : false, + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : 0, + ExperimentalTaskTemplatesEnabled: isSet4(object.ExperimentalTaskTemplatesEnabled) ? globalThis.Boolean(object.ExperimentalTaskTemplatesEnabled) : false, + ExperimentalTaskTemplates: globalThis.Array.isArray(object?.ExperimentalTaskTemplates) ? object.ExperimentalTaskTemplates.map((e) => TaskTemplate.fromJSON(e)) : [], + ExperimentalGroupSize: isSet4(object.ExperimentalGroupSize) ? globalThis.Number(object.ExperimentalGroupSize) : 0, + untrusted: isSet4(object.untrusted) ? globalThis.Boolean(object.untrusted) : false, + ExperimentalBufferContainers: isSet4(object.ExperimentalBufferContainers) ? globalThis.Number(object.ExperimentalBufferContainers) : 0, + ExperimentalProxyIp: isSet4(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0, + runtimePerfRecord: isSet4(object.runtimePerfRecord) ? globalThis.Boolean(object.runtimePerfRecord) : false, + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + snapshotDebug: isSet4(object.snapshotDebug) ? globalThis.Boolean(object.snapshotDebug) : false, + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + methodDefinitionsSet: isSet4(object.methodDefinitionsSet) ? globalThis.Boolean(object.methodDefinitionsSet) : false, + ExperimentalCustomScaling: isSet4(object.ExperimentalCustomScaling) ? globalThis.Boolean(object.ExperimentalCustomScaling) : false, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : "", + ExperimentalEnableGpuSnapshot: isSet4(object.ExperimentalEnableGpuSnapshot) ? globalThis.Boolean(object.ExperimentalEnableGpuSnapshot) : false, + autoscalerSettings: isSet4(object.autoscalerSettings) ? AutoscalerSettings.fromJSON(object.autoscalerSettings) : void 0, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + mountClientDependencies: isSet4(object.mountClientDependencies) ? globalThis.Boolean(object.mountClientDependencies) : false, + flashServiceUrls: globalThis.Array.isArray(object?.flashServiceUrls) ? object.flashServiceUrls.map((e) => globalThis.String(e)) : [], + flashServiceLabel: isSet4(object.flashServiceLabel) ? globalThis.String(object.flashServiceLabel) : "", + enableGpuSnapshot: isSet4(object.enableGpuSnapshot) ? globalThis.Boolean(object.enableGpuSnapshot) : false, + startupTimeoutSecs: isSet4(object.startupTimeoutSecs) ? globalThis.Number(object.startupTimeoutSecs) : 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.functionSerialized.length !== 0) { + obj.functionSerialized = base64FromBytes(message.functionSerialized); + } + if (message.definitionType !== 0) { + obj.definitionType = function_DefinitionTypeToJSON(message.definitionType); + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.rateLimit !== void 0) { + obj.rateLimit = RateLimit.toJSON(message.rateLimit); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.sharedVolumeMounts?.length) { + obj.sharedVolumeMounts = message.sharedVolumeMounts.map((e) => SharedVolumeMount.toJSON(e)); + } + if (message.proxyId !== void 0) { + obj.proxyId = message.proxyId; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.concurrencyLimit !== 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.classSerialized.length !== 0) { + obj.classSerialized = base64FromBytes(message.classSerialized); + } + if (message.taskIdleTimeoutSecs !== 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.cloudProvider !== void 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + if (message.warmPoolSize !== 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.maxConcurrentInputs !== 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.isBuilderFunction !== false) { + obj.isBuilderFunction = message.isBuilderFunction; + } + if (message.isAutoSnapshot !== false) { + obj.isAutoSnapshot = message.isAutoSnapshot; + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.isCheckpointingFunction !== false) { + obj.isCheckpointingFunction = message.isCheckpointingFunction; + } + if (message.checkpointingEnabled !== false) { + obj.checkpointingEnabled = message.checkpointingEnabled; + } + if (message.checkpoint !== void 0) { + obj.checkpoint = CheckpointInfo.toJSON(message.checkpoint); + } + if (message.objectDependencies?.length) { + obj.objectDependencies = message.objectDependencies.map((e) => ObjectDependency.toJSON(e)); + } + if (message.blockNetwork !== false) { + obj.blockNetwork = message.blockNetwork; + } + if (message.maxInputs !== 0) { + obj.maxInputs = Math.round(message.maxInputs); + } + if (message.s3Mounts?.length) { + obj.s3Mounts = message.s3Mounts.map((e) => S3Mount.toJSON(e)); + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.isClass !== false) { + obj.isClass = message.isClass; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.batchMaxSize !== 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + if (message.i6pnEnabled !== false) { + obj.i6pnEnabled = message.i6pnEnabled; + } + if (message.ExperimentalConcurrentCancellations !== false) { + obj.ExperimentalConcurrentCancellations = message.ExperimentalConcurrentCancellations; + } + if (message.targetConcurrentInputs !== 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.ExperimentalTaskTemplatesEnabled !== false) { + obj.ExperimentalTaskTemplatesEnabled = message.ExperimentalTaskTemplatesEnabled; + } + if (message.ExperimentalTaskTemplates?.length) { + obj.ExperimentalTaskTemplates = message.ExperimentalTaskTemplates.map((e) => TaskTemplate.toJSON(e)); + } + if (message.ExperimentalGroupSize !== 0) { + obj.ExperimentalGroupSize = Math.round(message.ExperimentalGroupSize); + } + if (message.untrusted !== false) { + obj.untrusted = message.untrusted; + } + if (message.ExperimentalBufferContainers !== 0) { + obj.ExperimentalBufferContainers = Math.round(message.ExperimentalBufferContainers); + } + if (message.ExperimentalProxyIp !== void 0) { + obj.ExperimentalProxyIp = message.ExperimentalProxyIp; + } + if (message.runtimePerfRecord !== false) { + obj.runtimePerfRecord = message.runtimePerfRecord; + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.snapshotDebug !== false) { + obj.snapshotDebug = message.snapshotDebug; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.methodDefinitionsSet !== false) { + obj.methodDefinitionsSet = message.methodDefinitionsSet; + } + if (message.ExperimentalCustomScaling !== false) { + obj.ExperimentalCustomScaling = message.ExperimentalCustomScaling; + } + if (message.cloudProviderStr !== "") { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + obj.ExperimentalEnableGpuSnapshot = message.ExperimentalEnableGpuSnapshot; + } + if (message.autoscalerSettings !== void 0) { + obj.autoscalerSettings = AutoscalerSettings.toJSON(message.autoscalerSettings); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.mountClientDependencies !== false) { + obj.mountClientDependencies = message.mountClientDependencies; + } + if (message.flashServiceUrls?.length) { + obj.flashServiceUrls = message.flashServiceUrls; + } + if (message.flashServiceLabel !== "") { + obj.flashServiceLabel = message.flashServiceLabel; + } + if (message.enableGpuSnapshot !== false) { + obj.enableGpuSnapshot = message.enableGpuSnapshot; + } + if (message.startupTimeoutSecs !== 0) { + obj.startupTimeoutSecs = Math.round(message.startupTimeoutSecs); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMessage(); + message.moduleName = object.moduleName ?? ""; + message.functionName = object.functionName ?? ""; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.imageId = object.imageId ?? ""; + message.functionSerialized = object.functionSerialized ?? new Uint8Array(0); + message.definitionType = object.definitionType ?? 0; + message.functionType = object.functionType ?? 0; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.rateLimit = object.rateLimit !== void 0 && object.rateLimit !== null ? RateLimit.fromPartial(object.rateLimit) : void 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.sharedVolumeMounts = object.sharedVolumeMounts?.map((e) => SharedVolumeMount.fromPartial(e)) || []; + message.proxyId = object.proxyId ?? void 0; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.concurrencyLimit = object.concurrencyLimit ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.classSerialized = object.classSerialized ?? new Uint8Array(0); + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? 0; + message.cloudProvider = object.cloudProvider ?? void 0; + message.warmPoolSize = object.warmPoolSize ?? 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.runtime = object.runtime ?? ""; + message.appName = object.appName ?? ""; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.workerId = object.workerId ?? ""; + message.runtimeDebug = object.runtimeDebug ?? false; + message.isBuilderFunction = object.isBuilderFunction ?? false; + message.isAutoSnapshot = object.isAutoSnapshot ?? false; + message.isMethod = object.isMethod ?? false; + message.isCheckpointingFunction = object.isCheckpointingFunction ?? false; + message.checkpointingEnabled = object.checkpointingEnabled ?? false; + message.checkpoint = object.checkpoint !== void 0 && object.checkpoint !== null ? CheckpointInfo.fromPartial(object.checkpoint) : void 0; + message.objectDependencies = object.objectDependencies?.map((e) => ObjectDependency.fromPartial(e)) || []; + message.blockNetwork = object.blockNetwork ?? false; + message.maxInputs = object.maxInputs ?? 0; + message.s3Mounts = object.s3Mounts?.map((e) => S3Mount.fromPartial(e)) || []; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.isClass = object.isClass ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.batchMaxSize = object.batchMaxSize ?? 0; + message.batchLingerMs = object.batchLingerMs ?? 0; + message.i6pnEnabled = object.i6pnEnabled ?? false; + message.ExperimentalConcurrentCancellations = object.ExperimentalConcurrentCancellations ?? false; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? 0; + message.ExperimentalTaskTemplatesEnabled = object.ExperimentalTaskTemplatesEnabled ?? false; + message.ExperimentalTaskTemplates = object.ExperimentalTaskTemplates?.map((e) => TaskTemplate.fromPartial(e)) || []; + message.ExperimentalGroupSize = object.ExperimentalGroupSize ?? 0; + message.untrusted = object.untrusted ?? false; + message.ExperimentalBufferContainers = object.ExperimentalBufferContainers ?? 0; + message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0; + message.runtimePerfRecord = object.runtimePerfRecord ?? false; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.snapshotDebug = object.snapshotDebug ?? false; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.methodDefinitionsSet = object.methodDefinitionsSet ?? false; + message.ExperimentalCustomScaling = object.ExperimentalCustomScaling ?? false; + message.cloudProviderStr = object.cloudProviderStr ?? ""; + message.ExperimentalEnableGpuSnapshot = object.ExperimentalEnableGpuSnapshot ?? false; + message.autoscalerSettings = object.autoscalerSettings !== void 0 && object.autoscalerSettings !== null ? AutoscalerSettings.fromPartial(object.autoscalerSettings) : void 0; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.mountClientDependencies = object.mountClientDependencies ?? false; + message.flashServiceUrls = object.flashServiceUrls?.map((e) => e) || []; + message.flashServiceLabel = object.flashServiceLabel ?? ""; + message.enableGpuSnapshot = object.enableGpuSnapshot ?? false; + message.startupTimeoutSecs = object.startupTimeoutSecs ?? 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunction_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var Function_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunction_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return Function_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunction_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunction_ExperimentalOptionsEntry() { + return { key: "", value: "" }; +} +var Function_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunction_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Function_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunction_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseFunctionAsyncInvokeRequest() { + return { functionId: "", parentInputId: "", input: void 0 }; +} +var FunctionAsyncInvokeRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionAsyncInvokeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + return obj; + }, + create(base) { + return FunctionAsyncInvokeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionAsyncInvokeRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseFunctionAsyncInvokeResponse() { + return { retryWithBlobUpload: false, functionCallId: "" }; +} +var FunctionAsyncInvokeResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.retryWithBlobUpload !== false) { + writer.uint32(8).bool(message.retryWithBlobUpload); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionAsyncInvokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.retryWithBlobUpload = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + retryWithBlobUpload: isSet4(object.retryWithBlobUpload) ? globalThis.Boolean(object.retryWithBlobUpload) : false, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.retryWithBlobUpload !== false) { + obj.retryWithBlobUpload = message.retryWithBlobUpload; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionAsyncInvokeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionAsyncInvokeResponse(); + message.retryWithBlobUpload = object.retryWithBlobUpload ?? false; + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionBindParamsRequest() { + return { + functionId: "", + serializedParams: new Uint8Array(0), + functionOptions: void 0, + environmentName: "", + authSecret: "" + }; +} +var FunctionBindParamsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.serializedParams.length !== 0) { + writer.uint32(18).bytes(message.serializedParams); + } + if (message.functionOptions !== void 0) { + FunctionOptions.encode(message.functionOptions, writer.uint32(26).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.authSecret !== "") { + writer.uint32(42).string(message.authSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionBindParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.serializedParams = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionOptions = FunctionOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.authSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + serializedParams: isSet4(object.serializedParams) ? bytesFromBase64(object.serializedParams) : new Uint8Array(0), + functionOptions: isSet4(object.functionOptions) ? FunctionOptions.fromJSON(object.functionOptions) : void 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + authSecret: isSet4(object.authSecret) ? globalThis.String(object.authSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.serializedParams.length !== 0) { + obj.serializedParams = base64FromBytes(message.serializedParams); + } + if (message.functionOptions !== void 0) { + obj.functionOptions = FunctionOptions.toJSON(message.functionOptions); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.authSecret !== "") { + obj.authSecret = message.authSecret; + } + return obj; + }, + create(base) { + return FunctionBindParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionBindParamsRequest(); + message.functionId = object.functionId ?? ""; + message.serializedParams = object.serializedParams ?? new Uint8Array(0); + message.functionOptions = object.functionOptions !== void 0 && object.functionOptions !== null ? FunctionOptions.fromPartial(object.functionOptions) : void 0; + message.environmentName = object.environmentName ?? ""; + message.authSecret = object.authSecret ?? ""; + return message; + } +}; +function createBaseFunctionBindParamsResponse() { + return { boundFunctionId: "", handleMetadata: void 0 }; +} +var FunctionBindParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.boundFunctionId !== "") { + writer.uint32(10).string(message.boundFunctionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionBindParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.boundFunctionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + boundFunctionId: isSet4(object.boundFunctionId) ? globalThis.String(object.boundFunctionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.boundFunctionId !== "") { + obj.boundFunctionId = message.boundFunctionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return FunctionBindParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionBindParamsResponse(); + message.boundFunctionId = object.boundFunctionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseFunctionCallCallGraphInfo() { + return { functionCallId: "", parentInputId: "", functionName: "", moduleName: "" }; +} +var FunctionCallCallGraphInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.functionName !== "") { + writer.uint32(26).string(message.functionName); + } + if (message.moduleName !== "") { + writer.uint32(34).string(message.moduleName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallCallGraphInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.moduleName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + create(base) { + return FunctionCallCallGraphInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallCallGraphInfo(); + message.functionCallId = object.functionCallId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.functionName = object.functionName ?? ""; + message.moduleName = object.moduleName ?? ""; + return message; + } +}; +function createBaseFunctionCallCancelRequest() { + return { functionCallId: "", terminateContainers: false, functionId: void 0 }; +} +var FunctionCallCancelRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.terminateContainers !== false) { + writer.uint32(16).bool(message.terminateContainers); + } + if (message.functionId !== void 0) { + writer.uint32(26).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallCancelRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.terminateContainers = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + terminateContainers: isSet4(object.terminateContainers) ? globalThis.Boolean(object.terminateContainers) : false, + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.terminateContainers !== false) { + obj.terminateContainers = message.terminateContainers; + } + if (message.functionId !== void 0) { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionCallCancelRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallCancelRequest(); + message.functionCallId = object.functionCallId ?? ""; + message.terminateContainers = object.terminateContainers ?? false; + message.functionId = object.functionId ?? void 0; + return message; + } +}; +function createBaseFunctionCallFromIdRequest() { + return { functionCallId: "" }; +} +var FunctionCallFromIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallFromIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionCallFromIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallFromIdRequest(); + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionCallFromIdResponse() { + return { functionCallId: "", numInputs: 0 }; +} +var FunctionCallFromIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.numInputs !== 0) { + writer.uint32(16).int32(message.numInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallFromIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.numInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + numInputs: isSet4(object.numInputs) ? globalThis.Number(object.numInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.numInputs !== 0) { + obj.numInputs = Math.round(message.numInputs); + } + return obj; + }, + create(base) { + return FunctionCallFromIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallFromIdResponse(); + message.functionCallId = object.functionCallId ?? ""; + message.numInputs = object.numInputs ?? 0; + return message; + } +}; +function createBaseFunctionCallGetDataRequest() { + return { functionCallId: void 0, attemptToken: void 0, lastIndex: 0 }; +} +var FunctionCallGetDataRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.attemptToken !== void 0) { + writer.uint32(26).string(message.attemptToken); + } + if (message.lastIndex !== 0) { + writer.uint32(16).uint64(message.lastIndex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallGetDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.lastIndex = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0, + lastIndex: isSet4(object.lastIndex) ? globalThis.Number(object.lastIndex) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + if (message.lastIndex !== 0) { + obj.lastIndex = Math.round(message.lastIndex); + } + return obj; + }, + create(base) { + return FunctionCallGetDataRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallGetDataRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.attemptToken = object.attemptToken ?? void 0; + message.lastIndex = object.lastIndex ?? 0; + return message; + } +}; +function createBaseFunctionCallInfo() { + return { + functionCallId: "", + idx: 0, + createdAt: 0, + scheduledAt: 0, + pendingInputs: void 0, + failedInputs: void 0, + succeededInputs: void 0, + timeoutInputs: void 0, + cancelledInputs: void 0, + totalInputs: 0 + }; +} +var FunctionCallInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.createdAt !== 0) { + writer.uint32(49).double(message.createdAt); + } + if (message.scheduledAt !== 0) { + writer.uint32(57).double(message.scheduledAt); + } + if (message.pendingInputs !== void 0) { + InputCategoryInfo.encode(message.pendingInputs, writer.uint32(98).fork()).join(); + } + if (message.failedInputs !== void 0) { + InputCategoryInfo.encode(message.failedInputs, writer.uint32(106).fork()).join(); + } + if (message.succeededInputs !== void 0) { + InputCategoryInfo.encode(message.succeededInputs, writer.uint32(114).fork()).join(); + } + if (message.timeoutInputs !== void 0) { + InputCategoryInfo.encode(message.timeoutInputs, writer.uint32(122).fork()).join(); + } + if (message.cancelledInputs !== void 0) { + InputCategoryInfo.encode(message.cancelledInputs, writer.uint32(130).fork()).join(); + } + if (message.totalInputs !== 0) { + writer.uint32(136).int32(message.totalInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.scheduledAt = reader.double(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.pendingInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.failedInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.succeededInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.timeoutInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.cancelledInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.totalInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + scheduledAt: isSet4(object.scheduledAt) ? globalThis.Number(object.scheduledAt) : 0, + pendingInputs: isSet4(object.pendingInputs) ? InputCategoryInfo.fromJSON(object.pendingInputs) : void 0, + failedInputs: isSet4(object.failedInputs) ? InputCategoryInfo.fromJSON(object.failedInputs) : void 0, + succeededInputs: isSet4(object.succeededInputs) ? InputCategoryInfo.fromJSON(object.succeededInputs) : void 0, + timeoutInputs: isSet4(object.timeoutInputs) ? InputCategoryInfo.fromJSON(object.timeoutInputs) : void 0, + cancelledInputs: isSet4(object.cancelledInputs) ? InputCategoryInfo.fromJSON(object.cancelledInputs) : void 0, + totalInputs: isSet4(object.totalInputs) ? globalThis.Number(object.totalInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.scheduledAt !== 0) { + obj.scheduledAt = message.scheduledAt; + } + if (message.pendingInputs !== void 0) { + obj.pendingInputs = InputCategoryInfo.toJSON(message.pendingInputs); + } + if (message.failedInputs !== void 0) { + obj.failedInputs = InputCategoryInfo.toJSON(message.failedInputs); + } + if (message.succeededInputs !== void 0) { + obj.succeededInputs = InputCategoryInfo.toJSON(message.succeededInputs); + } + if (message.timeoutInputs !== void 0) { + obj.timeoutInputs = InputCategoryInfo.toJSON(message.timeoutInputs); + } + if (message.cancelledInputs !== void 0) { + obj.cancelledInputs = InputCategoryInfo.toJSON(message.cancelledInputs); + } + if (message.totalInputs !== 0) { + obj.totalInputs = Math.round(message.totalInputs); + } + return obj; + }, + create(base) { + return FunctionCallInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallInfo(); + message.functionCallId = object.functionCallId ?? ""; + message.idx = object.idx ?? 0; + message.createdAt = object.createdAt ?? 0; + message.scheduledAt = object.scheduledAt ?? 0; + message.pendingInputs = object.pendingInputs !== void 0 && object.pendingInputs !== null ? InputCategoryInfo.fromPartial(object.pendingInputs) : void 0; + message.failedInputs = object.failedInputs !== void 0 && object.failedInputs !== null ? InputCategoryInfo.fromPartial(object.failedInputs) : void 0; + message.succeededInputs = object.succeededInputs !== void 0 && object.succeededInputs !== null ? InputCategoryInfo.fromPartial(object.succeededInputs) : void 0; + message.timeoutInputs = object.timeoutInputs !== void 0 && object.timeoutInputs !== null ? InputCategoryInfo.fromPartial(object.timeoutInputs) : void 0; + message.cancelledInputs = object.cancelledInputs !== void 0 && object.cancelledInputs !== null ? InputCategoryInfo.fromPartial(object.cancelledInputs) : void 0; + message.totalInputs = object.totalInputs ?? 0; + return message; + } +}; +function createBaseFunctionCallListRequest() { + return { functionId: "" }; +} +var FunctionCallListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionCallListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallListRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionCallListResponse() { + return { functionCalls: [] }; +} +var FunctionCallListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.functionCalls) { + FunctionCallInfo.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCalls.push(FunctionCallInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCalls: globalThis.Array.isArray(object?.functionCalls) ? object.functionCalls.map((e) => FunctionCallInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCalls?.length) { + obj.functionCalls = message.functionCalls.map((e) => FunctionCallInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCallListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallListResponse(); + message.functionCalls = object.functionCalls?.map((e) => FunctionCallInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionCallPutDataRequest() { + return { functionCallId: void 0, attemptToken: void 0, dataChunks: [] }; +} +var FunctionCallPutDataRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.attemptToken !== void 0) { + writer.uint32(26).string(message.attemptToken); + } + for (const v of message.dataChunks) { + DataChunk.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallPutDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataChunks.push(DataChunk.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0, + dataChunks: globalThis.Array.isArray(object?.dataChunks) ? object.dataChunks.map((e) => DataChunk.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + if (message.dataChunks?.length) { + obj.dataChunks = message.dataChunks.map((e) => DataChunk.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCallPutDataRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallPutDataRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.attemptToken = object.attemptToken ?? void 0; + message.dataChunks = object.dataChunks?.map((e) => DataChunk.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionCreateRequest() { + return { function: void 0, appId: "", schedule: void 0, existingFunctionId: "", functionData: void 0 }; +} +var FunctionCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(10).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(18).string(message.appId); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(50).fork()).join(); + } + if (message.existingFunctionId !== "") { + writer.uint32(58).string(message.existingFunctionId); + } + if (message.functionData !== void 0) { + FunctionData.encode(message.functionData, writer.uint32(74).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.existingFunctionId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionData = FunctionData.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + existingFunctionId: isSet4(object.existingFunctionId) ? globalThis.String(object.existingFunctionId) : "", + functionData: isSet4(object.functionData) ? FunctionData.fromJSON(object.functionData) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.existingFunctionId !== "") { + obj.existingFunctionId = message.existingFunctionId; + } + if (message.functionData !== void 0) { + obj.functionData = FunctionData.toJSON(message.functionData); + } + return obj; + }, + create(base) { + return FunctionCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCreateRequest(); + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + message.appId = object.appId ?? ""; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.existingFunctionId = object.existingFunctionId ?? ""; + message.functionData = object.functionData !== void 0 && object.functionData !== null ? FunctionData.fromPartial(object.functionData) : void 0; + return message; + } +}; +function createBaseFunctionCreateResponse() { + return { functionId: "", DeprecatedWebUrl: "", function: void 0, handleMetadata: void 0, serverWarnings: [] }; +} +var FunctionCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.DeprecatedWebUrl !== "") { + writer.uint32(18).string(message.DeprecatedWebUrl); + } + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(34).fork()).join(); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(42).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.DeprecatedWebUrl = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + DeprecatedWebUrl: isSet4(object.DeprecatedWebUrl) ? globalThis.String(object.DeprecatedWebUrl) : "", + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0, + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.DeprecatedWebUrl !== "") { + obj.DeprecatedWebUrl = message.DeprecatedWebUrl; + } + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCreateResponse(); + message.functionId = object.functionId ?? ""; + message.DeprecatedWebUrl = object.DeprecatedWebUrl ?? ""; + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionData() { + return { + moduleName: "", + functionName: "", + functionType: 0, + warmPoolSize: 0, + concurrencyLimit: 0, + taskIdleTimeoutSecs: 0, + ExperimentalGroupSize: 0, + ExperimentalBufferContainers: 0, + ExperimentalCustomScaling: false, + ExperimentalEnableGpuSnapshot: false, + workerId: "", + timeoutSecs: 0, + webUrl: "", + webUrlInfo: void 0, + webhookConfig: void 0, + customDomainInfo: [], + ExperimentalProxyIp: void 0, + methodDefinitions: {}, + methodDefinitionsSet: false, + isClass: false, + classParameterInfo: void 0, + isMethod: false, + useFunctionId: "", + useMethodName: "", + rankedFunctions: [], + schedule: void 0, + untrusted: false, + snapshotDebug: false, + runtimePerfRecord: false, + autoscalerSettings: void 0, + functionSchema: void 0, + experimentalOptions: {}, + flashServiceUrls: [], + flashServiceLabel: "", + startupTimeoutSecs: 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionData = { + encode(message, writer = new BinaryWriter()) { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(24).int32(message.functionType); + } + if (message.warmPoolSize !== 0) { + writer.uint32(32).uint32(message.warmPoolSize); + } + if (message.concurrencyLimit !== 0) { + writer.uint32(40).uint32(message.concurrencyLimit); + } + if (message.taskIdleTimeoutSecs !== 0) { + writer.uint32(48).uint32(message.taskIdleTimeoutSecs); + } + if (message.ExperimentalGroupSize !== 0) { + writer.uint32(152).uint32(message.ExperimentalGroupSize); + } + if (message.ExperimentalBufferContainers !== 0) { + writer.uint32(176).uint32(message.ExperimentalBufferContainers); + } + if (message.ExperimentalCustomScaling !== false) { + writer.uint32(184).bool(message.ExperimentalCustomScaling); + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + writer.uint32(240).bool(message.ExperimentalEnableGpuSnapshot); + } + if (message.workerId !== "") { + writer.uint32(58).string(message.workerId); + } + if (message.timeoutSecs !== 0) { + writer.uint32(64).uint32(message.timeoutSecs); + } + if (message.webUrl !== "") { + writer.uint32(74).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(82).fork()).join(); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(90).fork()).join(); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(98).fork()).join(); + } + if (message.ExperimentalProxyIp !== void 0) { + writer.uint32(194).string(message.ExperimentalProxyIp); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + FunctionData_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(202).fork()).join(); + }); + if (message.methodDefinitionsSet !== false) { + writer.uint32(208).bool(message.methodDefinitionsSet); + } + if (message.isClass !== false) { + writer.uint32(104).bool(message.isClass); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(114).fork()).join(); + } + if (message.isMethod !== false) { + writer.uint32(120).bool(message.isMethod); + } + if (message.useFunctionId !== "") { + writer.uint32(130).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(138).string(message.useMethodName); + } + for (const v of message.rankedFunctions) { + FunctionData_RankedFunction.encode(v, writer.uint32(146).fork()).join(); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(162).fork()).join(); + } + if (message.untrusted !== false) { + writer.uint32(216).bool(message.untrusted); + } + if (message.snapshotDebug !== false) { + writer.uint32(224).bool(message.snapshotDebug); + } + if (message.runtimePerfRecord !== false) { + writer.uint32(232).bool(message.runtimePerfRecord); + } + if (message.autoscalerSettings !== void 0) { + AutoscalerSettings.encode(message.autoscalerSettings, writer.uint32(250).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(258).fork()).join(); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + FunctionData_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(266).fork()).join(); + }); + for (const v of message.flashServiceUrls) { + writer.uint32(274).string(v); + } + if (message.flashServiceLabel !== "") { + writer.uint32(282).string(message.flashServiceLabel); + } + if (message.startupTimeoutSecs !== 0) { + writer.uint32(288).uint32(message.startupTimeoutSecs); + } + writer.uint32(298).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(306).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.moduleName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.ExperimentalGroupSize = reader.uint32(); + continue; + } + case 22: { + if (tag !== 176) { + break; + } + message.ExperimentalBufferContainers = reader.uint32(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + message.ExperimentalCustomScaling = reader.bool(); + continue; + } + case 30: { + if (tag !== 240) { + break; + } + message.ExperimentalEnableGpuSnapshot = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.workerId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + message.ExperimentalProxyIp = reader.string(); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + const entry25 = FunctionData_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry25.value !== void 0) { + message.methodDefinitions[entry25.key] = entry25.value; + } + continue; + } + case 26: { + if (tag !== 208) { + break; + } + message.methodDefinitionsSet = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.isClass = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.rankedFunctions.push(FunctionData_RankedFunction.decode(reader, reader.uint32())); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.untrusted = reader.bool(); + continue; + } + case 28: { + if (tag !== 224) { + break; + } + message.snapshotDebug = reader.bool(); + continue; + } + case 29: { + if (tag !== 232) { + break; + } + message.runtimePerfRecord = reader.bool(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + message.autoscalerSettings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + case 32: { + if (tag !== 258) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 266) { + break; + } + const entry33 = FunctionData_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry33.value !== void 0) { + message.experimentalOptions[entry33.key] = entry33.value; + } + continue; + } + case 34: { + if (tag !== 274) { + break; + } + message.flashServiceUrls.push(reader.string()); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.flashServiceLabel = reader.string(); + continue; + } + case 36: { + if (tag !== 288) { + break; + } + message.startupTimeoutSecs = reader.uint32(); + continue; + } + case 37: { + if (tag === 296) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 298) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 38: { + if (tag === 304) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 306) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : 0, + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : 0, + ExperimentalGroupSize: isSet4(object.ExperimentalGroupSize) ? globalThis.Number(object.ExperimentalGroupSize) : 0, + ExperimentalBufferContainers: isSet4(object.ExperimentalBufferContainers) ? globalThis.Number(object.ExperimentalBufferContainers) : 0, + ExperimentalCustomScaling: isSet4(object.ExperimentalCustomScaling) ? globalThis.Boolean(object.ExperimentalCustomScaling) : false, + ExperimentalEnableGpuSnapshot: isSet4(object.ExperimentalEnableGpuSnapshot) ? globalThis.Boolean(object.ExperimentalEnableGpuSnapshot) : false, + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + ExperimentalProxyIp: isSet4(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0, + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + methodDefinitionsSet: isSet4(object.methodDefinitionsSet) ? globalThis.Boolean(object.methodDefinitionsSet) : false, + isClass: isSet4(object.isClass) ? globalThis.Boolean(object.isClass) : false, + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + rankedFunctions: globalThis.Array.isArray(object?.rankedFunctions) ? object.rankedFunctions.map((e) => FunctionData_RankedFunction.fromJSON(e)) : [], + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + untrusted: isSet4(object.untrusted) ? globalThis.Boolean(object.untrusted) : false, + snapshotDebug: isSet4(object.snapshotDebug) ? globalThis.Boolean(object.snapshotDebug) : false, + runtimePerfRecord: isSet4(object.runtimePerfRecord) ? globalThis.Boolean(object.runtimePerfRecord) : false, + autoscalerSettings: isSet4(object.autoscalerSettings) ? AutoscalerSettings.fromJSON(object.autoscalerSettings) : void 0, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + flashServiceUrls: globalThis.Array.isArray(object?.flashServiceUrls) ? object.flashServiceUrls.map((e) => globalThis.String(e)) : [], + flashServiceLabel: isSet4(object.flashServiceLabel) ? globalThis.String(object.flashServiceLabel) : "", + startupTimeoutSecs: isSet4(object.startupTimeoutSecs) ? globalThis.Number(object.startupTimeoutSecs) : 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.warmPoolSize !== 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.concurrencyLimit !== 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.taskIdleTimeoutSecs !== 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.ExperimentalGroupSize !== 0) { + obj.ExperimentalGroupSize = Math.round(message.ExperimentalGroupSize); + } + if (message.ExperimentalBufferContainers !== 0) { + obj.ExperimentalBufferContainers = Math.round(message.ExperimentalBufferContainers); + } + if (message.ExperimentalCustomScaling !== false) { + obj.ExperimentalCustomScaling = message.ExperimentalCustomScaling; + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + obj.ExperimentalEnableGpuSnapshot = message.ExperimentalEnableGpuSnapshot; + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.ExperimentalProxyIp !== void 0) { + obj.ExperimentalProxyIp = message.ExperimentalProxyIp; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.methodDefinitionsSet !== false) { + obj.methodDefinitionsSet = message.methodDefinitionsSet; + } + if (message.isClass !== false) { + obj.isClass = message.isClass; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.rankedFunctions?.length) { + obj.rankedFunctions = message.rankedFunctions.map((e) => FunctionData_RankedFunction.toJSON(e)); + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.untrusted !== false) { + obj.untrusted = message.untrusted; + } + if (message.snapshotDebug !== false) { + obj.snapshotDebug = message.snapshotDebug; + } + if (message.runtimePerfRecord !== false) { + obj.runtimePerfRecord = message.runtimePerfRecord; + } + if (message.autoscalerSettings !== void 0) { + obj.autoscalerSettings = AutoscalerSettings.toJSON(message.autoscalerSettings); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.flashServiceUrls?.length) { + obj.flashServiceUrls = message.flashServiceUrls; + } + if (message.flashServiceLabel !== "") { + obj.flashServiceLabel = message.flashServiceLabel; + } + if (message.startupTimeoutSecs !== 0) { + obj.startupTimeoutSecs = Math.round(message.startupTimeoutSecs); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData(); + message.moduleName = object.moduleName ?? ""; + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.warmPoolSize = object.warmPoolSize ?? 0; + message.concurrencyLimit = object.concurrencyLimit ?? 0; + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? 0; + message.ExperimentalGroupSize = object.ExperimentalGroupSize ?? 0; + message.ExperimentalBufferContainers = object.ExperimentalBufferContainers ?? 0; + message.ExperimentalCustomScaling = object.ExperimentalCustomScaling ?? false; + message.ExperimentalEnableGpuSnapshot = object.ExperimentalEnableGpuSnapshot ?? false; + message.workerId = object.workerId ?? ""; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.methodDefinitionsSet = object.methodDefinitionsSet ?? false; + message.isClass = object.isClass ?? false; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.isMethod = object.isMethod ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.rankedFunctions = object.rankedFunctions?.map((e) => FunctionData_RankedFunction.fromPartial(e)) || []; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.untrusted = object.untrusted ?? false; + message.snapshotDebug = object.snapshotDebug ?? false; + message.runtimePerfRecord = object.runtimePerfRecord ?? false; + message.autoscalerSettings = object.autoscalerSettings !== void 0 && object.autoscalerSettings !== null ? AutoscalerSettings.fromPartial(object.autoscalerSettings) : void 0; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.flashServiceUrls = object.flashServiceUrls?.map((e) => e) || []; + message.flashServiceLabel = object.flashServiceLabel ?? ""; + message.startupTimeoutSecs = object.startupTimeoutSecs ?? 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionData_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var FunctionData_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionData_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionData_RankedFunction() { + return { rank: 0, function: void 0 }; +} +var FunctionData_RankedFunction = { + encode(message, writer = new BinaryWriter()) { + if (message.rank !== 0) { + writer.uint32(8).uint32(message.rank); + } + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_RankedFunction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.rank = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rank: isSet4(object.rank) ? globalThis.Number(object.rank) : 0, + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.rank !== 0) { + obj.rank = Math.round(message.rank); + } + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + return obj; + }, + create(base) { + return FunctionData_RankedFunction.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_RankedFunction(); + message.rank = object.rank ?? 0; + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + return message; + } +}; +function createBaseFunctionData_ExperimentalOptionsEntry() { + return { key: "", value: "" }; +} +var FunctionData_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return FunctionData_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseFunctionFinishInputsRequest() { + return { functionId: "", functionCallId: "", numInputs: 0 }; +} +var FunctionFinishInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + if (message.numInputs !== 0) { + writer.uint32(24).uint32(message.numInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionFinishInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numInputs = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + numInputs: isSet4(object.numInputs) ? globalThis.Number(object.numInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.numInputs !== 0) { + obj.numInputs = Math.round(message.numInputs); + } + return obj; + }, + create(base) { + return FunctionFinishInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionFinishInputsRequest(); + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.numInputs = object.numInputs ?? 0; + return message; + } +}; +function createBaseFunctionGetCallGraphRequest() { + return { functionCallId: "" }; +} +var FunctionGetCallGraphRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCallGraphRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionGetCallGraphRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCallGraphRequest(); + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionGetCallGraphResponse() { + return { inputs: [], functionCalls: [] }; +} +var FunctionGetCallGraphResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + InputCallGraphInfo.encode(v, writer.uint32(10).fork()).join(); + } + for (const v of message.functionCalls) { + FunctionCallCallGraphInfo.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCallGraphResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputs.push(InputCallGraphInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCalls.push(FunctionCallCallGraphInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => InputCallGraphInfo.fromJSON(e)) : [], + functionCalls: globalThis.Array.isArray(object?.functionCalls) ? object.functionCalls.map((e) => FunctionCallCallGraphInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => InputCallGraphInfo.toJSON(e)); + } + if (message.functionCalls?.length) { + obj.functionCalls = message.functionCalls.map((e) => FunctionCallCallGraphInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionGetCallGraphResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCallGraphResponse(); + message.inputs = object.inputs?.map((e) => InputCallGraphInfo.fromPartial(e)) || []; + message.functionCalls = object.functionCalls?.map((e) => FunctionCallCallGraphInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionGetCurrentStatsRequest() { + return { functionId: "" }; +} +var FunctionGetCurrentStatsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCurrentStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionGetCurrentStatsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCurrentStatsRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionGetDynamicConcurrencyRequest() { + return { functionId: "", targetConcurrency: 0, maxConcurrency: 0 }; +} +var FunctionGetDynamicConcurrencyRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.targetConcurrency !== 0) { + writer.uint32(16).uint32(message.targetConcurrency); + } + if (message.maxConcurrency !== 0) { + writer.uint32(24).uint32(message.maxConcurrency); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetDynamicConcurrencyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.targetConcurrency = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxConcurrency = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + targetConcurrency: isSet4(object.targetConcurrency) ? globalThis.Number(object.targetConcurrency) : 0, + maxConcurrency: isSet4(object.maxConcurrency) ? globalThis.Number(object.maxConcurrency) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.targetConcurrency !== 0) { + obj.targetConcurrency = Math.round(message.targetConcurrency); + } + if (message.maxConcurrency !== 0) { + obj.maxConcurrency = Math.round(message.maxConcurrency); + } + return obj; + }, + create(base) { + return FunctionGetDynamicConcurrencyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetDynamicConcurrencyRequest(); + message.functionId = object.functionId ?? ""; + message.targetConcurrency = object.targetConcurrency ?? 0; + message.maxConcurrency = object.maxConcurrency ?? 0; + return message; + } +}; +function createBaseFunctionGetDynamicConcurrencyResponse() { + return { concurrency: 0 }; +} +var FunctionGetDynamicConcurrencyResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.concurrency !== 0) { + writer.uint32(8).uint32(message.concurrency); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetDynamicConcurrencyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.concurrency = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { concurrency: isSet4(object.concurrency) ? globalThis.Number(object.concurrency) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.concurrency !== 0) { + obj.concurrency = Math.round(message.concurrency); + } + return obj; + }, + create(base) { + return FunctionGetDynamicConcurrencyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetDynamicConcurrencyResponse(); + message.concurrency = object.concurrency ?? 0; + return message; + } +}; +function createBaseFunctionGetInputsItem() { + return { + inputId: "", + input: void 0, + killSwitch: false, + functionCallId: "", + functionCallInvocationType: 0, + retryCount: 0, + functionMapIdx: void 0, + attemptToken: "" + }; +} +var FunctionGetInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.killSwitch !== false) { + writer.uint32(24).bool(message.killSwitch); + } + if (message.functionCallId !== "") { + writer.uint32(42).string(message.functionCallId); + } + if (message.functionCallInvocationType !== 0) { + writer.uint32(48).int32(message.functionCallInvocationType); + } + if (message.retryCount !== 0) { + writer.uint32(56).uint32(message.retryCount); + } + if (message.functionMapIdx !== void 0) { + writer.uint32(64).int32(message.functionMapIdx); + } + if (message.attemptToken !== "") { + writer.uint32(74).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.killSwitch = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.functionCallInvocationType = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionMapIdx = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + killSwitch: isSet4(object.killSwitch) ? globalThis.Boolean(object.killSwitch) : false, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + functionCallInvocationType: isSet4(object.functionCallInvocationType) ? functionCallInvocationTypeFromJSON(object.functionCallInvocationType) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + functionMapIdx: isSet4(object.functionMapIdx) ? globalThis.Number(object.functionMapIdx) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.killSwitch !== false) { + obj.killSwitch = message.killSwitch; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.functionCallInvocationType !== 0) { + obj.functionCallInvocationType = functionCallInvocationTypeToJSON(message.functionCallInvocationType); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.functionMapIdx !== void 0) { + obj.functionMapIdx = Math.round(message.functionMapIdx); + } + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return FunctionGetInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsItem(); + message.inputId = object.inputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.killSwitch = object.killSwitch ?? false; + message.functionCallId = object.functionCallId ?? ""; + message.functionCallInvocationType = object.functionCallInvocationType ?? 0; + message.retryCount = object.retryCount ?? 0; + message.functionMapIdx = object.functionMapIdx ?? void 0; + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseFunctionGetInputsRequest() { + return { functionId: "", maxValues: 0, averageCallTime: 0, inputConcurrency: 0, batchMaxSize: 0, batchLingerMs: 0 }; +} +var FunctionGetInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.maxValues !== 0) { + writer.uint32(24).int32(message.maxValues); + } + if (message.averageCallTime !== 0) { + writer.uint32(45).float(message.averageCallTime); + } + if (message.inputConcurrency !== 0) { + writer.uint32(48).int32(message.inputConcurrency); + } + if (message.batchMaxSize !== 0) { + writer.uint32(88).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + writer.uint32(96).uint64(message.batchLingerMs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxValues = reader.int32(); + continue; + } + case 5: { + if (tag !== 45) { + break; + } + message.averageCallTime = reader.float(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.inputConcurrency = reader.int32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + maxValues: isSet4(object.maxValues) ? globalThis.Number(object.maxValues) : 0, + averageCallTime: isSet4(object.averageCallTime) ? globalThis.Number(object.averageCallTime) : 0, + inputConcurrency: isSet4(object.inputConcurrency) ? globalThis.Number(object.inputConcurrency) : 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.maxValues !== 0) { + obj.maxValues = Math.round(message.maxValues); + } + if (message.averageCallTime !== 0) { + obj.averageCallTime = message.averageCallTime; + } + if (message.inputConcurrency !== 0) { + obj.inputConcurrency = Math.round(message.inputConcurrency); + } + if (message.batchMaxSize !== 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + return obj; + }, + create(base) { + return FunctionGetInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsRequest(); + message.functionId = object.functionId ?? ""; + message.maxValues = object.maxValues ?? 0; + message.averageCallTime = object.averageCallTime ?? 0; + message.inputConcurrency = object.inputConcurrency ?? 0; + message.batchMaxSize = object.batchMaxSize ?? 0; + message.batchLingerMs = object.batchLingerMs ?? 0; + return message; + } +}; +function createBaseFunctionGetInputsResponse() { + return { inputs: [], rateLimitSleepDuration: 0 }; +} +var FunctionGetInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + FunctionGetInputsItem.encode(v, writer.uint32(26).fork()).join(); + } + if (message.rateLimitSleepDuration !== 0) { + writer.uint32(37).float(message.rateLimitSleepDuration); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.inputs.push(FunctionGetInputsItem.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.rateLimitSleepDuration = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionGetInputsItem.fromJSON(e)) : [], + rateLimitSleepDuration: isSet4(object.rateLimitSleepDuration) ? globalThis.Number(object.rateLimitSleepDuration) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionGetInputsItem.toJSON(e)); + } + if (message.rateLimitSleepDuration !== 0) { + obj.rateLimitSleepDuration = message.rateLimitSleepDuration; + } + return obj; + }, + create(base) { + return FunctionGetInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsResponse(); + message.inputs = object.inputs?.map((e) => FunctionGetInputsItem.fromPartial(e)) || []; + message.rateLimitSleepDuration = object.rateLimitSleepDuration ?? 0; + return message; + } +}; +function createBaseFunctionGetOutputsItem() { + return { + result: void 0, + idx: 0, + inputId: "", + dataFormat: 0, + taskId: "", + inputStartedAt: 0, + outputCreatedAt: 0, + retryCount: 0, + fcTraceTag: "" + }; +} +var FunctionGetOutputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.inputId !== "") { + writer.uint32(26).string(message.inputId); + } + if (message.dataFormat !== 0) { + writer.uint32(40).int32(message.dataFormat); + } + if (message.taskId !== "") { + writer.uint32(50).string(message.taskId); + } + if (message.inputStartedAt !== 0) { + writer.uint32(57).double(message.inputStartedAt); + } + if (message.outputCreatedAt !== 0) { + writer.uint32(65).double(message.outputCreatedAt); + } + if (message.retryCount !== 0) { + writer.uint32(72).uint32(message.retryCount); + } + if (message.fcTraceTag !== "") { + writer.uint32(82).string(message.fcTraceTag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.inputId = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.taskId = reader.string(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.inputStartedAt = reader.double(); + continue; + } + case 8: { + if (tag !== 65) { + break; + } + message.outputCreatedAt = reader.double(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.fcTraceTag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + inputStartedAt: isSet4(object.inputStartedAt) ? globalThis.Number(object.inputStartedAt) : 0, + outputCreatedAt: isSet4(object.outputCreatedAt) ? globalThis.Number(object.outputCreatedAt) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + fcTraceTag: isSet4(object.fcTraceTag) ? globalThis.String(object.fcTraceTag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.inputStartedAt !== 0) { + obj.inputStartedAt = message.inputStartedAt; + } + if (message.outputCreatedAt !== 0) { + obj.outputCreatedAt = message.outputCreatedAt; + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.fcTraceTag !== "") { + obj.fcTraceTag = message.fcTraceTag; + } + return obj; + }, + create(base) { + return FunctionGetOutputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsItem(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.idx = object.idx ?? 0; + message.inputId = object.inputId ?? ""; + message.dataFormat = object.dataFormat ?? 0; + message.taskId = object.taskId ?? ""; + message.inputStartedAt = object.inputStartedAt ?? 0; + message.outputCreatedAt = object.outputCreatedAt ?? 0; + message.retryCount = object.retryCount ?? 0; + message.fcTraceTag = object.fcTraceTag ?? ""; + return message; + } +}; +function createBaseFunctionGetOutputsRequest() { + return { + functionCallId: "", + maxValues: 0, + timeout: 0, + lastEntryId: "", + clearOnSuccess: false, + requestedAt: 0, + inputJwts: [], + startIdx: void 0, + endIdx: void 0 + }; +} +var FunctionGetOutputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.maxValues !== 0) { + writer.uint32(16).int32(message.maxValues); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(50).string(message.lastEntryId); + } + if (message.clearOnSuccess !== false) { + writer.uint32(56).bool(message.clearOnSuccess); + } + if (message.requestedAt !== 0) { + writer.uint32(65).double(message.requestedAt); + } + for (const v of message.inputJwts) { + writer.uint32(74).string(v); + } + if (message.startIdx !== void 0) { + writer.uint32(80).int32(message.startIdx); + } + if (message.endIdx !== void 0) { + writer.uint32(88).int32(message.endIdx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.maxValues = reader.int32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.clearOnSuccess = reader.bool(); + continue; + } + case 8: { + if (tag !== 65) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.inputJwts.push(reader.string()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.startIdx = reader.int32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.endIdx = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + maxValues: isSet4(object.maxValues) ? globalThis.Number(object.maxValues) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + clearOnSuccess: isSet4(object.clearOnSuccess) ? globalThis.Boolean(object.clearOnSuccess) : false, + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + inputJwts: globalThis.Array.isArray(object?.inputJwts) ? object.inputJwts.map((e) => globalThis.String(e)) : [], + startIdx: isSet4(object.startIdx) ? globalThis.Number(object.startIdx) : void 0, + endIdx: isSet4(object.endIdx) ? globalThis.Number(object.endIdx) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.maxValues !== 0) { + obj.maxValues = Math.round(message.maxValues); + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.clearOnSuccess !== false) { + obj.clearOnSuccess = message.clearOnSuccess; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.inputJwts?.length) { + obj.inputJwts = message.inputJwts; + } + if (message.startIdx !== void 0) { + obj.startIdx = Math.round(message.startIdx); + } + if (message.endIdx !== void 0) { + obj.endIdx = Math.round(message.endIdx); + } + return obj; + }, + create(base) { + return FunctionGetOutputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsRequest(); + message.functionCallId = object.functionCallId ?? ""; + message.maxValues = object.maxValues ?? 0; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.clearOnSuccess = object.clearOnSuccess ?? false; + message.requestedAt = object.requestedAt ?? 0; + message.inputJwts = object.inputJwts?.map((e) => e) || []; + message.startIdx = object.startIdx ?? void 0; + message.endIdx = object.endIdx ?? void 0; + return message; + } +}; +function createBaseFunctionGetOutputsResponse() { + return { idxs: [], outputs: [], lastEntryId: "", numUnfinishedInputs: 0 }; +} +var FunctionGetOutputsResponse = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(26).fork(); + for (const v of message.idxs) { + writer.int32(v); + } + writer.join(); + for (const v of message.outputs) { + FunctionGetOutputsItem.encode(v, writer.uint32(34).fork()).join(); + } + if (message.lastEntryId !== "") { + writer.uint32(42).string(message.lastEntryId); + } + if (message.numUnfinishedInputs !== 0) { + writer.uint32(48).int32(message.numUnfinishedInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag === 24) { + message.idxs.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.idxs.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.outputs.push(FunctionGetOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.numUnfinishedInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idxs: globalThis.Array.isArray(object?.idxs) ? object.idxs.map((e) => globalThis.Number(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionGetOutputsItem.fromJSON(e)) : [], + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + numUnfinishedInputs: isSet4(object.numUnfinishedInputs) ? globalThis.Number(object.numUnfinishedInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.idxs?.length) { + obj.idxs = message.idxs.map((e) => Math.round(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionGetOutputsItem.toJSON(e)); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.numUnfinishedInputs !== 0) { + obj.numUnfinishedInputs = Math.round(message.numUnfinishedInputs); + } + return obj; + }, + create(base) { + return FunctionGetOutputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsResponse(); + message.idxs = object.idxs?.map((e) => e) || []; + message.outputs = object.outputs?.map((e) => FunctionGetOutputsItem.fromPartial(e)) || []; + message.lastEntryId = object.lastEntryId ?? ""; + message.numUnfinishedInputs = object.numUnfinishedInputs ?? 0; + return message; + } +}; +function createBaseFunctionGetRequest() { + return { appName: "", objectTag: "", environmentName: "" }; +} +var FunctionGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.objectTag !== "") { + writer.uint32(18).string(message.objectTag); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.objectTag = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + objectTag: isSet4(object.objectTag) ? globalThis.String(object.objectTag) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.objectTag !== "") { + obj.objectTag = message.objectTag; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return FunctionGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetRequest(); + message.appName = object.appName ?? ""; + message.objectTag = object.objectTag ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseFunctionGetResponse() { + return { functionId: "", handleMetadata: void 0, serverWarnings: [] }; +} +var FunctionGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetResponse(); + message.functionId = object.functionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionGetSerializedRequest() { + return { functionId: "" }; +} +var FunctionGetSerializedRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetSerializedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionGetSerializedRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetSerializedRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionGetSerializedResponse() { + return { functionSerialized: new Uint8Array(0), classSerialized: new Uint8Array(0) }; +} +var FunctionGetSerializedResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionSerialized.length !== 0) { + writer.uint32(10).bytes(message.functionSerialized); + } + if (message.classSerialized.length !== 0) { + writer.uint32(18).bytes(message.classSerialized); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetSerializedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionSerialized = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classSerialized = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionSerialized: isSet4(object.functionSerialized) ? bytesFromBase64(object.functionSerialized) : new Uint8Array(0), + classSerialized: isSet4(object.classSerialized) ? bytesFromBase64(object.classSerialized) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionSerialized.length !== 0) { + obj.functionSerialized = base64FromBytes(message.functionSerialized); + } + if (message.classSerialized.length !== 0) { + obj.classSerialized = base64FromBytes(message.classSerialized); + } + return obj; + }, + create(base) { + return FunctionGetSerializedResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetSerializedResponse(); + message.functionSerialized = object.functionSerialized ?? new Uint8Array(0); + message.classSerialized = object.classSerialized ?? new Uint8Array(0); + return message; + } +}; +function createBaseFunctionHandleMetadata() { + return { + functionName: "", + functionType: 0, + webUrl: "", + isMethod: false, + useFunctionId: "", + useMethodName: "", + definitionId: "", + classParameterInfo: void 0, + methodHandleMetadata: {}, + functionSchema: void 0, + inputPlaneUrl: void 0, + inputPlaneRegion: void 0, + maxObjectSizeBytes: void 0, + ExperimentalFlashUrls: [], + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(64).int32(message.functionType); + } + if (message.webUrl !== "") { + writer.uint32(226).string(message.webUrl); + } + if (message.isMethod !== false) { + writer.uint32(312).bool(message.isMethod); + } + if (message.useFunctionId !== "") { + writer.uint32(322).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(330).string(message.useMethodName); + } + if (message.definitionId !== "") { + writer.uint32(338).string(message.definitionId); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(346).fork()).join(); + } + Object.entries(message.methodHandleMetadata).forEach(([key, value]) => { + FunctionHandleMetadata_MethodHandleMetadataEntry.encode({ key, value }, writer.uint32(354).fork()).join(); + }); + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(362).fork()).join(); + } + if (message.inputPlaneUrl !== void 0) { + writer.uint32(370).string(message.inputPlaneUrl); + } + if (message.inputPlaneRegion !== void 0) { + writer.uint32(378).string(message.inputPlaneRegion); + } + if (message.maxObjectSizeBytes !== void 0) { + writer.uint32(384).uint64(message.maxObjectSizeBytes); + } + for (const v of message.ExperimentalFlashUrls) { + writer.uint32(394).string(v); + } + writer.uint32(402).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(410).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 39: { + if (tag !== 312) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 42: { + if (tag !== 338) { + break; + } + message.definitionId = reader.string(); + continue; + } + case 43: { + if (tag !== 346) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + const entry44 = FunctionHandleMetadata_MethodHandleMetadataEntry.decode(reader, reader.uint32()); + if (entry44.value !== void 0) { + message.methodHandleMetadata[entry44.key] = entry44.value; + } + continue; + } + case 45: { + if (tag !== 362) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 46: { + if (tag !== 370) { + break; + } + message.inputPlaneUrl = reader.string(); + continue; + } + case 47: { + if (tag !== 378) { + break; + } + message.inputPlaneRegion = reader.string(); + continue; + } + case 48: { + if (tag !== 384) { + break; + } + message.maxObjectSizeBytes = longToNumber2(reader.uint64()); + continue; + } + case 49: { + if (tag !== 394) { + break; + } + message.ExperimentalFlashUrls.push(reader.string()); + continue; + } + case 50: { + if (tag === 400) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 402) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 51: { + if (tag === 408) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 410) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + definitionId: isSet4(object.definitionId) ? globalThis.String(object.definitionId) : "", + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + methodHandleMetadata: isObject2(object.methodHandleMetadata) ? Object.entries(object.methodHandleMetadata).reduce( + (acc, [key, value]) => { + acc[key] = FunctionHandleMetadata.fromJSON(value); + return acc; + }, + {} + ) : {}, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + inputPlaneUrl: isSet4(object.inputPlaneUrl) ? globalThis.String(object.inputPlaneUrl) : void 0, + inputPlaneRegion: isSet4(object.inputPlaneRegion) ? globalThis.String(object.inputPlaneRegion) : void 0, + maxObjectSizeBytes: isSet4(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0, + ExperimentalFlashUrls: globalThis.Array.isArray(object?.ExperimentalFlashUrls) ? object.ExperimentalFlashUrls.map((e) => globalThis.String(e)) : [], + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.definitionId !== "") { + obj.definitionId = message.definitionId; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.methodHandleMetadata) { + const entries = Object.entries(message.methodHandleMetadata); + if (entries.length > 0) { + obj.methodHandleMetadata = {}; + entries.forEach(([k, v]) => { + obj.methodHandleMetadata[k] = FunctionHandleMetadata.toJSON(v); + }); + } + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.inputPlaneUrl !== void 0) { + obj.inputPlaneUrl = message.inputPlaneUrl; + } + if (message.inputPlaneRegion !== void 0) { + obj.inputPlaneRegion = message.inputPlaneRegion; + } + if (message.maxObjectSizeBytes !== void 0) { + obj.maxObjectSizeBytes = Math.round(message.maxObjectSizeBytes); + } + if (message.ExperimentalFlashUrls?.length) { + obj.ExperimentalFlashUrls = message.ExperimentalFlashUrls; + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionHandleMetadata(); + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.webUrl = object.webUrl ?? ""; + message.isMethod = object.isMethod ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.definitionId = object.definitionId ?? ""; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.methodHandleMetadata = Object.entries(object.methodHandleMetadata ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = FunctionHandleMetadata.fromPartial(value); + } + return acc; + }, {}); + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.inputPlaneUrl = object.inputPlaneUrl ?? void 0; + message.inputPlaneRegion = object.inputPlaneRegion ?? void 0; + message.maxObjectSizeBytes = object.maxObjectSizeBytes ?? void 0; + message.ExperimentalFlashUrls = object.ExperimentalFlashUrls?.map((e) => e) || []; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionHandleMetadata_MethodHandleMetadataEntry() { + return { key: "", value: void 0 }; +} +var FunctionHandleMetadata_MethodHandleMetadataEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + FunctionHandleMetadata.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionHandleMetadata_MethodHandleMetadataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? FunctionHandleMetadata.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = FunctionHandleMetadata.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionHandleMetadata_MethodHandleMetadataEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionHandleMetadata_MethodHandleMetadataEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? FunctionHandleMetadata.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionInput() { + return { args: void 0, argsBlobId: void 0, finalInput: false, dataFormat: 0, methodName: void 0 }; +} +var FunctionInput = { + encode(message, writer = new BinaryWriter()) { + if (message.args !== void 0) { + writer.uint32(10).bytes(message.args); + } + if (message.argsBlobId !== void 0) { + writer.uint32(58).string(message.argsBlobId); + } + if (message.finalInput !== false) { + writer.uint32(72).bool(message.finalInput); + } + if (message.dataFormat !== 0) { + writer.uint32(80).int32(message.dataFormat); + } + if (message.methodName !== void 0) { + writer.uint32(90).string(message.methodName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.args = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.argsBlobId = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.finalInput = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.methodName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + args: isSet4(object.args) ? bytesFromBase64(object.args) : void 0, + argsBlobId: isSet4(object.argsBlobId) ? globalThis.String(object.argsBlobId) : void 0, + finalInput: isSet4(object.finalInput) ? globalThis.Boolean(object.finalInput) : false, + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + methodName: isSet4(object.methodName) ? globalThis.String(object.methodName) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.args !== void 0) { + obj.args = base64FromBytes(message.args); + } + if (message.argsBlobId !== void 0) { + obj.argsBlobId = message.argsBlobId; + } + if (message.finalInput !== false) { + obj.finalInput = message.finalInput; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.methodName !== void 0) { + obj.methodName = message.methodName; + } + return obj; + }, + create(base) { + return FunctionInput.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionInput(); + message.args = object.args ?? void 0; + message.argsBlobId = object.argsBlobId ?? void 0; + message.finalInput = object.finalInput ?? false; + message.dataFormat = object.dataFormat ?? 0; + message.methodName = object.methodName ?? void 0; + return message; + } +}; +function createBaseFunctionMapRequest() { + return { + functionId: "", + parentInputId: "", + returnExceptions: false, + functionCallType: 0, + pipelinedInputs: [], + functionCallInvocationType: 0, + fromSpawnMap: false + }; +} +var FunctionMapRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.returnExceptions !== false) { + writer.uint32(24).bool(message.returnExceptions); + } + if (message.functionCallType !== 0) { + writer.uint32(32).int32(message.functionCallType); + } + for (const v of message.pipelinedInputs) { + FunctionPutInputsItem.encode(v, writer.uint32(42).fork()).join(); + } + if (message.functionCallInvocationType !== 0) { + writer.uint32(48).int32(message.functionCallInvocationType); + } + if (message.fromSpawnMap !== false) { + writer.uint32(56).bool(message.fromSpawnMap); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMapRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.returnExceptions = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.functionCallType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pipelinedInputs.push(FunctionPutInputsItem.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.functionCallInvocationType = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.fromSpawnMap = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + returnExceptions: isSet4(object.returnExceptions) ? globalThis.Boolean(object.returnExceptions) : false, + functionCallType: isSet4(object.functionCallType) ? functionCallTypeFromJSON(object.functionCallType) : 0, + pipelinedInputs: globalThis.Array.isArray(object?.pipelinedInputs) ? object.pipelinedInputs.map((e) => FunctionPutInputsItem.fromJSON(e)) : [], + functionCallInvocationType: isSet4(object.functionCallInvocationType) ? functionCallInvocationTypeFromJSON(object.functionCallInvocationType) : 0, + fromSpawnMap: isSet4(object.fromSpawnMap) ? globalThis.Boolean(object.fromSpawnMap) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.returnExceptions !== false) { + obj.returnExceptions = message.returnExceptions; + } + if (message.functionCallType !== 0) { + obj.functionCallType = functionCallTypeToJSON(message.functionCallType); + } + if (message.pipelinedInputs?.length) { + obj.pipelinedInputs = message.pipelinedInputs.map((e) => FunctionPutInputsItem.toJSON(e)); + } + if (message.functionCallInvocationType !== 0) { + obj.functionCallInvocationType = functionCallInvocationTypeToJSON(message.functionCallInvocationType); + } + if (message.fromSpawnMap !== false) { + obj.fromSpawnMap = message.fromSpawnMap; + } + return obj; + }, + create(base) { + return FunctionMapRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMapRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.returnExceptions = object.returnExceptions ?? false; + message.functionCallType = object.functionCallType ?? 0; + message.pipelinedInputs = object.pipelinedInputs?.map((e) => FunctionPutInputsItem.fromPartial(e)) || []; + message.functionCallInvocationType = object.functionCallInvocationType ?? 0; + message.fromSpawnMap = object.fromSpawnMap ?? false; + return message; + } +}; +function createBaseFunctionMapResponse() { + return { + functionCallId: "", + pipelinedInputs: [], + retryPolicy: void 0, + functionCallJwt: "", + syncClientRetriesEnabled: false, + maxInputsOutstanding: 0 + }; +} +var FunctionMapResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + for (const v of message.pipelinedInputs) { + FunctionPutInputsResponseItem.encode(v, writer.uint32(18).fork()).join(); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(26).fork()).join(); + } + if (message.functionCallJwt !== "") { + writer.uint32(34).string(message.functionCallJwt); + } + if (message.syncClientRetriesEnabled !== false) { + writer.uint32(40).bool(message.syncClientRetriesEnabled); + } + if (message.maxInputsOutstanding !== 0) { + writer.uint32(48).uint32(message.maxInputsOutstanding); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMapResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pipelinedInputs.push(FunctionPutInputsResponseItem.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.functionCallJwt = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.syncClientRetriesEnabled = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.maxInputsOutstanding = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + pipelinedInputs: globalThis.Array.isArray(object?.pipelinedInputs) ? object.pipelinedInputs.map((e) => FunctionPutInputsResponseItem.fromJSON(e)) : [], + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + functionCallJwt: isSet4(object.functionCallJwt) ? globalThis.String(object.functionCallJwt) : "", + syncClientRetriesEnabled: isSet4(object.syncClientRetriesEnabled) ? globalThis.Boolean(object.syncClientRetriesEnabled) : false, + maxInputsOutstanding: isSet4(object.maxInputsOutstanding) ? globalThis.Number(object.maxInputsOutstanding) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.pipelinedInputs?.length) { + obj.pipelinedInputs = message.pipelinedInputs.map((e) => FunctionPutInputsResponseItem.toJSON(e)); + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.functionCallJwt !== "") { + obj.functionCallJwt = message.functionCallJwt; + } + if (message.syncClientRetriesEnabled !== false) { + obj.syncClientRetriesEnabled = message.syncClientRetriesEnabled; + } + if (message.maxInputsOutstanding !== 0) { + obj.maxInputsOutstanding = Math.round(message.maxInputsOutstanding); + } + return obj; + }, + create(base) { + return FunctionMapResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMapResponse(); + message.functionCallId = object.functionCallId ?? ""; + message.pipelinedInputs = object.pipelinedInputs?.map((e) => FunctionPutInputsResponseItem.fromPartial(e)) || []; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.functionCallJwt = object.functionCallJwt ?? ""; + message.syncClientRetriesEnabled = object.syncClientRetriesEnabled ?? false; + message.maxInputsOutstanding = object.maxInputsOutstanding ?? 0; + return message; + } +}; +function createBaseFunctionOptions() { + return { + secretIds: [], + mountIds: [], + resources: void 0, + retryPolicy: void 0, + concurrencyLimit: void 0, + timeoutSecs: void 0, + taskIdleTimeoutSecs: void 0, + warmPoolSize: void 0, + volumeMounts: [], + targetConcurrentInputs: void 0, + replaceVolumeMounts: false, + replaceSecretIds: false, + bufferContainers: void 0, + maxConcurrentInputs: void 0, + batchMaxSize: void 0, + batchLingerMs: void 0, + schedulerPlacement: void 0, + cloudProviderStr: void 0, + replaceCloudBucketMounts: false, + cloudBucketMounts: [] + }; +} +var FunctionOptions = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.secretIds) { + writer.uint32(10).string(v); + } + for (const v of message.mountIds) { + writer.uint32(18).string(v); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(26).fork()).join(); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(34).fork()).join(); + } + if (message.concurrencyLimit !== void 0) { + writer.uint32(40).uint32(message.concurrencyLimit); + } + if (message.timeoutSecs !== void 0) { + writer.uint32(48).uint32(message.timeoutSecs); + } + if (message.taskIdleTimeoutSecs !== void 0) { + writer.uint32(56).uint32(message.taskIdleTimeoutSecs); + } + if (message.warmPoolSize !== void 0) { + writer.uint32(64).uint32(message.warmPoolSize); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(74).fork()).join(); + } + if (message.targetConcurrentInputs !== void 0) { + writer.uint32(80).uint32(message.targetConcurrentInputs); + } + if (message.replaceVolumeMounts !== false) { + writer.uint32(88).bool(message.replaceVolumeMounts); + } + if (message.replaceSecretIds !== false) { + writer.uint32(96).bool(message.replaceSecretIds); + } + if (message.bufferContainers !== void 0) { + writer.uint32(104).uint32(message.bufferContainers); + } + if (message.maxConcurrentInputs !== void 0) { + writer.uint32(112).uint32(message.maxConcurrentInputs); + } + if (message.batchMaxSize !== void 0) { + writer.uint32(120).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== void 0) { + writer.uint32(128).uint64(message.batchLingerMs); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(138).fork()).join(); + } + if (message.cloudProviderStr !== void 0) { + writer.uint32(146).string(message.cloudProviderStr); + } + if (message.replaceCloudBucketMounts !== false) { + writer.uint32(152).bool(message.replaceCloudBucketMounts); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(162).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.replaceVolumeMounts = reader.bool(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.replaceSecretIds = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.bufferContainers = reader.uint32(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.replaceCloudBucketMounts = reader.bool(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : void 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : void 0, + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : void 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : void 0, + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : void 0, + replaceVolumeMounts: isSet4(object.replaceVolumeMounts) ? globalThis.Boolean(object.replaceVolumeMounts) : false, + replaceSecretIds: isSet4(object.replaceSecretIds) ? globalThis.Boolean(object.replaceSecretIds) : false, + bufferContainers: isSet4(object.bufferContainers) ? globalThis.Number(object.bufferContainers) : void 0, + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : void 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : void 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : void 0, + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : void 0, + replaceCloudBucketMounts: isSet4(object.replaceCloudBucketMounts) ? globalThis.Boolean(object.replaceCloudBucketMounts) : false, + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.concurrencyLimit !== void 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.timeoutSecs !== void 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.taskIdleTimeoutSecs !== void 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.warmPoolSize !== void 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.targetConcurrentInputs !== void 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.replaceVolumeMounts !== false) { + obj.replaceVolumeMounts = message.replaceVolumeMounts; + } + if (message.replaceSecretIds !== false) { + obj.replaceSecretIds = message.replaceSecretIds; + } + if (message.bufferContainers !== void 0) { + obj.bufferContainers = Math.round(message.bufferContainers); + } + if (message.maxConcurrentInputs !== void 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.batchMaxSize !== void 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== void 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.cloudProviderStr !== void 0) { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.replaceCloudBucketMounts !== false) { + obj.replaceCloudBucketMounts = message.replaceCloudBucketMounts; + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionOptions(); + message.secretIds = object.secretIds?.map((e) => e) || []; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.concurrencyLimit = object.concurrencyLimit ?? void 0; + message.timeoutSecs = object.timeoutSecs ?? void 0; + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? void 0; + message.warmPoolSize = object.warmPoolSize ?? void 0; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? void 0; + message.replaceVolumeMounts = object.replaceVolumeMounts ?? false; + message.replaceSecretIds = object.replaceSecretIds ?? false; + message.bufferContainers = object.bufferContainers ?? void 0; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? void 0; + message.batchMaxSize = object.batchMaxSize ?? void 0; + message.batchLingerMs = object.batchLingerMs ?? void 0; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.cloudProviderStr = object.cloudProviderStr ?? void 0; + message.replaceCloudBucketMounts = object.replaceCloudBucketMounts ?? false; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPrecreateRequest() { + return { + appId: "", + functionName: "", + existingFunctionId: "", + functionType: 0, + webhookConfig: void 0, + useFunctionId: "", + useMethodName: "", + methodDefinitions: {}, + functionSchema: void 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionPrecreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.existingFunctionId !== "") { + writer.uint32(26).string(message.existingFunctionId); + } + if (message.functionType !== 0) { + writer.uint32(32).int32(message.functionType); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(42).fork()).join(); + } + if (message.useFunctionId !== "") { + writer.uint32(50).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(58).string(message.useMethodName); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + FunctionPrecreateRequest_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(66).fork()).join(); + }); + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(74).fork()).join(); + } + writer.uint32(82).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.existingFunctionId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + const entry8 = FunctionPrecreateRequest_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry8.value !== void 0) { + message.methodDefinitions[entry8.key] = entry8.value; + } + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag === 80) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 11: { + if (tag === 88) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + existingFunctionId: isSet4(object.existingFunctionId) ? globalThis.String(object.existingFunctionId) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.existingFunctionId !== "") { + obj.existingFunctionId = message.existingFunctionId; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPrecreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateRequest(); + message.appId = object.appId ?? ""; + message.functionName = object.functionName ?? ""; + message.existingFunctionId = object.existingFunctionId ?? ""; + message.functionType = object.functionType ?? 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionPrecreateRequest_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var FunctionPrecreateRequest_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateRequest_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionPrecreateRequest_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateRequest_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionPrecreateResponse() { + return { functionId: "", handleMetadata: void 0 }; +} +var FunctionPrecreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return FunctionPrecreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateResponse(); + message.functionId = object.functionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseFunctionPutInputsItem() { + return { idx: 0, input: void 0, r2Failed: false, r2ThroughputBytesS: 0 }; +} +var FunctionPutInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.idx !== 0) { + writer.uint32(8).int32(message.idx); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.r2Failed !== false) { + writer.uint32(24).bool(message.r2Failed); + } + if (message.r2ThroughputBytesS !== 0) { + writer.uint32(40).uint64(message.r2ThroughputBytesS); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.idx = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.r2Failed = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.r2ThroughputBytesS = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + r2Failed: isSet4(object.r2Failed) ? globalThis.Boolean(object.r2Failed) : false, + r2ThroughputBytesS: isSet4(object.r2ThroughputBytesS) ? globalThis.Number(object.r2ThroughputBytesS) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.r2Failed !== false) { + obj.r2Failed = message.r2Failed; + } + if (message.r2ThroughputBytesS !== 0) { + obj.r2ThroughputBytesS = Math.round(message.r2ThroughputBytesS); + } + return obj; + }, + create(base) { + return FunctionPutInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsItem(); + message.idx = object.idx ?? 0; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.r2Failed = object.r2Failed ?? false; + message.r2ThroughputBytesS = object.r2ThroughputBytesS ?? 0; + return message; + } +}; +function createBaseFunctionPutInputsRequest() { + return { functionId: "", functionCallId: "", inputs: [] }; +} +var FunctionPutInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(26).string(message.functionCallId); + } + for (const v of message.inputs) { + FunctionPutInputsItem.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.inputs.push(FunctionPutInputsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionPutInputsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionPutInputsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPutInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsRequest(); + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.inputs = object.inputs?.map((e) => FunctionPutInputsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPutInputsResponse() { + return { inputs: [] }; +} +var FunctionPutInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + FunctionPutInputsResponseItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputs.push(FunctionPutInputsResponseItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionPutInputsResponseItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionPutInputsResponseItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPutInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsResponse(); + message.inputs = object.inputs?.map((e) => FunctionPutInputsResponseItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPutInputsResponseItem() { + return { idx: 0, inputId: "", inputJwt: "" }; +} +var FunctionPutInputsResponseItem = { + encode(message, writer = new BinaryWriter()) { + if (message.idx !== 0) { + writer.uint32(8).int32(message.idx); + } + if (message.inputId !== "") { + writer.uint32(18).string(message.inputId); + } + if (message.inputJwt !== "") { + writer.uint32(26).string(message.inputJwt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsResponseItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.idx = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.inputJwt = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + inputJwt: isSet4(object.inputJwt) ? globalThis.String(object.inputJwt) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.inputJwt !== "") { + obj.inputJwt = message.inputJwt; + } + return obj; + }, + create(base) { + return FunctionPutInputsResponseItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsResponseItem(); + message.idx = object.idx ?? 0; + message.inputId = object.inputId ?? ""; + message.inputJwt = object.inputJwt ?? ""; + return message; + } +}; +function createBaseFunctionPutOutputsItem() { + return { + inputId: "", + result: void 0, + inputStartedAt: 0, + outputCreatedAt: 0, + dataFormat: 0, + retryCount: 0, + functionCallId: "", + functionMapIdx: void 0 + }; +} +var FunctionPutOutputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.inputStartedAt !== 0) { + writer.uint32(25).double(message.inputStartedAt); + } + if (message.outputCreatedAt !== 0) { + writer.uint32(33).double(message.outputCreatedAt); + } + if (message.dataFormat !== 0) { + writer.uint32(56).int32(message.dataFormat); + } + if (message.retryCount !== 0) { + writer.uint32(64).uint32(message.retryCount); + } + if (message.functionCallId !== "") { + writer.uint32(74).string(message.functionCallId); + } + if (message.functionMapIdx !== void 0) { + writer.uint32(80).int32(message.functionMapIdx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutOutputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.inputStartedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.outputCreatedAt = reader.double(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.functionMapIdx = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + inputStartedAt: isSet4(object.inputStartedAt) ? globalThis.Number(object.inputStartedAt) : 0, + outputCreatedAt: isSet4(object.outputCreatedAt) ? globalThis.Number(object.outputCreatedAt) : 0, + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + functionMapIdx: isSet4(object.functionMapIdx) ? globalThis.Number(object.functionMapIdx) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.inputStartedAt !== 0) { + obj.inputStartedAt = message.inputStartedAt; + } + if (message.outputCreatedAt !== 0) { + obj.outputCreatedAt = message.outputCreatedAt; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.functionMapIdx !== void 0) { + obj.functionMapIdx = Math.round(message.functionMapIdx); + } + return obj; + }, + create(base) { + return FunctionPutOutputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutOutputsItem(); + message.inputId = object.inputId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.inputStartedAt = object.inputStartedAt ?? 0; + message.outputCreatedAt = object.outputCreatedAt ?? 0; + message.dataFormat = object.dataFormat ?? 0; + message.retryCount = object.retryCount ?? 0; + message.functionCallId = object.functionCallId ?? ""; + message.functionMapIdx = object.functionMapIdx ?? void 0; + return message; + } +}; +function createBaseFunctionPutOutputsRequest() { + return { outputs: [], requestedAt: 0 }; +} +var FunctionPutOutputsRequest = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.outputs) { + FunctionPutOutputsItem.encode(v, writer.uint32(34).fork()).join(); + } + if (message.requestedAt !== 0) { + writer.uint32(41).double(message.requestedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutOutputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + message.outputs.push(FunctionPutOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.requestedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionPutOutputsItem.fromJSON(e)) : [], + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionPutOutputsItem.toJSON(e)); + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + return obj; + }, + create(base) { + return FunctionPutOutputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutOutputsRequest(); + message.outputs = object.outputs?.map((e) => FunctionPutOutputsItem.fromPartial(e)) || []; + message.requestedAt = object.requestedAt ?? 0; + return message; + } +}; +function createBaseFunctionRetryInputsItem() { + return { inputJwt: "", input: void 0, retryCount: 0 }; +} +var FunctionRetryInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputJwt !== "") { + writer.uint32(10).string(message.inputJwt); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.retryCount !== 0) { + writer.uint32(24).uint32(message.retryCount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputJwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputJwt: isSet4(object.inputJwt) ? globalThis.String(object.inputJwt) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputJwt !== "") { + obj.inputJwt = message.inputJwt; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + return obj; + }, + create(base) { + return FunctionRetryInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsItem(); + message.inputJwt = object.inputJwt ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.retryCount = object.retryCount ?? 0; + return message; + } +}; +function createBaseFunctionRetryInputsRequest() { + return { functionCallJwt: "", inputs: [] }; +} +var FunctionRetryInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallJwt !== "") { + writer.uint32(10).string(message.functionCallJwt); + } + for (const v of message.inputs) { + FunctionRetryInputsItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallJwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputs.push(FunctionRetryInputsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallJwt: isSet4(object.functionCallJwt) ? globalThis.String(object.functionCallJwt) : "", + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionRetryInputsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallJwt !== "") { + obj.functionCallJwt = message.functionCallJwt; + } + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionRetryInputsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionRetryInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsRequest(); + message.functionCallJwt = object.functionCallJwt ?? ""; + message.inputs = object.inputs?.map((e) => FunctionRetryInputsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionRetryInputsResponse() { + return { inputJwts: [] }; +} +var FunctionRetryInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputJwts) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputJwts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputJwts: globalThis.Array.isArray(object?.inputJwts) ? object.inputJwts.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputJwts?.length) { + obj.inputJwts = message.inputJwts; + } + return obj; + }, + create(base) { + return FunctionRetryInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsResponse(); + message.inputJwts = object.inputJwts?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionRetryPolicy() { + return { backoffCoefficient: 0, initialDelayMs: 0, maxDelayMs: 0, retries: 0 }; +} +var FunctionRetryPolicy = { + encode(message, writer = new BinaryWriter()) { + if (message.backoffCoefficient !== 0) { + writer.uint32(13).float(message.backoffCoefficient); + } + if (message.initialDelayMs !== 0) { + writer.uint32(16).uint32(message.initialDelayMs); + } + if (message.maxDelayMs !== 0) { + writer.uint32(24).uint32(message.maxDelayMs); + } + if (message.retries !== 0) { + writer.uint32(144).uint32(message.retries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + message.backoffCoefficient = reader.float(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.initialDelayMs = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxDelayMs = reader.uint32(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + message.retries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + backoffCoefficient: isSet4(object.backoffCoefficient) ? globalThis.Number(object.backoffCoefficient) : 0, + initialDelayMs: isSet4(object.initialDelayMs) ? globalThis.Number(object.initialDelayMs) : 0, + maxDelayMs: isSet4(object.maxDelayMs) ? globalThis.Number(object.maxDelayMs) : 0, + retries: isSet4(object.retries) ? globalThis.Number(object.retries) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.backoffCoefficient !== 0) { + obj.backoffCoefficient = message.backoffCoefficient; + } + if (message.initialDelayMs !== 0) { + obj.initialDelayMs = Math.round(message.initialDelayMs); + } + if (message.maxDelayMs !== 0) { + obj.maxDelayMs = Math.round(message.maxDelayMs); + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + create(base) { + return FunctionRetryPolicy.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryPolicy(); + message.backoffCoefficient = object.backoffCoefficient ?? 0; + message.initialDelayMs = object.initialDelayMs ?? 0; + message.maxDelayMs = object.maxDelayMs ?? 0; + message.retries = object.retries ?? 0; + return message; + } +}; +function createBaseFunctionSchema() { + return { schemaType: 0, arguments: [], returnType: void 0 }; +} +var FunctionSchema = { + encode(message, writer = new BinaryWriter()) { + if (message.schemaType !== 0) { + writer.uint32(8).int32(message.schemaType); + } + for (const v of message.arguments) { + ClassParameterSpec.encode(v, writer.uint32(18).fork()).join(); + } + if (message.returnType !== void 0) { + GenericPayloadType.encode(message.returnType, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.schemaType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.arguments.push(ClassParameterSpec.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.returnType = GenericPayloadType.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + schemaType: isSet4(object.schemaType) ? functionSchema_FunctionSchemaTypeFromJSON(object.schemaType) : 0, + arguments: globalThis.Array.isArray(object?.arguments) ? object.arguments.map((e) => ClassParameterSpec.fromJSON(e)) : [], + returnType: isSet4(object.returnType) ? GenericPayloadType.fromJSON(object.returnType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.schemaType !== 0) { + obj.schemaType = functionSchema_FunctionSchemaTypeToJSON(message.schemaType); + } + if (message.arguments?.length) { + obj.arguments = message.arguments.map((e) => ClassParameterSpec.toJSON(e)); + } + if (message.returnType !== void 0) { + obj.returnType = GenericPayloadType.toJSON(message.returnType); + } + return obj; + }, + create(base) { + return FunctionSchema.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionSchema(); + message.schemaType = object.schemaType ?? 0; + message.arguments = object.arguments?.map((e) => ClassParameterSpec.fromPartial(e)) || []; + message.returnType = object.returnType !== void 0 && object.returnType !== null ? GenericPayloadType.fromPartial(object.returnType) : void 0; + return message; + } +}; +function createBaseFunctionStats() { + return { backlog: 0, numTotalTasks: 0 }; +} +var FunctionStats = { + encode(message, writer = new BinaryWriter()) { + if (message.backlog !== 0) { + writer.uint32(8).uint32(message.backlog); + } + if (message.numTotalTasks !== 0) { + writer.uint32(24).uint32(message.numTotalTasks); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.backlog = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numTotalTasks = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + backlog: isSet4(object.backlog) ? globalThis.Number(object.backlog) : 0, + numTotalTasks: isSet4(object.numTotalTasks) ? globalThis.Number(object.numTotalTasks) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.backlog !== 0) { + obj.backlog = Math.round(message.backlog); + } + if (message.numTotalTasks !== 0) { + obj.numTotalTasks = Math.round(message.numTotalTasks); + } + return obj; + }, + create(base) { + return FunctionStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionStats(); + message.backlog = object.backlog ?? 0; + message.numTotalTasks = object.numTotalTasks ?? 0; + return message; + } +}; +function createBaseFunctionUpdateSchedulingParamsRequest() { + return { functionId: "", warmPoolSizeOverride: 0, settings: void 0 }; +} +var FunctionUpdateSchedulingParamsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.warmPoolSizeOverride !== 0) { + writer.uint32(16).uint32(message.warmPoolSizeOverride); + } + if (message.settings !== void 0) { + AutoscalerSettings.encode(message.settings, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionUpdateSchedulingParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.warmPoolSizeOverride = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.settings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + warmPoolSizeOverride: isSet4(object.warmPoolSizeOverride) ? globalThis.Number(object.warmPoolSizeOverride) : 0, + settings: isSet4(object.settings) ? AutoscalerSettings.fromJSON(object.settings) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.warmPoolSizeOverride !== 0) { + obj.warmPoolSizeOverride = Math.round(message.warmPoolSizeOverride); + } + if (message.settings !== void 0) { + obj.settings = AutoscalerSettings.toJSON(message.settings); + } + return obj; + }, + create(base) { + return FunctionUpdateSchedulingParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionUpdateSchedulingParamsRequest(); + message.functionId = object.functionId ?? ""; + message.warmPoolSizeOverride = object.warmPoolSizeOverride ?? 0; + message.settings = object.settings !== void 0 && object.settings !== null ? AutoscalerSettings.fromPartial(object.settings) : void 0; + return message; + } +}; +function createBaseFunctionUpdateSchedulingParamsResponse() { + return {}; +} +var FunctionUpdateSchedulingParamsResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionUpdateSchedulingParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return FunctionUpdateSchedulingParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFunctionUpdateSchedulingParamsResponse(); + return message; + } +}; +function createBaseGPUConfig() { + return { type: 0, count: 0, gpuType: "" }; +} +var GPUConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.count !== 0) { + writer.uint32(16).uint32(message.count); + } + if (message.gpuType !== "") { + writer.uint32(34).string(message.gpuType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGPUConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.count = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? gPUTypeFromJSON(object.type) : 0, + count: isSet4(object.count) ? globalThis.Number(object.count) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = gPUTypeToJSON(message.type); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.gpuType !== "") { + obj.gpuType = message.gpuType; + } + return obj; + }, + create(base) { + return GPUConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGPUConfig(); + message.type = object.type ?? 0; + message.count = object.count ?? 0; + message.gpuType = object.gpuType ?? ""; + return message; + } +}; +function createBaseGeneratorDone() { + return { itemsTotal: 0 }; +} +var GeneratorDone = { + encode(message, writer = new BinaryWriter()) { + if (message.itemsTotal !== 0) { + writer.uint32(8).uint64(message.itemsTotal); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGeneratorDone(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.itemsTotal = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { itemsTotal: isSet4(object.itemsTotal) ? globalThis.Number(object.itemsTotal) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.itemsTotal !== 0) { + obj.itemsTotal = Math.round(message.itemsTotal); + } + return obj; + }, + create(base) { + return GeneratorDone.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratorDone(); + message.itemsTotal = object.itemsTotal ?? 0; + return message; + } +}; +function createBaseGenericPayloadType() { + return { baseType: 0, subTypes: [] }; +} +var GenericPayloadType = { + encode(message, writer = new BinaryWriter()) { + if (message.baseType !== 0) { + writer.uint32(8).int32(message.baseType); + } + for (const v of message.subTypes) { + GenericPayloadType.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGenericPayloadType(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.baseType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.subTypes.push(GenericPayloadType.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseType: isSet4(object.baseType) ? parameterTypeFromJSON(object.baseType) : 0, + subTypes: globalThis.Array.isArray(object?.subTypes) ? object.subTypes.map((e) => GenericPayloadType.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseType !== 0) { + obj.baseType = parameterTypeToJSON(message.baseType); + } + if (message.subTypes?.length) { + obj.subTypes = message.subTypes.map((e) => GenericPayloadType.toJSON(e)); + } + return obj; + }, + create(base) { + return GenericPayloadType.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenericPayloadType(); + message.baseType = object.baseType ?? 0; + message.subTypes = object.subTypes?.map((e) => GenericPayloadType.fromPartial(e)) || []; + return message; + } +}; +function createBaseGenericResult() { + return { + status: 0, + exception: "", + exitcode: 0, + traceback: "", + serializedTb: new Uint8Array(0), + tbLineCache: new Uint8Array(0), + data: void 0, + dataBlobId: void 0, + propagationReason: "" + }; +} +var GenericResult = { + encode(message, writer = new BinaryWriter()) { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + if (message.exception !== "") { + writer.uint32(18).string(message.exception); + } + if (message.exitcode !== 0) { + writer.uint32(24).int32(message.exitcode); + } + if (message.traceback !== "") { + writer.uint32(34).string(message.traceback); + } + if (message.serializedTb.length !== 0) { + writer.uint32(90).bytes(message.serializedTb); + } + if (message.tbLineCache.length !== 0) { + writer.uint32(98).bytes(message.tbLineCache); + } + if (message.data !== void 0) { + writer.uint32(42).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(82).string(message.dataBlobId); + } + if (message.propagationReason !== "") { + writer.uint32(106).string(message.propagationReason); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGenericResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.status = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.exception = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.exitcode = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.traceback = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.serializedTb = reader.bytes(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.tbLineCache = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.data = reader.bytes(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.propagationReason = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet4(object.status) ? genericResult_GenericStatusFromJSON(object.status) : 0, + exception: isSet4(object.exception) ? globalThis.String(object.exception) : "", + exitcode: isSet4(object.exitcode) ? globalThis.Number(object.exitcode) : 0, + traceback: isSet4(object.traceback) ? globalThis.String(object.traceback) : "", + serializedTb: isSet4(object.serializedTb) ? bytesFromBase64(object.serializedTb) : new Uint8Array(0), + tbLineCache: isSet4(object.tbLineCache) ? bytesFromBase64(object.tbLineCache) : new Uint8Array(0), + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + propagationReason: isSet4(object.propagationReason) ? globalThis.String(object.propagationReason) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.status !== 0) { + obj.status = genericResult_GenericStatusToJSON(message.status); + } + if (message.exception !== "") { + obj.exception = message.exception; + } + if (message.exitcode !== 0) { + obj.exitcode = Math.round(message.exitcode); + } + if (message.traceback !== "") { + obj.traceback = message.traceback; + } + if (message.serializedTb.length !== 0) { + obj.serializedTb = base64FromBytes(message.serializedTb); + } + if (message.tbLineCache.length !== 0) { + obj.tbLineCache = base64FromBytes(message.tbLineCache); + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.propagationReason !== "") { + obj.propagationReason = message.propagationReason; + } + return obj; + }, + create(base) { + return GenericResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenericResult(); + message.status = object.status ?? 0; + message.exception = object.exception ?? ""; + message.exitcode = object.exitcode ?? 0; + message.traceback = object.traceback ?? ""; + message.serializedTb = object.serializedTb ?? new Uint8Array(0); + message.tbLineCache = object.tbLineCache ?? new Uint8Array(0); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.propagationReason = object.propagationReason ?? ""; + return message; + } +}; +function createBaseImage() { + return { + baseImages: [], + dockerfileCommands: [], + contextFiles: [], + version: "", + secretIds: [], + contextMountId: "", + gpuConfig: void 0, + imageRegistryConfig: void 0, + buildFunctionDef: "", + buildFunctionGlobals: new Uint8Array(0), + runtime: "", + runtimeDebug: false, + buildFunction: void 0, + buildArgs: {}, + volumeMounts: [] + }; +} +var Image = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.baseImages) { + BaseImage.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.dockerfileCommands) { + writer.uint32(50).string(v); + } + for (const v of message.contextFiles) { + ImageContextFile.encode(v, writer.uint32(58).fork()).join(); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + for (const v of message.secretIds) { + writer.uint32(98).string(v); + } + if (message.contextMountId !== "") { + writer.uint32(122).string(message.contextMountId); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(130).fork()).join(); + } + if (message.imageRegistryConfig !== void 0) { + ImageRegistryConfig.encode(message.imageRegistryConfig, writer.uint32(138).fork()).join(); + } + if (message.buildFunctionDef !== "") { + writer.uint32(114).string(message.buildFunctionDef); + } + if (message.buildFunctionGlobals.length !== 0) { + writer.uint32(146).bytes(message.buildFunctionGlobals); + } + if (message.runtime !== "") { + writer.uint32(154).string(message.runtime); + } + if (message.runtimeDebug !== false) { + writer.uint32(160).bool(message.runtimeDebug); + } + if (message.buildFunction !== void 0) { + BuildFunction.encode(message.buildFunction, writer.uint32(170).fork()).join(); + } + Object.entries(message.buildArgs).forEach(([key, value]) => { + Image_BuildArgsEntry.encode({ key, value }, writer.uint32(178).fork()).join(); + }); + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(186).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + if (tag !== 42) { + break; + } + message.baseImages.push(BaseImage.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.dockerfileCommands.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.contextFiles.push(ImageContextFile.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.version = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.contextMountId = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.imageRegistryConfig = ImageRegistryConfig.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.buildFunctionDef = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.buildFunctionGlobals = reader.bytes(); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + message.runtime = reader.string(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + message.buildFunction = BuildFunction.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + const entry22 = Image_BuildArgsEntry.decode(reader, reader.uint32()); + if (entry22.value !== void 0) { + message.buildArgs[entry22.key] = entry22.value; + } + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseImages: globalThis.Array.isArray(object?.baseImages) ? object.baseImages.map((e) => BaseImage.fromJSON(e)) : [], + dockerfileCommands: globalThis.Array.isArray(object?.dockerfileCommands) ? object.dockerfileCommands.map((e) => globalThis.String(e)) : [], + contextFiles: globalThis.Array.isArray(object?.contextFiles) ? object.contextFiles.map((e) => ImageContextFile.fromJSON(e)) : [], + version: isSet4(object.version) ? globalThis.String(object.version) : "", + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + contextMountId: isSet4(object.contextMountId) ? globalThis.String(object.contextMountId) : "", + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0, + imageRegistryConfig: isSet4(object.imageRegistryConfig) ? ImageRegistryConfig.fromJSON(object.imageRegistryConfig) : void 0, + buildFunctionDef: isSet4(object.buildFunctionDef) ? globalThis.String(object.buildFunctionDef) : "", + buildFunctionGlobals: isSet4(object.buildFunctionGlobals) ? bytesFromBase64(object.buildFunctionGlobals) : new Uint8Array(0), + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : "", + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + buildFunction: isSet4(object.buildFunction) ? BuildFunction.fromJSON(object.buildFunction) : void 0, + buildArgs: isObject2(object.buildArgs) ? Object.entries(object.buildArgs).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseImages?.length) { + obj.baseImages = message.baseImages.map((e) => BaseImage.toJSON(e)); + } + if (message.dockerfileCommands?.length) { + obj.dockerfileCommands = message.dockerfileCommands; + } + if (message.contextFiles?.length) { + obj.contextFiles = message.contextFiles.map((e) => ImageContextFile.toJSON(e)); + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.contextMountId !== "") { + obj.contextMountId = message.contextMountId; + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + if (message.imageRegistryConfig !== void 0) { + obj.imageRegistryConfig = ImageRegistryConfig.toJSON(message.imageRegistryConfig); + } + if (message.buildFunctionDef !== "") { + obj.buildFunctionDef = message.buildFunctionDef; + } + if (message.buildFunctionGlobals.length !== 0) { + obj.buildFunctionGlobals = base64FromBytes(message.buildFunctionGlobals); + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.buildFunction !== void 0) { + obj.buildFunction = BuildFunction.toJSON(message.buildFunction); + } + if (message.buildArgs) { + const entries = Object.entries(message.buildArgs); + if (entries.length > 0) { + obj.buildArgs = {}; + entries.forEach(([k, v]) => { + obj.buildArgs[k] = v; + }); + } + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + return obj; + }, + create(base) { + return Image.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImage(); + message.baseImages = object.baseImages?.map((e) => BaseImage.fromPartial(e)) || []; + message.dockerfileCommands = object.dockerfileCommands?.map((e) => e) || []; + message.contextFiles = object.contextFiles?.map((e) => ImageContextFile.fromPartial(e)) || []; + message.version = object.version ?? ""; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.contextMountId = object.contextMountId ?? ""; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + message.imageRegistryConfig = object.imageRegistryConfig !== void 0 && object.imageRegistryConfig !== null ? ImageRegistryConfig.fromPartial(object.imageRegistryConfig) : void 0; + message.buildFunctionDef = object.buildFunctionDef ?? ""; + message.buildFunctionGlobals = object.buildFunctionGlobals ?? new Uint8Array(0); + message.runtime = object.runtime ?? ""; + message.runtimeDebug = object.runtimeDebug ?? false; + message.buildFunction = object.buildFunction !== void 0 && object.buildFunction !== null ? BuildFunction.fromPartial(object.buildFunction) : void 0; + message.buildArgs = Object.entries(object.buildArgs ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + return message; + } +}; +function createBaseImage_BuildArgsEntry() { + return { key: "", value: "" }; +} +var Image_BuildArgsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImage_BuildArgsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Image_BuildArgsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImage_BuildArgsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseImageContextFile() { + return { filename: "", data: new Uint8Array(0) }; +} +var ImageContextFile = { + encode(message, writer = new BinaryWriter()) { + if (message.filename !== "") { + writer.uint32(10).string(message.filename); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageContextFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.filename = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + filename: isSet4(object.filename) ? globalThis.String(object.filename) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.filename !== "") { + obj.filename = message.filename; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return ImageContextFile.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageContextFile(); + message.filename = object.filename ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + } +}; +function createBaseImageDeleteRequest() { + return { imageId: "" }; +} +var ImageDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return ImageDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageDeleteRequest(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseImageFromIdRequest() { + return { imageId: "" }; +} +var ImageFromIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageFromIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return ImageFromIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageFromIdRequest(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseImageFromIdResponse() { + return { imageId: "", metadata: void 0 }; +} +var ImageFromIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageFromIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageFromIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageFromIdResponse(); + message.imageId = object.imageId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageGetOrCreateRequest() { + return { + image: void 0, + appId: "", + existingImageId: "", + buildFunctionId: "", + forceBuild: false, + namespace: 0, + builderVersion: "", + allowGlobalDeployment: false, + ignoreCache: false + }; +} +var ImageGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.image !== void 0) { + Image.encode(message.image, writer.uint32(18).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(34).string(message.appId); + } + if (message.existingImageId !== "") { + writer.uint32(42).string(message.existingImageId); + } + if (message.buildFunctionId !== "") { + writer.uint32(50).string(message.buildFunctionId); + } + if (message.forceBuild !== false) { + writer.uint32(56).bool(message.forceBuild); + } + if (message.namespace !== 0) { + writer.uint32(64).int32(message.namespace); + } + if (message.builderVersion !== "") { + writer.uint32(74).string(message.builderVersion); + } + if (message.allowGlobalDeployment !== false) { + writer.uint32(80).bool(message.allowGlobalDeployment); + } + if (message.ignoreCache !== false) { + writer.uint32(88).bool(message.ignoreCache); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.image = Image.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.appId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.existingImageId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.buildFunctionId = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.forceBuild = reader.bool(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.namespace = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.builderVersion = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.allowGlobalDeployment = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.ignoreCache = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + image: isSet4(object.image) ? Image.fromJSON(object.image) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + existingImageId: isSet4(object.existingImageId) ? globalThis.String(object.existingImageId) : "", + buildFunctionId: isSet4(object.buildFunctionId) ? globalThis.String(object.buildFunctionId) : "", + forceBuild: isSet4(object.forceBuild) ? globalThis.Boolean(object.forceBuild) : false, + namespace: isSet4(object.namespace) ? deploymentNamespaceFromJSON(object.namespace) : 0, + builderVersion: isSet4(object.builderVersion) ? globalThis.String(object.builderVersion) : "", + allowGlobalDeployment: isSet4(object.allowGlobalDeployment) ? globalThis.Boolean(object.allowGlobalDeployment) : false, + ignoreCache: isSet4(object.ignoreCache) ? globalThis.Boolean(object.ignoreCache) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.image !== void 0) { + obj.image = Image.toJSON(message.image); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.existingImageId !== "") { + obj.existingImageId = message.existingImageId; + } + if (message.buildFunctionId !== "") { + obj.buildFunctionId = message.buildFunctionId; + } + if (message.forceBuild !== false) { + obj.forceBuild = message.forceBuild; + } + if (message.namespace !== 0) { + obj.namespace = deploymentNamespaceToJSON(message.namespace); + } + if (message.builderVersion !== "") { + obj.builderVersion = message.builderVersion; + } + if (message.allowGlobalDeployment !== false) { + obj.allowGlobalDeployment = message.allowGlobalDeployment; + } + if (message.ignoreCache !== false) { + obj.ignoreCache = message.ignoreCache; + } + return obj; + }, + create(base) { + return ImageGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageGetOrCreateRequest(); + message.image = object.image !== void 0 && object.image !== null ? Image.fromPartial(object.image) : void 0; + message.appId = object.appId ?? ""; + message.existingImageId = object.existingImageId ?? ""; + message.buildFunctionId = object.buildFunctionId ?? ""; + message.forceBuild = object.forceBuild ?? false; + message.namespace = object.namespace ?? 0; + message.builderVersion = object.builderVersion ?? ""; + message.allowGlobalDeployment = object.allowGlobalDeployment ?? false; + message.ignoreCache = object.ignoreCache ?? false; + return message; + } +}; +function createBaseImageGetOrCreateResponse() { + return { imageId: "", result: void 0, metadata: void 0 }; +} +var ImageGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageGetOrCreateResponse(); + message.imageId = object.imageId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageJoinStreamingRequest() { + return { imageId: "", timeout: 0, lastEntryId: "", includeLogsForFinished: false }; +} +var ImageJoinStreamingRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(26).string(message.lastEntryId); + } + if (message.includeLogsForFinished !== false) { + writer.uint32(32).bool(message.includeLogsForFinished); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageJoinStreamingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.includeLogsForFinished = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + includeLogsForFinished: isSet4(object.includeLogsForFinished) ? globalThis.Boolean(object.includeLogsForFinished) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.includeLogsForFinished !== false) { + obj.includeLogsForFinished = message.includeLogsForFinished; + } + return obj; + }, + create(base) { + return ImageJoinStreamingRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageJoinStreamingRequest(); + message.imageId = object.imageId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.includeLogsForFinished = object.includeLogsForFinished ?? false; + return message; + } +}; +function createBaseImageJoinStreamingResponse() { + return { result: void 0, taskLogs: [], entryId: "", eof: false, metadata: void 0 }; +} +var ImageJoinStreamingResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + for (const v of message.taskLogs) { + TaskLogs.encode(v, writer.uint32(18).fork()).join(); + } + if (message.entryId !== "") { + writer.uint32(26).string(message.entryId); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageJoinStreamingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskLogs.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.entryId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + taskLogs: globalThis.Array.isArray(object?.taskLogs) ? object.taskLogs.map((e) => TaskLogs.fromJSON(e)) : [], + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "", + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false, + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.taskLogs?.length) { + obj.taskLogs = message.taskLogs.map((e) => TaskLogs.toJSON(e)); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + if (message.eof !== false) { + obj.eof = message.eof; + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageJoinStreamingResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageJoinStreamingResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.taskLogs = object.taskLogs?.map((e) => TaskLogs.fromPartial(e)) || []; + message.entryId = object.entryId ?? ""; + message.eof = object.eof ?? false; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageMetadata() { + return { + pythonVersionInfo: void 0, + pythonPackages: {}, + workdir: void 0, + libcVersionInfo: void 0, + imageBuilderVersion: void 0 + }; +} +var ImageMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.pythonVersionInfo !== void 0) { + writer.uint32(10).string(message.pythonVersionInfo); + } + Object.entries(message.pythonPackages).forEach(([key, value]) => { + ImageMetadata_PythonPackagesEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + if (message.workdir !== void 0) { + writer.uint32(26).string(message.workdir); + } + if (message.libcVersionInfo !== void 0) { + writer.uint32(34).string(message.libcVersionInfo); + } + if (message.imageBuilderVersion !== void 0) { + writer.uint32(42).string(message.imageBuilderVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pythonVersionInfo = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = ImageMetadata_PythonPackagesEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.pythonPackages[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.workdir = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.libcVersionInfo = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pythonVersionInfo: isSet4(object.pythonVersionInfo) ? globalThis.String(object.pythonVersionInfo) : void 0, + pythonPackages: isObject2(object.pythonPackages) ? Object.entries(object.pythonPackages).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + libcVersionInfo: isSet4(object.libcVersionInfo) ? globalThis.String(object.libcVersionInfo) : void 0, + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.pythonVersionInfo !== void 0) { + obj.pythonVersionInfo = message.pythonVersionInfo; + } + if (message.pythonPackages) { + const entries = Object.entries(message.pythonPackages); + if (entries.length > 0) { + obj.pythonPackages = {}; + entries.forEach(([k, v]) => { + obj.pythonPackages[k] = v; + }); + } + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.libcVersionInfo !== void 0) { + obj.libcVersionInfo = message.libcVersionInfo; + } + if (message.imageBuilderVersion !== void 0) { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + return obj; + }, + create(base) { + return ImageMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageMetadata(); + message.pythonVersionInfo = object.pythonVersionInfo ?? void 0; + message.pythonPackages = Object.entries(object.pythonPackages ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.workdir = object.workdir ?? void 0; + message.libcVersionInfo = object.libcVersionInfo ?? void 0; + message.imageBuilderVersion = object.imageBuilderVersion ?? void 0; + return message; + } +}; +function createBaseImageMetadata_PythonPackagesEntry() { + return { key: "", value: "" }; +} +var ImageMetadata_PythonPackagesEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageMetadata_PythonPackagesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return ImageMetadata_PythonPackagesEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageMetadata_PythonPackagesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseImageRegistryConfig() { + return { registryAuthType: 0, secretId: "" }; +} +var ImageRegistryConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.registryAuthType !== 0) { + writer.uint32(8).int32(message.registryAuthType); + } + if (message.secretId !== "") { + writer.uint32(18).string(message.secretId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageRegistryConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.registryAuthType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.secretId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + registryAuthType: isSet4(object.registryAuthType) ? registryAuthTypeFromJSON(object.registryAuthType) : 0, + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.registryAuthType !== 0) { + obj.registryAuthType = registryAuthTypeToJSON(message.registryAuthType); + } + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + return obj; + }, + create(base) { + return ImageRegistryConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageRegistryConfig(); + message.registryAuthType = object.registryAuthType ?? 0; + message.secretId = object.secretId ?? ""; + return message; + } +}; +function createBaseInputCallGraphInfo() { + return { inputId: "", status: 0, functionCallId: "", taskId: "" }; +} +var InputCallGraphInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.functionCallId !== "") { + writer.uint32(26).string(message.functionCallId); + } + if (message.taskId !== "") { + writer.uint32(34).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputCallGraphInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + status: isSet4(object.status) ? genericResult_GenericStatusFromJSON(object.status) : 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.status !== 0) { + obj.status = genericResult_GenericStatusToJSON(message.status); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return InputCallGraphInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputCallGraphInfo(); + message.inputId = object.inputId ?? ""; + message.status = object.status ?? 0; + message.functionCallId = object.functionCallId ?? ""; + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseInputCategoryInfo() { + return { total: 0, latest: [] }; +} +var InputCategoryInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.total !== 0) { + writer.uint32(8).int32(message.total); + } + for (const v of message.latest) { + InputInfo.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputCategoryInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.total = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.latest.push(InputInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet4(object.total) ? globalThis.Number(object.total) : 0, + latest: globalThis.Array.isArray(object?.latest) ? object.latest.map((e) => InputInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.latest?.length) { + obj.latest = message.latest.map((e) => InputInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return InputCategoryInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputCategoryInfo(); + message.total = object.total ?? 0; + message.latest = object.latest?.map((e) => InputInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseInputInfo() { + return { inputId: "", idx: 0, taskId: "", startedAt: 0, finishedAt: 0, taskStartupTime: 0, taskFirstInput: false }; +} +var InputInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.taskId !== "") { + writer.uint32(26).string(message.taskId); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + if (message.finishedAt !== 0) { + writer.uint32(41).double(message.finishedAt); + } + if (message.taskStartupTime !== 0) { + writer.uint32(49).double(message.taskStartupTime); + } + if (message.taskFirstInput !== false) { + writer.uint32(56).bool(message.taskFirstInput); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.taskId = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.finishedAt = reader.double(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.taskStartupTime = reader.double(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.taskFirstInput = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0, + finishedAt: isSet4(object.finishedAt) ? globalThis.Number(object.finishedAt) : 0, + taskStartupTime: isSet4(object.taskStartupTime) ? globalThis.Number(object.taskStartupTime) : 0, + taskFirstInput: isSet4(object.taskFirstInput) ? globalThis.Boolean(object.taskFirstInput) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + if (message.finishedAt !== 0) { + obj.finishedAt = message.finishedAt; + } + if (message.taskStartupTime !== 0) { + obj.taskStartupTime = message.taskStartupTime; + } + if (message.taskFirstInput !== false) { + obj.taskFirstInput = message.taskFirstInput; + } + return obj; + }, + create(base) { + return InputInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputInfo(); + message.inputId = object.inputId ?? ""; + message.idx = object.idx ?? 0; + message.taskId = object.taskId ?? ""; + message.startedAt = object.startedAt ?? 0; + message.finishedAt = object.finishedAt ?? 0; + message.taskStartupTime = object.taskStartupTime ?? 0; + message.taskFirstInput = object.taskFirstInput ?? false; + return message; + } +}; +function createBaseListPagination() { + return { maxObjects: 0, createdBefore: 0 }; +} +var ListPagination = { + encode(message, writer = new BinaryWriter()) { + if (message.maxObjects !== 0) { + writer.uint32(8).int32(message.maxObjects); + } + if (message.createdBefore !== 0) { + writer.uint32(17).double(message.createdBefore); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseListPagination(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.maxObjects = reader.int32(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdBefore = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxObjects: isSet4(object.maxObjects) ? globalThis.Number(object.maxObjects) : 0, + createdBefore: isSet4(object.createdBefore) ? globalThis.Number(object.createdBefore) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.maxObjects !== 0) { + obj.maxObjects = Math.round(message.maxObjects); + } + if (message.createdBefore !== 0) { + obj.createdBefore = message.createdBefore; + } + return obj; + }, + create(base) { + return ListPagination.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseListPagination(); + message.maxObjects = object.maxObjects ?? 0; + message.createdBefore = object.createdBefore ?? 0; + return message; + } +}; +function createBaseMapAwaitRequest() { + return { functionCallId: void 0, mapToken: void 0, lastEntryId: "", requestedAt: 0, timeout: 0 }; +} +var MapAwaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.mapToken !== void 0) { + writer.uint32(42).string(message.mapToken); + } + if (message.lastEntryId !== "") { + writer.uint32(18).string(message.lastEntryId); + } + if (message.requestedAt !== 0) { + writer.uint32(25).double(message.requestedAt); + } + if (message.timeout !== 0) { + writer.uint32(37).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapAwaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : void 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.mapToken !== void 0) { + obj.mapToken = message.mapToken; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return MapAwaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapAwaitRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.mapToken = object.mapToken ?? void 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.requestedAt = object.requestedAt ?? 0; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseMapAwaitResponse() { + return { outputs: [], lastEntryId: "" }; +} +var MapAwaitResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.outputs) { + FunctionGetOutputsItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.lastEntryId !== "") { + writer.uint32(18).string(message.lastEntryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapAwaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.outputs.push(FunctionGetOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionGetOutputsItem.fromJSON(e)) : [], + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionGetOutputsItem.toJSON(e)); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + return obj; + }, + create(base) { + return MapAwaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapAwaitResponse(); + message.outputs = object.outputs?.map((e) => FunctionGetOutputsItem.fromPartial(e)) || []; + message.lastEntryId = object.lastEntryId ?? ""; + return message; + } +}; +function createBaseMapCheckInputsRequest() { + return { lastEntryId: "", timeout: 0, attemptTokens: [] }; +} +var MapCheckInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.lastEntryId !== "") { + writer.uint32(10).string(message.lastEntryId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + for (const v of message.attemptTokens) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapCheckInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptTokens.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + attemptTokens: globalThis.Array.isArray(object?.attemptTokens) ? object.attemptTokens.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.attemptTokens?.length) { + obj.attemptTokens = message.attemptTokens; + } + return obj; + }, + create(base) { + return MapCheckInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapCheckInputsRequest(); + message.lastEntryId = object.lastEntryId ?? ""; + message.timeout = object.timeout ?? 0; + message.attemptTokens = object.attemptTokens?.map((e) => e) || []; + return message; + } +}; +function createBaseMapCheckInputsResponse() { + return { lost: [] }; +} +var MapCheckInputsResponse = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.lost) { + writer.bool(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapCheckInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.lost.push(reader.bool()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.lost.push(reader.bool()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { lost: globalThis.Array.isArray(object?.lost) ? object.lost.map((e) => globalThis.Boolean(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.lost?.length) { + obj.lost = message.lost; + } + return obj; + }, + create(base) { + return MapCheckInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapCheckInputsResponse(); + message.lost = object.lost?.map((e) => e) || []; + return message; + } +}; +function createBaseMapStartOrContinueItem() { + return { input: void 0, attemptToken: void 0 }; +} +var MapStartOrContinueItem = { + encode(message, writer = new BinaryWriter()) { + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(10).fork()).join(); + } + if (message.attemptToken !== void 0) { + writer.uint32(18).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return MapStartOrContinueItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueItem(); + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + message.attemptToken = object.attemptToken ?? void 0; + return message; + } +}; +function createBaseMapStartOrContinueRequest() { + return { functionId: "", parentInputId: "", functionCallId: void 0, mapToken: void 0, items: [] }; +} +var MapStartOrContinueRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.functionCallId !== void 0) { + writer.uint32(26).string(message.functionCallId); + } + if (message.mapToken !== void 0) { + writer.uint32(42).string(message.mapToken); + } + for (const v of message.items) { + MapStartOrContinueItem.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.items.push(MapStartOrContinueItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : void 0, + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => MapStartOrContinueItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.mapToken !== void 0) { + obj.mapToken = message.mapToken; + } + if (message.items?.length) { + obj.items = message.items.map((e) => MapStartOrContinueItem.toJSON(e)); + } + return obj; + }, + create(base) { + return MapStartOrContinueRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.functionCallId = object.functionCallId ?? void 0; + message.mapToken = object.mapToken ?? void 0; + message.items = object.items?.map((e) => MapStartOrContinueItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseMapStartOrContinueResponse() { + return { + mapToken: "", + functionId: "", + functionCallId: "", + maxInputsOutstanding: 0, + attemptTokens: [], + retryPolicy: void 0 + }; +} +var MapStartOrContinueResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.mapToken !== "") { + writer.uint32(50).string(message.mapToken); + } + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + if (message.maxInputsOutstanding !== 0) { + writer.uint32(24).uint32(message.maxInputsOutstanding); + } + for (const v of message.attemptTokens) { + writer.uint32(34).string(v); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: { + if (tag !== 50) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxInputsOutstanding = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.attemptTokens.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + maxInputsOutstanding: isSet4(object.maxInputsOutstanding) ? globalThis.Number(object.maxInputsOutstanding) : 0, + attemptTokens: globalThis.Array.isArray(object?.attemptTokens) ? object.attemptTokens.map((e) => globalThis.String(e)) : [], + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mapToken !== "") { + obj.mapToken = message.mapToken; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.maxInputsOutstanding !== 0) { + obj.maxInputsOutstanding = Math.round(message.maxInputsOutstanding); + } + if (message.attemptTokens?.length) { + obj.attemptTokens = message.attemptTokens; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + return obj; + }, + create(base) { + return MapStartOrContinueResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueResponse(); + message.mapToken = object.mapToken ?? ""; + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.maxInputsOutstanding = object.maxInputsOutstanding ?? 0; + message.attemptTokens = object.attemptTokens?.map((e) => e) || []; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + return message; + } +}; +function createBaseMethodDefinition() { + return { + functionName: "", + functionType: 0, + webhookConfig: void 0, + webUrl: "", + webUrlInfo: void 0, + customDomainInfo: [], + functionSchema: void 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var MethodDefinition = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(10).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(16).int32(message.functionType); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(26).fork()).join(); + } + if (message.webUrl !== "") { + writer.uint32(34).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(42).fork()).join(); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(50).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(58).fork()).join(); + } + writer.uint32(66).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(74).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMethodDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag === 64) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag === 72) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 74) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return MethodDefinition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodDefinition(); + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseMountFile() { + return { filename: "", sha256Hex: "", size: void 0, mode: void 0 }; +} +var MountFile = { + encode(message, writer = new BinaryWriter()) { + if (message.filename !== "") { + writer.uint32(10).string(message.filename); + } + if (message.sha256Hex !== "") { + writer.uint32(26).string(message.sha256Hex); + } + if (message.size !== void 0) { + writer.uint32(32).uint64(message.size); + } + if (message.mode !== void 0) { + writer.uint32(40).uint32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.filename = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.mode = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + filename: isSet4(object.filename) ? globalThis.String(object.filename) : "", + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : void 0, + mode: isSet4(object.mode) ? globalThis.Number(object.mode) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.filename !== "") { + obj.filename = message.filename; + } + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.size !== void 0) { + obj.size = Math.round(message.size); + } + if (message.mode !== void 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + create(base) { + return MountFile.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountFile(); + message.filename = object.filename ?? ""; + message.sha256Hex = object.sha256Hex ?? ""; + message.size = object.size ?? void 0; + message.mode = object.mode ?? void 0; + return message; + } +}; +function createBaseMountGetOrCreateRequest() { + return { deploymentName: "", namespace: 0, environmentName: "", objectCreationType: 0, files: [], appId: "" }; +} +var MountGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.namespace !== 0) { + writer.uint32(16).int32(message.namespace); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + for (const v of message.files) { + MountFile.encode(v, writer.uint32(42).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(50).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.namespace = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.files.push(MountFile.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + namespace: isSet4(object.namespace) ? deploymentNamespaceFromJSON(object.namespace) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => MountFile.fromJSON(e)) : [], + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.namespace !== 0) { + obj.namespace = deploymentNamespaceToJSON(message.namespace); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.files?.length) { + obj.files = message.files.map((e) => MountFile.toJSON(e)); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return MountGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.namespace = object.namespace ?? 0; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.files = object.files?.map((e) => MountFile.fromPartial(e)) || []; + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseMountGetOrCreateResponse() { + return { mountId: "", handleMetadata: void 0 }; +} +var MountGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.mountId !== "") { + writer.uint32(10).string(message.mountId); + } + if (message.handleMetadata !== void 0) { + MountHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mountId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = MountHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mountId: isSet4(object.mountId) ? globalThis.String(object.mountId) : "", + handleMetadata: isSet4(object.handleMetadata) ? MountHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mountId !== "") { + obj.mountId = message.mountId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = MountHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return MountGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountGetOrCreateResponse(); + message.mountId = object.mountId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? MountHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseMountHandleMetadata() { + return { contentChecksumSha256Hex: "" }; +} +var MountHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.contentChecksumSha256Hex !== "") { + writer.uint32(10).string(message.contentChecksumSha256Hex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentChecksumSha256Hex = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentChecksumSha256Hex: isSet4(object.contentChecksumSha256Hex) ? globalThis.String(object.contentChecksumSha256Hex) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentChecksumSha256Hex !== "") { + obj.contentChecksumSha256Hex = message.contentChecksumSha256Hex; + } + return obj; + }, + create(base) { + return MountHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountHandleMetadata(); + message.contentChecksumSha256Hex = object.contentChecksumSha256Hex ?? ""; + return message; + } +}; +function createBaseMountPutFileRequest() { + return { sha256Hex: "", data: void 0, dataBlobId: void 0 }; +} +var MountPutFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sha256Hex !== "") { + writer.uint32(18).string(message.sha256Hex); + } + if (message.data !== void 0) { + writer.uint32(26).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(42).string(message.dataBlobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountPutFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.data = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + return obj; + }, + create(base) { + return MountPutFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountPutFileRequest(); + message.sha256Hex = object.sha256Hex ?? ""; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + return message; + } +}; +function createBaseMountPutFileResponse() { + return { exists: false }; +} +var MountPutFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(16).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountPutFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return MountPutFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountPutFileResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseMultiPartUpload() { + return { partLength: 0, uploadUrls: [], completionUrl: "" }; +} +var MultiPartUpload = { + encode(message, writer = new BinaryWriter()) { + if (message.partLength !== 0) { + writer.uint32(8).int64(message.partLength); + } + for (const v of message.uploadUrls) { + writer.uint32(18).string(v); + } + if (message.completionUrl !== "") { + writer.uint32(26).string(message.completionUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMultiPartUpload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.partLength = longToNumber2(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.uploadUrls.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.completionUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + partLength: isSet4(object.partLength) ? globalThis.Number(object.partLength) : 0, + uploadUrls: globalThis.Array.isArray(object?.uploadUrls) ? object.uploadUrls.map((e) => globalThis.String(e)) : [], + completionUrl: isSet4(object.completionUrl) ? globalThis.String(object.completionUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.partLength !== 0) { + obj.partLength = Math.round(message.partLength); + } + if (message.uploadUrls?.length) { + obj.uploadUrls = message.uploadUrls; + } + if (message.completionUrl !== "") { + obj.completionUrl = message.completionUrl; + } + return obj; + }, + create(base) { + return MultiPartUpload.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMultiPartUpload(); + message.partLength = object.partLength ?? 0; + message.uploadUrls = object.uploadUrls?.map((e) => e) || []; + message.completionUrl = object.completionUrl ?? ""; + return message; + } +}; +function createBaseMultiPartUploadList() { + return { items: [] }; +} +var MultiPartUploadList = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + MultiPartUpload.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMultiPartUploadList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(MultiPartUpload.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => MultiPartUpload.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => MultiPartUpload.toJSON(e)); + } + return obj; + }, + create(base) { + return MultiPartUploadList.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMultiPartUploadList(); + message.items = object.items?.map((e) => MultiPartUpload.fromPartial(e)) || []; + return message; + } +}; +function createBaseNetworkAccess() { + return { networkAccessType: 0, allowedCidrs: [] }; +} +var NetworkAccess = { + encode(message, writer = new BinaryWriter()) { + if (message.networkAccessType !== 0) { + writer.uint32(8).int32(message.networkAccessType); + } + for (const v of message.allowedCidrs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNetworkAccess(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.networkAccessType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.allowedCidrs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + networkAccessType: isSet4(object.networkAccessType) ? networkAccess_NetworkAccessTypeFromJSON(object.networkAccessType) : 0, + allowedCidrs: globalThis.Array.isArray(object?.allowedCidrs) ? object.allowedCidrs.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.networkAccessType !== 0) { + obj.networkAccessType = networkAccess_NetworkAccessTypeToJSON(message.networkAccessType); + } + if (message.allowedCidrs?.length) { + obj.allowedCidrs = message.allowedCidrs; + } + return obj; + }, + create(base) { + return NetworkAccess.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNetworkAccess(); + message.networkAccessType = object.networkAccessType ?? 0; + message.allowedCidrs = object.allowedCidrs?.map((e) => e) || []; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest() { + return { notebookId: "", results: [] }; +} +var NotebookKernelPublishResultsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.notebookId !== "") { + writer.uint32(10).string(message.notebookId); + } + for (const v of message.results) { + NotebookKernelPublishResultsRequest_CellResult.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.notebookId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.results.push(NotebookKernelPublishResultsRequest_CellResult.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + notebookId: isSet4(object.notebookId) ? globalThis.String(object.notebookId) : "", + results: globalThis.Array.isArray(object?.results) ? object.results.map((e) => NotebookKernelPublishResultsRequest_CellResult.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.notebookId !== "") { + obj.notebookId = message.notebookId; + } + if (message.results?.length) { + obj.results = message.results.map((e) => NotebookKernelPublishResultsRequest_CellResult.toJSON(e)); + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest(); + message.notebookId = object.notebookId ?? ""; + message.results = object.results?.map((e) => NotebookKernelPublishResultsRequest_CellResult.fromPartial(e)) || []; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest_ExecuteReply() { + return { status: "", executionCount: 0, duration: 0 }; +} +var NotebookKernelPublishResultsRequest_ExecuteReply = { + encode(message, writer = new BinaryWriter()) { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.executionCount !== 0) { + writer.uint32(16).uint32(message.executionCount); + } + if (message.duration !== 0) { + writer.uint32(25).double(message.duration); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest_ExecuteReply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.status = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.executionCount = reader.uint32(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.duration = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet4(object.status) ? globalThis.String(object.status) : "", + executionCount: isSet4(object.executionCount) ? globalThis.Number(object.executionCount) : 0, + duration: isSet4(object.duration) ? globalThis.Number(object.duration) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.executionCount !== 0) { + obj.executionCount = Math.round(message.executionCount); + } + if (message.duration !== 0) { + obj.duration = message.duration; + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest_ExecuteReply(); + message.status = object.status ?? ""; + message.executionCount = object.executionCount ?? 0; + message.duration = object.duration ?? 0; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest_CellResult() { + return { cellId: "", output: void 0, clearOutput: void 0, executeReply: void 0 }; +} +var NotebookKernelPublishResultsRequest_CellResult = { + encode(message, writer = new BinaryWriter()) { + if (message.cellId !== "") { + writer.uint32(10).string(message.cellId); + } + if (message.output !== void 0) { + NotebookOutput.encode(message.output, writer.uint32(18).fork()).join(); + } + if (message.clearOutput !== void 0) { + writer.uint32(24).bool(message.clearOutput); + } + if (message.executeReply !== void 0) { + NotebookKernelPublishResultsRequest_ExecuteReply.encode(message.executeReply, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest_CellResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cellId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.output = NotebookOutput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.clearOutput = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.executeReply = NotebookKernelPublishResultsRequest_ExecuteReply.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cellId: isSet4(object.cellId) ? globalThis.String(object.cellId) : "", + output: isSet4(object.output) ? NotebookOutput.fromJSON(object.output) : void 0, + clearOutput: isSet4(object.clearOutput) ? globalThis.Boolean(object.clearOutput) : void 0, + executeReply: isSet4(object.executeReply) ? NotebookKernelPublishResultsRequest_ExecuteReply.fromJSON(object.executeReply) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cellId !== "") { + obj.cellId = message.cellId; + } + if (message.output !== void 0) { + obj.output = NotebookOutput.toJSON(message.output); + } + if (message.clearOutput !== void 0) { + obj.clearOutput = message.clearOutput; + } + if (message.executeReply !== void 0) { + obj.executeReply = NotebookKernelPublishResultsRequest_ExecuteReply.toJSON(message.executeReply); + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest_CellResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest_CellResult(); + message.cellId = object.cellId ?? ""; + message.output = object.output !== void 0 && object.output !== null ? NotebookOutput.fromPartial(object.output) : void 0; + message.clearOutput = object.clearOutput ?? void 0; + message.executeReply = object.executeReply !== void 0 && object.executeReply !== null ? NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(object.executeReply) : void 0; + return message; + } +}; +function createBaseNotebookOutput() { + return { executeResult: void 0, displayData: void 0, stream: void 0, error: void 0 }; +} +var NotebookOutput = { + encode(message, writer = new BinaryWriter()) { + if (message.executeResult !== void 0) { + NotebookOutput_ExecuteResult.encode(message.executeResult, writer.uint32(10).fork()).join(); + } + if (message.displayData !== void 0) { + NotebookOutput_DisplayData.encode(message.displayData, writer.uint32(18).fork()).join(); + } + if (message.stream !== void 0) { + NotebookOutput_Stream.encode(message.stream, writer.uint32(26).fork()).join(); + } + if (message.error !== void 0) { + NotebookOutput_Error.encode(message.error, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.executeResult = NotebookOutput_ExecuteResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.displayData = NotebookOutput_DisplayData.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stream = NotebookOutput_Stream.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.error = NotebookOutput_Error.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + executeResult: isSet4(object.executeResult) ? NotebookOutput_ExecuteResult.fromJSON(object.executeResult) : void 0, + displayData: isSet4(object.displayData) ? NotebookOutput_DisplayData.fromJSON(object.displayData) : void 0, + stream: isSet4(object.stream) ? NotebookOutput_Stream.fromJSON(object.stream) : void 0, + error: isSet4(object.error) ? NotebookOutput_Error.fromJSON(object.error) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.executeResult !== void 0) { + obj.executeResult = NotebookOutput_ExecuteResult.toJSON(message.executeResult); + } + if (message.displayData !== void 0) { + obj.displayData = NotebookOutput_DisplayData.toJSON(message.displayData); + } + if (message.stream !== void 0) { + obj.stream = NotebookOutput_Stream.toJSON(message.stream); + } + if (message.error !== void 0) { + obj.error = NotebookOutput_Error.toJSON(message.error); + } + return obj; + }, + create(base) { + return NotebookOutput.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput(); + message.executeResult = object.executeResult !== void 0 && object.executeResult !== null ? NotebookOutput_ExecuteResult.fromPartial(object.executeResult) : void 0; + message.displayData = object.displayData !== void 0 && object.displayData !== null ? NotebookOutput_DisplayData.fromPartial(object.displayData) : void 0; + message.stream = object.stream !== void 0 && object.stream !== null ? NotebookOutput_Stream.fromPartial(object.stream) : void 0; + message.error = object.error !== void 0 && object.error !== null ? NotebookOutput_Error.fromPartial(object.error) : void 0; + return message; + } +}; +function createBaseNotebookOutput_ExecuteResult() { + return { executionCount: 0, data: void 0, metadata: void 0 }; +} +var NotebookOutput_ExecuteResult = { + encode(message, writer = new BinaryWriter()) { + if (message.executionCount !== 0) { + writer.uint32(8).uint32(message.executionCount); + } + if (message.data !== void 0) { + Struct.encode(Struct.wrap(message.data), writer.uint32(18).fork()).join(); + } + if (message.metadata !== void 0) { + Struct.encode(Struct.wrap(message.metadata), writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_ExecuteResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.executionCount = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + executionCount: isSet4(object.executionCount) ? globalThis.Number(object.executionCount) : 0, + data: isObject2(object.data) ? object.data : void 0, + metadata: isObject2(object.metadata) ? object.metadata : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.executionCount !== 0) { + obj.executionCount = Math.round(message.executionCount); + } + if (message.data !== void 0) { + obj.data = message.data; + } + if (message.metadata !== void 0) { + obj.metadata = message.metadata; + } + return obj; + }, + create(base) { + return NotebookOutput_ExecuteResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_ExecuteResult(); + message.executionCount = object.executionCount ?? 0; + message.data = object.data ?? void 0; + message.metadata = object.metadata ?? void 0; + return message; + } +}; +function createBaseNotebookOutput_DisplayData() { + return { data: void 0, metadata: void 0, transientDisplayId: void 0 }; +} +var NotebookOutput_DisplayData = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + Struct.encode(Struct.wrap(message.data), writer.uint32(10).fork()).join(); + } + if (message.metadata !== void 0) { + Struct.encode(Struct.wrap(message.metadata), writer.uint32(18).fork()).join(); + } + if (message.transientDisplayId !== void 0) { + writer.uint32(26).string(message.transientDisplayId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_DisplayData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.transientDisplayId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isObject2(object.data) ? object.data : void 0, + metadata: isObject2(object.metadata) ? object.metadata : void 0, + transientDisplayId: isSet4(object.transientDisplayId) ? globalThis.String(object.transientDisplayId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = message.data; + } + if (message.metadata !== void 0) { + obj.metadata = message.metadata; + } + if (message.transientDisplayId !== void 0) { + obj.transientDisplayId = message.transientDisplayId; + } + return obj; + }, + create(base) { + return NotebookOutput_DisplayData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_DisplayData(); + message.data = object.data ?? void 0; + message.metadata = object.metadata ?? void 0; + message.transientDisplayId = object.transientDisplayId ?? void 0; + return message; + } +}; +function createBaseNotebookOutput_Stream() { + return { name: "", text: "" }; +} +var NotebookOutput_Stream = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.text !== "") { + writer.uint32(18).string(message.text); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_Stream(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.text = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + text: isSet4(object.text) ? globalThis.String(object.text) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.text !== "") { + obj.text = message.text; + } + return obj; + }, + create(base) { + return NotebookOutput_Stream.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_Stream(); + message.name = object.name ?? ""; + message.text = object.text ?? ""; + return message; + } +}; +function createBaseNotebookOutput_Error() { + return { ename: "", evalue: "", traceback: [] }; +} +var NotebookOutput_Error = { + encode(message, writer = new BinaryWriter()) { + if (message.ename !== "") { + writer.uint32(10).string(message.ename); + } + if (message.evalue !== "") { + writer.uint32(18).string(message.evalue); + } + for (const v of message.traceback) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_Error(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.ename = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.evalue = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.traceback.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ename: isSet4(object.ename) ? globalThis.String(object.ename) : "", + evalue: isSet4(object.evalue) ? globalThis.String(object.evalue) : "", + traceback: globalThis.Array.isArray(object?.traceback) ? object.traceback.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.ename !== "") { + obj.ename = message.ename; + } + if (message.evalue !== "") { + obj.evalue = message.evalue; + } + if (message.traceback?.length) { + obj.traceback = message.traceback; + } + return obj; + }, + create(base) { + return NotebookOutput_Error.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_Error(); + message.ename = object.ename ?? ""; + message.evalue = object.evalue ?? ""; + message.traceback = object.traceback?.map((e) => e) || []; + return message; + } +}; +function createBaseObject() { + return { + objectId: "", + functionHandleMetadata: void 0, + mountHandleMetadata: void 0, + classHandleMetadata: void 0, + sandboxHandleMetadata: void 0, + volumeMetadata: void 0 + }; +} +var Object_ = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + if (message.functionHandleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.functionHandleMetadata, writer.uint32(26).fork()).join(); + } + if (message.mountHandleMetadata !== void 0) { + MountHandleMetadata.encode(message.mountHandleMetadata, writer.uint32(34).fork()).join(); + } + if (message.classHandleMetadata !== void 0) { + ClassHandleMetadata.encode(message.classHandleMetadata, writer.uint32(42).fork()).join(); + } + if (message.sandboxHandleMetadata !== void 0) { + SandboxHandleMetadata.encode(message.sandboxHandleMetadata, writer.uint32(50).fork()).join(); + } + if (message.volumeMetadata !== void 0) { + VolumeMetadata.encode(message.volumeMetadata, writer.uint32(58).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseObject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionHandleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.mountHandleMetadata = MountHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.classHandleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.sandboxHandleMetadata = SandboxHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.volumeMetadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "", + functionHandleMetadata: isSet4(object.functionHandleMetadata) ? FunctionHandleMetadata.fromJSON(object.functionHandleMetadata) : void 0, + mountHandleMetadata: isSet4(object.mountHandleMetadata) ? MountHandleMetadata.fromJSON(object.mountHandleMetadata) : void 0, + classHandleMetadata: isSet4(object.classHandleMetadata) ? ClassHandleMetadata.fromJSON(object.classHandleMetadata) : void 0, + sandboxHandleMetadata: isSet4(object.sandboxHandleMetadata) ? SandboxHandleMetadata.fromJSON(object.sandboxHandleMetadata) : void 0, + volumeMetadata: isSet4(object.volumeMetadata) ? VolumeMetadata.fromJSON(object.volumeMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.functionHandleMetadata !== void 0) { + obj.functionHandleMetadata = FunctionHandleMetadata.toJSON(message.functionHandleMetadata); + } + if (message.mountHandleMetadata !== void 0) { + obj.mountHandleMetadata = MountHandleMetadata.toJSON(message.mountHandleMetadata); + } + if (message.classHandleMetadata !== void 0) { + obj.classHandleMetadata = ClassHandleMetadata.toJSON(message.classHandleMetadata); + } + if (message.sandboxHandleMetadata !== void 0) { + obj.sandboxHandleMetadata = SandboxHandleMetadata.toJSON(message.sandboxHandleMetadata); + } + if (message.volumeMetadata !== void 0) { + obj.volumeMetadata = VolumeMetadata.toJSON(message.volumeMetadata); + } + return obj; + }, + create(base) { + return Object_.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseObject(); + message.objectId = object.objectId ?? ""; + message.functionHandleMetadata = object.functionHandleMetadata !== void 0 && object.functionHandleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.functionHandleMetadata) : void 0; + message.mountHandleMetadata = object.mountHandleMetadata !== void 0 && object.mountHandleMetadata !== null ? MountHandleMetadata.fromPartial(object.mountHandleMetadata) : void 0; + message.classHandleMetadata = object.classHandleMetadata !== void 0 && object.classHandleMetadata !== null ? ClassHandleMetadata.fromPartial(object.classHandleMetadata) : void 0; + message.sandboxHandleMetadata = object.sandboxHandleMetadata !== void 0 && object.sandboxHandleMetadata !== null ? SandboxHandleMetadata.fromPartial(object.sandboxHandleMetadata) : void 0; + message.volumeMetadata = object.volumeMetadata !== void 0 && object.volumeMetadata !== null ? VolumeMetadata.fromPartial(object.volumeMetadata) : void 0; + return message; + } +}; +function createBaseObjectDependency() { + return { objectId: "" }; +} +var ObjectDependency = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseObjectDependency(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + return obj; + }, + create(base) { + return ObjectDependency.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseObjectDependency(); + message.objectId = object.objectId ?? ""; + return message; + } +}; +function createBasePTYInfo() { + return { + enabled: false, + winszRows: 0, + winszCols: 0, + envTerm: "", + envColorterm: "", + envTermProgram: "", + ptyType: 0, + noTerminateOnIdleStdin: false + }; +} +var PTYInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.enabled !== false) { + writer.uint32(8).bool(message.enabled); + } + if (message.winszRows !== 0) { + writer.uint32(16).uint32(message.winszRows); + } + if (message.winszCols !== 0) { + writer.uint32(24).uint32(message.winszCols); + } + if (message.envTerm !== "") { + writer.uint32(34).string(message.envTerm); + } + if (message.envColorterm !== "") { + writer.uint32(42).string(message.envColorterm); + } + if (message.envTermProgram !== "") { + writer.uint32(50).string(message.envTermProgram); + } + if (message.ptyType !== 0) { + writer.uint32(56).int32(message.ptyType); + } + if (message.noTerminateOnIdleStdin !== false) { + writer.uint32(64).bool(message.noTerminateOnIdleStdin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePTYInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.enabled = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.winszRows = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.winszCols = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.envTerm = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.envColorterm = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.envTermProgram = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.ptyType = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.noTerminateOnIdleStdin = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + enabled: isSet4(object.enabled) ? globalThis.Boolean(object.enabled) : false, + winszRows: isSet4(object.winszRows) ? globalThis.Number(object.winszRows) : 0, + winszCols: isSet4(object.winszCols) ? globalThis.Number(object.winszCols) : 0, + envTerm: isSet4(object.envTerm) ? globalThis.String(object.envTerm) : "", + envColorterm: isSet4(object.envColorterm) ? globalThis.String(object.envColorterm) : "", + envTermProgram: isSet4(object.envTermProgram) ? globalThis.String(object.envTermProgram) : "", + ptyType: isSet4(object.ptyType) ? pTYInfo_PTYTypeFromJSON(object.ptyType) : 0, + noTerminateOnIdleStdin: isSet4(object.noTerminateOnIdleStdin) ? globalThis.Boolean(object.noTerminateOnIdleStdin) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + if (message.winszRows !== 0) { + obj.winszRows = Math.round(message.winszRows); + } + if (message.winszCols !== 0) { + obj.winszCols = Math.round(message.winszCols); + } + if (message.envTerm !== "") { + obj.envTerm = message.envTerm; + } + if (message.envColorterm !== "") { + obj.envColorterm = message.envColorterm; + } + if (message.envTermProgram !== "") { + obj.envTermProgram = message.envTermProgram; + } + if (message.ptyType !== 0) { + obj.ptyType = pTYInfo_PTYTypeToJSON(message.ptyType); + } + if (message.noTerminateOnIdleStdin !== false) { + obj.noTerminateOnIdleStdin = message.noTerminateOnIdleStdin; + } + return obj; + }, + create(base) { + return PTYInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePTYInfo(); + message.enabled = object.enabled ?? false; + message.winszRows = object.winszRows ?? 0; + message.winszCols = object.winszCols ?? 0; + message.envTerm = object.envTerm ?? ""; + message.envColorterm = object.envColorterm ?? ""; + message.envTermProgram = object.envTermProgram ?? ""; + message.ptyType = object.ptyType ?? 0; + message.noTerminateOnIdleStdin = object.noTerminateOnIdleStdin ?? false; + return message; + } +}; +function createBasePortSpec() { + return { port: 0, unencrypted: false, tunnelType: void 0 }; +} +var PortSpec = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + if (message.unencrypted !== false) { + writer.uint32(16).bool(message.unencrypted); + } + if (message.tunnelType !== void 0) { + writer.uint32(24).int32(message.tunnelType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePortSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.unencrypted = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.tunnelType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencrypted: isSet4(object.unencrypted) ? globalThis.Boolean(object.unencrypted) : false, + tunnelType: isSet4(object.tunnelType) ? tunnelTypeFromJSON(object.tunnelType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencrypted !== false) { + obj.unencrypted = message.unencrypted; + } + if (message.tunnelType !== void 0) { + obj.tunnelType = tunnelTypeToJSON(message.tunnelType); + } + return obj; + }, + create(base) { + return PortSpec.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePortSpec(); + message.port = object.port ?? 0; + message.unencrypted = object.unencrypted ?? false; + message.tunnelType = object.tunnelType ?? void 0; + return message; + } +}; +function createBasePortSpecs() { + return { ports: [] }; +} +var PortSpecs = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.ports) { + PortSpec.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePortSpecs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.ports.push(PortSpec.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { ports: globalThis.Array.isArray(object?.ports) ? object.ports.map((e) => PortSpec.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => PortSpec.toJSON(e)); + } + return obj; + }, + create(base) { + return PortSpecs.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePortSpecs(); + message.ports = object.ports?.map((e) => PortSpec.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxy() { + return { name: "", createdAt: 0, environmentName: "", proxyId: "", proxyIps: [] }; +} +var Proxy2 = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.proxyId !== "") { + writer.uint32(42).string(message.proxyId); + } + for (const v of message.proxyIps) { + ProxyIp.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.proxyIps.push(ProxyIp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "", + proxyIps: globalThis.Array.isArray(object?.proxyIps) ? object.proxyIps.map((e) => ProxyIp.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + if (message.proxyIps?.length) { + obj.proxyIps = message.proxyIps.map((e) => ProxyIp.toJSON(e)); + } + return obj; + }, + create(base) { + return Proxy2.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxy(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.environmentName = object.environmentName ?? ""; + message.proxyId = object.proxyId ?? ""; + message.proxyIps = object.proxyIps?.map((e) => ProxyIp.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxyAddIpRequest() { + return { proxyId: "" }; +} +var ProxyAddIpRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyAddIpRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyAddIpRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyAddIpRequest(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyAddIpResponse() { + return { proxyIp: void 0 }; +} +var ProxyAddIpResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== void 0) { + ProxyIp.encode(message.proxyIp, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyAddIpResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = ProxyIp.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyIp: isSet4(object.proxyIp) ? ProxyIp.fromJSON(object.proxyIp) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== void 0) { + obj.proxyIp = ProxyIp.toJSON(message.proxyIp); + } + return obj; + }, + create(base) { + return ProxyAddIpResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyAddIpResponse(); + message.proxyIp = object.proxyIp !== void 0 && object.proxyIp !== null ? ProxyIp.fromPartial(object.proxyIp) : void 0; + return message; + } +}; +function createBaseProxyCreateRequest() { + return { name: "", environmentName: "" }; +} +var ProxyCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyCreateRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyCreateResponse() { + return { proxy: void 0 }; +} +var ProxyCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxy !== void 0) { + Proxy2.encode(message.proxy, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxy = Proxy2.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxy: isSet4(object.proxy) ? Proxy2.fromJSON(object.proxy) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxy !== void 0) { + obj.proxy = Proxy2.toJSON(message.proxy); + } + return obj; + }, + create(base) { + return ProxyCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyCreateResponse(); + message.proxy = object.proxy !== void 0 && object.proxy !== null ? Proxy2.fromPartial(object.proxy) : void 0; + return message; + } +}; +function createBaseProxyDeleteRequest() { + return { proxyId: "" }; +} +var ProxyDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyDeleteRequest(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0 }; +} +var ProxyGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return ProxyGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseProxyGetOrCreateResponse() { + return { proxyId: "" }; +} +var ProxyGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetOrCreateResponse(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyGetRequest() { + return { name: "", environmentName: "" }; +} +var ProxyGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyGetResponse() { + return { proxy: void 0 }; +} +var ProxyGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxy !== void 0) { + Proxy2.encode(message.proxy, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxy = Proxy2.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxy: isSet4(object.proxy) ? Proxy2.fromJSON(object.proxy) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxy !== void 0) { + obj.proxy = Proxy2.toJSON(message.proxy); + } + return obj; + }, + create(base) { + return ProxyGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetResponse(); + message.proxy = object.proxy !== void 0 && object.proxy !== null ? Proxy2.fromPartial(object.proxy) : void 0; + return message; + } +}; +function createBaseProxyIp() { + return { proxyIp: "", status: 0, createdAt: 0, environmentName: "" }; +} +var ProxyIp = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== "") { + writer.uint32(10).string(message.proxyIp); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyIp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + proxyIp: isSet4(object.proxyIp) ? globalThis.String(object.proxyIp) : "", + status: isSet4(object.status) ? proxyIpStatusFromJSON(object.status) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== "") { + obj.proxyIp = message.proxyIp; + } + if (message.status !== 0) { + obj.status = proxyIpStatusToJSON(message.status); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyIp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyIp(); + message.proxyIp = object.proxyIp ?? ""; + message.status = object.status ?? 0; + message.createdAt = object.createdAt ?? 0; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyListResponse() { + return { proxies: [] }; +} +var ProxyListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.proxies) { + Proxy2.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxies.push(Proxy2.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + proxies: globalThis.Array.isArray(object?.proxies) ? object.proxies.map((e) => Proxy2.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.proxies?.length) { + obj.proxies = message.proxies.map((e) => Proxy2.toJSON(e)); + } + return obj; + }, + create(base) { + return ProxyListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyListResponse(); + message.proxies = object.proxies?.map((e) => Proxy2.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxyRemoveIpRequest() { + return { proxyIp: "" }; +} +var ProxyRemoveIpRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== "") { + writer.uint32(10).string(message.proxyIp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyRemoveIpRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyIp: isSet4(object.proxyIp) ? globalThis.String(object.proxyIp) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== "") { + obj.proxyIp = message.proxyIp; + } + return obj; + }, + create(base) { + return ProxyRemoveIpRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyRemoveIpRequest(); + message.proxyIp = object.proxyIp ?? ""; + return message; + } +}; +function createBaseQueueClearRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), allPartitions: false }; +} +var QueueClearRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.allPartitions !== false) { + writer.uint32(24).bool(message.allPartitions); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueClearRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.allPartitions = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + allPartitions: isSet4(object.allPartitions) ? globalThis.Boolean(object.allPartitions) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.allPartitions !== false) { + obj.allPartitions = message.allPartitions; + } + return obj; + }, + create(base) { + return QueueClearRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueClearRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.allPartitions = object.allPartitions ?? false; + return message; + } +}; +function createBaseQueueDeleteRequest() { + return { queueId: "" }; +} +var QueueDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + return obj; + }, + create(base) { + return QueueDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueDeleteRequest(); + message.queueId = object.queueId ?? ""; + return message; + } +}; +function createBaseQueueGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0 }; +} +var QueueGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return QueueGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseQueueGetOrCreateResponse() { + return { queueId: "", metadata: void 0 }; +} +var QueueGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.metadata !== void 0) { + QueueMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = QueueMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + metadata: isSet4(object.metadata) ? QueueMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.metadata !== void 0) { + obj.metadata = QueueMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return QueueGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetOrCreateResponse(); + message.queueId = object.queueId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? QueueMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseQueueGetRequest() { + return { queueId: "", timeout: 0, nValues: 0, partitionKey: new Uint8Array(0) }; +} +var QueueGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.nValues !== 0) { + writer.uint32(32).int32(message.nValues); + } + if (message.partitionKey.length !== 0) { + writer.uint32(42).bytes(message.partitionKey); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.nValues = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + nValues: isSet4(object.nValues) ? globalThis.Number(object.nValues) : 0, + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.nValues !== 0) { + obj.nValues = Math.round(message.nValues); + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + return obj; + }, + create(base) { + return QueueGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetRequest(); + message.queueId = object.queueId ?? ""; + message.timeout = object.timeout ?? 0; + message.nValues = object.nValues ?? 0; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + return message; + } +}; +function createBaseQueueGetResponse() { + return { values: [] }; +} +var QueueGetResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.values) { + writer.uint32(18).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.values.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e) => bytesFromBase64(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return QueueGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetResponse(); + message.values = object.values?.map((e) => e) || []; + return message; + } +}; +function createBaseQueueHeartbeatRequest() { + return { queueId: "" }; +} +var QueueHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + return obj; + }, + create(base) { + return QueueHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueHeartbeatRequest(); + message.queueId = object.queueId ?? ""; + return message; + } +}; +function createBaseQueueItem() { + return { value: new Uint8Array(0), entryId: "" }; +} +var QueueItem = { + encode(message, writer = new BinaryWriter()) { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.entryId !== "") { + writer.uint32(18).string(message.entryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.value = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.entryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + value: isSet4(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + return obj; + }, + create(base) { + return QueueItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueItem(); + message.value = object.value ?? new Uint8Array(0); + message.entryId = object.entryId ?? ""; + return message; + } +}; +function createBaseQueueLenRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), total: false }; +} +var QueueLenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.total !== false) { + writer.uint32(24).bool(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.total = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + total: isSet4(object.total) ? globalThis.Boolean(object.total) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.total !== false) { + obj.total = message.total; + } + return obj; + }, + create(base) { + return QueueLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueLenRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.total = object.total ?? false; + return message; + } +}; +function createBaseQueueLenResponse() { + return { len: 0 }; +} +var QueueLenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).int32(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { len: isSet4(object.len) ? globalThis.Number(object.len) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return QueueLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueLenResponse(); + message.len = object.len ?? 0; + return message; + } +}; +function createBaseQueueListRequest() { + return { environmentName: "", totalSizeLimit: 0, pagination: void 0 }; +} +var QueueListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.totalSizeLimit !== 0) { + writer.uint32(16).int32(message.totalSizeLimit); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.totalSizeLimit = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + totalSizeLimit: isSet4(object.totalSizeLimit) ? globalThis.Number(object.totalSizeLimit) : 0, + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.totalSizeLimit !== 0) { + obj.totalSizeLimit = Math.round(message.totalSizeLimit); + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueueListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListRequest(); + message.environmentName = object.environmentName ?? ""; + message.totalSizeLimit = object.totalSizeLimit ?? 0; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseQueueListResponse() { + return { queues: [], environmentName: "" }; +} +var QueueListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.queues) { + QueueListResponse_QueueInfo.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queues.push(QueueListResponse_QueueInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queues: globalThis.Array.isArray(object?.queues) ? object.queues.map((e) => QueueListResponse_QueueInfo.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.queues?.length) { + obj.queues = message.queues.map((e) => QueueListResponse_QueueInfo.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return QueueListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListResponse(); + message.queues = object.queues?.map((e) => QueueListResponse_QueueInfo.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseQueueListResponse_QueueInfo() { + return { name: "", createdAt: 0, numPartitions: 0, totalSize: 0, queueId: "", metadata: void 0 }; +} +var QueueListResponse_QueueInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.numPartitions !== 0) { + writer.uint32(24).int32(message.numPartitions); + } + if (message.totalSize !== 0) { + writer.uint32(32).int32(message.totalSize); + } + if (message.queueId !== "") { + writer.uint32(42).string(message.queueId); + } + if (message.metadata !== void 0) { + QueueMetadata.encode(message.metadata, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListResponse_QueueInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numPartitions = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.totalSize = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.queueId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.metadata = QueueMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + numPartitions: isSet4(object.numPartitions) ? globalThis.Number(object.numPartitions) : 0, + totalSize: isSet4(object.totalSize) ? globalThis.Number(object.totalSize) : 0, + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + metadata: isSet4(object.metadata) ? QueueMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.numPartitions !== 0) { + obj.numPartitions = Math.round(message.numPartitions); + } + if (message.totalSize !== 0) { + obj.totalSize = Math.round(message.totalSize); + } + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.metadata !== void 0) { + obj.metadata = QueueMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return QueueListResponse_QueueInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListResponse_QueueInfo(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.numPartitions = object.numPartitions ?? 0; + message.totalSize = object.totalSize ?? 0; + message.queueId = object.queueId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? QueueMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseQueueMetadata() { + return { name: "", creationInfo: void 0 }; +} +var QueueMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return QueueMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseQueueNextItemsRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), lastEntryId: "", itemPollTimeout: 0 }; +} +var QueueNextItemsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.lastEntryId !== "") { + writer.uint32(26).string(message.lastEntryId); + } + if (message.itemPollTimeout !== 0) { + writer.uint32(37).float(message.itemPollTimeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueNextItemsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.itemPollTimeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + itemPollTimeout: isSet4(object.itemPollTimeout) ? globalThis.Number(object.itemPollTimeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.itemPollTimeout !== 0) { + obj.itemPollTimeout = message.itemPollTimeout; + } + return obj; + }, + create(base) { + return QueueNextItemsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueNextItemsRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.lastEntryId = object.lastEntryId ?? ""; + message.itemPollTimeout = object.itemPollTimeout ?? 0; + return message; + } +}; +function createBaseQueueNextItemsResponse() { + return { items: [] }; +} +var QueueNextItemsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + QueueItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueNextItemsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(QueueItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => QueueItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => QueueItem.toJSON(e)); + } + return obj; + }, + create(base) { + return QueueNextItemsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueNextItemsResponse(); + message.items = object.items?.map((e) => QueueItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseQueuePutRequest() { + return { queueId: "", values: [], partitionKey: new Uint8Array(0), partitionTtlSeconds: 0 }; +} +var QueuePutRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + for (const v of message.values) { + writer.uint32(34).bytes(v); + } + if (message.partitionKey.length !== 0) { + writer.uint32(42).bytes(message.partitionKey); + } + if (message.partitionTtlSeconds !== 0) { + writer.uint32(48).int32(message.partitionTtlSeconds); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueuePutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.values.push(reader.bytes()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.partitionTtlSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e) => bytesFromBase64(e)) : [], + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + partitionTtlSeconds: isSet4(object.partitionTtlSeconds) ? globalThis.Number(object.partitionTtlSeconds) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.partitionTtlSeconds !== 0) { + obj.partitionTtlSeconds = Math.round(message.partitionTtlSeconds); + } + return obj; + }, + create(base) { + return QueuePutRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueuePutRequest(); + message.queueId = object.queueId ?? ""; + message.values = object.values?.map((e) => e) || []; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.partitionTtlSeconds = object.partitionTtlSeconds ?? 0; + return message; + } +}; +function createBaseRateLimit() { + return { limit: 0, interval: 0 }; +} +var RateLimit = { + encode(message, writer = new BinaryWriter()) { + if (message.limit !== 0) { + writer.uint32(8).int32(message.limit); + } + if (message.interval !== 0) { + writer.uint32(16).int32(message.interval); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRateLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.limit = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.interval = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + limit: isSet4(object.limit) ? globalThis.Number(object.limit) : 0, + interval: isSet4(object.interval) ? rateLimitIntervalFromJSON(object.interval) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.interval !== 0) { + obj.interval = rateLimitIntervalToJSON(message.interval); + } + return obj; + }, + create(base) { + return RateLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRateLimit(); + message.limit = object.limit ?? 0; + message.interval = object.interval ?? 0; + return message; + } +}; +function createBaseResources() { + return { + memoryMb: 0, + milliCpu: 0, + gpuConfig: void 0, + memoryMbMax: 0, + ephemeralDiskMb: 0, + milliCpuMax: 0, + rdma: false + }; +} +var Resources = { + encode(message, writer = new BinaryWriter()) { + if (message.memoryMb !== 0) { + writer.uint32(16).uint32(message.memoryMb); + } + if (message.milliCpu !== 0) { + writer.uint32(24).uint32(message.milliCpu); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(34).fork()).join(); + } + if (message.memoryMbMax !== 0) { + writer.uint32(40).uint32(message.memoryMbMax); + } + if (message.ephemeralDiskMb !== 0) { + writer.uint32(48).uint32(message.ephemeralDiskMb); + } + if (message.milliCpuMax !== 0) { + writer.uint32(56).uint32(message.milliCpuMax); + } + if (message.rdma !== false) { + writer.uint32(64).bool(message.rdma); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseResources(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.memoryMb = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.milliCpu = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.memoryMbMax = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.ephemeralDiskMb = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.milliCpuMax = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rdma = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + memoryMb: isSet4(object.memoryMb) ? globalThis.Number(object.memoryMb) : 0, + milliCpu: isSet4(object.milliCpu) ? globalThis.Number(object.milliCpu) : 0, + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0, + memoryMbMax: isSet4(object.memoryMbMax) ? globalThis.Number(object.memoryMbMax) : 0, + ephemeralDiskMb: isSet4(object.ephemeralDiskMb) ? globalThis.Number(object.ephemeralDiskMb) : 0, + milliCpuMax: isSet4(object.milliCpuMax) ? globalThis.Number(object.milliCpuMax) : 0, + rdma: isSet4(object.rdma) ? globalThis.Boolean(object.rdma) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.memoryMb !== 0) { + obj.memoryMb = Math.round(message.memoryMb); + } + if (message.milliCpu !== 0) { + obj.milliCpu = Math.round(message.milliCpu); + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + if (message.memoryMbMax !== 0) { + obj.memoryMbMax = Math.round(message.memoryMbMax); + } + if (message.ephemeralDiskMb !== 0) { + obj.ephemeralDiskMb = Math.round(message.ephemeralDiskMb); + } + if (message.milliCpuMax !== 0) { + obj.milliCpuMax = Math.round(message.milliCpuMax); + } + if (message.rdma !== false) { + obj.rdma = message.rdma; + } + return obj; + }, + create(base) { + return Resources.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResources(); + message.memoryMb = object.memoryMb ?? 0; + message.milliCpu = object.milliCpu ?? 0; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + message.memoryMbMax = object.memoryMbMax ?? 0; + message.ephemeralDiskMb = object.ephemeralDiskMb ?? 0; + message.milliCpuMax = object.milliCpuMax ?? 0; + message.rdma = object.rdma ?? false; + return message; + } +}; +function createBaseRuntimeInputMessage() { + return { message: new Uint8Array(0), messageIndex: 0, eof: false }; +} +var RuntimeInputMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.message.length !== 0) { + writer.uint32(10).bytes(message.message); + } + if (message.messageIndex !== 0) { + writer.uint32(16).uint64(message.messageIndex); + } + if (message.eof !== false) { + writer.uint32(24).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeInputMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.message = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.messageIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + message: isSet4(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0), + messageIndex: isSet4(object.messageIndex) ? globalThis.Number(object.messageIndex) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.message.length !== 0) { + obj.message = base64FromBytes(message.message); + } + if (message.messageIndex !== 0) { + obj.messageIndex = Math.round(message.messageIndex); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return RuntimeInputMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeInputMessage(); + message.message = object.message ?? new Uint8Array(0); + message.messageIndex = object.messageIndex ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseRuntimeOutputBatch() { + return { items: [], batchIndex: 0, exitCode: void 0, stdout: [], stderr: [], info: [] }; +} +var RuntimeOutputBatch = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + RuntimeOutputMessage.encode(v, writer.uint32(10).fork()).join(); + } + if (message.batchIndex !== 0) { + writer.uint32(16).uint64(message.batchIndex); + } + if (message.exitCode !== void 0) { + writer.uint32(24).int32(message.exitCode); + } + for (const v of message.stdout) { + RuntimeOutputMessage.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.stderr) { + RuntimeOutputMessage.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.info) { + RuntimeOutputMessage.encode(v, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeOutputBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.batchIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.exitCode = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.stdout.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.stderr.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.info.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + batchIndex: isSet4(object.batchIndex) ? globalThis.Number(object.batchIndex) : 0, + exitCode: isSet4(object.exitCode) ? globalThis.Number(object.exitCode) : void 0, + stdout: globalThis.Array.isArray(object?.stdout) ? object.stdout.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + stderr: globalThis.Array.isArray(object?.stderr) ? object.stderr.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + info: globalThis.Array.isArray(object?.info) ? object.info.map((e) => RuntimeOutputMessage.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.batchIndex !== 0) { + obj.batchIndex = Math.round(message.batchIndex); + } + if (message.exitCode !== void 0) { + obj.exitCode = Math.round(message.exitCode); + } + if (message.stdout?.length) { + obj.stdout = message.stdout.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.stderr?.length) { + obj.stderr = message.stderr.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.info?.length) { + obj.info = message.info.map((e) => RuntimeOutputMessage.toJSON(e)); + } + return obj; + }, + create(base) { + return RuntimeOutputBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeOutputBatch(); + message.items = object.items?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.batchIndex = object.batchIndex ?? 0; + message.exitCode = object.exitCode ?? void 0; + message.stdout = object.stdout?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.stderr = object.stderr?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.info = object.info?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + return message; + } +}; +function createBaseRuntimeOutputMessage() { + return { fileDescriptor: 0, message: "", messageBytes: new Uint8Array(0) }; +} +var RuntimeOutputMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== 0) { + writer.uint32(8).int32(message.fileDescriptor); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.messageBytes.length !== 0) { + writer.uint32(26).bytes(message.messageBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeOutputMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.message = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.messageBytes = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + message: isSet4(object.message) ? globalThis.String(object.message) : "", + messageBytes: isSet4(object.messageBytes) ? bytesFromBase64(object.messageBytes) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.messageBytes.length !== 0) { + obj.messageBytes = base64FromBytes(message.messageBytes); + } + return obj; + }, + create(base) { + return RuntimeOutputMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeOutputMessage(); + message.fileDescriptor = object.fileDescriptor ?? 0; + message.message = object.message ?? ""; + message.messageBytes = object.messageBytes ?? new Uint8Array(0); + return message; + } +}; +function createBaseS3Mount() { + return { bucketName: "", mountPath: "", credentialsSecretId: "", readOnly: false }; +} +var S3Mount = { + encode(message, writer = new BinaryWriter()) { + if (message.bucketName !== "") { + writer.uint32(10).string(message.bucketName); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.credentialsSecretId !== "") { + writer.uint32(26).string(message.credentialsSecretId); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseS3Mount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.bucketName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.credentialsSecretId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + bucketName: isSet4(object.bucketName) ? globalThis.String(object.bucketName) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + credentialsSecretId: isSet4(object.credentialsSecretId) ? globalThis.String(object.credentialsSecretId) : "", + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.bucketName !== "") { + obj.bucketName = message.bucketName; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.credentialsSecretId !== "") { + obj.credentialsSecretId = message.credentialsSecretId; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + create(base) { + return S3Mount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseS3Mount(); + message.bucketName = object.bucketName ?? ""; + message.mountPath = object.mountPath ?? ""; + message.credentialsSecretId = object.credentialsSecretId ?? ""; + message.readOnly = object.readOnly ?? false; + return message; + } +}; +function createBaseSandbox() { + return { + entrypointArgs: [], + mountIds: [], + imageId: "", + secretIds: [], + resources: void 0, + cloudProvider: 0, + timeoutSecs: 0, + workdir: void 0, + nfsMounts: [], + runtimeDebug: false, + blockNetwork: false, + s3Mounts: [], + cloudBucketMounts: [], + volumeMounts: [], + ptyInfo: void 0, + schedulerPlacement: void 0, + workerId: "", + openPorts: void 0, + i6pnEnabled: false, + networkAccess: void 0, + proxyId: void 0, + enableSnapshot: false, + snapshotVersion: void 0, + cloudProviderStr: "", + runscRuntimeVersion: void 0, + runtime: void 0, + verbose: false, + name: void 0, + experimentalOptions: {}, + preloadPathPrefixes: [], + idleTimeoutSecs: void 0, + directSandboxCommandsEnabled: false + }; +} +var Sandbox = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entrypointArgs) { + writer.uint32(10).string(v); + } + for (const v of message.mountIds) { + writer.uint32(18).string(v); + } + if (message.imageId !== "") { + writer.uint32(26).string(message.imageId); + } + for (const v of message.secretIds) { + writer.uint32(34).string(v); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(42).fork()).join(); + } + if (message.cloudProvider !== 0) { + writer.uint32(48).int32(message.cloudProvider); + } + if (message.timeoutSecs !== 0) { + writer.uint32(56).uint32(message.timeoutSecs); + } + if (message.workdir !== void 0) { + writer.uint32(66).string(message.workdir); + } + for (const v of message.nfsMounts) { + SharedVolumeMount.encode(v, writer.uint32(74).fork()).join(); + } + if (message.runtimeDebug !== false) { + writer.uint32(80).bool(message.runtimeDebug); + } + if (message.blockNetwork !== false) { + writer.uint32(88).bool(message.blockNetwork); + } + for (const v of message.s3Mounts) { + S3Mount.encode(v, writer.uint32(98).fork()).join(); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(114).fork()).join(); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(106).fork()).join(); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(122).fork()).join(); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(138).fork()).join(); + } + if (message.workerId !== "") { + writer.uint32(154).string(message.workerId); + } + if (message.openPorts !== void 0) { + PortSpecs.encode(message.openPorts, writer.uint32(162).fork()).join(); + } + if (message.i6pnEnabled !== false) { + writer.uint32(168).bool(message.i6pnEnabled); + } + if (message.networkAccess !== void 0) { + NetworkAccess.encode(message.networkAccess, writer.uint32(178).fork()).join(); + } + if (message.proxyId !== void 0) { + writer.uint32(186).string(message.proxyId); + } + if (message.enableSnapshot !== false) { + writer.uint32(192).bool(message.enableSnapshot); + } + if (message.snapshotVersion !== void 0) { + writer.uint32(200).uint32(message.snapshotVersion); + } + if (message.cloudProviderStr !== "") { + writer.uint32(210).string(message.cloudProviderStr); + } + if (message.runscRuntimeVersion !== void 0) { + writer.uint32(218).string(message.runscRuntimeVersion); + } + if (message.runtime !== void 0) { + writer.uint32(226).string(message.runtime); + } + if (message.verbose !== false) { + writer.uint32(232).bool(message.verbose); + } + if (message.name !== void 0) { + writer.uint32(242).string(message.name); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + Sandbox_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(250).fork()).join(); + }); + for (const v of message.preloadPathPrefixes) { + writer.uint32(258).string(v); + } + if (message.idleTimeoutSecs !== void 0) { + writer.uint32(264).uint32(message.idleTimeoutSecs); + } + if (message.directSandboxCommandsEnabled !== false) { + writer.uint32(272).bool(message.directSandboxCommandsEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandbox(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entrypointArgs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.imageId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.workdir = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.nfsMounts.push(SharedVolumeMount.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.blockNetwork = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.s3Mounts.push(S3Mount.decode(reader, reader.uint32())); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + message.workerId = reader.string(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.openPorts = PortSpecs.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + message.i6pnEnabled = reader.bool(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.networkAccess = NetworkAccess.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 24: { + if (tag !== 192) { + break; + } + message.enableSnapshot = reader.bool(); + continue; + } + case 25: { + if (tag !== 200) { + break; + } + message.snapshotVersion = reader.uint32(); + continue; + } + case 26: { + if (tag !== 210) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 27: { + if (tag !== 218) { + break; + } + message.runscRuntimeVersion = reader.string(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.runtime = reader.string(); + continue; + } + case 29: { + if (tag !== 232) { + break; + } + message.verbose = reader.bool(); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + message.name = reader.string(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + const entry31 = Sandbox_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry31.value !== void 0) { + message.experimentalOptions[entry31.key] = entry31.value; + } + continue; + } + case 32: { + if (tag !== 258) { + break; + } + message.preloadPathPrefixes.push(reader.string()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + message.idleTimeoutSecs = reader.uint32(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.directSandboxCommandsEnabled = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entrypointArgs: globalThis.Array.isArray(object?.entrypointArgs) ? object.entrypointArgs.map((e) => globalThis.String(e)) : [], + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + nfsMounts: globalThis.Array.isArray(object?.nfsMounts) ? object.nfsMounts.map((e) => SharedVolumeMount.fromJSON(e)) : [], + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + blockNetwork: isSet4(object.blockNetwork) ? globalThis.Boolean(object.blockNetwork) : false, + s3Mounts: globalThis.Array.isArray(object?.s3Mounts) ? object.s3Mounts.map((e) => S3Mount.fromJSON(e)) : [], + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [], + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + openPorts: isSet4(object.openPorts) ? PortSpecs.fromJSON(object.openPorts) : void 0, + i6pnEnabled: isSet4(object.i6pnEnabled) ? globalThis.Boolean(object.i6pnEnabled) : false, + networkAccess: isSet4(object.networkAccess) ? NetworkAccess.fromJSON(object.networkAccess) : void 0, + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : void 0, + enableSnapshot: isSet4(object.enableSnapshot) ? globalThis.Boolean(object.enableSnapshot) : false, + snapshotVersion: isSet4(object.snapshotVersion) ? globalThis.Number(object.snapshotVersion) : void 0, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : "", + runscRuntimeVersion: isSet4(object.runscRuntimeVersion) ? globalThis.String(object.runscRuntimeVersion) : void 0, + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : void 0, + verbose: isSet4(object.verbose) ? globalThis.Boolean(object.verbose) : false, + name: isSet4(object.name) ? globalThis.String(object.name) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = Boolean(value); + return acc; + }, {}) : {}, + preloadPathPrefixes: globalThis.Array.isArray(object?.preloadPathPrefixes) ? object.preloadPathPrefixes.map((e) => globalThis.String(e)) : [], + idleTimeoutSecs: isSet4(object.idleTimeoutSecs) ? globalThis.Number(object.idleTimeoutSecs) : void 0, + directSandboxCommandsEnabled: isSet4(object.directSandboxCommandsEnabled) ? globalThis.Boolean(object.directSandboxCommandsEnabled) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.entrypointArgs?.length) { + obj.entrypointArgs = message.entrypointArgs; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.nfsMounts?.length) { + obj.nfsMounts = message.nfsMounts.map((e) => SharedVolumeMount.toJSON(e)); + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.blockNetwork !== false) { + obj.blockNetwork = message.blockNetwork; + } + if (message.s3Mounts?.length) { + obj.s3Mounts = message.s3Mounts.map((e) => S3Mount.toJSON(e)); + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.openPorts !== void 0) { + obj.openPorts = PortSpecs.toJSON(message.openPorts); + } + if (message.i6pnEnabled !== false) { + obj.i6pnEnabled = message.i6pnEnabled; + } + if (message.networkAccess !== void 0) { + obj.networkAccess = NetworkAccess.toJSON(message.networkAccess); + } + if (message.proxyId !== void 0) { + obj.proxyId = message.proxyId; + } + if (message.enableSnapshot !== false) { + obj.enableSnapshot = message.enableSnapshot; + } + if (message.snapshotVersion !== void 0) { + obj.snapshotVersion = Math.round(message.snapshotVersion); + } + if (message.cloudProviderStr !== "") { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.runscRuntimeVersion !== void 0) { + obj.runscRuntimeVersion = message.runscRuntimeVersion; + } + if (message.runtime !== void 0) { + obj.runtime = message.runtime; + } + if (message.verbose !== false) { + obj.verbose = message.verbose; + } + if (message.name !== void 0) { + obj.name = message.name; + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.preloadPathPrefixes?.length) { + obj.preloadPathPrefixes = message.preloadPathPrefixes; + } + if (message.idleTimeoutSecs !== void 0) { + obj.idleTimeoutSecs = Math.round(message.idleTimeoutSecs); + } + if (message.directSandboxCommandsEnabled !== false) { + obj.directSandboxCommandsEnabled = message.directSandboxCommandsEnabled; + } + return obj; + }, + create(base) { + return Sandbox.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandbox(); + message.entrypointArgs = object.entrypointArgs?.map((e) => e) || []; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.imageId = object.imageId ?? ""; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.cloudProvider = object.cloudProvider ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.workdir = object.workdir ?? void 0; + message.nfsMounts = object.nfsMounts?.map((e) => SharedVolumeMount.fromPartial(e)) || []; + message.runtimeDebug = object.runtimeDebug ?? false; + message.blockNetwork = object.blockNetwork ?? false; + message.s3Mounts = object.s3Mounts?.map((e) => S3Mount.fromPartial(e)) || []; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.workerId = object.workerId ?? ""; + message.openPorts = object.openPorts !== void 0 && object.openPorts !== null ? PortSpecs.fromPartial(object.openPorts) : void 0; + message.i6pnEnabled = object.i6pnEnabled ?? false; + message.networkAccess = object.networkAccess !== void 0 && object.networkAccess !== null ? NetworkAccess.fromPartial(object.networkAccess) : void 0; + message.proxyId = object.proxyId ?? void 0; + message.enableSnapshot = object.enableSnapshot ?? false; + message.snapshotVersion = object.snapshotVersion ?? void 0; + message.cloudProviderStr = object.cloudProviderStr ?? ""; + message.runscRuntimeVersion = object.runscRuntimeVersion ?? void 0; + message.runtime = object.runtime ?? void 0; + message.verbose = object.verbose ?? false; + message.name = object.name ?? void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.Boolean(value); + } + return acc; + }, + {} + ); + message.preloadPathPrefixes = object.preloadPathPrefixes?.map((e) => e) || []; + message.idleTimeoutSecs = object.idleTimeoutSecs ?? void 0; + message.directSandboxCommandsEnabled = object.directSandboxCommandsEnabled ?? false; + return message; + } +}; +function createBaseSandbox_ExperimentalOptionsEntry() { + return { key: "", value: false }; +} +var Sandbox_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== false) { + writer.uint32(16).bool(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandbox_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.value = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.Boolean(object.value) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== false) { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Sandbox_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandbox_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? false; + return message; + } +}; +function createBaseSandboxCreateConnectTokenRequest() { + return { sandboxId: "", userMetadata: "" }; +} +var SandboxCreateConnectTokenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.userMetadata !== "") { + writer.uint32(18).string(message.userMetadata); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateConnectTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.userMetadata = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + userMetadata: isSet4(object.userMetadata) ? globalThis.String(object.userMetadata) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.userMetadata !== "") { + obj.userMetadata = message.userMetadata; + } + return obj; + }, + create(base) { + return SandboxCreateConnectTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateConnectTokenRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.userMetadata = object.userMetadata ?? ""; + return message; + } +}; +function createBaseSandboxCreateConnectTokenResponse() { + return { url: "", token: "" }; +} +var SandboxCreateConnectTokenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + if (message.token !== "") { + writer.uint32(18).string(message.token); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateConnectTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + url: isSet4(object.url) ? globalThis.String(object.url) : "", + token: isSet4(object.token) ? globalThis.String(object.token) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + create(base) { + return SandboxCreateConnectTokenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateConnectTokenResponse(); + message.url = object.url ?? ""; + message.token = object.token ?? ""; + return message; + } +}; +function createBaseSandboxCreateRequest() { + return { appId: "", definition: void 0, environmentName: "" }; +} +var SandboxCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.definition !== void 0) { + Sandbox.encode(message.definition, writer.uint32(18).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.definition = Sandbox.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + definition: isSet4(object.definition) ? Sandbox.fromJSON(object.definition) : void 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.definition !== void 0) { + obj.definition = Sandbox.toJSON(message.definition); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SandboxCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateRequest(); + message.appId = object.appId ?? ""; + message.definition = object.definition !== void 0 && object.definition !== null ? Sandbox.fromPartial(object.definition) : void 0; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSandboxCreateResponse() { + return { sandboxId: "" }; +} +var SandboxCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetCommandRouterAccessRequest() { + return { sandboxId: "" }; +} +var SandboxGetCommandRouterAccessRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetCommandRouterAccessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetCommandRouterAccessRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetCommandRouterAccessRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetCommandRouterAccessResponse() { + return { jwt: "", url: "" }; +} +var SandboxGetCommandRouterAccessResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.jwt !== "") { + writer.uint32(10).string(message.jwt); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetCommandRouterAccessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.jwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + jwt: isSet4(object.jwt) ? globalThis.String(object.jwt) : "", + url: isSet4(object.url) ? globalThis.String(object.url) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.jwt !== "") { + obj.jwt = message.jwt; + } + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return SandboxGetCommandRouterAccessResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetCommandRouterAccessResponse(); + message.jwt = object.jwt ?? ""; + message.url = object.url ?? ""; + return message; + } +}; +function createBaseSandboxGetFromNameRequest() { + return { sandboxName: "", environmentName: "", appName: "" }; +} +var SandboxGetFromNameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxName !== "") { + writer.uint32(10).string(message.sandboxName); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + if (message.appName !== "") { + writer.uint32(26).string(message.appName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetFromNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxName: isSet4(object.sandboxName) ? globalThis.String(object.sandboxName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxName !== "") { + obj.sandboxName = message.sandboxName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + return obj; + }, + create(base) { + return SandboxGetFromNameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetFromNameRequest(); + message.sandboxName = object.sandboxName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.appName = object.appName ?? ""; + return message; + } +}; +function createBaseSandboxGetFromNameResponse() { + return { sandboxId: "" }; +} +var SandboxGetFromNameResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetFromNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetFromNameResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetFromNameResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetLogsRequest() { + return { sandboxId: "", fileDescriptor: 0, timeout: 0, lastEntryId: "" }; +} +var SandboxGetLogsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.fileDescriptor !== 0) { + writer.uint32(16).int32(message.fileDescriptor); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(34).string(message.lastEntryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetLogsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + return obj; + }, + create(base) { + return SandboxGetLogsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetLogsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + return message; + } +}; +function createBaseSandboxGetResourceUsageRequest() { + return { sandboxId: "" }; +} +var SandboxGetResourceUsageRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetResourceUsageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetResourceUsageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetResourceUsageRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetResourceUsageResponse() { + return { cpuCoreNanosecs: 0, memGibNanosecs: 0, gpuNanosecs: 0, gpuType: void 0 }; +} +var SandboxGetResourceUsageResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cpuCoreNanosecs !== 0) { + writer.uint32(8).uint64(message.cpuCoreNanosecs); + } + if (message.memGibNanosecs !== 0) { + writer.uint32(16).uint64(message.memGibNanosecs); + } + if (message.gpuNanosecs !== 0) { + writer.uint32(24).uint64(message.gpuNanosecs); + } + if (message.gpuType !== void 0) { + writer.uint32(34).string(message.gpuType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetResourceUsageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.cpuCoreNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.memGibNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.gpuNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cpuCoreNanosecs: isSet4(object.cpuCoreNanosecs) ? globalThis.Number(object.cpuCoreNanosecs) : 0, + memGibNanosecs: isSet4(object.memGibNanosecs) ? globalThis.Number(object.memGibNanosecs) : 0, + gpuNanosecs: isSet4(object.gpuNanosecs) ? globalThis.Number(object.gpuNanosecs) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cpuCoreNanosecs !== 0) { + obj.cpuCoreNanosecs = Math.round(message.cpuCoreNanosecs); + } + if (message.memGibNanosecs !== 0) { + obj.memGibNanosecs = Math.round(message.memGibNanosecs); + } + if (message.gpuNanosecs !== 0) { + obj.gpuNanosecs = Math.round(message.gpuNanosecs); + } + if (message.gpuType !== void 0) { + obj.gpuType = message.gpuType; + } + return obj; + }, + create(base) { + return SandboxGetResourceUsageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetResourceUsageResponse(); + message.cpuCoreNanosecs = object.cpuCoreNanosecs ?? 0; + message.memGibNanosecs = object.memGibNanosecs ?? 0; + message.gpuNanosecs = object.gpuNanosecs ?? 0; + message.gpuType = object.gpuType ?? void 0; + return message; + } +}; +function createBaseSandboxGetTaskIdRequest() { + return { sandboxId: "", timeout: void 0, waitUntilReady: false }; +} +var SandboxGetTaskIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== void 0) { + writer.uint32(21).float(message.timeout); + } + if (message.waitUntilReady !== false) { + writer.uint32(24).bool(message.waitUntilReady); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTaskIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.waitUntilReady = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : void 0, + waitUntilReady: isSet4(object.waitUntilReady) ? globalThis.Boolean(object.waitUntilReady) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== void 0) { + obj.timeout = message.timeout; + } + if (message.waitUntilReady !== false) { + obj.waitUntilReady = message.waitUntilReady; + } + return obj; + }, + create(base) { + return SandboxGetTaskIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTaskIdRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? void 0; + message.waitUntilReady = object.waitUntilReady ?? false; + return message; + } +}; +function createBaseSandboxGetTaskIdResponse() { + return { taskId: void 0, taskResult: void 0 }; +} +var SandboxGetTaskIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== void 0) { + writer.uint32(10).string(message.taskId); + } + if (message.taskResult !== void 0) { + GenericResult.encode(message.taskResult, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTaskIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskResult = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : void 0, + taskResult: isSet4(object.taskResult) ? GenericResult.fromJSON(object.taskResult) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== void 0) { + obj.taskId = message.taskId; + } + if (message.taskResult !== void 0) { + obj.taskResult = GenericResult.toJSON(message.taskResult); + } + return obj; + }, + create(base) { + return SandboxGetTaskIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTaskIdResponse(); + message.taskId = object.taskId ?? void 0; + message.taskResult = object.taskResult !== void 0 && object.taskResult !== null ? GenericResult.fromPartial(object.taskResult) : void 0; + return message; + } +}; +function createBaseSandboxGetTunnelsRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxGetTunnelsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTunnelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxGetTunnelsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTunnelsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxGetTunnelsResponse() { + return { result: void 0, tunnels: [] }; +} +var SandboxGetTunnelsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + for (const v of message.tunnels) { + TunnelData.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTunnelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tunnels.push(TunnelData.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + tunnels: globalThis.Array.isArray(object?.tunnels) ? object.tunnels.map((e) => TunnelData.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.tunnels?.length) { + obj.tunnels = message.tunnels.map((e) => TunnelData.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxGetTunnelsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTunnelsResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.tunnels = object.tunnels?.map((e) => TunnelData.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxHandleMetadata() { + return { result: void 0 }; +} +var SandboxHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxHandleMetadata(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSandboxInfo() { + return { id: "", createdAt: 0, taskInfo: void 0, appId: "", tags: [], name: "" }; +} +var SandboxInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.taskInfo !== void 0) { + TaskInfo.encode(message.taskInfo, writer.uint32(34).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(50).fork()).join(); + } + if (message.name !== "") { + writer.uint32(58).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.taskInfo = TaskInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet4(object.id) ? globalThis.String(object.id) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + taskInfo: isSet4(object.taskInfo) ? TaskInfo.fromJSON(object.taskInfo) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [], + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.taskInfo !== void 0) { + obj.taskInfo = TaskInfo.toJSON(message.taskInfo); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return SandboxInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxInfo(); + message.id = object.id ?? ""; + message.createdAt = object.createdAt ?? 0; + message.taskInfo = object.taskInfo !== void 0 && object.taskInfo !== null ? TaskInfo.fromPartial(object.taskInfo) : void 0; + message.appId = object.appId ?? ""; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseSandboxListRequest() { + return { appId: "", beforeTimestamp: 0, environmentName: "", includeFinished: false, tags: [] }; +} +var SandboxListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.beforeTimestamp !== 0) { + writer.uint32(17).double(message.beforeTimestamp); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.includeFinished !== false) { + writer.uint32(32).bool(message.includeFinished); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.beforeTimestamp = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.includeFinished = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + beforeTimestamp: isSet4(object.beforeTimestamp) ? globalThis.Number(object.beforeTimestamp) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + includeFinished: isSet4(object.includeFinished) ? globalThis.Boolean(object.includeFinished) : false, + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.beforeTimestamp !== 0) { + obj.beforeTimestamp = message.beforeTimestamp; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.includeFinished !== false) { + obj.includeFinished = message.includeFinished; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxListRequest(); + message.appId = object.appId ?? ""; + message.beforeTimestamp = object.beforeTimestamp ?? 0; + message.environmentName = object.environmentName ?? ""; + message.includeFinished = object.includeFinished ?? false; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxListResponse() { + return { sandboxes: [] }; +} +var SandboxListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.sandboxes) { + SandboxInfo.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxes.push(SandboxInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxes: globalThis.Array.isArray(object?.sandboxes) ? object.sandboxes.map((e) => SandboxInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxes?.length) { + obj.sandboxes = message.sandboxes.map((e) => SandboxInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxListResponse(); + message.sandboxes = object.sandboxes?.map((e) => SandboxInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxRestoreRequest() { + return { snapshotId: "", sandboxNameOverride: "", sandboxNameOverrideType: 0 }; +} +var SandboxRestoreRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + if (message.sandboxNameOverride !== "") { + writer.uint32(18).string(message.sandboxNameOverride); + } + if (message.sandboxNameOverrideType !== 0) { + writer.uint32(24).int32(message.sandboxNameOverrideType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxRestoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sandboxNameOverride = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sandboxNameOverrideType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "", + sandboxNameOverride: isSet4(object.sandboxNameOverride) ? globalThis.String(object.sandboxNameOverride) : "", + sandboxNameOverrideType: isSet4(object.sandboxNameOverrideType) ? sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(object.sandboxNameOverrideType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + if (message.sandboxNameOverride !== "") { + obj.sandboxNameOverride = message.sandboxNameOverride; + } + if (message.sandboxNameOverrideType !== 0) { + obj.sandboxNameOverrideType = sandboxRestoreRequest_SandboxNameOverrideTypeToJSON( + message.sandboxNameOverrideType + ); + } + return obj; + }, + create(base) { + return SandboxRestoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxRestoreRequest(); + message.snapshotId = object.snapshotId ?? ""; + message.sandboxNameOverride = object.sandboxNameOverride ?? ""; + message.sandboxNameOverrideType = object.sandboxNameOverrideType ?? 0; + return message; + } +}; +function createBaseSandboxRestoreResponse() { + return { sandboxId: "" }; +} +var SandboxRestoreResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxRestoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxRestoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxRestoreResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncGetRequest() { + return { imageId: "", timeout: 0 }; +} +var SandboxSnapshotFsAsyncGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncGetRequest(); + message.imageId = object.imageId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncRequest() { + return { sandboxId: "" }; +} +var SandboxSnapshotFsAsyncRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncResponse() { + return { imageId: "" }; +} +var SandboxSnapshotFsAsyncResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncResponse(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxSnapshotFsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotFsResponse() { + return { imageId: "", result: void 0, imageMetadata: void 0 }; +} +var SandboxSnapshotFsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.imageMetadata !== void 0) { + ImageMetadata.encode(message.imageMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.imageMetadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + imageMetadata: isSet4(object.imageMetadata) ? ImageMetadata.fromJSON(object.imageMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.imageMetadata !== void 0) { + obj.imageMetadata = ImageMetadata.toJSON(message.imageMetadata); + } + return obj; + }, + create(base) { + return SandboxSnapshotFsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsResponse(); + message.imageId = object.imageId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.imageMetadata = object.imageMetadata !== void 0 && object.imageMetadata !== null ? ImageMetadata.fromPartial(object.imageMetadata) : void 0; + return message; + } +}; +function createBaseSandboxSnapshotGetRequest() { + return { snapshotId: "" }; +} +var SandboxSnapshotGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotGetRequest(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotGetResponse() { + return { snapshotId: "" }; +} +var SandboxSnapshotGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotGetResponse(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotRequest() { + return { sandboxId: "" }; +} +var SandboxSnapshotRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxSnapshotRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotResponse() { + return { snapshotId: "" }; +} +var SandboxSnapshotResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotResponse(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotWaitRequest() { + return { snapshotId: "", timeout: 0 }; +} +var SandboxSnapshotWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotWaitRequest(); + message.snapshotId = object.snapshotId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotWaitResponse() { + return { result: void 0 }; +} +var SandboxSnapshotWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxSnapshotWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotWaitResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSandboxStdinWriteRequest() { + return { sandboxId: "", input: new Uint8Array(0), index: 0, eof: false }; +} +var SandboxStdinWriteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.input.length !== 0) { + writer.uint32(18).bytes(message.input); + } + if (message.index !== 0) { + writer.uint32(24).uint32(message.index); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxStdinWriteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.index = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + input: isSet4(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0), + index: isSet4(object.index) ? globalThis.Number(object.index) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.input.length !== 0) { + obj.input = base64FromBytes(message.input); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return SandboxStdinWriteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxStdinWriteRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.input = object.input ?? new Uint8Array(0); + message.index = object.index ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseSandboxStdinWriteResponse() { + return {}; +} +var SandboxStdinWriteResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxStdinWriteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return SandboxStdinWriteResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseSandboxStdinWriteResponse(); + return message; + } +}; +function createBaseSandboxTag() { + return { tagName: "", tagValue: "" }; +} +var SandboxTag = { + encode(message, writer = new BinaryWriter()) { + if (message.tagName !== "") { + writer.uint32(10).string(message.tagName); + } + if (message.tagValue !== "") { + writer.uint32(18).string(message.tagValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTag(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tagName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tagValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tagName: isSet4(object.tagName) ? globalThis.String(object.tagName) : "", + tagValue: isSet4(object.tagValue) ? globalThis.String(object.tagValue) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tagName !== "") { + obj.tagName = message.tagName; + } + if (message.tagValue !== "") { + obj.tagValue = message.tagValue; + } + return obj; + }, + create(base) { + return SandboxTag.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTag(); + message.tagName = object.tagName ?? ""; + message.tagValue = object.tagValue ?? ""; + return message; + } +}; +function createBaseSandboxTagsGetRequest() { + return { sandboxId: "" }; +} +var SandboxTagsGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxTagsGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsGetRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxTagsGetResponse() { + return { tags: [] }; +} +var SandboxTagsGetResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxTagsGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsGetResponse(); + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxTagsSetRequest() { + return { environmentName: "", sandboxId: "", tags: [] }; +} +var SandboxTagsSetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.sandboxId !== "") { + writer.uint32(18).string(message.sandboxId); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxTagsSetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsSetRequest(); + message.environmentName = object.environmentName ?? ""; + message.sandboxId = object.sandboxId ?? ""; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxTerminateRequest() { + return { sandboxId: "" }; +} +var SandboxTerminateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTerminateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxTerminateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTerminateRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxTerminateResponse() { + return { existingResult: void 0 }; +} +var SandboxTerminateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.existingResult !== void 0) { + GenericResult.encode(message.existingResult, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTerminateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.existingResult = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { existingResult: isSet4(object.existingResult) ? GenericResult.fromJSON(object.existingResult) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.existingResult !== void 0) { + obj.existingResult = GenericResult.toJSON(message.existingResult); + } + return obj; + }, + create(base) { + return SandboxTerminateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTerminateResponse(); + message.existingResult = object.existingResult !== void 0 && object.existingResult !== null ? GenericResult.fromPartial(object.existingResult) : void 0; + return message; + } +}; +function createBaseSandboxWaitRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxWaitRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxWaitResponse() { + return { result: void 0 }; +} +var SandboxWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxWaitResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSchedule() { + return { cron: void 0, period: void 0 }; +} +var Schedule = { + encode(message, writer = new BinaryWriter()) { + if (message.cron !== void 0) { + Schedule_Cron.encode(message.cron, writer.uint32(10).fork()).join(); + } + if (message.period !== void 0) { + Schedule_Period.encode(message.period, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cron = Schedule_Cron.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.period = Schedule_Period.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cron: isSet4(object.cron) ? Schedule_Cron.fromJSON(object.cron) : void 0, + period: isSet4(object.period) ? Schedule_Period.fromJSON(object.period) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cron !== void 0) { + obj.cron = Schedule_Cron.toJSON(message.cron); + } + if (message.period !== void 0) { + obj.period = Schedule_Period.toJSON(message.period); + } + return obj; + }, + create(base) { + return Schedule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule(); + message.cron = object.cron !== void 0 && object.cron !== null ? Schedule_Cron.fromPartial(object.cron) : void 0; + message.period = object.period !== void 0 && object.period !== null ? Schedule_Period.fromPartial(object.period) : void 0; + return message; + } +}; +function createBaseSchedule_Cron() { + return { cronString: "", timezone: "" }; +} +var Schedule_Cron = { + encode(message, writer = new BinaryWriter()) { + if (message.cronString !== "") { + writer.uint32(10).string(message.cronString); + } + if (message.timezone !== "") { + writer.uint32(18).string(message.timezone); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule_Cron(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cronString = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.timezone = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cronString: isSet4(object.cronString) ? globalThis.String(object.cronString) : "", + timezone: isSet4(object.timezone) ? globalThis.String(object.timezone) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.cronString !== "") { + obj.cronString = message.cronString; + } + if (message.timezone !== "") { + obj.timezone = message.timezone; + } + return obj; + }, + create(base) { + return Schedule_Cron.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule_Cron(); + message.cronString = object.cronString ?? ""; + message.timezone = object.timezone ?? ""; + return message; + } +}; +function createBaseSchedule_Period() { + return { years: 0, months: 0, weeks: 0, days: 0, hours: 0, minutes: 0, seconds: 0 }; +} +var Schedule_Period = { + encode(message, writer = new BinaryWriter()) { + if (message.years !== 0) { + writer.uint32(8).int32(message.years); + } + if (message.months !== 0) { + writer.uint32(16).int32(message.months); + } + if (message.weeks !== 0) { + writer.uint32(24).int32(message.weeks); + } + if (message.days !== 0) { + writer.uint32(32).int32(message.days); + } + if (message.hours !== 0) { + writer.uint32(40).int32(message.hours); + } + if (message.minutes !== 0) { + writer.uint32(48).int32(message.minutes); + } + if (message.seconds !== 0) { + writer.uint32(61).float(message.seconds); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule_Period(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.years = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.months = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.weeks = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.days = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.hours = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.minutes = reader.int32(); + continue; + } + case 7: { + if (tag !== 61) { + break; + } + message.seconds = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + years: isSet4(object.years) ? globalThis.Number(object.years) : 0, + months: isSet4(object.months) ? globalThis.Number(object.months) : 0, + weeks: isSet4(object.weeks) ? globalThis.Number(object.weeks) : 0, + days: isSet4(object.days) ? globalThis.Number(object.days) : 0, + hours: isSet4(object.hours) ? globalThis.Number(object.hours) : 0, + minutes: isSet4(object.minutes) ? globalThis.Number(object.minutes) : 0, + seconds: isSet4(object.seconds) ? globalThis.Number(object.seconds) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.years !== 0) { + obj.years = Math.round(message.years); + } + if (message.months !== 0) { + obj.months = Math.round(message.months); + } + if (message.weeks !== 0) { + obj.weeks = Math.round(message.weeks); + } + if (message.days !== 0) { + obj.days = Math.round(message.days); + } + if (message.hours !== 0) { + obj.hours = Math.round(message.hours); + } + if (message.minutes !== 0) { + obj.minutes = Math.round(message.minutes); + } + if (message.seconds !== 0) { + obj.seconds = message.seconds; + } + return obj; + }, + create(base) { + return Schedule_Period.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule_Period(); + message.years = object.years ?? 0; + message.months = object.months ?? 0; + message.weeks = object.weeks ?? 0; + message.days = object.days ?? 0; + message.hours = object.hours ?? 0; + message.minutes = object.minutes ?? 0; + message.seconds = object.seconds ?? 0; + return message; + } +}; +function createBaseSchedulerPlacement() { + return { regions: [], Zone: void 0, Lifecycle: void 0, InstanceTypes: [] }; +} +var SchedulerPlacement = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.regions) { + writer.uint32(34).string(v); + } + if (message.Zone !== void 0) { + writer.uint32(18).string(message.Zone); + } + if (message.Lifecycle !== void 0) { + writer.uint32(26).string(message.Lifecycle); + } + for (const v of message.InstanceTypes) { + writer.uint32(42).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedulerPlacement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + message.regions.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.Zone = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.Lifecycle = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.InstanceTypes.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + regions: globalThis.Array.isArray(object?.regions) ? object.regions.map((e) => globalThis.String(e)) : [], + Zone: isSet4(object.Zone) ? globalThis.String(object.Zone) : void 0, + Lifecycle: isSet4(object.Lifecycle) ? globalThis.String(object.Lifecycle) : void 0, + InstanceTypes: globalThis.Array.isArray(object?.InstanceTypes) ? object.InstanceTypes.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.regions?.length) { + obj.regions = message.regions; + } + if (message.Zone !== void 0) { + obj.Zone = message.Zone; + } + if (message.Lifecycle !== void 0) { + obj.Lifecycle = message.Lifecycle; + } + if (message.InstanceTypes?.length) { + obj.InstanceTypes = message.InstanceTypes; + } + return obj; + }, + create(base) { + return SchedulerPlacement.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedulerPlacement(); + message.regions = object.regions?.map((e) => e) || []; + message.Zone = object.Zone ?? void 0; + message.Lifecycle = object.Lifecycle ?? void 0; + message.InstanceTypes = object.InstanceTypes?.map((e) => e) || []; + return message; + } +}; +function createBaseSecretDeleteRequest() { + return { secretId: "" }; +} +var SecretDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.secretId !== "") { + writer.uint32(10).string(message.secretId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + return obj; + }, + create(base) { + return SecretDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretDeleteRequest(); + message.secretId = object.secretId ?? ""; + return message; + } +}; +function createBaseSecretGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, envDict: {}, appId: "", requiredKeys: [] }; +} +var SecretGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + Object.entries(message.envDict).forEach(([key, value]) => { + SecretGetOrCreateRequest_EnvDictEntry.encode({ key, value }, writer.uint32(42).fork()).join(); + }); + if (message.appId !== "") { + writer.uint32(50).string(message.appId); + } + for (const v of message.requiredKeys) { + writer.uint32(58).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + const entry5 = SecretGetOrCreateRequest_EnvDictEntry.decode(reader, reader.uint32()); + if (entry5.value !== void 0) { + message.envDict[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.appId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.requiredKeys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + envDict: isObject2(object.envDict) ? Object.entries(object.envDict).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + requiredKeys: globalThis.Array.isArray(object?.requiredKeys) ? object.requiredKeys.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.envDict) { + const entries = Object.entries(message.envDict); + if (entries.length > 0) { + obj.envDict = {}; + entries.forEach(([k, v]) => { + obj.envDict[k] = v; + }); + } + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.requiredKeys?.length) { + obj.requiredKeys = message.requiredKeys; + } + return obj; + }, + create(base) { + return SecretGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.envDict = Object.entries(object.envDict ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.appId = object.appId ?? ""; + message.requiredKeys = object.requiredKeys?.map((e) => e) || []; + return message; + } +}; +function createBaseSecretGetOrCreateRequest_EnvDictEntry() { + return { key: "", value: "" }; +} +var SecretGetOrCreateRequest_EnvDictEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateRequest_EnvDictEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return SecretGetOrCreateRequest_EnvDictEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateRequest_EnvDictEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseSecretGetOrCreateResponse() { + return { secretId: "", metadata: void 0 }; +} +var SecretGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.secretId !== "") { + writer.uint32(10).string(message.secretId); + } + if (message.metadata !== void 0) { + SecretMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = SecretMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "", + metadata: isSet4(object.metadata) ? SecretMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + if (message.metadata !== void 0) { + obj.metadata = SecretMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return SecretGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateResponse(); + message.secretId = object.secretId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? SecretMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseSecretListItem() { + return { label: "", createdAt: 0, lastUsedAt: 0, environmentName: "", secretId: "", metadata: void 0 }; +} +var SecretListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.lastUsedAt !== 0) { + writer.uint32(25).double(message.lastUsedAt); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.secretId !== "") { + writer.uint32(42).string(message.secretId); + } + if (message.metadata !== void 0) { + SecretMetadata.encode(message.metadata, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.lastUsedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.secretId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.metadata = SecretMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + lastUsedAt: isSet4(object.lastUsedAt) ? globalThis.Number(object.lastUsedAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "", + metadata: isSet4(object.metadata) ? SecretMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.lastUsedAt !== 0) { + obj.lastUsedAt = message.lastUsedAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + if (message.metadata !== void 0) { + obj.metadata = SecretMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return SecretListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListItem(); + message.label = object.label ?? ""; + message.createdAt = object.createdAt ?? 0; + message.lastUsedAt = object.lastUsedAt ?? 0; + message.environmentName = object.environmentName ?? ""; + message.secretId = object.secretId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? SecretMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseSecretListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var SecretListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return SecretListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseSecretListResponse() { + return { items: [], environmentName: "" }; +} +var SecretListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + SecretListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(SecretListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => SecretListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => SecretListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SecretListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListResponse(); + message.items = object.items?.map((e) => SecretListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSecretMetadata() { + return { name: "", creationInfo: void 0 }; +} +var SecretMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return SecretMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseSharedVolumeDeleteRequest() { + return { sharedVolumeId: "" }; +} +var SharedVolumeDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeDeleteRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetFileRequest() { + return { sharedVolumeId: "", path: "" }; +} +var SharedVolumeGetFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return SharedVolumeGetFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetFileResponse() { + return { data: void 0, dataBlobId: void 0 }; +} +var SharedVolumeGetFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + writer.uint32(10).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(18).string(message.dataBlobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + return obj; + }, + create(base) { + return SharedVolumeGetFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetFileResponse(); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + return message; + } +}; +function createBaseSharedVolumeGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, appId: "" }; +} +var SharedVolumeGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return SharedVolumeGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetOrCreateResponse() { + return { sharedVolumeId: "" }; +} +var SharedVolumeGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetOrCreateResponse(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeHeartbeatRequest() { + return { sharedVolumeId: "" }; +} +var SharedVolumeHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeHeartbeatRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeListFilesRequest() { + return { sharedVolumeId: "", path: "" }; +} +var SharedVolumeListFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return SharedVolumeListFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListFilesRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + return message; + } +}; +function createBaseSharedVolumeListFilesResponse() { + return { entries: [] }; +} +var SharedVolumeListFilesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return SharedVolumeListFilesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListFilesResponse(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseSharedVolumeListItem() { + return { label: "", sharedVolumeId: "", createdAt: 0, cloudProvider: 0 }; +} +var SharedVolumeListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.sharedVolumeId !== "") { + writer.uint32(18).string(message.sharedVolumeId); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.cloudProvider !== 0) { + writer.uint32(32).int32(message.cloudProvider); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + return obj; + }, + create(base) { + return SharedVolumeListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListItem(); + message.label = object.label ?? ""; + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.createdAt = object.createdAt ?? 0; + message.cloudProvider = object.cloudProvider ?? 0; + return message; + } +}; +function createBaseSharedVolumeListRequest() { + return { environmentName: "" }; +} +var SharedVolumeListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SharedVolumeListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSharedVolumeListResponse() { + return { items: [], environmentName: "" }; +} +var SharedVolumeListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + SharedVolumeListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(SharedVolumeListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => SharedVolumeListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => SharedVolumeListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SharedVolumeListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListResponse(); + message.items = object.items?.map((e) => SharedVolumeListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSharedVolumeMount() { + return { mountPath: "", sharedVolumeId: "", cloudProvider: 0 }; +} +var SharedVolumeMount = { + encode(message, writer = new BinaryWriter()) { + if (message.mountPath !== "") { + writer.uint32(10).string(message.mountPath); + } + if (message.sharedVolumeId !== "") { + writer.uint32(18).string(message.sharedVolumeId); + } + if (message.cloudProvider !== 0) { + writer.uint32(24).int32(message.cloudProvider); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + return obj; + }, + create(base) { + return SharedVolumeMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeMount(); + message.mountPath = object.mountPath ?? ""; + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.cloudProvider = object.cloudProvider ?? 0; + return message; + } +}; +function createBaseSharedVolumePutFileRequest() { + return { sharedVolumeId: "", path: "", sha256Hex: "", data: void 0, dataBlobId: void 0, resumable: false }; +} +var SharedVolumePutFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.sha256Hex !== "") { + writer.uint32(26).string(message.sha256Hex); + } + if (message.data !== void 0) { + writer.uint32(34).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(42).string(message.dataBlobId); + } + if (message.resumable !== false) { + writer.uint32(48).bool(message.resumable); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumePutFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.data = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.resumable = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + resumable: isSet4(object.resumable) ? globalThis.Boolean(object.resumable) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.resumable !== false) { + obj.resumable = message.resumable; + } + return obj; + }, + create(base) { + return SharedVolumePutFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumePutFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + message.sha256Hex = object.sha256Hex ?? ""; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.resumable = object.resumable ?? false; + return message; + } +}; +function createBaseSharedVolumePutFileResponse() { + return { exists: false }; +} +var SharedVolumePutFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(8).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumePutFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return SharedVolumePutFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumePutFileResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseSharedVolumeRemoveFileRequest() { + return { sharedVolumeId: "", path: "", recursive: false }; +} +var SharedVolumeRemoveFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeRemoveFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return SharedVolumeRemoveFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeRemoveFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseSystemErrorMessage() { + return { errorCode: 0, errorMessage: "" }; +} +var SystemErrorMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.errorCode !== 0) { + writer.uint32(8).int32(message.errorCode); + } + if (message.errorMessage !== "") { + writer.uint32(18).string(message.errorMessage); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSystemErrorMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.errorCode = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.errorMessage = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + errorCode: isSet4(object.errorCode) ? systemErrorCodeFromJSON(object.errorCode) : 0, + errorMessage: isSet4(object.errorMessage) ? globalThis.String(object.errorMessage) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.errorCode !== 0) { + obj.errorCode = systemErrorCodeToJSON(message.errorCode); + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + create(base) { + return SystemErrorMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSystemErrorMessage(); + message.errorCode = object.errorCode ?? 0; + message.errorMessage = object.errorMessage ?? ""; + return message; + } +}; +function createBaseTaskClusterHelloRequest() { + return { taskId: "", containerIp: "" }; +} +var TaskClusterHelloRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.containerIp !== "") { + writer.uint32(18).string(message.containerIp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskClusterHelloRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.containerIp = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + containerIp: isSet4(object.containerIp) ? globalThis.String(object.containerIp) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.containerIp !== "") { + obj.containerIp = message.containerIp; + } + return obj; + }, + create(base) { + return TaskClusterHelloRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskClusterHelloRequest(); + message.taskId = object.taskId ?? ""; + message.containerIp = object.containerIp ?? ""; + return message; + } +}; +function createBaseTaskClusterHelloResponse() { + return { clusterId: "", clusterRank: 0, containerIps: [], containerIpv4Ips: [] }; +} +var TaskClusterHelloResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.clusterId !== "") { + writer.uint32(10).string(message.clusterId); + } + if (message.clusterRank !== 0) { + writer.uint32(16).uint32(message.clusterRank); + } + for (const v of message.containerIps) { + writer.uint32(26).string(v); + } + for (const v of message.containerIpv4Ips) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskClusterHelloResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusterId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.clusterRank = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.containerIps.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.containerIpv4Ips.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "", + clusterRank: isSet4(object.clusterRank) ? globalThis.Number(object.clusterRank) : 0, + containerIps: globalThis.Array.isArray(object?.containerIps) ? object.containerIps.map((e) => globalThis.String(e)) : [], + containerIpv4Ips: globalThis.Array.isArray(object?.containerIpv4Ips) ? object.containerIpv4Ips.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + if (message.clusterRank !== 0) { + obj.clusterRank = Math.round(message.clusterRank); + } + if (message.containerIps?.length) { + obj.containerIps = message.containerIps; + } + if (message.containerIpv4Ips?.length) { + obj.containerIpv4Ips = message.containerIpv4Ips; + } + return obj; + }, + create(base) { + return TaskClusterHelloResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskClusterHelloResponse(); + message.clusterId = object.clusterId ?? ""; + message.clusterRank = object.clusterRank ?? 0; + message.containerIps = object.containerIps?.map((e) => e) || []; + message.containerIpv4Ips = object.containerIpv4Ips?.map((e) => e) || []; + return message; + } +}; +function createBaseTaskCurrentInputsResponse() { + return { inputIds: [] }; +} +var TaskCurrentInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputIds) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskCurrentInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputIds: globalThis.Array.isArray(object?.inputIds) ? object.inputIds.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputIds?.length) { + obj.inputIds = message.inputIds; + } + return obj; + }, + create(base) { + return TaskCurrentInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskCurrentInputsResponse(); + message.inputIds = object.inputIds?.map((e) => e) || []; + return message; + } +}; +function createBaseTaskGetAutoscalingMetricsRequest() { + return { taskId: "" }; +} +var TaskGetAutoscalingMetricsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetAutoscalingMetricsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return TaskGetAutoscalingMetricsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetAutoscalingMetricsRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseTaskGetAutoscalingMetricsResponse() { + return { metrics: void 0 }; +} +var TaskGetAutoscalingMetricsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.metrics !== void 0) { + AutoscalingMetrics.encode(message.metrics, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetAutoscalingMetricsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.metrics = AutoscalingMetrics.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { metrics: isSet4(object.metrics) ? AutoscalingMetrics.fromJSON(object.metrics) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.metrics !== void 0) { + obj.metrics = AutoscalingMetrics.toJSON(message.metrics); + } + return obj; + }, + create(base) { + return TaskGetAutoscalingMetricsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetAutoscalingMetricsResponse(); + message.metrics = object.metrics !== void 0 && object.metrics !== null ? AutoscalingMetrics.fromPartial(object.metrics) : void 0; + return message; + } +}; +function createBaseTaskGetCommandRouterAccessRequest() { + return { taskId: "" }; +} +var TaskGetCommandRouterAccessRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetCommandRouterAccessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return TaskGetCommandRouterAccessRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetCommandRouterAccessRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseTaskGetCommandRouterAccessResponse() { + return { jwt: "", url: "" }; +} +var TaskGetCommandRouterAccessResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.jwt !== "") { + writer.uint32(10).string(message.jwt); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetCommandRouterAccessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.jwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + jwt: isSet4(object.jwt) ? globalThis.String(object.jwt) : "", + url: isSet4(object.url) ? globalThis.String(object.url) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.jwt !== "") { + obj.jwt = message.jwt; + } + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return TaskGetCommandRouterAccessResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetCommandRouterAccessResponse(); + message.jwt = object.jwt ?? ""; + message.url = object.url ?? ""; + return message; + } +}; +function createBaseTaskInfo() { + return { + id: "", + startedAt: 0, + finishedAt: 0, + result: void 0, + enqueuedAt: 0, + gpuType: "", + sandboxId: "", + snapshotBehavior: 0, + gpuConfig: void 0 + }; +} +var TaskInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.startedAt !== 0) { + writer.uint32(17).double(message.startedAt); + } + if (message.finishedAt !== 0) { + writer.uint32(25).double(message.finishedAt); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(34).fork()).join(); + } + if (message.enqueuedAt !== 0) { + writer.uint32(41).double(message.enqueuedAt); + } + if (message.gpuType !== "") { + writer.uint32(50).string(message.gpuType); + } + if (message.sandboxId !== "") { + writer.uint32(58).string(message.sandboxId); + } + if (message.snapshotBehavior !== 0) { + writer.uint32(64).int32(message.snapshotBehavior); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(74).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.startedAt = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.finishedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.enqueuedAt = reader.double(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.gpuType = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.snapshotBehavior = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet4(object.id) ? globalThis.String(object.id) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0, + finishedAt: isSet4(object.finishedAt) ? globalThis.Number(object.finishedAt) : 0, + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + enqueuedAt: isSet4(object.enqueuedAt) ? globalThis.Number(object.enqueuedAt) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : "", + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + snapshotBehavior: isSet4(object.snapshotBehavior) ? taskSnapshotBehaviorFromJSON(object.snapshotBehavior) : 0, + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + if (message.finishedAt !== 0) { + obj.finishedAt = message.finishedAt; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.enqueuedAt !== 0) { + obj.enqueuedAt = message.enqueuedAt; + } + if (message.gpuType !== "") { + obj.gpuType = message.gpuType; + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.snapshotBehavior !== 0) { + obj.snapshotBehavior = taskSnapshotBehaviorToJSON(message.snapshotBehavior); + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + return obj; + }, + create(base) { + return TaskInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskInfo(); + message.id = object.id ?? ""; + message.startedAt = object.startedAt ?? 0; + message.finishedAt = object.finishedAt ?? 0; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.enqueuedAt = object.enqueuedAt ?? 0; + message.gpuType = object.gpuType ?? ""; + message.sandboxId = object.sandboxId ?? ""; + message.snapshotBehavior = object.snapshotBehavior ?? 0; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + return message; + } +}; +function createBaseTaskListRequest() { + return { environmentName: "" }; +} +var TaskListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return TaskListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseTaskListResponse() { + return { tasks: [] }; +} +var TaskListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.tasks) { + TaskStats.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tasks.push(TaskStats.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tasks: globalThis.Array.isArray(object?.tasks) ? object.tasks.map((e) => TaskStats.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.tasks?.length) { + obj.tasks = message.tasks.map((e) => TaskStats.toJSON(e)); + } + return obj; + }, + create(base) { + return TaskListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskListResponse(); + message.tasks = object.tasks?.map((e) => TaskStats.fromPartial(e)) || []; + return message; + } +}; +function createBaseTaskLogs() { + return { + data: "", + taskState: 0, + timestamp: 0, + fileDescriptor: 0, + taskProgress: void 0, + functionCallId: "", + inputId: "", + timestampNs: 0 + }; +} +var TaskLogs = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.taskState !== 0) { + writer.uint32(48).int32(message.taskState); + } + if (message.timestamp !== 0) { + writer.uint32(57).double(message.timestamp); + } + if (message.fileDescriptor !== 0) { + writer.uint32(64).int32(message.fileDescriptor); + } + if (message.taskProgress !== void 0) { + TaskProgress.encode(message.taskProgress, writer.uint32(74).fork()).join(); + } + if (message.functionCallId !== "") { + writer.uint32(82).string(message.functionCallId); + } + if (message.inputId !== "") { + writer.uint32(90).string(message.inputId); + } + if (message.timestampNs !== 0) { + writer.uint32(96).uint64(message.timestampNs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskLogs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.taskState = reader.int32(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.timestamp = reader.double(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.taskProgress = TaskProgress.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.inputId = reader.string(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.timestampNs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? globalThis.String(object.data) : "", + taskState: isSet4(object.taskState) ? taskStateFromJSON(object.taskState) : 0, + timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0, + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + taskProgress: isSet4(object.taskProgress) ? TaskProgress.fromJSON(object.taskProgress) : void 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + timestampNs: isSet4(object.timestampNs) ? globalThis.Number(object.timestampNs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.taskState !== 0) { + obj.taskState = taskStateToJSON(message.taskState); + } + if (message.timestamp !== 0) { + obj.timestamp = message.timestamp; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.taskProgress !== void 0) { + obj.taskProgress = TaskProgress.toJSON(message.taskProgress); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.timestampNs !== 0) { + obj.timestampNs = Math.round(message.timestampNs); + } + return obj; + }, + create(base) { + return TaskLogs.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskLogs(); + message.data = object.data ?? ""; + message.taskState = object.taskState ?? 0; + message.timestamp = object.timestamp ?? 0; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.taskProgress = object.taskProgress !== void 0 && object.taskProgress !== null ? TaskProgress.fromPartial(object.taskProgress) : void 0; + message.functionCallId = object.functionCallId ?? ""; + message.inputId = object.inputId ?? ""; + message.timestampNs = object.timestampNs ?? 0; + return message; + } +}; +function createBaseTaskLogsBatch() { + return { + taskId: "", + items: [], + entryId: "", + appDone: false, + functionId: "", + inputId: "", + imageId: "", + eof: false, + ptyExecId: "", + rootFunctionId: "", + ttlDays: 0 + }; +} +var TaskLogsBatch = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + for (const v of message.items) { + TaskLogs.encode(v, writer.uint32(18).fork()).join(); + } + if (message.entryId !== "") { + writer.uint32(42).string(message.entryId); + } + if (message.appDone !== false) { + writer.uint32(80).bool(message.appDone); + } + if (message.functionId !== "") { + writer.uint32(90).string(message.functionId); + } + if (message.inputId !== "") { + writer.uint32(98).string(message.inputId); + } + if (message.imageId !== "") { + writer.uint32(106).string(message.imageId); + } + if (message.eof !== false) { + writer.uint32(112).bool(message.eof); + } + if (message.ptyExecId !== "") { + writer.uint32(122).string(message.ptyExecId); + } + if (message.rootFunctionId !== "") { + writer.uint32(130).string(message.rootFunctionId); + } + if (message.ttlDays !== 0) { + writer.uint32(136).uint32(message.ttlDays); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskLogsBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.items.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.entryId = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.appDone = reader.bool(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.functionId = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.inputId = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.imageId = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.eof = reader.bool(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.ptyExecId = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.rootFunctionId = reader.string(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.ttlDays = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => TaskLogs.fromJSON(e)) : [], + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "", + appDone: isSet4(object.appDone) ? globalThis.Boolean(object.appDone) : false, + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false, + ptyExecId: isSet4(object.ptyExecId) ? globalThis.String(object.ptyExecId) : "", + rootFunctionId: isSet4(object.rootFunctionId) ? globalThis.String(object.rootFunctionId) : "", + ttlDays: isSet4(object.ttlDays) ? globalThis.Number(object.ttlDays) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.items?.length) { + obj.items = message.items.map((e) => TaskLogs.toJSON(e)); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + if (message.appDone !== false) { + obj.appDone = message.appDone; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.eof !== false) { + obj.eof = message.eof; + } + if (message.ptyExecId !== "") { + obj.ptyExecId = message.ptyExecId; + } + if (message.rootFunctionId !== "") { + obj.rootFunctionId = message.rootFunctionId; + } + if (message.ttlDays !== 0) { + obj.ttlDays = Math.round(message.ttlDays); + } + return obj; + }, + create(base) { + return TaskLogsBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskLogsBatch(); + message.taskId = object.taskId ?? ""; + message.items = object.items?.map((e) => TaskLogs.fromPartial(e)) || []; + message.entryId = object.entryId ?? ""; + message.appDone = object.appDone ?? false; + message.functionId = object.functionId ?? ""; + message.inputId = object.inputId ?? ""; + message.imageId = object.imageId ?? ""; + message.eof = object.eof ?? false; + message.ptyExecId = object.ptyExecId ?? ""; + message.rootFunctionId = object.rootFunctionId ?? ""; + message.ttlDays = object.ttlDays ?? 0; + return message; + } +}; +function createBaseTaskProgress() { + return { len: 0, pos: 0, progressType: 0, description: "" }; +} +var TaskProgress = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).uint64(message.len); + } + if (message.pos !== 0) { + writer.uint32(16).uint64(message.pos); + } + if (message.progressType !== 0) { + writer.uint32(24).int32(message.progressType); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.pos = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.progressType = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + len: isSet4(object.len) ? globalThis.Number(object.len) : 0, + pos: isSet4(object.pos) ? globalThis.Number(object.pos) : 0, + progressType: isSet4(object.progressType) ? progressTypeFromJSON(object.progressType) : 0, + description: isSet4(object.description) ? globalThis.String(object.description) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + if (message.pos !== 0) { + obj.pos = Math.round(message.pos); + } + if (message.progressType !== 0) { + obj.progressType = progressTypeToJSON(message.progressType); + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + create(base) { + return TaskProgress.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskProgress(); + message.len = object.len ?? 0; + message.pos = object.pos ?? 0; + message.progressType = object.progressType ?? 0; + message.description = object.description ?? ""; + return message; + } +}; +function createBaseTaskResultRequest() { + return { result: void 0 }; +} +var TaskResultRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return TaskResultRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskResultRequest(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseTaskStats() { + return { taskId: "", appId: "", appDescription: "", startedAt: 0 }; +} +var TaskStats = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.appId !== "") { + writer.uint32(18).string(message.appId); + } + if (message.appDescription !== "") { + writer.uint32(26).string(message.appDescription); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appDescription = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + appDescription: isSet4(object.appDescription) ? globalThis.String(object.appDescription) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.appDescription !== "") { + obj.appDescription = message.appDescription; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + return obj; + }, + create(base) { + return TaskStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskStats(); + message.taskId = object.taskId ?? ""; + message.appId = object.appId ?? ""; + message.appDescription = object.appDescription ?? ""; + message.startedAt = object.startedAt ?? 0; + return message; + } +}; +function createBaseTaskTemplate() { + return { rank: 0, resources: void 0, targetConcurrentInputs: 0, maxConcurrentInputs: 0, index: 0 }; +} +var TaskTemplate = { + encode(message, writer = new BinaryWriter()) { + if (message.rank !== 0) { + writer.uint32(8).uint32(message.rank); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(18).fork()).join(); + } + if (message.targetConcurrentInputs !== 0) { + writer.uint32(24).uint32(message.targetConcurrentInputs); + } + if (message.maxConcurrentInputs !== 0) { + writer.uint32(32).uint32(message.maxConcurrentInputs); + } + if (message.index !== 0) { + writer.uint32(40).uint32(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskTemplate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.rank = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.index = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rank: isSet4(object.rank) ? globalThis.Number(object.rank) : 0, + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : 0, + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : 0, + index: isSet4(object.index) ? globalThis.Number(object.index) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.rank !== 0) { + obj.rank = Math.round(message.rank); + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.targetConcurrentInputs !== 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.maxConcurrentInputs !== 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + create(base) { + return TaskTemplate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskTemplate(); + message.rank = object.rank ?? 0; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? 0; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? 0; + message.index = object.index ?? 0; + return message; + } +}; +function createBaseTokenFlowCreateRequest() { + return { utmSource: "", localhostPort: 0, nextUrl: "" }; +} +var TokenFlowCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.utmSource !== "") { + writer.uint32(26).string(message.utmSource); + } + if (message.localhostPort !== 0) { + writer.uint32(32).int32(message.localhostPort); + } + if (message.nextUrl !== "") { + writer.uint32(42).string(message.nextUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.utmSource = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.localhostPort = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.nextUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + utmSource: isSet4(object.utmSource) ? globalThis.String(object.utmSource) : "", + localhostPort: isSet4(object.localhostPort) ? globalThis.Number(object.localhostPort) : 0, + nextUrl: isSet4(object.nextUrl) ? globalThis.String(object.nextUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.utmSource !== "") { + obj.utmSource = message.utmSource; + } + if (message.localhostPort !== 0) { + obj.localhostPort = Math.round(message.localhostPort); + } + if (message.nextUrl !== "") { + obj.nextUrl = message.nextUrl; + } + return obj; + }, + create(base) { + return TokenFlowCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowCreateRequest(); + message.utmSource = object.utmSource ?? ""; + message.localhostPort = object.localhostPort ?? 0; + message.nextUrl = object.nextUrl ?? ""; + return message; + } +}; +function createBaseTokenFlowCreateResponse() { + return { tokenFlowId: "", webUrl: "", code: "", waitSecret: "" }; +} +var TokenFlowCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.tokenFlowId !== "") { + writer.uint32(10).string(message.tokenFlowId); + } + if (message.webUrl !== "") { + writer.uint32(18).string(message.webUrl); + } + if (message.code !== "") { + writer.uint32(26).string(message.code); + } + if (message.waitSecret !== "") { + writer.uint32(34).string(message.waitSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tokenFlowId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.code = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.waitSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tokenFlowId: isSet4(object.tokenFlowId) ? globalThis.String(object.tokenFlowId) : "", + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + code: isSet4(object.code) ? globalThis.String(object.code) : "", + waitSecret: isSet4(object.waitSecret) ? globalThis.String(object.waitSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tokenFlowId !== "") { + obj.tokenFlowId = message.tokenFlowId; + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.code !== "") { + obj.code = message.code; + } + if (message.waitSecret !== "") { + obj.waitSecret = message.waitSecret; + } + return obj; + }, + create(base) { + return TokenFlowCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowCreateResponse(); + message.tokenFlowId = object.tokenFlowId ?? ""; + message.webUrl = object.webUrl ?? ""; + message.code = object.code ?? ""; + message.waitSecret = object.waitSecret ?? ""; + return message; + } +}; +function createBaseTokenFlowWaitRequest() { + return { timeout: 0, tokenFlowId: "", waitSecret: "" }; +} +var TokenFlowWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.timeout !== 0) { + writer.uint32(13).float(message.timeout); + } + if (message.tokenFlowId !== "") { + writer.uint32(18).string(message.tokenFlowId); + } + if (message.waitSecret !== "") { + writer.uint32(26).string(message.waitSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + message.timeout = reader.float(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenFlowId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.waitSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + tokenFlowId: isSet4(object.tokenFlowId) ? globalThis.String(object.tokenFlowId) : "", + waitSecret: isSet4(object.waitSecret) ? globalThis.String(object.waitSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.tokenFlowId !== "") { + obj.tokenFlowId = message.tokenFlowId; + } + if (message.waitSecret !== "") { + obj.waitSecret = message.waitSecret; + } + return obj; + }, + create(base) { + return TokenFlowWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowWaitRequest(); + message.timeout = object.timeout ?? 0; + message.tokenFlowId = object.tokenFlowId ?? ""; + message.waitSecret = object.waitSecret ?? ""; + return message; + } +}; +function createBaseTokenFlowWaitResponse() { + return { tokenId: "", tokenSecret: "", timeout: false, workspaceUsername: "" }; +} +var TokenFlowWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.tokenId !== "") { + writer.uint32(10).string(message.tokenId); + } + if (message.tokenSecret !== "") { + writer.uint32(18).string(message.tokenSecret); + } + if (message.timeout !== false) { + writer.uint32(24).bool(message.timeout); + } + if (message.workspaceUsername !== "") { + writer.uint32(34).string(message.workspaceUsername); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tokenId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenSecret = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.timeout = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.workspaceUsername = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tokenId: isSet4(object.tokenId) ? globalThis.String(object.tokenId) : "", + tokenSecret: isSet4(object.tokenSecret) ? globalThis.String(object.tokenSecret) : "", + timeout: isSet4(object.timeout) ? globalThis.Boolean(object.timeout) : false, + workspaceUsername: isSet4(object.workspaceUsername) ? globalThis.String(object.workspaceUsername) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tokenId !== "") { + obj.tokenId = message.tokenId; + } + if (message.tokenSecret !== "") { + obj.tokenSecret = message.tokenSecret; + } + if (message.timeout !== false) { + obj.timeout = message.timeout; + } + if (message.workspaceUsername !== "") { + obj.workspaceUsername = message.workspaceUsername; + } + return obj; + }, + create(base) { + return TokenFlowWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowWaitResponse(); + message.tokenId = object.tokenId ?? ""; + message.tokenSecret = object.tokenSecret ?? ""; + message.timeout = object.timeout ?? false; + message.workspaceUsername = object.workspaceUsername ?? ""; + return message; + } +}; +function createBaseTunnelData() { + return { host: "", port: 0, unencryptedHost: void 0, unencryptedPort: void 0, containerPort: 0 }; +} +var TunnelData = { + encode(message, writer = new BinaryWriter()) { + if (message.host !== "") { + writer.uint32(10).string(message.host); + } + if (message.port !== 0) { + writer.uint32(16).uint32(message.port); + } + if (message.unencryptedHost !== void 0) { + writer.uint32(26).string(message.unencryptedHost); + } + if (message.unencryptedPort !== void 0) { + writer.uint32(32).uint32(message.unencryptedPort); + } + if (message.containerPort !== 0) { + writer.uint32(40).uint32(message.containerPort); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.port = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unencryptedHost = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.unencryptedPort = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.containerPort = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencryptedHost: isSet4(object.unencryptedHost) ? globalThis.String(object.unencryptedHost) : void 0, + unencryptedPort: isSet4(object.unencryptedPort) ? globalThis.Number(object.unencryptedPort) : void 0, + containerPort: isSet4(object.containerPort) ? globalThis.Number(object.containerPort) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencryptedHost !== void 0) { + obj.unencryptedHost = message.unencryptedHost; + } + if (message.unencryptedPort !== void 0) { + obj.unencryptedPort = Math.round(message.unencryptedPort); + } + if (message.containerPort !== 0) { + obj.containerPort = Math.round(message.containerPort); + } + return obj; + }, + create(base) { + return TunnelData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelData(); + message.host = object.host ?? ""; + message.port = object.port ?? 0; + message.unencryptedHost = object.unencryptedHost ?? void 0; + message.unencryptedPort = object.unencryptedPort ?? void 0; + message.containerPort = object.containerPort ?? 0; + return message; + } +}; +function createBaseTunnelStartRequest() { + return { port: 0, unencrypted: false, tunnelType: void 0 }; +} +var TunnelStartRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + if (message.unencrypted !== false) { + writer.uint32(16).bool(message.unencrypted); + } + if (message.tunnelType !== void 0) { + writer.uint32(24).int32(message.tunnelType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStartRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.unencrypted = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.tunnelType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencrypted: isSet4(object.unencrypted) ? globalThis.Boolean(object.unencrypted) : false, + tunnelType: isSet4(object.tunnelType) ? tunnelTypeFromJSON(object.tunnelType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencrypted !== false) { + obj.unencrypted = message.unencrypted; + } + if (message.tunnelType !== void 0) { + obj.tunnelType = tunnelTypeToJSON(message.tunnelType); + } + return obj; + }, + create(base) { + return TunnelStartRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStartRequest(); + message.port = object.port ?? 0; + message.unencrypted = object.unencrypted ?? false; + message.tunnelType = object.tunnelType ?? void 0; + return message; + } +}; +function createBaseTunnelStartResponse() { + return { host: "", port: 0, unencryptedHost: void 0, unencryptedPort: void 0 }; +} +var TunnelStartResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.host !== "") { + writer.uint32(10).string(message.host); + } + if (message.port !== 0) { + writer.uint32(16).uint32(message.port); + } + if (message.unencryptedHost !== void 0) { + writer.uint32(26).string(message.unencryptedHost); + } + if (message.unencryptedPort !== void 0) { + writer.uint32(32).uint32(message.unencryptedPort); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStartResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.port = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unencryptedHost = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.unencryptedPort = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencryptedHost: isSet4(object.unencryptedHost) ? globalThis.String(object.unencryptedHost) : void 0, + unencryptedPort: isSet4(object.unencryptedPort) ? globalThis.Number(object.unencryptedPort) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencryptedHost !== void 0) { + obj.unencryptedHost = message.unencryptedHost; + } + if (message.unencryptedPort !== void 0) { + obj.unencryptedPort = Math.round(message.unencryptedPort); + } + return obj; + }, + create(base) { + return TunnelStartResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStartResponse(); + message.host = object.host ?? ""; + message.port = object.port ?? 0; + message.unencryptedHost = object.unencryptedHost ?? void 0; + message.unencryptedPort = object.unencryptedPort ?? void 0; + return message; + } +}; +function createBaseTunnelStopRequest() { + return { port: 0 }; +} +var TunnelStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { port: isSet4(object.port) ? globalThis.Number(object.port) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return TunnelStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStopRequest(); + message.port = object.port ?? 0; + return message; + } +}; +function createBaseTunnelStopResponse() { + return { exists: false }; +} +var TunnelStopResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(8).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return TunnelStopResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStopResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseUploadUrlList() { + return { items: [] }; +} +var UploadUrlList = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseUploadUrlList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => globalThis.String(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + create(base) { + return UploadUrlList.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUploadUrlList(); + message.items = object.items?.map((e) => e) || []; + return message; + } +}; +function createBaseVolumeCommitRequest() { + return { volumeId: "" }; +} +var VolumeCommitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeCommitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCommitRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeCommitResponse() { + return { skipReload: false }; +} +var VolumeCommitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.skipReload !== false) { + writer.uint32(8).bool(message.skipReload); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.skipReload = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { skipReload: isSet4(object.skipReload) ? globalThis.Boolean(object.skipReload) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.skipReload !== false) { + obj.skipReload = message.skipReload; + } + return obj; + }, + create(base) { + return VolumeCommitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCommitResponse(); + message.skipReload = object.skipReload ?? false; + return message; + } +}; +function createBaseVolumeCopyFiles2Request() { + return { volumeId: "", srcPaths: [], dstPath: "", recursive: false }; +} +var VolumeCopyFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.srcPaths) { + writer.uint32(18).string(v); + } + if (message.dstPath !== "") { + writer.uint32(26).string(message.dstPath); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCopyFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.srcPaths.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dstPath = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + srcPaths: globalThis.Array.isArray(object?.srcPaths) ? object.srcPaths.map((e) => globalThis.String(e)) : [], + dstPath: isSet4(object.dstPath) ? globalThis.String(object.dstPath) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.srcPaths?.length) { + obj.srcPaths = message.srcPaths; + } + if (message.dstPath !== "") { + obj.dstPath = message.dstPath; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeCopyFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCopyFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.srcPaths = object.srcPaths?.map((e) => e) || []; + message.dstPath = object.dstPath ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeCopyFilesRequest() { + return { volumeId: "", srcPaths: [], dstPath: "", recursive: false }; +} +var VolumeCopyFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.srcPaths) { + writer.uint32(18).string(v); + } + if (message.dstPath !== "") { + writer.uint32(26).string(message.dstPath); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCopyFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.srcPaths.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dstPath = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + srcPaths: globalThis.Array.isArray(object?.srcPaths) ? object.srcPaths.map((e) => globalThis.String(e)) : [], + dstPath: isSet4(object.dstPath) ? globalThis.String(object.dstPath) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.srcPaths?.length) { + obj.srcPaths = message.srcPaths; + } + if (message.dstPath !== "") { + obj.dstPath = message.dstPath; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeCopyFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCopyFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.srcPaths = object.srcPaths?.map((e) => e) || []; + message.dstPath = object.dstPath ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeDeleteRequest() { + return { volumeId: "", environmentName: "" }; +} +var VolumeDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return VolumeDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeDeleteRequest(); + message.volumeId = object.volumeId ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseVolumeGetFile2Request() { + return { volumeId: "", path: "", start: 0, len: 0 }; +} +var VolumeGetFile2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFile2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFile2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFile2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFile2Response() { + return { getUrls: [], size: 0, start: 0, len: 0 }; +} +var VolumeGetFile2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.getUrls) { + writer.uint32(10).string(v); + } + if (message.size !== 0) { + writer.uint32(16).uint64(message.size); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFile2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.getUrls.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + getUrls: globalThis.Array.isArray(object?.getUrls) ? object.getUrls.map((e) => globalThis.String(e)) : [], + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.getUrls?.length) { + obj.getUrls = message.getUrls; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFile2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFile2Response(); + message.getUrls = object.getUrls?.map((e) => e) || []; + message.size = object.size ?? 0; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFileRequest() { + return { volumeId: "", path: "", start: 0, len: 0 }; +} +var VolumeGetFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFileRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFileResponse() { + return { data: void 0, dataBlobId: void 0, size: 0, start: 0, len: 0 }; +} +var VolumeGetFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + writer.uint32(10).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(18).string(message.dataBlobId); + } + if (message.size !== 0) { + writer.uint32(24).uint64(message.size); + } + if (message.start !== 0) { + writer.uint32(32).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(40).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFileResponse(); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.size = object.size ?? 0; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, appId: "", version: 0 }; +} +var VolumeGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(48).int32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.version = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + return obj; + }, + create(base) { + return VolumeGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + return message; + } +}; +function createBaseVolumeGetOrCreateResponse() { + return { volumeId: "", version: 0, metadata: void 0 }; +} +var VolumeGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + if (message.metadata !== void 0) { + VolumeMetadata.encode(message.metadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0, + metadata: isSet4(object.metadata) ? VolumeMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + if (message.metadata !== void 0) { + obj.metadata = VolumeMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return VolumeGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetOrCreateResponse(); + message.volumeId = object.volumeId ?? ""; + message.version = object.version ?? 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? VolumeMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseVolumeHeartbeatRequest() { + return { volumeId: "" }; +} +var VolumeHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeHeartbeatRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeListFiles2Request() { + return { volumeId: "", path: "", recursive: false, maxEntries: void 0 }; +} +var VolumeListFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + if (message.maxEntries !== void 0) { + writer.uint32(24).uint32(message.maxEntries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxEntries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + maxEntries: isSet4(object.maxEntries) ? globalThis.Number(object.maxEntries) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.maxEntries !== void 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + return obj; + }, + create(base) { + return VolumeListFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.maxEntries = object.maxEntries ?? void 0; + return message; + } +}; +function createBaseVolumeListFiles2Response() { + return { entries: [] }; +} +var VolumeListFiles2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFiles2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumeListFiles2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFiles2Response(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumeListFilesRequest() { + return { volumeId: "", path: "", recursive: false, maxEntries: void 0 }; +} +var VolumeListFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + if (message.maxEntries !== void 0) { + writer.uint32(24).uint32(message.maxEntries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxEntries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + maxEntries: isSet4(object.maxEntries) ? globalThis.Number(object.maxEntries) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.maxEntries !== void 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + return obj; + }, + create(base) { + return VolumeListFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.maxEntries = object.maxEntries ?? void 0; + return message; + } +}; +function createBaseVolumeListFilesResponse() { + return { entries: [] }; +} +var VolumeListFilesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumeListFilesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFilesResponse(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumeListItem() { + return { label: "", volumeId: "", createdAt: 0, metadata: void 0 }; +} +var VolumeListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.volumeId !== "") { + writer.uint32(18).string(message.volumeId); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.metadata !== void 0) { + VolumeMetadata.encode(message.metadata, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.metadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + metadata: isSet4(object.metadata) ? VolumeMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.metadata !== void 0) { + obj.metadata = VolumeMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return VolumeListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListItem(); + message.label = object.label ?? ""; + message.volumeId = object.volumeId ?? ""; + message.createdAt = object.createdAt ?? 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? VolumeMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseVolumeListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var VolumeListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return VolumeListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseVolumeListResponse() { + return { items: [], environmentName: "" }; +} +var VolumeListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + VolumeListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(VolumeListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => VolumeListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => VolumeListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return VolumeListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListResponse(); + message.items = object.items?.map((e) => VolumeListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseVolumeMetadata() { + return { version: 0, name: "", creationInfo: void 0 }; +} +var VolumeMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.version !== 0) { + writer.uint32(8).int32(message.version); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.version = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return VolumeMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeMetadata(); + message.version = object.version ?? 0; + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseVolumeMount() { + return { volumeId: "", mountPath: "", allowBackgroundCommits: false, readOnly: false }; +} +var VolumeMount = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.allowBackgroundCommits !== false) { + writer.uint32(24).bool(message.allowBackgroundCommits); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.allowBackgroundCommits = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + allowBackgroundCommits: isSet4(object.allowBackgroundCommits) ? globalThis.Boolean(object.allowBackgroundCommits) : false, + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.allowBackgroundCommits !== false) { + obj.allowBackgroundCommits = message.allowBackgroundCommits; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + create(base) { + return VolumeMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeMount(); + message.volumeId = object.volumeId ?? ""; + message.mountPath = object.mountPath ?? ""; + message.allowBackgroundCommits = object.allowBackgroundCommits ?? false; + message.readOnly = object.readOnly ?? false; + return message; + } +}; +function createBaseVolumePutFiles2Request() { + return { volumeId: "", files: [], disallowOverwriteExistingFiles: false }; +} +var VolumePutFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.files) { + VolumePutFiles2Request_File.encode(v, writer.uint32(18).fork()).join(); + } + if (message.disallowOverwriteExistingFiles !== false) { + writer.uint32(24).bool(message.disallowOverwriteExistingFiles); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.files.push(VolumePutFiles2Request_File.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.disallowOverwriteExistingFiles = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => VolumePutFiles2Request_File.fromJSON(e)) : [], + disallowOverwriteExistingFiles: isSet4(object.disallowOverwriteExistingFiles) ? globalThis.Boolean(object.disallowOverwriteExistingFiles) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.files?.length) { + obj.files = message.files.map((e) => VolumePutFiles2Request_File.toJSON(e)); + } + if (message.disallowOverwriteExistingFiles !== false) { + obj.disallowOverwriteExistingFiles = message.disallowOverwriteExistingFiles; + } + return obj; + }, + create(base) { + return VolumePutFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.files = object.files?.map((e) => VolumePutFiles2Request_File.fromPartial(e)) || []; + message.disallowOverwriteExistingFiles = object.disallowOverwriteExistingFiles ?? false; + return message; + } +}; +function createBaseVolumePutFiles2Request_File() { + return { path: "", size: 0, blocks: [], mode: void 0 }; +} +var VolumePutFiles2Request_File = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.size !== 0) { + writer.uint32(16).uint64(message.size); + } + for (const v of message.blocks) { + VolumePutFiles2Request_Block.encode(v, writer.uint32(26).fork()).join(); + } + if (message.mode !== void 0) { + writer.uint32(32).uint32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request_File(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.blocks.push(VolumePutFiles2Request_Block.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.mode = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e) => VolumePutFiles2Request_Block.fromJSON(e)) : [], + mode: isSet4(object.mode) ? globalThis.Number(object.mode) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => VolumePutFiles2Request_Block.toJSON(e)); + } + if (message.mode !== void 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + create(base) { + return VolumePutFiles2Request_File.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request_File(); + message.path = object.path ?? ""; + message.size = object.size ?? 0; + message.blocks = object.blocks?.map((e) => VolumePutFiles2Request_Block.fromPartial(e)) || []; + message.mode = object.mode ?? void 0; + return message; + } +}; +function createBaseVolumePutFiles2Request_Block() { + return { contentsSha256: new Uint8Array(0), putResponse: void 0 }; +} +var VolumePutFiles2Request_Block = { + encode(message, writer = new BinaryWriter()) { + if (message.contentsSha256.length !== 0) { + writer.uint32(10).bytes(message.contentsSha256); + } + if (message.putResponse !== void 0) { + writer.uint32(18).bytes(message.putResponse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request_Block(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentsSha256 = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.putResponse = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentsSha256: isSet4(object.contentsSha256) ? bytesFromBase64(object.contentsSha256) : new Uint8Array(0), + putResponse: isSet4(object.putResponse) ? bytesFromBase64(object.putResponse) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentsSha256.length !== 0) { + obj.contentsSha256 = base64FromBytes(message.contentsSha256); + } + if (message.putResponse !== void 0) { + obj.putResponse = base64FromBytes(message.putResponse); + } + return obj; + }, + create(base) { + return VolumePutFiles2Request_Block.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request_Block(); + message.contentsSha256 = object.contentsSha256 ?? new Uint8Array(0); + message.putResponse = object.putResponse ?? void 0; + return message; + } +}; +function createBaseVolumePutFiles2Response() { + return { missingBlocks: [] }; +} +var VolumePutFiles2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.missingBlocks) { + VolumePutFiles2Response_MissingBlock.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.missingBlocks.push(VolumePutFiles2Response_MissingBlock.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + missingBlocks: globalThis.Array.isArray(object?.missingBlocks) ? object.missingBlocks.map((e) => VolumePutFiles2Response_MissingBlock.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.missingBlocks?.length) { + obj.missingBlocks = message.missingBlocks.map((e) => VolumePutFiles2Response_MissingBlock.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumePutFiles2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Response(); + message.missingBlocks = object.missingBlocks?.map((e) => VolumePutFiles2Response_MissingBlock.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumePutFiles2Response_MissingBlock() { + return { fileIndex: 0, blockIndex: 0, putUrl: "" }; +} +var VolumePutFiles2Response_MissingBlock = { + encode(message, writer = new BinaryWriter()) { + if (message.fileIndex !== 0) { + writer.uint32(8).uint64(message.fileIndex); + } + if (message.blockIndex !== 0) { + writer.uint32(16).uint64(message.blockIndex); + } + if (message.putUrl !== "") { + writer.uint32(26).string(message.putUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Response_MissingBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fileIndex = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.blockIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.putUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileIndex: isSet4(object.fileIndex) ? globalThis.Number(object.fileIndex) : 0, + blockIndex: isSet4(object.blockIndex) ? globalThis.Number(object.blockIndex) : 0, + putUrl: isSet4(object.putUrl) ? globalThis.String(object.putUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileIndex !== 0) { + obj.fileIndex = Math.round(message.fileIndex); + } + if (message.blockIndex !== 0) { + obj.blockIndex = Math.round(message.blockIndex); + } + if (message.putUrl !== "") { + obj.putUrl = message.putUrl; + } + return obj; + }, + create(base) { + return VolumePutFiles2Response_MissingBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Response_MissingBlock(); + message.fileIndex = object.fileIndex ?? 0; + message.blockIndex = object.blockIndex ?? 0; + message.putUrl = object.putUrl ?? ""; + return message; + } +}; +function createBaseVolumePutFilesRequest() { + return { volumeId: "", files: [], disallowOverwriteExistingFiles: false }; +} +var VolumePutFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.files) { + MountFile.encode(v, writer.uint32(18).fork()).join(); + } + if (message.disallowOverwriteExistingFiles !== false) { + writer.uint32(24).bool(message.disallowOverwriteExistingFiles); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.files.push(MountFile.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.disallowOverwriteExistingFiles = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => MountFile.fromJSON(e)) : [], + disallowOverwriteExistingFiles: isSet4(object.disallowOverwriteExistingFiles) ? globalThis.Boolean(object.disallowOverwriteExistingFiles) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.files?.length) { + obj.files = message.files.map((e) => MountFile.toJSON(e)); + } + if (message.disallowOverwriteExistingFiles !== false) { + obj.disallowOverwriteExistingFiles = message.disallowOverwriteExistingFiles; + } + return obj; + }, + create(base) { + return VolumePutFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.files = object.files?.map((e) => MountFile.fromPartial(e)) || []; + message.disallowOverwriteExistingFiles = object.disallowOverwriteExistingFiles ?? false; + return message; + } +}; +function createBaseVolumeReloadRequest() { + return { volumeId: "" }; +} +var VolumeReloadRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeReloadRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeReloadRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeReloadRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeRemoveFile2Request() { + return { volumeId: "", path: "", recursive: false }; +} +var VolumeRemoveFile2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRemoveFile2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeRemoveFile2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRemoveFile2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeRemoveFileRequest() { + return { volumeId: "", path: "", recursive: false }; +} +var VolumeRemoveFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRemoveFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeRemoveFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRemoveFileRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeRenameRequest() { + return { volumeId: "", name: "" }; +} +var VolumeRenameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRenameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return VolumeRenameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRenameRequest(); + message.volumeId = object.volumeId ?? ""; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseWarning() { + return { type: 0, message: "" }; +} +var Warning = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWarning(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? warning_WarningTypeFromJSON(object.type) : 0, + message: isSet4(object.message) ? globalThis.String(object.message) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = warning_WarningTypeToJSON(message.type); + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + create(base) { + return Warning.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWarning(); + message.type = object.type ?? 0; + message.message = object.message ?? ""; + return message; + } +}; +function createBaseWebUrlInfo() { + return { truncated: false, hasUniqueHash: false, labelStolen: false }; +} +var WebUrlInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.truncated !== false) { + writer.uint32(8).bool(message.truncated); + } + if (message.hasUniqueHash !== false) { + writer.uint32(16).bool(message.hasUniqueHash); + } + if (message.labelStolen !== false) { + writer.uint32(24).bool(message.labelStolen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWebUrlInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.truncated = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.hasUniqueHash = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.labelStolen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + truncated: isSet4(object.truncated) ? globalThis.Boolean(object.truncated) : false, + hasUniqueHash: isSet4(object.hasUniqueHash) ? globalThis.Boolean(object.hasUniqueHash) : false, + labelStolen: isSet4(object.labelStolen) ? globalThis.Boolean(object.labelStolen) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.truncated !== false) { + obj.truncated = message.truncated; + } + if (message.hasUniqueHash !== false) { + obj.hasUniqueHash = message.hasUniqueHash; + } + if (message.labelStolen !== false) { + obj.labelStolen = message.labelStolen; + } + return obj; + }, + create(base) { + return WebUrlInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWebUrlInfo(); + message.truncated = object.truncated ?? false; + message.hasUniqueHash = object.hasUniqueHash ?? false; + message.labelStolen = object.labelStolen ?? false; + return message; + } +}; +function createBaseWebhookConfig() { + return { + type: 0, + method: "", + requestedSuffix: "", + asyncMode: 0, + customDomains: [], + webServerPort: 0, + webServerStartupTimeout: 0, + webEndpointDocs: false, + requiresProxyAuth: false + }; +} +var WebhookConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.method !== "") { + writer.uint32(18).string(message.method); + } + if (message.requestedSuffix !== "") { + writer.uint32(34).string(message.requestedSuffix); + } + if (message.asyncMode !== 0) { + writer.uint32(40).int32(message.asyncMode); + } + for (const v of message.customDomains) { + CustomDomainConfig.encode(v, writer.uint32(50).fork()).join(); + } + if (message.webServerPort !== 0) { + writer.uint32(56).uint32(message.webServerPort); + } + if (message.webServerStartupTimeout !== 0) { + writer.uint32(69).float(message.webServerStartupTimeout); + } + if (message.webEndpointDocs !== false) { + writer.uint32(72).bool(message.webEndpointDocs); + } + if (message.requiresProxyAuth !== false) { + writer.uint32(80).bool(message.requiresProxyAuth); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWebhookConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.method = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.requestedSuffix = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.asyncMode = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.customDomains.push(CustomDomainConfig.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.webServerPort = reader.uint32(); + continue; + } + case 8: { + if (tag !== 69) { + break; + } + message.webServerStartupTimeout = reader.float(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.webEndpointDocs = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.requiresProxyAuth = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? webhookTypeFromJSON(object.type) : 0, + method: isSet4(object.method) ? globalThis.String(object.method) : "", + requestedSuffix: isSet4(object.requestedSuffix) ? globalThis.String(object.requestedSuffix) : "", + asyncMode: isSet4(object.asyncMode) ? webhookAsyncModeFromJSON(object.asyncMode) : 0, + customDomains: globalThis.Array.isArray(object?.customDomains) ? object.customDomains.map((e) => CustomDomainConfig.fromJSON(e)) : [], + webServerPort: isSet4(object.webServerPort) ? globalThis.Number(object.webServerPort) : 0, + webServerStartupTimeout: isSet4(object.webServerStartupTimeout) ? globalThis.Number(object.webServerStartupTimeout) : 0, + webEndpointDocs: isSet4(object.webEndpointDocs) ? globalThis.Boolean(object.webEndpointDocs) : false, + requiresProxyAuth: isSet4(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = webhookTypeToJSON(message.type); + } + if (message.method !== "") { + obj.method = message.method; + } + if (message.requestedSuffix !== "") { + obj.requestedSuffix = message.requestedSuffix; + } + if (message.asyncMode !== 0) { + obj.asyncMode = webhookAsyncModeToJSON(message.asyncMode); + } + if (message.customDomains?.length) { + obj.customDomains = message.customDomains.map((e) => CustomDomainConfig.toJSON(e)); + } + if (message.webServerPort !== 0) { + obj.webServerPort = Math.round(message.webServerPort); + } + if (message.webServerStartupTimeout !== 0) { + obj.webServerStartupTimeout = message.webServerStartupTimeout; + } + if (message.webEndpointDocs !== false) { + obj.webEndpointDocs = message.webEndpointDocs; + } + if (message.requiresProxyAuth !== false) { + obj.requiresProxyAuth = message.requiresProxyAuth; + } + return obj; + }, + create(base) { + return WebhookConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWebhookConfig(); + message.type = object.type ?? 0; + message.method = object.method ?? ""; + message.requestedSuffix = object.requestedSuffix ?? ""; + message.asyncMode = object.asyncMode ?? 0; + message.customDomains = object.customDomains?.map((e) => CustomDomainConfig.fromPartial(e)) || []; + message.webServerPort = object.webServerPort ?? 0; + message.webServerStartupTimeout = object.webServerStartupTimeout ?? 0; + message.webEndpointDocs = object.webEndpointDocs ?? false; + message.requiresProxyAuth = object.requiresProxyAuth ?? false; + return message; + } +}; +function createBaseWorkspaceBillingReportItem() { + return { objectId: "", description: "", environmentName: "", interval: void 0, cost: "", tags: {} }; +} +var WorkspaceBillingReportItem = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.interval !== void 0) { + Timestamp.encode(toTimestamp(message.interval), writer.uint32(34).fork()).join(); + } + if (message.cost !== "") { + writer.uint32(42).string(message.cost); + } + Object.entries(message.tags).forEach(([key, value]) => { + WorkspaceBillingReportItem_TagsEntry.encode({ key, value }, writer.uint32(50).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.interval = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.cost = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + const entry6 = WorkspaceBillingReportItem_TagsEntry.decode(reader, reader.uint32()); + if (entry6.value !== void 0) { + message.tags[entry6.key] = entry6.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + interval: isSet4(object.interval) ? fromJsonTimestamp(object.interval) : void 0, + cost: isSet4(object.cost) ? globalThis.String(object.cost) : "", + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.interval !== void 0) { + obj.interval = message.interval.toISOString(); + } + if (message.cost !== "") { + obj.cost = message.cost; + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return WorkspaceBillingReportItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportItem(); + message.objectId = object.objectId ?? ""; + message.description = object.description ?? ""; + message.environmentName = object.environmentName ?? ""; + message.interval = object.interval ?? void 0; + message.cost = object.cost ?? ""; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseWorkspaceBillingReportItem_TagsEntry() { + return { key: "", value: "" }; +} +var WorkspaceBillingReportItem_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportItem_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return WorkspaceBillingReportItem_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportItem_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseWorkspaceBillingReportRequest() { + return { startTimestamp: void 0, endTimestamp: void 0, resolution: "", tagNames: [] }; +} +var WorkspaceBillingReportRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.startTimestamp !== void 0) { + Timestamp.encode(toTimestamp(message.startTimestamp), writer.uint32(10).fork()).join(); + } + if (message.endTimestamp !== void 0) { + Timestamp.encode(toTimestamp(message.endTimestamp), writer.uint32(18).fork()).join(); + } + if (message.resolution !== "") { + writer.uint32(26).string(message.resolution); + } + for (const v of message.tagNames) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.startTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.endTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.resolution = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.tagNames.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + startTimestamp: isSet4(object.startTimestamp) ? fromJsonTimestamp(object.startTimestamp) : void 0, + endTimestamp: isSet4(object.endTimestamp) ? fromJsonTimestamp(object.endTimestamp) : void 0, + resolution: isSet4(object.resolution) ? globalThis.String(object.resolution) : "", + tagNames: globalThis.Array.isArray(object?.tagNames) ? object.tagNames.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.startTimestamp !== void 0) { + obj.startTimestamp = message.startTimestamp.toISOString(); + } + if (message.endTimestamp !== void 0) { + obj.endTimestamp = message.endTimestamp.toISOString(); + } + if (message.resolution !== "") { + obj.resolution = message.resolution; + } + if (message.tagNames?.length) { + obj.tagNames = message.tagNames; + } + return obj; + }, + create(base) { + return WorkspaceBillingReportRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportRequest(); + message.startTimestamp = object.startTimestamp ?? void 0; + message.endTimestamp = object.endTimestamp ?? void 0; + message.resolution = object.resolution ?? ""; + message.tagNames = object.tagNames?.map((e) => e) || []; + return message; + } +}; +function createBaseWorkspaceNameLookupResponse() { + return { workspaceName: "", username: "" }; +} +var WorkspaceNameLookupResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.workspaceName !== "") { + writer.uint32(10).string(message.workspaceName); + } + if (message.username !== "") { + writer.uint32(18).string(message.username); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceNameLookupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.workspaceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.username = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + workspaceName: isSet4(object.workspaceName) ? globalThis.String(object.workspaceName) : "", + username: isSet4(object.username) ? globalThis.String(object.username) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.workspaceName !== "") { + obj.workspaceName = message.workspaceName; + } + if (message.username !== "") { + obj.username = message.username; + } + return obj; + }, + create(base) { + return WorkspaceNameLookupResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceNameLookupResponse(); + message.workspaceName = object.workspaceName ?? ""; + message.username = object.username ?? ""; + return message; + } +}; +var ModalClientDefinition = { + name: "ModalClient", + fullName: "modal.client.ModalClient", + methods: { + /** Apps */ + appClientDisconnect: { + name: "AppClientDisconnect", + requestType: AppClientDisconnectRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appCreate: { + name: "AppCreate", + requestType: AppCreateRequest, + requestStream: false, + responseType: AppCreateResponse, + responseStream: false, + options: {} + }, + appDeploy: { + name: "AppDeploy", + requestType: AppDeployRequest, + requestStream: false, + responseType: AppDeployResponse, + responseStream: false, + options: {} + }, + appDeploymentHistory: { + name: "AppDeploymentHistory", + requestType: AppDeploymentHistoryRequest, + requestStream: false, + responseType: AppDeploymentHistoryResponse, + responseStream: false, + options: {} + }, + appGetByDeploymentName: { + name: "AppGetByDeploymentName", + requestType: AppGetByDeploymentNameRequest, + requestStream: false, + responseType: AppGetByDeploymentNameResponse, + responseStream: false, + options: {} + }, + appGetLayout: { + name: "AppGetLayout", + requestType: AppGetLayoutRequest, + requestStream: false, + responseType: AppGetLayoutResponse, + responseStream: false, + options: {} + }, + appGetLogs: { + name: "AppGetLogs", + requestType: AppGetLogsRequest, + requestStream: false, + responseType: TaskLogsBatch, + responseStream: true, + options: {} + }, + appGetObjects: { + name: "AppGetObjects", + requestType: AppGetObjectsRequest, + requestStream: false, + responseType: AppGetObjectsResponse, + responseStream: false, + options: {} + }, + appGetOrCreate: { + name: "AppGetOrCreate", + requestType: AppGetOrCreateRequest, + requestStream: false, + responseType: AppGetOrCreateResponse, + responseStream: false, + options: {} + }, + appGetTags: { + name: "AppGetTags", + requestType: AppGetTagsRequest, + requestStream: false, + responseType: AppGetTagsResponse, + responseStream: false, + options: {} + }, + appHeartbeat: { + name: "AppHeartbeat", + requestType: AppHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appList: { + name: "AppList", + requestType: AppListRequest, + requestStream: false, + responseType: AppListResponse, + responseStream: false, + options: {} + }, + appLookup: { + name: "AppLookup", + requestType: AppLookupRequest, + requestStream: false, + responseType: AppLookupResponse, + responseStream: false, + options: {} + }, + appPublish: { + name: "AppPublish", + requestType: AppPublishRequest, + requestStream: false, + responseType: AppPublishResponse, + responseStream: false, + options: {} + }, + appRollback: { + name: "AppRollback", + requestType: AppRollbackRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appSetObjects: { + name: "AppSetObjects", + requestType: AppSetObjectsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appSetTags: { + name: "AppSetTags", + requestType: AppSetTagsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appStop: { + name: "AppStop", + requestType: AppStopRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Input Plane */ + attemptAwait: { + name: "AttemptAwait", + requestType: AttemptAwaitRequest, + requestStream: false, + responseType: AttemptAwaitResponse, + responseStream: false, + options: {} + }, + attemptRetry: { + name: "AttemptRetry", + requestType: AttemptRetryRequest, + requestStream: false, + responseType: AttemptRetryResponse, + responseStream: false, + options: {} + }, + attemptStart: { + name: "AttemptStart", + requestType: AttemptStartRequest, + requestStream: false, + responseType: AttemptStartResponse, + responseStream: false, + options: {} + }, + /** Auth Token */ + authTokenGet: { + name: "AuthTokenGet", + requestType: AuthTokenGetRequest, + requestStream: false, + responseType: AuthTokenGetResponse, + responseStream: false, + options: {} + }, + /** Blobs */ + blobCreate: { + name: "BlobCreate", + requestType: BlobCreateRequest, + requestStream: false, + responseType: BlobCreateResponse, + responseStream: false, + options: {} + }, + blobGet: { + name: "BlobGet", + requestType: BlobGetRequest, + requestStream: false, + responseType: BlobGetResponse, + responseStream: false, + options: {} + }, + /** Classes */ + classCreate: { + name: "ClassCreate", + requestType: ClassCreateRequest, + requestStream: false, + responseType: ClassCreateResponse, + responseStream: false, + options: {} + }, + classGet: { + name: "ClassGet", + requestType: ClassGetRequest, + requestStream: false, + responseType: ClassGetResponse, + responseStream: false, + options: {} + }, + /** Clients */ + clientHello: { + name: "ClientHello", + requestType: Empty, + requestStream: false, + responseType: ClientHelloResponse, + responseStream: false, + options: {} + }, + /** Clusters */ + clusterGet: { + name: "ClusterGet", + requestType: ClusterGetRequest, + requestStream: false, + responseType: ClusterGetResponse, + responseStream: false, + options: {} + }, + clusterList: { + name: "ClusterList", + requestType: ClusterListRequest, + requestStream: false, + responseType: ClusterListResponse, + responseStream: false, + options: {} + }, + /** Container */ + containerCheckpoint: { + name: "ContainerCheckpoint", + requestType: ContainerCheckpointRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerExec: { + name: "ContainerExec", + requestType: ContainerExecRequest, + requestStream: false, + responseType: ContainerExecResponse, + responseStream: false, + options: {} + }, + containerExecGetOutput: { + name: "ContainerExecGetOutput", + requestType: ContainerExecGetOutputRequest, + requestStream: false, + responseType: RuntimeOutputBatch, + responseStream: true, + options: {} + }, + containerExecPutInput: { + name: "ContainerExecPutInput", + requestType: ContainerExecPutInputRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerExecWait: { + name: "ContainerExecWait", + requestType: ContainerExecWaitRequest, + requestStream: false, + responseType: ContainerExecWaitResponse, + responseStream: false, + options: {} + }, + containerFilesystemExec: { + name: "ContainerFilesystemExec", + requestType: ContainerFilesystemExecRequest, + requestStream: false, + responseType: ContainerFilesystemExecResponse, + responseStream: false, + options: {} + }, + containerFilesystemExecGetOutput: { + name: "ContainerFilesystemExecGetOutput", + requestType: ContainerFilesystemExecGetOutputRequest, + requestStream: false, + responseType: FilesystemRuntimeOutputBatch, + responseStream: true, + options: {} + }, + containerHeartbeat: { + name: "ContainerHeartbeat", + requestType: ContainerHeartbeatRequest, + requestStream: false, + responseType: ContainerHeartbeatResponse, + responseStream: false, + options: {} + }, + containerHello: { + name: "ContainerHello", + requestType: Empty, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerLog: { + name: "ContainerLog", + requestType: ContainerLogRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerReloadVolumes: { + name: "ContainerReloadVolumes", + requestType: ContainerReloadVolumesRequest, + requestStream: false, + responseType: ContainerReloadVolumesResponse, + responseStream: false, + options: {} + }, + containerStop: { + name: "ContainerStop", + requestType: ContainerStopRequest, + requestStream: false, + responseType: ContainerStopResponse, + responseStream: false, + options: {} + }, + /** Dicts */ + dictClear: { + name: "DictClear", + requestType: DictClearRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictContains: { + name: "DictContains", + requestType: DictContainsRequest, + requestStream: false, + responseType: DictContainsResponse, + responseStream: false, + options: {} + }, + dictContents: { + name: "DictContents", + requestType: DictContentsRequest, + requestStream: false, + responseType: DictEntry, + responseStream: true, + options: {} + }, + dictDelete: { + name: "DictDelete", + requestType: DictDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictGet: { + name: "DictGet", + requestType: DictGetRequest, + requestStream: false, + responseType: DictGetResponse, + responseStream: false, + options: {} + }, + dictGetOrCreate: { + name: "DictGetOrCreate", + requestType: DictGetOrCreateRequest, + requestStream: false, + responseType: DictGetOrCreateResponse, + responseStream: false, + options: {} + }, + dictHeartbeat: { + name: "DictHeartbeat", + requestType: DictHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictLen: { + name: "DictLen", + requestType: DictLenRequest, + requestStream: false, + responseType: DictLenResponse, + responseStream: false, + options: {} + }, + dictList: { + name: "DictList", + requestType: DictListRequest, + requestStream: false, + responseType: DictListResponse, + responseStream: false, + options: {} + }, + dictPop: { + name: "DictPop", + requestType: DictPopRequest, + requestStream: false, + responseType: DictPopResponse, + responseStream: false, + options: {} + }, + dictUpdate: { + name: "DictUpdate", + requestType: DictUpdateRequest, + requestStream: false, + responseType: DictUpdateResponse, + responseStream: false, + options: {} + }, + /** Domains */ + domainCertificateVerify: { + name: "DomainCertificateVerify", + requestType: DomainCertificateVerifyRequest, + requestStream: false, + responseType: DomainCertificateVerifyResponse, + responseStream: false, + options: {} + }, + domainCreate: { + name: "DomainCreate", + requestType: DomainCreateRequest, + requestStream: false, + responseType: DomainCreateResponse, + responseStream: false, + options: {} + }, + domainList: { + name: "DomainList", + requestType: DomainListRequest, + requestStream: false, + responseType: DomainListResponse, + responseStream: false, + options: {} + }, + /** Environments */ + environmentCreate: { + name: "EnvironmentCreate", + requestType: EnvironmentCreateRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + environmentDelete: { + name: "EnvironmentDelete", + requestType: EnvironmentDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + environmentGetOrCreate: { + name: "EnvironmentGetOrCreate", + requestType: EnvironmentGetOrCreateRequest, + requestStream: false, + responseType: EnvironmentGetOrCreateResponse, + responseStream: false, + options: {} + }, + environmentList: { + name: "EnvironmentList", + requestType: Empty, + requestStream: false, + responseType: EnvironmentListResponse, + responseStream: false, + options: {} + }, + environmentUpdate: { + name: "EnvironmentUpdate", + requestType: EnvironmentUpdateRequest, + requestStream: false, + responseType: EnvironmentListItem, + responseStream: false, + options: {} + }, + /** Modal Flash (experimental) */ + flashContainerDeregister: { + name: "FlashContainerDeregister", + requestType: FlashContainerDeregisterRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + flashContainerList: { + name: "FlashContainerList", + requestType: FlashContainerListRequest, + requestStream: false, + responseType: FlashContainerListResponse, + responseStream: false, + options: {} + }, + flashContainerRegister: { + name: "FlashContainerRegister", + requestType: FlashContainerRegisterRequest, + requestStream: false, + responseType: FlashContainerRegisterResponse, + responseStream: false, + options: {} + }, + flashSetTargetSlotsMetrics: { + name: "FlashSetTargetSlotsMetrics", + requestType: FlashSetTargetSlotsMetricsRequest, + requestStream: false, + responseType: FlashSetTargetSlotsMetricsResponse, + responseStream: false, + options: {} + }, + /** Functions */ + functionAsyncInvoke: { + name: "FunctionAsyncInvoke", + requestType: FunctionAsyncInvokeRequest, + requestStream: false, + responseType: FunctionAsyncInvokeResponse, + responseStream: false, + options: {} + }, + functionBindParams: { + name: "FunctionBindParams", + requestType: FunctionBindParamsRequest, + requestStream: false, + responseType: FunctionBindParamsResponse, + responseStream: false, + options: {} + }, + functionCallCancel: { + name: "FunctionCallCancel", + requestType: FunctionCallCancelRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionCallFromId: { + name: "FunctionCallFromId", + requestType: FunctionCallFromIdRequest, + requestStream: false, + responseType: FunctionCallFromIdResponse, + responseStream: false, + options: {} + }, + functionCallGetDataIn: { + name: "FunctionCallGetDataIn", + requestType: FunctionCallGetDataRequest, + requestStream: false, + responseType: DataChunk, + responseStream: true, + options: {} + }, + functionCallGetDataOut: { + name: "FunctionCallGetDataOut", + requestType: FunctionCallGetDataRequest, + requestStream: false, + responseType: DataChunk, + responseStream: true, + options: {} + }, + functionCallList: { + name: "FunctionCallList", + requestType: FunctionCallListRequest, + requestStream: false, + responseType: FunctionCallListResponse, + responseStream: false, + options: {} + }, + functionCallPutDataOut: { + name: "FunctionCallPutDataOut", + requestType: FunctionCallPutDataRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionCreate: { + name: "FunctionCreate", + requestType: FunctionCreateRequest, + requestStream: false, + responseType: FunctionCreateResponse, + responseStream: false, + options: {} + }, + /** For map RPCs, to signal that all inputs have been sent */ + functionFinishInputs: { + name: "FunctionFinishInputs", + requestType: FunctionFinishInputsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionGet: { + name: "FunctionGet", + requestType: FunctionGetRequest, + requestStream: false, + responseType: FunctionGetResponse, + responseStream: false, + options: {} + }, + functionGetCallGraph: { + name: "FunctionGetCallGraph", + requestType: FunctionGetCallGraphRequest, + requestStream: false, + responseType: FunctionGetCallGraphResponse, + responseStream: false, + options: {} + }, + functionGetCurrentStats: { + name: "FunctionGetCurrentStats", + requestType: FunctionGetCurrentStatsRequest, + requestStream: false, + responseType: FunctionStats, + responseStream: false, + options: {} + }, + functionGetDynamicConcurrency: { + name: "FunctionGetDynamicConcurrency", + requestType: FunctionGetDynamicConcurrencyRequest, + requestStream: false, + responseType: FunctionGetDynamicConcurrencyResponse, + responseStream: false, + options: {} + }, + /** For containers to request next call */ + functionGetInputs: { + name: "FunctionGetInputs", + requestType: FunctionGetInputsRequest, + requestStream: false, + responseType: FunctionGetInputsResponse, + responseStream: false, + options: {} + }, + /** Returns the next result(s) for an entire function call (FunctionMap) */ + functionGetOutputs: { + name: "FunctionGetOutputs", + requestType: FunctionGetOutputsRequest, + requestStream: false, + responseType: FunctionGetOutputsResponse, + responseStream: false, + options: {} + }, + functionGetSerialized: { + name: "FunctionGetSerialized", + requestType: FunctionGetSerializedRequest, + requestStream: false, + responseType: FunctionGetSerializedResponse, + responseStream: false, + options: {} + }, + functionMap: { + name: "FunctionMap", + requestType: FunctionMapRequest, + requestStream: false, + responseType: FunctionMapResponse, + responseStream: false, + options: {} + }, + functionPrecreate: { + name: "FunctionPrecreate", + requestType: FunctionPrecreateRequest, + requestStream: false, + responseType: FunctionPrecreateResponse, + responseStream: false, + options: {} + }, + functionPutInputs: { + name: "FunctionPutInputs", + requestType: FunctionPutInputsRequest, + requestStream: false, + responseType: FunctionPutInputsResponse, + responseStream: false, + options: {} + }, + /** For containers to return result */ + functionPutOutputs: { + name: "FunctionPutOutputs", + requestType: FunctionPutOutputsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionRetryInputs: { + name: "FunctionRetryInputs", + requestType: FunctionRetryInputsRequest, + requestStream: false, + responseType: FunctionRetryInputsResponse, + responseStream: false, + options: {} + }, + functionStartPtyShell: { + name: "FunctionStartPtyShell", + requestType: Empty, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionUpdateSchedulingParams: { + name: "FunctionUpdateSchedulingParams", + requestType: FunctionUpdateSchedulingParamsRequest, + requestStream: false, + responseType: FunctionUpdateSchedulingParamsResponse, + responseStream: false, + options: {} + }, + /** Images */ + imageDelete: { + name: "ImageDelete", + requestType: ImageDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + imageFromId: { + name: "ImageFromId", + requestType: ImageFromIdRequest, + requestStream: false, + responseType: ImageFromIdResponse, + responseStream: false, + options: {} + }, + imageGetOrCreate: { + name: "ImageGetOrCreate", + requestType: ImageGetOrCreateRequest, + requestStream: false, + responseType: ImageGetOrCreateResponse, + responseStream: false, + options: {} + }, + imageJoinStreaming: { + name: "ImageJoinStreaming", + requestType: ImageJoinStreamingRequest, + requestStream: false, + responseType: ImageJoinStreamingResponse, + responseStream: true, + options: {} + }, + /** Input Plane Map */ + mapAwait: { + name: "MapAwait", + requestType: MapAwaitRequest, + requestStream: false, + responseType: MapAwaitResponse, + responseStream: false, + options: {} + }, + mapCheckInputs: { + name: "MapCheckInputs", + requestType: MapCheckInputsRequest, + requestStream: false, + responseType: MapCheckInputsResponse, + responseStream: false, + options: {} + }, + mapStartOrContinue: { + name: "MapStartOrContinue", + requestType: MapStartOrContinueRequest, + requestStream: false, + responseType: MapStartOrContinueResponse, + responseStream: false, + options: {} + }, + /** Mounts */ + mountGetOrCreate: { + name: "MountGetOrCreate", + requestType: MountGetOrCreateRequest, + requestStream: false, + responseType: MountGetOrCreateResponse, + responseStream: false, + options: {} + }, + mountPutFile: { + name: "MountPutFile", + requestType: MountPutFileRequest, + requestStream: false, + responseType: MountPutFileResponse, + responseStream: false, + options: {} + }, + /** Notebooks */ + notebookKernelPublishResults: { + name: "NotebookKernelPublishResults", + requestType: NotebookKernelPublishResultsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Proxies */ + proxyAddIp: { + name: "ProxyAddIp", + requestType: ProxyAddIpRequest, + requestStream: false, + responseType: ProxyAddIpResponse, + responseStream: false, + options: {} + }, + proxyCreate: { + name: "ProxyCreate", + requestType: ProxyCreateRequest, + requestStream: false, + responseType: ProxyCreateResponse, + responseStream: false, + options: {} + }, + proxyDelete: { + name: "ProxyDelete", + requestType: ProxyDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + proxyGet: { + name: "ProxyGet", + requestType: ProxyGetRequest, + requestStream: false, + responseType: ProxyGetResponse, + responseStream: false, + options: {} + }, + proxyGetOrCreate: { + name: "ProxyGetOrCreate", + requestType: ProxyGetOrCreateRequest, + requestStream: false, + responseType: ProxyGetOrCreateResponse, + responseStream: false, + options: {} + }, + proxyList: { + name: "ProxyList", + requestType: Empty, + requestStream: false, + responseType: ProxyListResponse, + responseStream: false, + options: {} + }, + proxyRemoveIp: { + name: "ProxyRemoveIp", + requestType: ProxyRemoveIpRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Queues */ + queueClear: { + name: "QueueClear", + requestType: QueueClearRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueDelete: { + name: "QueueDelete", + requestType: QueueDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueGet: { + name: "QueueGet", + requestType: QueueGetRequest, + requestStream: false, + responseType: QueueGetResponse, + responseStream: false, + options: {} + }, + queueGetOrCreate: { + name: "QueueGetOrCreate", + requestType: QueueGetOrCreateRequest, + requestStream: false, + responseType: QueueGetOrCreateResponse, + responseStream: false, + options: {} + }, + queueHeartbeat: { + name: "QueueHeartbeat", + requestType: QueueHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueLen: { + name: "QueueLen", + requestType: QueueLenRequest, + requestStream: false, + responseType: QueueLenResponse, + responseStream: false, + options: {} + }, + queueList: { + name: "QueueList", + requestType: QueueListRequest, + requestStream: false, + responseType: QueueListResponse, + responseStream: false, + options: {} + }, + queueNextItems: { + name: "QueueNextItems", + requestType: QueueNextItemsRequest, + requestStream: false, + responseType: QueueNextItemsResponse, + responseStream: false, + options: {} + }, + queuePut: { + name: "QueuePut", + requestType: QueuePutRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Sandboxes */ + sandboxCreate: { + name: "SandboxCreate", + requestType: SandboxCreateRequest, + requestStream: false, + responseType: SandboxCreateResponse, + responseStream: false, + options: {} + }, + sandboxCreateConnectToken: { + name: "SandboxCreateConnectToken", + requestType: SandboxCreateConnectTokenRequest, + requestStream: false, + responseType: SandboxCreateConnectTokenResponse, + responseStream: false, + options: {} + }, + sandboxGetCommandRouterAccess: { + name: "SandboxGetCommandRouterAccess", + requestType: SandboxGetCommandRouterAccessRequest, + requestStream: false, + responseType: SandboxGetCommandRouterAccessResponse, + responseStream: false, + options: {} + }, + sandboxGetFromName: { + name: "SandboxGetFromName", + requestType: SandboxGetFromNameRequest, + requestStream: false, + responseType: SandboxGetFromNameResponse, + responseStream: false, + options: {} + }, + sandboxGetLogs: { + name: "SandboxGetLogs", + requestType: SandboxGetLogsRequest, + requestStream: false, + responseType: TaskLogsBatch, + responseStream: true, + options: {} + }, + sandboxGetResourceUsage: { + name: "SandboxGetResourceUsage", + requestType: SandboxGetResourceUsageRequest, + requestStream: false, + responseType: SandboxGetResourceUsageResponse, + responseStream: false, + options: {} + }, + /** needed for modal container exec */ + sandboxGetTaskId: { + name: "SandboxGetTaskId", + requestType: SandboxGetTaskIdRequest, + requestStream: false, + responseType: SandboxGetTaskIdResponse, + responseStream: false, + options: {} + }, + sandboxGetTunnels: { + name: "SandboxGetTunnels", + requestType: SandboxGetTunnelsRequest, + requestStream: false, + responseType: SandboxGetTunnelsResponse, + responseStream: false, + options: {} + }, + sandboxList: { + name: "SandboxList", + requestType: SandboxListRequest, + requestStream: false, + responseType: SandboxListResponse, + responseStream: false, + options: {} + }, + sandboxRestore: { + name: "SandboxRestore", + requestType: SandboxRestoreRequest, + requestStream: false, + responseType: SandboxRestoreResponse, + responseStream: false, + options: {} + }, + sandboxSnapshot: { + name: "SandboxSnapshot", + requestType: SandboxSnapshotRequest, + requestStream: false, + responseType: SandboxSnapshotResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFs: { + name: "SandboxSnapshotFs", + requestType: SandboxSnapshotFsRequest, + requestStream: false, + responseType: SandboxSnapshotFsResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFsAsync: { + name: "SandboxSnapshotFsAsync", + requestType: SandboxSnapshotFsAsyncRequest, + requestStream: false, + responseType: SandboxSnapshotFsAsyncResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFsAsyncGet: { + name: "SandboxSnapshotFsAsyncGet", + requestType: SandboxSnapshotFsAsyncGetRequest, + requestStream: false, + responseType: SandboxSnapshotFsResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotGet: { + name: "SandboxSnapshotGet", + requestType: SandboxSnapshotGetRequest, + requestStream: false, + responseType: SandboxSnapshotGetResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotWait: { + name: "SandboxSnapshotWait", + requestType: SandboxSnapshotWaitRequest, + requestStream: false, + responseType: SandboxSnapshotWaitResponse, + responseStream: false, + options: {} + }, + sandboxStdinWrite: { + name: "SandboxStdinWrite", + requestType: SandboxStdinWriteRequest, + requestStream: false, + responseType: SandboxStdinWriteResponse, + responseStream: false, + options: {} + }, + sandboxTagsGet: { + name: "SandboxTagsGet", + requestType: SandboxTagsGetRequest, + requestStream: false, + responseType: SandboxTagsGetResponse, + responseStream: false, + options: {} + }, + sandboxTagsSet: { + name: "SandboxTagsSet", + requestType: SandboxTagsSetRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sandboxTerminate: { + name: "SandboxTerminate", + requestType: SandboxTerminateRequest, + requestStream: false, + responseType: SandboxTerminateResponse, + responseStream: false, + options: {} + }, + sandboxWait: { + name: "SandboxWait", + requestType: SandboxWaitRequest, + requestStream: false, + responseType: SandboxWaitResponse, + responseStream: false, + options: {} + }, + /** Secrets */ + secretDelete: { + name: "SecretDelete", + requestType: SecretDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + secretGetOrCreate: { + name: "SecretGetOrCreate", + requestType: SecretGetOrCreateRequest, + requestStream: false, + responseType: SecretGetOrCreateResponse, + responseStream: false, + options: {} + }, + secretList: { + name: "SecretList", + requestType: SecretListRequest, + requestStream: false, + responseType: SecretListResponse, + responseStream: false, + options: {} + }, + /** SharedVolumes */ + sharedVolumeDelete: { + name: "SharedVolumeDelete", + requestType: SharedVolumeDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sharedVolumeGetFile: { + name: "SharedVolumeGetFile", + requestType: SharedVolumeGetFileRequest, + requestStream: false, + responseType: SharedVolumeGetFileResponse, + responseStream: false, + options: {} + }, + sharedVolumeGetOrCreate: { + name: "SharedVolumeGetOrCreate", + requestType: SharedVolumeGetOrCreateRequest, + requestStream: false, + responseType: SharedVolumeGetOrCreateResponse, + responseStream: false, + options: {} + }, + sharedVolumeHeartbeat: { + name: "SharedVolumeHeartbeat", + requestType: SharedVolumeHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sharedVolumeList: { + name: "SharedVolumeList", + requestType: SharedVolumeListRequest, + requestStream: false, + responseType: SharedVolumeListResponse, + responseStream: false, + options: {} + }, + sharedVolumeListFiles: { + name: "SharedVolumeListFiles", + requestType: SharedVolumeListFilesRequest, + requestStream: false, + responseType: SharedVolumeListFilesResponse, + responseStream: false, + options: {} + }, + sharedVolumeListFilesStream: { + name: "SharedVolumeListFilesStream", + requestType: SharedVolumeListFilesRequest, + requestStream: false, + responseType: SharedVolumeListFilesResponse, + responseStream: true, + options: {} + }, + sharedVolumePutFile: { + name: "SharedVolumePutFile", + requestType: SharedVolumePutFileRequest, + requestStream: false, + responseType: SharedVolumePutFileResponse, + responseStream: false, + options: {} + }, + sharedVolumeRemoveFile: { + name: "SharedVolumeRemoveFile", + requestType: SharedVolumeRemoveFileRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Tasks */ + taskClusterHello: { + name: "TaskClusterHello", + requestType: TaskClusterHelloRequest, + requestStream: false, + responseType: TaskClusterHelloResponse, + responseStream: false, + options: {} + }, + taskCurrentInputs: { + name: "TaskCurrentInputs", + requestType: Empty, + requestStream: false, + responseType: TaskCurrentInputsResponse, + responseStream: false, + options: {} + }, + /** Used for flash autoscaling */ + taskGetAutoscalingMetrics: { + name: "TaskGetAutoscalingMetrics", + requestType: TaskGetAutoscalingMetricsRequest, + requestStream: false, + responseType: TaskGetAutoscalingMetricsResponse, + responseStream: false, + options: {} + }, + taskGetCommandRouterAccess: { + name: "TaskGetCommandRouterAccess", + requestType: TaskGetCommandRouterAccessRequest, + requestStream: false, + responseType: TaskGetCommandRouterAccessResponse, + responseStream: false, + options: {} + }, + taskList: { + name: "TaskList", + requestType: TaskListRequest, + requestStream: false, + responseType: TaskListResponse, + responseStream: false, + options: {} + }, + taskResult: { + name: "TaskResult", + requestType: TaskResultRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Tokens (web auth flow) */ + tokenFlowCreate: { + name: "TokenFlowCreate", + requestType: TokenFlowCreateRequest, + requestStream: false, + responseType: TokenFlowCreateResponse, + responseStream: false, + options: {} + }, + tokenFlowWait: { + name: "TokenFlowWait", + requestType: TokenFlowWaitRequest, + requestStream: false, + responseType: TokenFlowWaitResponse, + responseStream: false, + options: {} + }, + /** Tunnels */ + tunnelStart: { + name: "TunnelStart", + requestType: TunnelStartRequest, + requestStream: false, + responseType: TunnelStartResponse, + responseStream: false, + options: {} + }, + tunnelStop: { + name: "TunnelStop", + requestType: TunnelStopRequest, + requestStream: false, + responseType: TunnelStopResponse, + responseStream: false, + options: {} + }, + /** Volumes */ + volumeCommit: { + name: "VolumeCommit", + requestType: VolumeCommitRequest, + requestStream: false, + responseType: VolumeCommitResponse, + responseStream: false, + options: {} + }, + volumeCopyFiles: { + name: "VolumeCopyFiles", + requestType: VolumeCopyFilesRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeCopyFiles2: { + name: "VolumeCopyFiles2", + requestType: VolumeCopyFiles2Request, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeDelete: { + name: "VolumeDelete", + requestType: VolumeDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeGetFile: { + name: "VolumeGetFile", + requestType: VolumeGetFileRequest, + requestStream: false, + responseType: VolumeGetFileResponse, + responseStream: false, + options: {} + }, + volumeGetFile2: { + name: "VolumeGetFile2", + requestType: VolumeGetFile2Request, + requestStream: false, + responseType: VolumeGetFile2Response, + responseStream: false, + options: {} + }, + volumeGetOrCreate: { + name: "VolumeGetOrCreate", + requestType: VolumeGetOrCreateRequest, + requestStream: false, + responseType: VolumeGetOrCreateResponse, + responseStream: false, + options: {} + }, + volumeHeartbeat: { + name: "VolumeHeartbeat", + requestType: VolumeHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeList: { + name: "VolumeList", + requestType: VolumeListRequest, + requestStream: false, + responseType: VolumeListResponse, + responseStream: false, + options: {} + }, + volumeListFiles: { + name: "VolumeListFiles", + requestType: VolumeListFilesRequest, + requestStream: false, + responseType: VolumeListFilesResponse, + responseStream: true, + options: {} + }, + volumeListFiles2: { + name: "VolumeListFiles2", + requestType: VolumeListFiles2Request, + requestStream: false, + responseType: VolumeListFiles2Response, + responseStream: true, + options: {} + }, + volumePutFiles: { + name: "VolumePutFiles", + requestType: VolumePutFilesRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumePutFiles2: { + name: "VolumePutFiles2", + requestType: VolumePutFiles2Request, + requestStream: false, + responseType: VolumePutFiles2Response, + responseStream: false, + options: {} + }, + volumeReload: { + name: "VolumeReload", + requestType: VolumeReloadRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRemoveFile: { + name: "VolumeRemoveFile", + requestType: VolumeRemoveFileRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRemoveFile2: { + name: "VolumeRemoveFile2", + requestType: VolumeRemoveFile2Request, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRename: { + name: "VolumeRename", + requestType: VolumeRenameRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Workspaces */ + workspaceBillingReport: { + name: "WorkspaceBillingReport", + requestType: WorkspaceBillingReportRequest, + requestStream: false, + responseType: WorkspaceBillingReportItem, + responseStream: true, + options: {} + }, + workspaceNameLookup: { + name: "WorkspaceNameLookup", + requestType: Empty, + requestStream: false, + responseType: WorkspaceNameLookupResponse, + responseStream: false, + options: {} + } + } +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1e3); + const nanos = date.getTime() % 1e3 * 1e6; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1e3; + millis += (t.nanos || 0) / 1e6; + return new globalThis.Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function longToNumber2(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isObject2(value) { + return typeof value === "object" && value !== null; +} +function isSet4(value) { + return value !== null && value !== void 0; +} + +// src/client.ts +var import_uuid = require("uuid"); +var import_nice_grpc10 = require("nice-grpc"); + +// src/cloud_bucket_mount.ts +var CloudBucketMountService = class { + #client; + constructor(client2) { + this.#client = client2; + } + create(bucketName, params = {}) { + let bucketType = 1 /* S3 */; + if (params.bucketEndpointUrl) { + const url = new URL(params.bucketEndpointUrl); + if (url.hostname.endsWith("r2.cloudflarestorage.com")) { + bucketType = 2 /* R2 */; + } else if (url.hostname.endsWith("storage.googleapis.com")) { + bucketType = 3 /* GCP */; + } else { + bucketType = 1 /* S3 */; + this.#client.logger.debug( + "CloudBucketMount received unrecognized bucket endpoint URL. Assuming AWS S3 configuration as fallback.", + "bucketEndpointUrl", + params.bucketEndpointUrl + ); + } + } + if (params.requesterPays && !params.secret) { + throw new Error("Credentials required in order to use Requester Pays."); + } + if (params.keyPrefix && !params.keyPrefix.endsWith("/")) { + throw new Error( + "keyPrefix will be prefixed to all object paths, so it must end in a '/'" + ); + } + return new CloudBucketMount2( + bucketName, + params.secret, + params.readOnly ?? false, + params.requesterPays ?? false, + params.bucketEndpointUrl, + params.keyPrefix, + params.oidcAuthRoleArn, + bucketType + ); + } +}; +var CloudBucketMount2 = class { + bucketName; + secret; + readOnly; + requesterPays; + bucketEndpointUrl; + keyPrefix; + oidcAuthRoleArn; + #bucketType; + constructor(bucketName, secretOrParams, readOnly, requesterPays, bucketEndpointUrl, keyPrefix, oidcAuthRoleArn, bucketType) { + if (bucketType !== void 0) { + this.bucketName = bucketName; + this.secret = secretOrParams; + this.readOnly = readOnly; + this.requesterPays = requesterPays; + this.bucketEndpointUrl = bucketEndpointUrl; + this.keyPrefix = keyPrefix; + this.oidcAuthRoleArn = oidcAuthRoleArn; + this.#bucketType = bucketType; + } else { + const params = secretOrParams === void 0 ? {} : secretOrParams; + return getDefaultClient().cloudBucketMounts.create(bucketName, params); + } + } + /** @ignore */ + toProto(mountPath) { + return { + bucketName: this.bucketName, + mountPath, + credentialsSecretId: this.secret?.secretId ?? "", + readOnly: this.readOnly, + bucketType: this.#bucketType, + requesterPays: this.requesterPays, + bucketEndpointUrl: this.bucketEndpointUrl, + keyPrefix: this.keyPrefix, + oidcAuthRoleArn: this.oidcAuthRoleArn + }; + } +}; + +// src/cls.ts +var import_nice_grpc3 = require("nice-grpc"); + +// src/errors.ts +var FunctionTimeoutError = class extends Error { + constructor(message) { + super(message); + this.name = "FunctionTimeoutError"; + } +}; +var RemoteError = class extends Error { + constructor(message) { + super(message); + this.name = "RemoteError"; + } +}; +var InternalFailure = class extends Error { + constructor(message) { + super(message); + this.name = "InternalFailure"; + } +}; +var NotFoundError = class extends Error { + constructor(message) { + super(message); + this.name = "NotFoundError"; + } +}; +var AlreadyExistsError = class extends Error { + constructor(message) { + super(message); + this.name = "AlreadyExistsError"; + } +}; +var InvalidError = class extends Error { + constructor(message) { + super(message); + this.name = "InvalidError"; + } +}; +var QueueEmptyError = class extends Error { + constructor(message) { + super(message); + this.name = "QueueEmptyError"; + } +}; +var QueueFullError = class extends Error { + constructor(message) { + super(message); + this.name = "QueueFullError"; + } +}; +var SandboxFilesystemError = class extends Error { + constructor(message) { + super(message); + this.name = "SandboxFilesystemError"; + } +}; +var SandboxTimeoutError = class extends Error { + constructor(message = "Sandbox operation timed out") { + super(message); + this.name = "SandboxTimeoutError"; + } +}; + +// src/function.ts +var import_node_crypto = require("crypto"); + +// src/serialization.ts +var import_cbor_x = require("cbor-x"); +var encoderOptions = { + mapsAsObjects: true, + useRecords: false, + tagUint8Array: false, + useTag259ForMaps: false +}; +var decoderOptions = { + mapsAsObjects: true, + useRecords: false, + tagUint8Array: false, + useTag259ForMaps: false +}; +var encoder = new import_cbor_x.Encoder(encoderOptions); +var decoder = new import_cbor_x.Decoder(decoderOptions); +function cborEncode(value) { + return encoder.encode(value); +} +function cborDecode(data) { + return decoder.decode(data); +} + +// src/invocation.ts +var outputsTimeoutMs = 55 * 1e3; +var ControlPlaneInvocation = class _ControlPlaneInvocation { + cpClient; + functionCallId; + input; + functionCallJwt; + inputJwt; + constructor(cpClient, functionCallId, input, functionCallJwt, inputJwt) { + this.cpClient = cpClient; + this.functionCallId = functionCallId; + this.input = input; + this.functionCallJwt = functionCallJwt; + this.inputJwt = inputJwt; + } + static async create(client2, functionId, input, invocationType) { + const functionPutInputsItem = FunctionPutInputsItem.create({ + idx: 0, + input + }); + const functionMapResponse = await client2.cpClient.functionMap({ + functionId, + functionCallType: 1 /* FUNCTION_CALL_TYPE_UNARY */, + functionCallInvocationType: invocationType, + pipelinedInputs: [functionPutInputsItem] + }); + return new _ControlPlaneInvocation( + client2.cpClient, + functionMapResponse.functionCallId, + input, + functionMapResponse.functionCallJwt, + functionMapResponse.pipelinedInputs[0].inputJwt + ); + } + static fromFunctionCallId(client2, functionCallId) { + return new _ControlPlaneInvocation(client2.cpClient, functionCallId); + } + async awaitOutput(timeoutMs) { + return await pollFunctionOutput( + this.cpClient, + (timeoutMs2) => this.#getOutput(timeoutMs2), + timeoutMs + ); + } + async #getOutput(timeoutMs) { + const response = await this.cpClient.functionGetOutputs({ + functionCallId: this.functionCallId, + maxValues: 1, + timeout: timeoutMs / 1e3, + lastEntryId: "0-0", + clearOnSuccess: true, + requestedAt: timeNowSeconds() + }); + return response.outputs ? response.outputs[0] : void 0; + } + async retry(retryCount) { + if (!this.input) { + throw new Error("Cannot retry Function invocation - input missing"); + } + const retryItem = { + inputJwt: this.inputJwt, + input: this.input, + retryCount + }; + const functionRetryResponse = await this.cpClient.functionRetryInputs({ + functionCallJwt: this.functionCallJwt, + inputs: [retryItem] + }); + this.inputJwt = functionRetryResponse.inputJwts[0]; + } +}; +var InputPlaneInvocation = class _InputPlaneInvocation { + cpClient; + ipClient; + functionId; + input; + attemptToken; + constructor(cpClient, ipClient, functionId, input, attemptToken) { + this.cpClient = cpClient; + this.ipClient = ipClient; + this.functionId = functionId; + this.input = input; + this.attemptToken = attemptToken; + } + static async create(client2, inputPlaneUrl, functionId, input) { + const functionPutInputsItem = FunctionPutInputsItem.create({ + idx: 0, + input + }); + const ipClient = client2.ipClient(inputPlaneUrl); + const attemptStartResponse = await ipClient.attemptStart({ + functionId, + input: functionPutInputsItem + }); + return new _InputPlaneInvocation( + client2.cpClient, + ipClient, + functionId, + functionPutInputsItem, + attemptStartResponse.attemptToken + ); + } + async awaitOutput(timeoutMs) { + return await pollFunctionOutput( + this.cpClient, + (timeoutMs2) => this.#getOutput(timeoutMs2), + timeoutMs + ); + } + async #getOutput(timeoutMs) { + const response = await this.ipClient.attemptAwait({ + attemptToken: this.attemptToken, + requestedAt: timeNowSeconds(), + timeoutSecs: timeoutMs / 1e3 + }); + return response.output; + } + async retry(_retryCount) { + const attemptRetryResponse = await this.ipClient.attemptRetry({ + functionId: this.functionId, + input: this.input, + attemptToken: this.attemptToken + }); + this.attemptToken = attemptRetryResponse.attemptToken; + } +}; +function timeNowSeconds() { + return Date.now() / 1e3; +} +async function pollFunctionOutput(cpClient, getOutput, timeoutMs) { + const startTime = Date.now(); + let pollTimeoutMs = outputsTimeoutMs; + if (timeoutMs !== void 0) { + pollTimeoutMs = Math.min(timeoutMs, outputsTimeoutMs); + } + while (true) { + const output = await getOutput(pollTimeoutMs); + if (output) { + return await processResult(cpClient, output.result, output.dataFormat); + } + if (timeoutMs !== void 0) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Timeout exceeded: ${timeoutMs}ms`; + throw new FunctionTimeoutError(message); + } + pollTimeoutMs = Math.min(outputsTimeoutMs, remainingMs); + } + } +} +async function processResult(cpClient, result, dataFormat) { + if (!result) { + throw new Error("Received null result from invocation"); + } + let data = new Uint8Array(); + if (result.data !== void 0) { + data = result.data; + } else if (result.dataBlobId) { + data = await blobDownload(cpClient, result.dataBlobId); + } + switch (result.status) { + case 4 /* GENERIC_STATUS_TIMEOUT */: + throw new FunctionTimeoutError(`Timeout: ${result.exception}`); + case 6 /* GENERIC_STATUS_INTERNAL_FAILURE */: + throw new InternalFailure(`Internal failure: ${result.exception}`); + case 1 /* GENERIC_STATUS_SUCCESS */: + break; + default: + throw new RemoteError(`Remote error: ${result.exception}`); + } + return deserializeDataFormat(data, dataFormat); +} +async function blobDownload(cpClient, blobId) { + const resp = await cpClient.blobGet({ blobId }); + const s3resp = await fetch(resp.downloadUrl); + if (!s3resp.ok) { + throw new Error(`Failed to download blob: ${s3resp.statusText}`); + } + const buf = await s3resp.arrayBuffer(); + return new Uint8Array(buf); +} +function deserializeDataFormat(data, dataFormat) { + if (!data) { + return null; + } + switch (dataFormat) { + case 1 /* DATA_FORMAT_PICKLE */: + throw new Error( + "PICKLE output format is not supported - remote function must return CBOR format" + ); + case 4 /* DATA_FORMAT_CBOR */: + return cborDecode(data); + case 2 /* DATA_FORMAT_ASGI */: + throw new Error("ASGI data format is not supported in modal-js"); + case 3 /* DATA_FORMAT_GENERATOR_DONE */: + return GeneratorDone.decode(data); + default: + throw new Error(`Unsupported data format: ${dataFormat}`); + } +} + +// src/validation.ts +function checkForRenamedParams(params, renames) { + if (!params) return; + for (const [oldName, newName] of Object.entries(renames)) { + if (oldName in params) { + throw new Error( + `Parameter '${oldName}' has been renamed to '${newName}'.` + ); + } + } +} + +// src/function_call.ts +var FunctionCallService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a new {@link FunctionCall} from ID. + */ + async fromId(functionCallId) { + return new FunctionCall(this.#client, functionCallId); + } +}; +var FunctionCall = class _FunctionCall { + functionCallId; + #client; + /** @ignore */ + constructor(client2, functionCallId) { + this.#client = client2; + this.functionCallId = functionCallId; + } + /** + * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead. + */ + static fromId(functionCallId) { + return new _FunctionCall(void 0, functionCallId); + } + /** Get the result of a FunctionCall, optionally waiting with a timeout. */ + async get(params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const invocation = ControlPlaneInvocation.fromFunctionCallId( + this.#client || getDefaultClient(), + this.functionCallId + ); + return invocation.awaitOutput(params.timeoutMs); + } + /** Cancel a running FunctionCall. */ + async cancel(params = {}) { + const cpClient = this.#client?.cpClient || getDefaultClient().cpClient; + await cpClient.functionCallCancel({ + functionCallId: this.functionCallId, + terminateContainers: params.terminateContainers + }); + } +}; + +// src/function.ts +var import_nice_grpc = require("nice-grpc"); +var maxObjectSizeBytes = 2 * 1024 * 1024; +var maxSystemRetries = 8; +var FunctionService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Function_ Function} by its name in an App. + */ + async fromName(appName, name, params = {}) { + if (name.includes(".")) { + const [clsName, methodName] = name.split(".", 2); + throw new Error( + `Cannot retrieve Cls methods using 'functions.fromName()'. Use: + const cls = await client.cls.fromName("${appName}", "${clsName}"); + const instance = await cls.instance(); + const m = instance.method("${methodName}");` + ); + } + try { + const resp = await this.#client.cpClient.functionGet({ + appName, + objectTag: name, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Retrieved Function", + "function_id", + resp.functionId, + "app_name", + appName, + "function_name", + name + ); + return new Function_( + this.#client, + resp.functionId, + void 0, + resp.handleMetadata + ); + } catch (err) { + if (err instanceof import_nice_grpc.ClientError && err.code === import_nice_grpc.Status.NOT_FOUND) + throw new NotFoundError(`Function '${appName}/${name}' not found`); + throw err; + } + } +}; +var Function_ = class { + functionId; + methodName; + #client; + #handleMetadata; + /** @ignore */ + constructor(client2, functionId, methodName, functionHandleMetadata) { + this.functionId = functionId; + this.methodName = methodName; + this.#client = client2; + this.#handleMetadata = functionHandleMetadata; + } + /** + * @deprecated Use `client.functions.fromName()` instead. + */ + static async lookup(appName, name, params = {}) { + return await getDefaultClient().functions.fromName(appName, name, params); + } + #checkNoWebUrl(fnName) { + if (this.#handleMetadata?.webUrl) { + throw new InvalidError( + `A webhook Function cannot be invoked for remote execution with '.${fnName}'. Invoke this Function via its web url '${this.#handleMetadata.webUrl}' instead.` + ); + } + } + // Execute a single input into a remote Function. + async remote(args = [], kwargs = {}) { + this.#client.logger.debug( + "Executing function call", + "function_id", + this.functionId + ); + this.#checkNoWebUrl("remote"); + const input = await this.#createInput(args, kwargs); + const invocation = await this.#createRemoteInvocation(input); + let retryCount = 0; + while (true) { + try { + const result = await invocation.awaitOutput(); + this.#client.logger.debug( + "Function call completed", + "function_id", + this.functionId + ); + return result; + } catch (err) { + if (err instanceof InternalFailure && retryCount <= maxSystemRetries) { + this.#client.logger.debug( + "Retrying function call due to internal failure", + "function_id", + this.functionId, + "retry_count", + retryCount + ); + await invocation.retry(retryCount); + retryCount++; + } else { + throw err; + } + } + } + } + async #createRemoteInvocation(input) { + if (this.#handleMetadata?.inputPlaneUrl) { + return await InputPlaneInvocation.create( + this.#client, + this.#handleMetadata.inputPlaneUrl, + this.functionId, + input + ); + } + return await ControlPlaneInvocation.create( + this.#client, + this.functionId, + input, + 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */ + ); + } + // Spawn a single input into a remote Function. + async spawn(args = [], kwargs = {}) { + this.#client.logger.debug( + "Spawning function call", + "function_id", + this.functionId + ); + this.#checkNoWebUrl("spawn"); + const input = await this.#createInput(args, kwargs); + const invocation = await ControlPlaneInvocation.create( + this.#client, + this.functionId, + input, + 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */ + ); + this.#client.logger.debug( + "Function call spawned", + "function_id", + this.functionId, + "function_call_id", + invocation.functionCallId + ); + return new FunctionCall(this.#client, invocation.functionCallId); + } + // Returns statistics about the Function. + async getCurrentStats() { + const resp = await this.#client.cpClient.functionGetCurrentStats( + { functionId: this.functionId }, + { timeoutMs: 1e4 } + ); + return { + backlog: resp.backlog, + numTotalRunners: resp.numTotalTasks + }; + } + // Overrides the current autoscaler behavior for this Function. + async updateAutoscaler(params) { + checkForRenamedParams(params, { scaledownWindow: "scaledownWindowMs" }); + await this.#client.cpClient.functionUpdateSchedulingParams({ + functionId: this.functionId, + warmPoolSizeOverride: 0, + // Deprecated field, always set to 0 + settings: { + minContainers: params.minContainers, + maxContainers: params.maxContainers, + bufferContainers: params.bufferContainers, + scaledownWindow: params.scaledownWindowMs !== void 0 ? Math.trunc(params.scaledownWindowMs / 1e3) : void 0 + } + }); + } + /** + * URL of a Function running as a web endpoint. + * @returns The web URL if this Function is a web endpoint, otherwise undefined + */ + async getWebUrl() { + return this.#handleMetadata?.webUrl || void 0; + } + async #createInput(args = [], kwargs = {}) { + const supported_input_formats = this.#handleMetadata?.supportedInputFormats?.length ? this.#handleMetadata.supportedInputFormats : [1 /* DATA_FORMAT_PICKLE */]; + if (!supported_input_formats.includes(4 /* DATA_FORMAT_CBOR */)) { + throw new InvalidError( + "cannot call Modal Function from JS SDK since it was deployed with an incompatible Python SDK version. Redeploy with Modal Python SDK >= 1.2" + ); + } + const payload = cborEncode([args, kwargs]); + let argsBlobId = void 0; + if (payload.length > maxObjectSizeBytes) { + argsBlobId = await blobUpload(this.#client.cpClient, payload); + } + return { + args: argsBlobId ? void 0 : payload, + argsBlobId, + dataFormat: 4 /* DATA_FORMAT_CBOR */, + methodName: this.methodName, + finalInput: false + // This field isn't specified in the Python client, so it defaults to false. + }; + } +}; +async function blobUpload(cpClient, data) { + const contentMd5 = (0, import_node_crypto.createHash)("md5").update(data).digest("base64"); + const contentSha256 = (0, import_node_crypto.createHash)("sha256").update(data).digest("base64"); + const resp = await cpClient.blobCreate({ + contentMd5, + contentSha256Base64: contentSha256, + contentLength: data.length + }); + if (resp.multipart) { + throw new Error( + "Function input size exceeds multipart upload threshold, unsupported by this SDK version" + ); + } else if (resp.uploadUrl) { + const uploadResp = await fetch(resp.uploadUrl, { + method: "PUT", + headers: { + "Content-Type": "application/octet-stream", + "Content-MD5": contentMd5 + }, + body: data + }); + if (uploadResp.status < 200 || uploadResp.status >= 300) { + throw new Error(`Failed blob upload: ${uploadResp.statusText}`); + } + return resp.blobId; + } else { + throw new Error("Missing upload URL in BlobCreate response"); + } +} + +// src/secret.ts +var import_nice_grpc2 = require("nice-grpc"); +var SecretService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** Reference a {@link Secret} by its name. */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.secretGetOrCreate({ + deploymentName: name, + environmentName: this.#client.environmentName(params?.environment), + requiredKeys: params?.requiredKeys ?? [] + }); + this.#client.logger.debug( + "Retrieved Secret", + "secret_id", + resp.secretId, + "secret_name", + name + ); + return new Secret(resp.secretId, name); + } catch (err) { + if (err instanceof import_nice_grpc2.ClientError && err.code === import_nice_grpc2.Status.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof import_nice_grpc2.ClientError && err.code === import_nice_grpc2.Status.FAILED_PRECONDITION && err.details.includes("Secret is missing key")) + throw new NotFoundError(err.details); + throw err; + } + } + /** Create a {@link Secret} from a plain object of key-value pairs. */ + async fromObject(entries, params) { + for (const [, value] of Object.entries(entries)) { + if (value == null || typeof value !== "string") { + throw new InvalidError( + "entries must be an object mapping string keys to string values, but got:\n" + JSON.stringify(entries) + ); + } + } + try { + const resp = await this.#client.cpClient.secretGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + envDict: entries, + environmentName: this.#client.environmentName(params?.environment) + }); + this.#client.logger.debug( + "Created ephemeral Secret", + "secret_id", + resp.secretId + ); + return new Secret(resp.secretId); + } catch (err) { + if (err instanceof import_nice_grpc2.ClientError && (err.code === import_nice_grpc2.Status.INVALID_ARGUMENT || err.code === import_nice_grpc2.Status.FAILED_PRECONDITION)) + throw new InvalidError(err.details); + throw err; + } + } + /** + * Delete a named {@link Secret}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Secret. + */ + async delete(name, params) { + try { + const secret = await this.fromName(name, { + environment: params?.environment + }); + await this.#client.cpClient.secretDelete({ + secretId: secret.secretId + }); + this.#client.logger.debug( + "Deleted Secret", + "secret_name", + name, + "secret_id", + secret.secretId + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } +}; +var Secret = class { + secretId; + name; + /** @ignore */ + constructor(secretId, name) { + this.secretId = secretId; + this.name = name; + } + /** + * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead. + */ + static async fromName(name, params) { + return getDefaultClient().secrets.fromName(name, params); + } + /** + * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead. + */ + static async fromObject(entries, params) { + return getDefaultClient().secrets.fromObject(entries, params); + } +}; +async function mergeEnvIntoSecrets(client2, env, secrets) { + const result = [...secrets || []]; + if (env && Object.keys(env).length > 0) { + result.push(await client2.secrets.fromObject(env)); + } + return result; +} + +// src/retries.ts +var Retries = class { + maxRetries; + backoffCoefficient; + initialDelayMs; + maxDelayMs; + constructor(params) { + const { + maxRetries, + backoffCoefficient = 2, + initialDelayMs = 1e3, + maxDelayMs = 6e4 + } = params; + if (maxRetries < 0 || maxRetries > 10) { + throw new Error( + `Invalid maxRetries: ${maxRetries}. Must be between 0 and 10.` + ); + } + if (backoffCoefficient < 1 || backoffCoefficient > 10) { + throw new Error( + `Invalid backoffCoefficient: ${backoffCoefficient}. Must be between 1.0 and 10.0` + ); + } + if (initialDelayMs < 0 || initialDelayMs > 6e4) { + throw new Error( + `Invalid initialDelayMs: ${initialDelayMs}. Must be between 0 and 60000 ms.` + ); + } + if (maxDelayMs < 1e3 || maxDelayMs > 6e4) { + throw new Error( + `Invalid maxDelayMs: ${maxDelayMs}. Must be between 1000 and 60000 ms.` + ); + } + this.maxRetries = maxRetries; + this.backoffCoefficient = backoffCoefficient; + this.initialDelayMs = initialDelayMs; + this.maxDelayMs = maxDelayMs; + } +}; +function parseRetries(retries) { + if (retries === void 0) return void 0; + if (typeof retries === "number") { + if (!Number.isInteger(retries) || retries < 0 || retries > 10) { + throw new Error( + `Retries parameter must be an integer between 0 and 10. Found: ${retries}` + ); + } + return new Retries({ + maxRetries: retries, + backoffCoefficient: 1, + initialDelayMs: 1e3 + }); + } + if (retries instanceof Retries) return retries; + throw new Error( + `Retries parameter must be an integer or instance of Retries. Found: ${typeof retries}.` + ); +} + +// src/cls.ts +var ClsService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Cls} from a deployed {@link App} by its name. + */ + async fromName(appName, name, params = {}) { + try { + const serviceFunctionName = `${name}.*`; + const serviceFunction = await this.#client.cpClient.functionGet({ + appName, + objectTag: serviceFunctionName, + environmentName: this.#client.environmentName(params.environment) + }); + const parameterInfo = serviceFunction.handleMetadata?.classParameterInfo; + const schema = parameterInfo?.schema ?? []; + if (schema.length > 0 && parameterInfo?.format !== 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */) { + throw new Error( + `Unsupported parameter format: ${parameterInfo?.format}` + ); + } + this.#client.logger.debug( + "Retrieved Cls", + "function_id", + serviceFunction.functionId, + "app_name", + appName, + "cls_name", + name + ); + return new Cls( + this.#client, + serviceFunction.functionId, + serviceFunction.handleMetadata, + void 0 + ); + } catch (err) { + if (err instanceof import_nice_grpc3.ClientError && err.code === import_nice_grpc3.Status.NOT_FOUND) + throw new NotFoundError(`Class '${appName}/${name}' not found`); + throw err; + } + } +}; +var Cls = class _Cls { + #client; + #serviceFunctionId; + #serviceFunctionMetadata; + #serviceOptions; + /** @ignore */ + constructor(client2, serviceFunctionId, serviceFunctionMetadata, options) { + this.#client = client2; + this.#serviceFunctionId = serviceFunctionId; + this.#serviceFunctionMetadata = serviceFunctionMetadata; + this.#serviceOptions = options; + } + get #schema() { + return this.#serviceFunctionMetadata.classParameterInfo?.schema ?? []; + } + /** + * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead. + */ + static async lookup(appName, name, params = {}) { + return getDefaultClient().cls.fromName(appName, name, params); + } + /** Create a new instance of the Cls with parameters and/or runtime options. */ + async instance(parameters = {}) { + let functionId; + if (this.#schema.length === 0 && this.#serviceOptions === void 0) { + functionId = this.#serviceFunctionId; + } else { + functionId = await this.#bindParameters(parameters); + } + const methods = /* @__PURE__ */ new Map(); + for (const [name, methodMetadata] of Object.entries( + this.#serviceFunctionMetadata.methodHandleMetadata + )) { + methods.set( + name, + new Function_(this.#client, functionId, name, methodMetadata) + ); + } + return new ClsInstance(methods); + } + /** Override the static Function configuration at runtime. */ + withOptions(options) { + const merged = mergeServiceOptions(this.#serviceOptions, options); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Create an instance of the Cls with input concurrency enabled or overridden with new values. */ + withConcurrency(params) { + const merged = mergeServiceOptions(this.#serviceOptions, { + maxConcurrentInputs: params.maxInputs, + targetConcurrentInputs: params.targetInputs + }); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Create an instance of the Cls with dynamic batching enabled or overridden with new values. */ + withBatching(params) { + const merged = mergeServiceOptions(this.#serviceOptions, { + batchMaxSize: params.maxBatchSize, + batchWaitMs: params.waitMs + }); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Bind parameters to the Cls function. */ + async #bindParameters(parameters) { + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + this.#serviceOptions?.env, + this.#serviceOptions?.secrets + ); + const mergedOptions = mergeServiceOptions(this.#serviceOptions, { + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }); + const serializedParams = encodeParameterSet(this.#schema, parameters); + const functionOptions = await buildFunctionOptionsProto(mergedOptions); + const bindResp = await this.#client.cpClient.functionBindParams({ + functionId: this.#serviceFunctionId, + serializedParams, + functionOptions, + environmentName: this.#client.environmentName() + }); + return bindResp.boundFunctionId; + } +}; +function encodeParameterSet(schema, params) { + const encoded = []; + for (const paramSpec of schema) { + const paramValue = encodeParameter(paramSpec, params[paramSpec.name]); + encoded.push(paramValue); + } + encoded.sort((a, b) => a.name.localeCompare(b.name)); + return ClassParameterSet.encode({ parameters: encoded }).finish(); +} +function mergeServiceOptions(base, diff) { + const filteredDiff = Object.fromEntries( + Object.entries(diff).filter(([, value]) => value !== void 0) + ); + const merged = { ...base ?? {}, ...filteredDiff }; + return Object.keys(merged).length === 0 ? void 0 : merged; +} +async function buildFunctionOptionsProto(options) { + if (!options) return void 0; + const o = options ?? {}; + checkForRenamedParams(o, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + scaledownWindow: "scaledownWindowMs", + timeout: "timeoutMs" + }); + const gpuConfig = parseGpuConfig(o.gpu); + let milliCpu = void 0; + let milliCpuMax = void 0; + if (o.cpu === void 0 && o.cpuLimit !== void 0) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (o.cpu !== void 0) { + if (o.cpu <= 0) { + throw new Error(`cpu (${o.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1e3 * o.cpu); + if (o.cpuLimit !== void 0) { + if (o.cpuLimit < o.cpu) { + throw new Error( + `cpu (${o.cpu}) cannot be higher than cpuLimit (${o.cpuLimit})` + ); + } + milliCpuMax = Math.trunc(1e3 * o.cpuLimit); + } + } + let memoryMb = void 0; + let memoryMbMax = void 0; + if (o.memoryMiB === void 0 && o.memoryLimitMiB !== void 0) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified" + ); + } + if (o.memoryMiB !== void 0) { + if (o.memoryMiB <= 0) { + throw new Error(`memoryMiB (${o.memoryMiB}) must be a positive number`); + } + memoryMb = o.memoryMiB; + if (o.memoryLimitMiB !== void 0) { + if (o.memoryLimitMiB < o.memoryMiB) { + throw new Error( + `memoryMiB (${o.memoryMiB}) cannot be higher than memoryLimitMiB (${o.memoryLimitMiB})` + ); + } + memoryMbMax = o.memoryLimitMiB; + } + } + const resources = milliCpu !== void 0 || milliCpuMax !== void 0 || memoryMb !== void 0 || memoryMbMax !== void 0 || gpuConfig ? { + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, + gpuConfig + } : void 0; + const secretIds = (o.secrets || []).map((s) => s.secretId); + const volumeMounts = o.volumes ? Object.entries(o.volumes).map(([mountPath, volume]) => ({ + volumeId: volume.volumeId, + mountPath, + allowBackgroundCommits: true, + readOnly: volume.isReadOnly + })) : []; + const parsedRetries = parseRetries(o.retries); + const retryPolicy = parsedRetries ? { + retries: parsedRetries.maxRetries, + backoffCoefficient: parsedRetries.backoffCoefficient, + initialDelayMs: parsedRetries.initialDelayMs, + maxDelayMs: parsedRetries.maxDelayMs + } : void 0; + if (o.scaledownWindowMs !== void 0 && o.scaledownWindowMs % 1e3 !== 0) { + throw new Error( + `scaledownWindowMs must be a multiple of 1000ms, got ${o.scaledownWindowMs}` + ); + } + if (o.timeoutMs !== void 0 && o.timeoutMs % 1e3 !== 0) { + throw new Error( + `timeoutMs must be a multiple of 1000ms, got ${o.timeoutMs}` + ); + } + const functionOptions = FunctionOptions.create({ + secretIds, + replaceSecretIds: secretIds.length > 0, + replaceVolumeMounts: volumeMounts.length > 0, + volumeMounts, + resources, + retryPolicy, + concurrencyLimit: o.maxContainers, + bufferContainers: o.bufferContainers, + taskIdleTimeoutSecs: o.scaledownWindowMs !== void 0 ? o.scaledownWindowMs / 1e3 : void 0, + timeoutSecs: o.timeoutMs !== void 0 ? o.timeoutMs / 1e3 : void 0, + maxConcurrentInputs: o.maxConcurrentInputs, + targetConcurrentInputs: o.targetConcurrentInputs, + batchMaxSize: o.batchMaxSize, + batchLingerMs: o.batchWaitMs + }); + return functionOptions; +} +function encodeParameter(paramSpec, value) { + const name = paramSpec.name; + const paramType = paramSpec.type; + const paramValue = { name, type: paramType }; + switch (paramType) { + case 1 /* PARAM_TYPE_STRING */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.stringDefault ?? ""; + } + if (typeof value !== "string") { + throw new Error(`Parameter '${name}' must be a string`); + } + paramValue.stringValue = value; + break; + case 2 /* PARAM_TYPE_INT */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.intDefault ?? 0; + } + if (typeof value !== "number") { + throw new Error(`Parameter '${name}' must be an integer`); + } + paramValue.intValue = value; + break; + case 9 /* PARAM_TYPE_BOOL */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.boolDefault ?? false; + } + if (typeof value !== "boolean") { + throw new Error(`Parameter '${name}' must be a boolean`); + } + paramValue.boolValue = value; + break; + case 4 /* PARAM_TYPE_BYTES */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.bytesDefault ?? new Uint8Array(); + } + if (!(value instanceof Uint8Array)) { + throw new Error(`Parameter '${name}' must be a byte array`); + } + paramValue.bytesValue = value; + break; + default: + throw new Error(`Unsupported parameter type: ${paramType}`); + } + return paramValue; +} +var ClsInstance = class { + #methods; + constructor(methods) { + this.#methods = methods; + } + method(name) { + const method = this.#methods.get(name); + if (!method) { + throw new NotFoundError(`Method '${name}' not found on class`); + } + return method; + } +}; + +// src/image.ts +var import_nice_grpc4 = require("nice-grpc"); +var import_nice_grpc5 = require("nice-grpc"); +var ImageService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Creates an {@link Image} from an Image ID + * + * @param imageId - Image ID. + */ + async fromId(imageId) { + try { + const resp = await this.#client.cpClient.imageFromId({ imageId }); + return new Image2(this.#client, resp.imageId, ""); + } catch (err) { + if (err instanceof import_nice_grpc4.ClientError && err.code === import_nice_grpc5.Status.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof import_nice_grpc4.ClientError && err.code === import_nice_grpc5.Status.FAILED_PRECONDITION && err.details.includes("Could not find image with ID")) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - Optional. A Secret containing credentials for registry authentication. + */ + fromRegistry(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromAwsEcr(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 1 /* REGISTRY_AUTH_TYPE_AWS */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromGcpArtifactRegistry(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 2 /* REGISTRY_AUTH_TYPE_GCP */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. + */ + async delete(imageId, _ = {}) { + try { + await this.#client.cpClient.imageDelete({ imageId }); + } catch (err) { + if (err instanceof import_nice_grpc4.ClientError && err.code === import_nice_grpc5.Status.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof import_nice_grpc4.ClientError && err.code === import_nice_grpc5.Status.FAILED_PRECONDITION && err.details.includes("Could not find image with ID")) + throw new NotFoundError(err.details); + throw err; + } + } +}; +var Image2 = class _Image { + #client; + #imageId; + #tag; + #imageRegistryConfig; + #layers; + /** @ignore */ + constructor(client2, imageId, tag, imageRegistryConfig, layers) { + this.#client = client2; + this.#imageId = imageId; + this.#tag = tag; + this.#imageRegistryConfig = imageRegistryConfig; + this.#layers = layers || [ + { + commands: [], + env: void 0, + secrets: void 0, + gpuConfig: void 0, + forceBuild: false + } + ]; + } + get imageId() { + return this.#imageId; + } + /** + * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead. + */ + static async fromId(imageId) { + return getDefaultClient().images.fromId(imageId); + } + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + static fromRegistry(tag, secret) { + return getDefaultClient().images.fromRegistry(tag, secret); + } + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + static fromAwsEcr(tag, secret) { + return getDefaultClient().images.fromAwsEcr(tag, secret); + } + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + static fromGcpArtifactRegistry(tag, secret) { + return getDefaultClient().images.fromGcpArtifactRegistry(tag, secret); + } + static validateDockerfileCommands(commands) { + for (const command of commands) { + const trimmed = command.trim().toUpperCase(); + if (trimmed.startsWith("COPY ") && !trimmed.startsWith("COPY --FROM=")) { + throw new InvalidError( + "COPY commands that copy from local context are not yet supported." + ); + } + } + } + /** + * Extend an image with arbitrary Dockerfile-like commands. + * + * Each call creates a new Image layer that will be built sequentially. + * The provided options apply only to this layer. + * + * @param commands - Array of Dockerfile commands as strings + * @param params - Optional configuration for this layer's build + * @returns A new Image instance + */ + dockerfileCommands(commands, params) { + if (commands.length === 0) { + return this; + } + _Image.validateDockerfileCommands(commands); + const newLayer = { + commands: [...commands], + env: params?.env, + secrets: params?.secrets, + gpuConfig: params?.gpu ? parseGpuConfig(params.gpu) : void 0, + forceBuild: params?.forceBuild + }; + return new _Image(this.#client, "", this.#tag, this.#imageRegistryConfig, [ + ...this.#layers, + newLayer + ]); + } + /** + * Eagerly builds an Image on Modal. + * + * @param app - App to use to build the Image. + */ + async build(app) { + if (this.imageId !== "") { + return this; + } + this.#client.logger.debug("Building image", "app_id", app.appId); + let baseImageId; + for (let i = 0; i < this.#layers.length; i++) { + const layer = this.#layers[i]; + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + layer.env, + layer.secrets + ); + const secretIds = mergedSecrets.map((secret) => secret.secretId); + const gpuConfig = layer.gpuConfig; + let dockerfileCommands; + let baseImages; + if (i === 0) { + dockerfileCommands = [`FROM ${this.#tag}`, ...layer.commands]; + baseImages = []; + } else { + dockerfileCommands = ["FROM base", ...layer.commands]; + baseImages = [{ dockerTag: "base", imageId: baseImageId }]; + } + const resp = await this.#client.cpClient.imageGetOrCreate({ + appId: app.appId, + image: Image.create({ + dockerfileCommands, + imageRegistryConfig: this.#imageRegistryConfig, + secretIds, + gpuConfig, + contextFiles: [], + baseImages + }), + builderVersion: this.#client.imageBuilderVersion(), + forceBuild: layer.forceBuild || false + }); + let result; + if (resp.result?.status) { + result = resp.result; + } else { + let lastEntryId = ""; + let resultJoined = void 0; + while (!resultJoined) { + for await (const item of this.#client.cpClient.imageJoinStreaming({ + imageId: resp.imageId, + timeout: 55, + lastEntryId + })) { + if (item.entryId) lastEntryId = item.entryId; + if (item.result?.status) { + resultJoined = item.result; + break; + } + } + } + result = resultJoined; + } + if (result.status === 2 /* GENERIC_STATUS_FAILURE */) { + throw new Error( + `Image build for ${resp.imageId} failed with the exception: +${result.exception}` + ); + } else if (result.status === 3 /* GENERIC_STATUS_TERMINATED */) { + throw new Error( + `Image build for ${resp.imageId} terminated due to external shut-down. Please try again.` + ); + } else if (result.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + throw new Error( + `Image build for ${resp.imageId} timed out. Please try again with a larger timeout parameter.` + ); + } else if (result.status !== 1 /* GENERIC_STATUS_SUCCESS */) { + throw new Error( + `Image build for ${resp.imageId} failed with unknown status: ${result.status}` + ); + } + baseImageId = resp.imageId; + } + this.#imageId = baseImageId; + this.#client.logger.debug("Image build completed", "image_id", baseImageId); + return this; + } + /** + * @deprecated Use {@link ImageService#delete client.images.delete()} instead. + */ + static async delete(imageId, _ = {}) { + return getDefaultClient().images.delete(imageId); + } +}; + +// src/proxy.ts +var import_nice_grpc6 = require("nice-grpc"); +var ProxyService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Proxy} by its name. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const proxy = await modal.proxies.fromName("my-proxy"); + * ``` + */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.proxyGet({ + name, + environmentName: this.#client.environmentName(params?.environment) + }); + if (!resp.proxy?.proxyId) { + throw new NotFoundError(`Proxy '${name}' not found`); + } + return new Proxy3(resp.proxy.proxyId); + } catch (err) { + if (err instanceof import_nice_grpc6.ClientError && err.code === import_nice_grpc6.Status.NOT_FOUND) + throw new NotFoundError(`Proxy '${name}' not found`); + throw err; + } + } +}; +var Proxy3 = class { + proxyId; + /** @ignore */ + constructor(proxyId) { + this.proxyId = proxyId; + } + /** + * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead. + */ + static async fromName(name, params) { + return getDefaultClient().proxies.fromName(name, params); + } +}; + +// src/pickle.ts +var PickleError = class extends Error { + constructor(message) { + super(message); + this.name = "PickleError"; + } +}; +var Writer = class { + out = []; + byte(b) { + this.out.push(b & 255); + } + bytes(arr) { + for (const b of arr) this.byte(b); + } + uint32LE(x) { + this.byte(x); + this.byte(x >>> 8); + this.byte(x >>> 16); + this.byte(x >>> 24); + } + uint64LE(n) { + let v = BigInt(n); + for (let i = 0; i < 8; i++) { + this.byte(Number(v & 0xffn)); + v >>= 8n; + } + } + float64BE(v) { + const dv = new DataView(new ArrayBuffer(8)); + dv.setFloat64(0, v, false); + this.bytes(new Uint8Array(dv.buffer)); + } + toUint8() { + return new Uint8Array(this.out); + } +}; +var Reader = class { + constructor(buf, pos = 0) { + this.buf = buf; + this.pos = pos; + } + eof() { + return this.pos >= this.buf.length; + } + byte() { + return this.buf[this.pos++]; + } + take(n) { + const s = this.buf.subarray(this.pos, this.pos + n); + this.pos += n; + return s; + } + uint32LE() { + const b0 = this.byte(), b1 = this.byte(), b2 = this.byte(), b3 = this.byte(); + return b0 | b1 << 8 | b2 << 16 | b3 << 24; + } + uint64LE() { + const lo = this.uint32LE() >>> 0; + const hi = this.uint32LE() >>> 0; + return hi * 2 ** 32 + lo; + } + int32LE() { + const v = new DataView( + this.buf.buffer, + this.buf.byteOffset + this.pos, + 4 + ).getInt32(0, true); + this.pos += 4; + return v; + } + float64BE() { + const v = new DataView( + this.buf.buffer, + this.buf.byteOffset + this.pos, + 8 + ).getFloat64(0, false); + this.pos += 8; + return v; + } +}; +function encodeValue(val, w, proto) { + if (val === null || val === void 0) { + w.byte(78 /* NONE */); + return; + } + if (typeof val === "boolean") { + w.byte(val ? 136 /* NEWTRUE */ : 137 /* NEWFALSE */); + return; + } + if (typeof val === "number") { + if (Number.isInteger(val)) { + if (val >= 0 && val <= 255) { + w.byte(75 /* BININT1 */); + w.byte(val); + } else if (val >= 0 && val <= 65535) { + w.byte(77 /* BININT2 */); + w.byte(val & 255); + w.byte(val >> 8 & 255); + } else { + w.byte(74 /* BININT4 */); + w.uint32LE(val >>> 0); + } + } else { + w.byte(71 /* BINFLOAT */); + w.float64BE(val); + } + maybeMemoize(w, proto); + return; + } + if (typeof val === "string") { + const utf8 = new TextEncoder().encode(val); + if (proto >= 4 && utf8.length < 256) { + w.byte(140 /* SHORT_BINUNICODE */); + w.byte(utf8.length); + } else if (proto >= 4 && utf8.length > 4294967295) { + w.byte(141 /* BINUNICODE8 */); + w.uint64LE(utf8.length); + } else { + w.byte(88 /* BINUNICODE */); + w.uint32LE(utf8.length); + } + w.bytes(utf8); + maybeMemoize(w, proto); + return; + } + if (val instanceof Uint8Array) { + const len = val.length; + if (proto >= 4 && len < 256) { + w.byte(67 /* SHORT_BINBYTES */); + w.byte(len); + } else if (proto >= 4 && len > 4294967295) { + w.byte(142 /* BINBYTES8 */); + w.uint64LE(len); + } else { + w.byte(66 /* BINBYTES */); + w.uint32LE(len); + } + w.bytes(val); + maybeMemoize(w, proto); + return; + } + if (Array.isArray(val)) { + w.byte(93 /* EMPTY_LIST */); + maybeMemoize(w, proto); + for (const item of val) { + encodeValue(item, w, proto); + w.byte(97 /* APPEND */); + } + return; + } + if (typeof val === "object") { + w.byte(125 /* EMPTY_DICT */); + maybeMemoize(w, proto); + for (const [k, v] of Object.entries(val)) { + encodeValue(k, w, proto); + encodeValue(v, w, proto); + w.byte(115 /* SETITEM */); + } + return; + } + throw new PickleError( + `The JS Modal SDK does not support encoding/pickling data of type ${typeof val}` + ); +} +function maybeMemoize(w, proto) { + if (proto >= 4) { + w.byte(148 /* MEMOIZE */); + } +} +function dumps(obj, protocol = 4) { + if (![3, 4, 5].includes(protocol)) + throw new PickleError( + `The JS Modal SDK does not support pickle protocol version ${protocol}` + ); + const w = new Writer(); + w.byte(128 /* PROTO */); + w.byte(protocol); + if (protocol === 5) { + w.byte(149 /* FRAME */); + w.uint64LE(0); + } + encodeValue(obj, w, protocol); + w.byte(46 /* STOP */); + return w.toUint8(); +} +function loads(buf) { + const r = new Reader(buf); + const op0 = r.byte(); + if (op0 !== 128 /* PROTO */) throw new PickleError("pickle missing PROTO header"); + const proto = r.byte(); + if (![3, 4, 5].includes(proto)) + throw new PickleError( + `The JS Modal SDK does not support pickle protocol version ${proto}` + ); + const stack = []; + const memo = []; + const tdec = new TextDecoder(); + function push(v) { + stack.push(v); + } + function pop() { + return stack.pop(); + } + if (proto === 5 && buf[r["pos"]] === 149 /* FRAME */) { + r.byte(); + const size = r.uint64LE(); + void size; + } + const MARK = Symbol("pickle-mark"); + while (!r.eof()) { + const op = r.byte(); + switch (op) { + case 46 /* STOP */: + return stack.pop(); + case 78 /* NONE */: + push(null); + break; + case 136 /* NEWTRUE */: + push(true); + break; + case 137 /* NEWFALSE */: + push(false); + break; + case 75 /* BININT1 */: + push(r.byte()); + break; + case 77 /* BININT2 */: { + const lo = r.byte(), hi = r.byte(); + const n = hi << 8 | lo; + push(n); + break; + } + case 74 /* BININT4 */: { + push(r.int32LE()); + break; + } + case 71 /* BINFLOAT */: + push(r.float64BE()); + break; + case 140 /* SHORT_BINUNICODE */: { + const n = r.byte(); + push(tdec.decode(r.take(n))); + break; + } + case 88 /* BINUNICODE */: { + const n = r.uint32LE(); + push(tdec.decode(r.take(n))); + break; + } + case 141 /* BINUNICODE8 */: { + const n = r.uint64LE(); + push(tdec.decode(r.take(n))); + break; + } + case 67 /* SHORT_BINBYTES */: { + const n = r.byte(); + push(r.take(n)); + break; + } + case 66 /* BINBYTES */: { + const n = r.uint32LE(); + push(r.take(n)); + break; + } + case 142 /* BINBYTES8 */: { + const n = r.uint64LE(); + push(r.take(n)); + break; + } + case 93 /* EMPTY_LIST */: + push([]); + break; + case 97 /* APPEND */: { + const v = pop(); + const lst = pop(); + lst.push(v); + push(lst); + break; + } + case 125 /* EMPTY_DICT */: + push({}); + break; + case 115 /* SETITEM */: { + const v = pop(), k = pop(), d = pop(); + d[k] = v; + push(d); + break; + } + // Memo handling ---------------------------------------- + case 148 /* MEMOIZE */: + memo.push(stack[stack.length - 1]); + break; + case 113 /* BINPUT */: + memo[r.byte()] = stack[stack.length - 1]; + break; + case 114 /* LONG_BINPUT */: + memo[r.uint32LE()] = stack[stack.length - 1]; + break; + case 104 /* BINGET */: + push(memo[r.byte()]); + break; + case 106 /* LONG_BINGET */: + push(memo[r.uint32LE()]); + break; + case 149 /* FRAME */: { + const _size = r.uint64LE(); + break; + } + case 40 /* MARK */: + push(MARK); + break; + case 101 /* APPENDS */: { + const markIndex = stack.lastIndexOf(MARK); + if (markIndex === -1) { + throw new PickleError("APPENDS without MARK"); + } + const lst = stack[markIndex - 1]; + if (!Array.isArray(lst)) { + throw new PickleError("APPENDS expects a list below MARK"); + } + const items = stack.slice(markIndex + 1); + lst.push(...items); + stack.length = markIndex - 1; + push(lst); + break; + } + case 117 /* SETITEMS */: { + const markIndex = stack.lastIndexOf(MARK); + if (markIndex === -1) { + throw new PickleError("SETITEMS without MARK"); + } + const d = stack[markIndex - 1]; + if (typeof d !== "object" || d === null || Array.isArray(d)) { + throw new PickleError("SETITEMS expects a dict below MARK"); + } + const items = stack.slice(markIndex + 1); + for (let i = 0; i < items.length; i += 2) { + if (i + 1 < items.length) { + d[items[i]] = items[i + 1]; + } + } + stack.length = markIndex - 1; + push(d); + break; + } + default: + throw new PickleError( + `The JS Modal SDK does not support decoding/unpickling this kind of data. Error: unsupported opcode 0x${op.toString(16)}` + ); + } + } + throw new PickleError("pickle stream ended without STOP"); +} + +// src/queue.ts +var import_nice_grpc7 = require("nice-grpc"); + +// src/ephemeral.ts +var ephemeralObjectHeartbeatSleep = 3e5; +var EphemeralHeartbeatManager = class { + heartbeatFn; + abortController; + constructor(heartbeatFn) { + this.heartbeatFn = heartbeatFn; + this.abortController = new AbortController(); + this.start(); + } + start() { + const signal = this.abortController.signal; + (async () => { + while (!signal.aborted) { + await this.heartbeatFn(); + await Promise.race([ + new Promise((resolve) => { + setTimeout(resolve, ephemeralObjectHeartbeatSleep).unref(); + }), + new Promise((resolve) => { + signal.addEventListener("abort", resolve, { once: true }); + }) + ]); + } + })(); + } + stop() { + this.abortController.abort(); + } +}; + +// src/queue.ts +var queueInitialPutBackoffMs = 100; +var queueDefaultPartitionTtlMs = 24 * 3600 * 1e3; +var QueueService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a nameless, temporary {@link Queue}. + * You will need to call {@link Queue#closeEphemeral Queue.closeEphemeral()} to delete the Queue. + */ + async ephemeral(params = {}) { + const resp = await this.#client.cpClient.queueGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Created ephemeral Queue", + "queue_id", + resp.queueId + ); + const ephemeralHbManager = new EphemeralHeartbeatManager( + () => this.#client.cpClient.queueHeartbeat({ queueId: resp.queueId }) + ); + return new Queue(this.#client, resp.queueId, void 0, ephemeralHbManager); + } + /** + * Reference a {@link Queue} by name. + */ + async fromName(name, params = {}) { + try { + const resp = await this.#client.cpClient.queueGetOrCreate({ + deploymentName: name, + objectCreationType: params.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : void 0, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Retrieved Queue", + "queue_id", + resp.queueId, + "queue_name", + name + ); + return new Queue(this.#client, resp.queueId, name); + } catch (err) { + if (err instanceof import_nice_grpc7.ClientError && err.code === import_nice_grpc7.Status.NOT_FOUND) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Delete a {@link Queue} by name. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Queue. + */ + async delete(name, params = {}) { + try { + const queue = await this.fromName(name, { + environment: params.environment, + createIfMissing: false + }); + await this.#client.cpClient.queueDelete({ queueId: queue.queueId }); + this.#client.logger.debug( + "Deleted Queue", + "queue_name", + name, + "queue_id", + queue.queueId + ); + } catch (err) { + if (err instanceof NotFoundError && params.allowMissing) { + return; + } + throw err; + } + } +}; +var Queue = class _Queue { + #client; + queueId; + name; + #ephemeralHbManager; + /** @ignore */ + constructor(client2, queueId, name, ephemeralHbManager) { + this.#client = client2; + this.queueId = queueId; + this.name = name; + this.#ephemeralHbManager = ephemeralHbManager; + } + static #validatePartitionKey(partition) { + if (partition) { + const partitionKey = new TextEncoder().encode(partition); + if (partitionKey.length === 0 || partitionKey.length > 64) { + throw new InvalidError( + "Queue partition key must be between 1 and 64 bytes." + ); + } + return partitionKey; + } + return new Uint8Array(); + } + /** + * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead. + */ + static async ephemeral(params = {}) { + return getDefaultClient().queues.ephemeral(params); + } + /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */ + closeEphemeral() { + if (this.#ephemeralHbManager) { + this.#ephemeralHbManager.stop(); + } else { + throw new InvalidError("Queue is not ephemeral."); + } + } + /** + * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead. + */ + static async lookup(name, options = {}) { + return getDefaultClient().queues.fromName(name, options); + } + /** + * @deprecated Use {@link QueueService#delete client.queues.delete()} instead. + */ + static async delete(name, options = {}) { + return getDefaultClient().queues.delete(name, options); + } + /** + * Remove all objects from a Queue partition. + */ + async clear(params = {}) { + if (params.partition && params.all) { + throw new InvalidError( + "Partition must be null when requesting to clear all." + ); + } + await this.#client.cpClient.queueClear({ + queueId: this.queueId, + partitionKey: _Queue.#validatePartitionKey(params.partition), + allPartitions: params.all + }); + } + async #get(n, partition, timeoutMs) { + const partitionKey = _Queue.#validatePartitionKey(partition); + const startTime = Date.now(); + let pollTimeoutMs = 5e4; + if (timeoutMs !== void 0) { + pollTimeoutMs = Math.min(pollTimeoutMs, timeoutMs); + } + while (true) { + const response = await this.#client.cpClient.queueGet({ + queueId: this.queueId, + partitionKey, + timeout: pollTimeoutMs / 1e3, + nValues: n + }); + if (response.values && response.values.length > 0) { + return response.values.map((value) => loads(value)); + } + if (timeoutMs !== void 0) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Queue ${this.queueId} did not return values within ${timeoutMs}ms.`; + throw new QueueEmptyError(message); + } + pollTimeoutMs = Math.min(pollTimeoutMs, remainingMs); + } + } + } + /** + * Remove and return the next object from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + async get(params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const values = await this.#get(1, params.partition, params.timeoutMs); + return values[0]; + } + /** + * Remove and return up to `n` objects from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + async getMany(n, params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + return await this.#get(n, params.partition, params.timeoutMs); + } + async #put(values, timeoutMs, partition, partitionTtlMs) { + const valuesEncoded = values.map((v) => dumps(v)); + const partitionKey = _Queue.#validatePartitionKey(partition); + let delay = queueInitialPutBackoffMs; + const deadline = timeoutMs ? Date.now() + timeoutMs : void 0; + while (true) { + try { + await this.#client.cpClient.queuePut({ + queueId: this.queueId, + values: valuesEncoded, + partitionKey, + partitionTtlSeconds: (partitionTtlMs || queueDefaultPartitionTtlMs) / 1e3 + }); + break; + } catch (e) { + if (e instanceof import_nice_grpc7.ClientError && e.code === import_nice_grpc7.Status.RESOURCE_EXHAUSTED) { + delay = Math.min(delay * 2, 3e4); + if (deadline !== void 0) { + const remaining = deadline - Date.now(); + if (remaining <= 0) + throw new QueueFullError(`Put failed on ${this.queueId}.`); + delay = Math.min(delay, remaining); + } + await new Promise((resolve) => setTimeout(resolve, delay)); + } else { + throw e; + } + } + } + } + /** + * Add an item to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + async put(v, params = {}) { + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs" + }); + await this.#put( + [v], + params.timeoutMs, + params.partition, + params.partitionTtlMs + ); + } + /** + * Add several items to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + async putMany(values, params = {}) { + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs" + }); + await this.#put( + values, + params.timeoutMs, + params.partition, + params.partitionTtlMs + ); + } + /** Return the number of objects in the Queue. */ + async len(params = {}) { + if (params.partition && params.total) { + throw new InvalidError( + "Partition must be null when requesting total length." + ); + } + const resp = await this.#client.cpClient.queueLen({ + queueId: this.queueId, + partitionKey: _Queue.#validatePartitionKey(params.partition), + total: params.total + }); + return resp.len; + } + /** Iterate through items in a Queue without mutation. */ + async *iterate(params = {}) { + checkForRenamedParams(params, { itemPollTimeout: "itemPollTimeoutMs" }); + const { partition, itemPollTimeoutMs = 0 } = params; + let lastEntryId = void 0; + const validatedPartitionKey = _Queue.#validatePartitionKey(partition); + let fetchDeadline = Date.now() + itemPollTimeoutMs; + const maxPollDurationMs = 3e4; + while (true) { + const pollDurationMs = Math.max( + 0, + Math.min(maxPollDurationMs, fetchDeadline - Date.now()) + ); + const request = { + queueId: this.queueId, + partitionKey: validatedPartitionKey, + itemPollTimeout: pollDurationMs / 1e3, + lastEntryId: lastEntryId || "" + }; + const response = await this.#client.cpClient.queueNextItems(request); + if (response.items && response.items.length > 0) { + for (const item of response.items) { + yield loads(item.value); + lastEntryId = item.entryId; + } + fetchDeadline = Date.now() + itemPollTimeoutMs; + } else if (Date.now() > fetchDeadline) { + break; + } + } + } +}; + +// src/sandbox.ts +var import_nice_grpc8 = require("nice-grpc"); + +// src/sandbox_snapshot.ts +var SandboxSnapshot = class { + snapshotId; + /** @ignore */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + constructor(client2, snapshotId) { + this.snapshotId = snapshotId; + } + /** + * @deprecated Use {@link SandboxSnapshotService#fromId client.sandboxSnapshots.fromId()} instead. + */ + static async fromId(snapshotId) { + return getDefaultClient().sandboxSnapshots.fromId(snapshotId); + } +}; +var SandboxSnapshotService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Get a {@link SandboxSnapshot} by ID. + */ + async fromId(snapshotId) { + await this.#client.cpClient.sandboxSnapshotGet({ snapshotId }); + return new SandboxSnapshot(this.#client, snapshotId); + } +}; + +// src/sandbox_filesystem.ts +var SandboxFile = class { + #client; + #fileDescriptor; + #taskId; + /** @ignore */ + constructor(client2, fileDescriptor, taskId) { + this.#client = client2; + this.#fileDescriptor = fileDescriptor; + this.#taskId = taskId; + } + /** + * Read data from the file. + * @returns Promise that resolves to the read data as Uint8Array + */ + async read() { + const resp = await runFilesystemExec(this.#client.cpClient, { + fileReadRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + const chunks = resp.chunks; + const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; + } + return result; + } + /** + * Write data to the file. + * @param data - Data to write (string or Uint8Array) + */ + async write(data) { + await runFilesystemExec(this.#client.cpClient, { + fileWriteRequest: { + fileDescriptor: this.#fileDescriptor, + data + }, + taskId: this.#taskId + }); + } + /** + * Flush any buffered data to the file. + */ + async flush() { + await runFilesystemExec(this.#client.cpClient, { + fileFlushRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + } + /** + * Close the file handle. + */ + async close() { + await runFilesystemExec(this.#client.cpClient, { + fileCloseRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + } +}; +async function runFilesystemExec(cpClient, request) { + const response = await cpClient.containerFilesystemExec(request); + const chunks = []; + let retries = 10; + let completed = false; + while (!completed) { + try { + const outputIterator = cpClient.containerFilesystemExecGetOutput({ + execId: response.execId, + timeout: 55 + }); + for await (const batch of outputIterator) { + chunks.push(...batch.output); + if (batch.eof) { + completed = true; + break; + } + if (batch.error !== void 0) { + if (retries > 0) { + retries--; + break; + } + throw new SandboxFilesystemError(batch.error.errorMessage); + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) { + retries--; + } else throw err; + } + } + return { chunks, response }; +} + +// src/streams.ts +function toModalReadStream(stream) { + return Object.assign(stream, readMixin); +} +function toModalWriteStream(stream) { + return Object.assign(stream, writeMixin); +} +var readMixin = { + async readText() { + const reader = this.getReader(); + try { + const decoder2 = new TextDecoder("utf-8"); + const chunks = []; + while (true) { + const { value, done } = await reader.read(); + if (value) { + if (typeof value === "string") chunks.push(value); + else { + chunks.push(decoder2.decode(value.buffer, { stream: true })); + } + } + if (done) { + chunks.push(decoder2.decode(void 0, { stream: false })); + break; + } + } + return chunks.join(""); + } finally { + reader.releaseLock(); + } + }, + async readBytes() { + const chunks = []; + const reader = this.getReader(); + try { + while (true) { + const { value, done } = await reader.read(); + if (value) { + if (typeof value === "string") { + chunks.push(new TextEncoder().encode(value)); + } else { + chunks.push(value); + } + } + if (done) break; + } + } finally { + reader.releaseLock(); + } + let totalLength = 0; + for (const chunk of chunks) { + totalLength += chunk.length; + } + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; + } + return result; + } +}; +var writeMixin = { + async writeText(text) { + const writer = this.getWriter(); + try { + await writer.write(text); + } finally { + writer.releaseLock(); + } + }, + async writeBytes(bytes) { + const writer = this.getWriter(); + try { + await writer.write(bytes); + } finally { + writer.releaseLock(); + } + } +}; +function streamConsumingIter(iterable) { + const iter = iterable[Symbol.asyncIterator](); + return new ReadableStream( + { + async pull(controller) { + const { done, value } = await iter.next(); + if (value) { + controller.enqueue(value); + } + if (done) { + controller.close(); + } + }, + async cancel() { + consumeIterator(iter); + } + }, + new ByteLengthQueuingStrategy({ + highWaterMark: 64 * 1024 + // 64 KiB + }) + ); +} +async function consumeIterator(iter) { + while (true) { + const { done } = await iter.next(); + if (done) break; + } +} + +// src/sandbox.ts +async function buildSandboxCreateRequestProto(appId, imageId, params = {}) { + checkForRenamedParams(params, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + timeout: "timeoutMs", + idleTimeout: "idleTimeoutMs" + }); + const gpuConfig = parseGpuConfig(params.gpu); + if (params.timeoutMs && params.timeoutMs % 1e3 !== 0) { + throw new Error( + `timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}` + ); + } + if (params.idleTimeoutMs && params.idleTimeoutMs % 1e3 !== 0) { + throw new Error( + `idleTimeoutMs must be a multiple of 1000ms, got ${params.idleTimeoutMs}` + ); + } + if (params.workdir && !params.workdir.startsWith("/")) { + throw new Error(`workdir must be an absolute path, got: ${params.workdir}`); + } + const volumeMounts = params.volumes ? Object.entries(params.volumes).map(([mountPath, volume]) => ({ + volumeId: volume.volumeId, + mountPath, + allowBackgroundCommits: true, + readOnly: volume.isReadOnly + })) : []; + const cloudBucketMounts = params.cloudBucketMounts ? Object.entries(params.cloudBucketMounts).map( + ([mountPath, mount]) => mount.toProto(mountPath) + ) : []; + const openPorts = []; + if (params.encryptedPorts) { + openPorts.push( + ...params.encryptedPorts.map( + (port) => PortSpec.create({ + port, + unencrypted: false + }) + ) + ); + } + if (params.h2Ports) { + openPorts.push( + ...params.h2Ports.map( + (port) => PortSpec.create({ + port, + unencrypted: false, + tunnelType: 1 /* TUNNEL_TYPE_H2 */ + }) + ) + ); + } + if (params.unencryptedPorts) { + openPorts.push( + ...params.unencryptedPorts.map( + (port) => PortSpec.create({ + port, + unencrypted: true + }) + ) + ); + } + const secretIds = (params.secrets || []).map((secret) => secret.secretId); + let networkAccess; + if (params.blockNetwork) { + if (params.cidrAllowlist) { + throw new Error( + "cidrAllowlist cannot be used when blockNetwork is enabled" + ); + } + networkAccess = { + networkAccessType: 2 /* BLOCKED */, + allowedCidrs: [] + }; + } else if (params.cidrAllowlist) { + networkAccess = { + networkAccessType: 3 /* ALLOWLIST */, + allowedCidrs: params.cidrAllowlist + }; + } else { + networkAccess = { + networkAccessType: 1 /* OPEN */, + allowedCidrs: [] + }; + } + const schedulerPlacement = params.regions?.length ? SchedulerPlacement.create({ + regions: params.regions + }) : void 0; + let ptyInfo; + if (params.pty) { + ptyInfo = defaultSandboxPTYInfo(); + } + let milliCpu = void 0; + let milliCpuMax = void 0; + if (params.cpu === void 0 && params.cpuLimit !== void 0) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (params.cpu !== void 0) { + if (params.cpu <= 0) { + throw new Error(`cpu (${params.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1e3 * params.cpu); + if (params.cpuLimit !== void 0) { + if (params.cpuLimit < params.cpu) { + throw new Error( + `cpu (${params.cpu}) cannot be higher than cpuLimit (${params.cpuLimit})` + ); + } + milliCpuMax = Math.trunc(1e3 * params.cpuLimit); + } + } + let memoryMb = void 0; + let memoryMbMax = void 0; + if (params.memoryMiB === void 0 && params.memoryLimitMiB !== void 0) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified" + ); + } + if (params.memoryMiB !== void 0) { + if (params.memoryMiB <= 0) { + throw new Error( + `the memoryMiB request (${params.memoryMiB}) must be a positive number` + ); + } + memoryMb = params.memoryMiB; + if (params.memoryLimitMiB !== void 0) { + if (params.memoryLimitMiB < params.memoryMiB) { + throw new Error( + `the memoryMiB request (${params.memoryMiB}) cannot be higher than memoryLimitMiB (${params.memoryLimitMiB})` + ); + } + memoryMbMax = params.memoryLimitMiB; + } + } + return SandboxCreateRequest.create({ + appId, + definition: { + // Sleep default is implicit in image builder version <=2024.10 + entrypointArgs: params.command ?? ["sleep", "48h"], + imageId, + timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 : 600, + idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0, + workdir: params.workdir ?? void 0, + networkAccess, + resources: Resources.create({ + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, + gpuConfig + }), + volumeMounts, + cloudBucketMounts, + ptyInfo, + secretIds, + openPorts: PortSpecs.create({ ports: openPorts }), + cloudProviderStr: params.cloud ?? "", + schedulerPlacement, + verbose: params.verbose ?? false, + proxyId: params.proxy?.proxyId, + name: params.name, + experimentalOptions: params.experimentalOptions, + enableSnapshot: params.experimentalEnableSnapshot ?? false + } + }); +} +var SandboxService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options. + */ + async create(app, image, params = {}) { + await image.build(app); + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + params.env, + params.secrets + ); + const mergedParams = { + ...params, + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }; + const createReq = await buildSandboxCreateRequestProto( + app.appId, + image.imageId, + mergedParams + ); + let createResp; + try { + createResp = await this.#client.cpClient.sandboxCreate(createReq); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.ALREADY_EXISTS) { + throw new AlreadyExistsError(err.details || err.message); + } + throw err; + } + this.#client.logger.debug( + "Created Sandbox", + "sandbox_id", + createResp.sandboxId + ); + const memorySnapshotsEnabled = params.experimentalEnableSnapshot ?? false; + return new Sandbox2(this.#client, createResp.sandboxId, { + memorySnapshotsEnabled + }); + } + /** Returns a running {@link Sandbox} object from an ID. + * + * @returns Sandbox with ID + */ + async fromId(sandboxId, params) { + try { + await this.#client.cpClient.sandboxWait({ + sandboxId, + timeout: 0 + }); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.NOT_FOUND) + throw new NotFoundError(`Sandbox with id: '${sandboxId}' not found`); + throw err; + } + return new Sandbox2(this.#client, sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled + }); + } + /** Get a running {@link Sandbox} by name from a deployed {@link App}. + * + * Raises a {@link NotFoundError} if no running Sandbox is found with the given name. + * A Sandbox's name is the `name` argument passed to {@link SandboxService#create sandboxes.create()}. + * + * @param appName - Name of the deployed App + * @param name - Name of the Sandbox + * @param params - Optional parameters for getting the Sandbox + * @returns Promise that resolves to a Sandbox + */ + async fromName(appName, name, params) { + try { + const resp = await this.#client.cpClient.sandboxGetFromName({ + sandboxName: name, + appName, + environmentName: this.#client.environmentName(params?.environment) + }); + return new Sandbox2(this.#client, resp.sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled + }); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.NOT_FOUND) + throw new NotFoundError( + `Sandbox with name '${name}' not found in App '${appName}'` + ); + throw err; + } + } + /** + * Restore a {@link Sandbox} from a {@link SandboxSnapshot} (experimental). + * + * @param snapshot - The snapshot to restore from + * @param params - Optional parameters for restoring the Sandbox + * @returns Promise that resolves to a Sandbox + */ + async experimentalFromSnapshot(snapshot, params = {}) { + let sandboxNameOverrideType = 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */; + let sandboxNameOverride = ""; + if (params.name === null) { + sandboxNameOverrideType = 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */; + } else if (params.name) { + sandboxNameOverrideType = 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */; + sandboxNameOverride = params.name; + } + let restoreResp; + try { + restoreResp = await this.#client.cpClient.sandboxRestore({ + snapshotId: snapshot.snapshotId, + sandboxNameOverride, + sandboxNameOverrideType + }); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.ALREADY_EXISTS) { + throw new AlreadyExistsError(err.details || err.message); + } + throw err; + } + await this.#client.cpClient.sandboxGetTaskId({ + sandboxId: restoreResp.sandboxId, + waitUntilReady: true, + timeout: 55 + }); + return new Sandbox2(this.#client, restoreResp.sandboxId, { + memorySnapshotsEnabled: true + }); + } + /** + * List all {@link Sandbox}es for the current Environment or App ID (if specified). + * If tags are specified, only Sandboxes that have at least those tags are returned. + */ + async *list(params = {}) { + const env = this.#client.environmentName(params.environment); + const tagsList = params.tags ? Object.entries(params.tags).map(([tagName, tagValue]) => ({ + tagName, + tagValue + })) : []; + let beforeTimestamp = void 0; + while (true) { + try { + const resp = await this.#client.cpClient.sandboxList({ + appId: params.appId, + beforeTimestamp, + environmentName: env, + includeFinished: false, + tags: tagsList + }); + if (!resp.sandboxes || resp.sandboxes.length === 0) { + return; + } + for (const info of resp.sandboxes) { + yield new Sandbox2(this.#client, info.id); + } + beforeTimestamp = resp.sandboxes[resp.sandboxes.length - 1].createdAt; + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + } + } +}; +var Tunnel = class { + /** @ignore */ + constructor(host, port, unencryptedHost, unencryptedPort) { + this.host = host; + this.port = port; + this.unencryptedHost = unencryptedHost; + this.unencryptedPort = unencryptedPort; + } + /** Get the public HTTPS URL of the forwarded port. */ + get url() { + let value = `https://${this.host}`; + if (this.port !== 443) { + value += `:${this.port}`; + } + return value; + } + /** Get the public TLS socket as a [host, port] tuple. */ + get tlsSocket() { + return [this.host, this.port]; + } + /** Get the public TCP socket as a [host, port] tuple. */ + get tcpSocket() { + if (!this.unencryptedHost || this.unencryptedPort === void 0) { + throw new InvalidError( + "This tunnel is not configured for unencrypted TCP." + ); + } + return [this.unencryptedHost, this.unencryptedPort]; + } +}; +function defaultSandboxPTYInfo() { + return PTYInfo.create({ + enabled: true, + winszRows: 24, + winszCols: 80, + envTerm: "xterm-256color", + envColorterm: "truecolor", + envTermProgram: "", + ptyType: 2 /* PTY_TYPE_SHELL */, + noTerminateOnIdleStdin: true + }); +} +async function buildContainerExecRequestProto(taskId, command, params) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const secretIds = (params?.secrets || []).map((secret) => secret.secretId); + let ptyInfo; + if (params?.pty) { + ptyInfo = defaultSandboxPTYInfo(); + } + return ContainerExecRequest.create({ + taskId, + command, + workdir: params?.workdir, + timeoutSecs: params?.timeoutMs ? params.timeoutMs / 1e3 : 0, + secretIds, + ptyInfo + }); +} +var Sandbox2 = class _Sandbox { + #client; + sandboxId; + stdin; + stdout; + stderr; + #taskId; + #tunnels; + #memorySnapshotsEnabled; + /** @ignore */ + constructor(client2, sandboxId, options = {}) { + this.#client = client2; + this.sandboxId = sandboxId; + this.#memorySnapshotsEnabled = options.memorySnapshotsEnabled ?? false; + this.stdin = toModalWriteStream(inputStreamSb(client2.cpClient, sandboxId)); + this.stdout = toModalReadStream( + streamConsumingIter( + outputStreamSb( + client2.cpClient, + sandboxId, + 1 /* FILE_DESCRIPTOR_STDOUT */ + ) + ).pipeThrough(new TextDecoderStream()) + ); + this.stderr = toModalReadStream( + streamConsumingIter( + outputStreamSb( + client2.cpClient, + sandboxId, + 2 /* FILE_DESCRIPTOR_STDERR */ + ) + ).pipeThrough(new TextDecoderStream()) + ); + } + /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */ + async setTags(tags) { + const tagsList = Object.entries(tags).map(([tagName, tagValue]) => ({ + tagName, + tagValue + })); + try { + await this.#client.cpClient.sandboxTagsSet({ + environmentName: this.#client.environmentName(), + sandboxId: this.sandboxId, + tags: tagsList + }); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + } + /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */ + async getTags() { + let resp; + try { + resp = await this.#client.cpClient.sandboxTagsGet({ + sandboxId: this.sandboxId + }); + } catch (err) { + if (err instanceof import_nice_grpc8.ClientError && err.code === import_nice_grpc8.Status.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + const tags = {}; + for (const tag of resp.tags) { + tags[tag.tagName] = tag.tagValue; + } + return tags; + } + /** + * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead. + */ + static async fromId(sandboxId) { + return getDefaultClient().sandboxes.fromId(sandboxId); + } + /** + * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead. + */ + static async fromName(appName, name, environment) { + return getDefaultClient().sandboxes.fromName(appName, name, { + environment + }); + } + /** + * Open a file in the Sandbox filesystem. + * @param path - Path to the file to open + * @param mode - File open mode (r, w, a, r+, w+, a+) + * @returns Promise that resolves to a {@link SandboxFile} + */ + async open(path2, mode = "r") { + const taskId = await this.#getTaskId(); + const resp = await runFilesystemExec(this.#client.cpClient, { + fileOpenRequest: { + path: path2, + mode + }, + taskId + }); + const fileDescriptor = resp.response.fileDescriptor; + return new SandboxFile(this.#client, fileDescriptor, taskId); + } + async exec(command, params) { + const taskId = await this.#getTaskId(); + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + params?.env, + params?.secrets + ); + const mergedParams = { + ...params, + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }; + const req = await buildContainerExecRequestProto( + taskId, + command, + mergedParams + ); + const resp = await this.#client.cpClient.containerExec(req); + this.#client.logger.debug( + "Created ContainerProcess", + "exec_id", + resp.execId, + "sandbox_id", + this.sandboxId, + "command", + command + ); + return new ContainerProcess(this.#client, resp.execId, params); + } + async #getTaskId() { + if (this.#taskId === void 0) { + const resp = await this.#client.cpClient.sandboxGetTaskId({ + sandboxId: this.sandboxId + }); + if (!resp.taskId) { + throw new Error( + `Sandbox ${this.sandboxId} does not have a task ID. It may not be running.` + ); + } + if (resp.taskResult) { + throw new Error( + `Sandbox ${this.sandboxId} has already completed with result: ${resp.taskResult}` + ); + } + this.#taskId = resp.taskId; + } + return this.#taskId; + } + async terminate() { + await this.#client.cpClient.sandboxTerminate({ sandboxId: this.sandboxId }); + this.#taskId = void 0; + } + async wait() { + while (true) { + const resp = await this.#client.cpClient.sandboxWait({ + sandboxId: this.sandboxId, + timeout: 10 + }); + if (resp.result) { + const returnCode = _Sandbox.#getReturnCode(resp.result); + this.#client.logger.debug( + "Sandbox wait completed", + "sandbox_id", + this.sandboxId, + "status", + resp.result.status, + "return_code", + returnCode + ); + return returnCode; + } + } + } + /** Get {@link Tunnel} metadata for the Sandbox. + * + * Raises {@link SandboxTimeoutError} if the tunnels are not available after the timeout. + * + * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. + */ + async tunnels(timeoutMs = 5e4) { + if (this.#tunnels) { + return this.#tunnels; + } + const resp = await this.#client.cpClient.sandboxGetTunnels({ + sandboxId: this.sandboxId, + timeout: timeoutMs / 1e3 + }); + if (resp.result?.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + throw new SandboxTimeoutError(); + } + this.#tunnels = {}; + for (const t of resp.tunnels) { + this.#tunnels[t.containerPort] = new Tunnel( + t.host, + t.port, + t.unencryptedHost, + t.unencryptedPort + ); + } + return this.#tunnels; + } + /** + * Snapshot the filesystem of the Sandbox. + * + * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. + * + * @param timeoutMs - Timeout for the snapshot operation in milliseconds + * @returns Promise that resolves to an {@link Image} + */ + async snapshotFilesystem(timeoutMs = 55e3) { + const resp = await this.#client.cpClient.sandboxSnapshotFs({ + sandboxId: this.sandboxId, + timeout: timeoutMs / 1e3 + }); + if (resp.result?.status !== 1 /* GENERIC_STATUS_SUCCESS */) { + throw new Error( + `Sandbox snapshot failed: ${resp.result?.exception || "Unknown error"}` + ); + } + if (!resp.imageId) { + throw new Error("Sandbox snapshot response missing `imageId`"); + } + return new Image2(this.#client, resp.imageId, ""); + } + /** + * Take a memory snapshot of the Sandbox (experimental). + * + * Returns a {@link SandboxSnapshot} object which can be used to restore a new Sandbox. + * + * @returns Promise that resolves to a {@link SandboxSnapshot} + */ + async experimentalSnapshot() { + if (!this.#memorySnapshotsEnabled) { + throw new InvalidError( + "Memory snapshots are not supported for this sandbox. Enable them by setting `experimentalEnableSnapshot: true` when creating the sandbox." + ); + } + await this.#getTaskId(); + const snapshotResp = await this.#client.cpClient.sandboxSnapshot({ + sandboxId: this.sandboxId + }); + const snapshotId = snapshotResp.snapshotId; + if (!snapshotId) { + throw new Error("Sandbox snapshot response missing `snapshotId`"); + } + const waitResp = await this.#client.cpClient.sandboxSnapshotWait({ + snapshotId, + timeout: 55 + }); + const result = waitResp.result; + if (result && result.status !== 1 /* GENERIC_STATUS_SUCCESS */ && result.status !== 0 /* GENERIC_STATUS_UNSPECIFIED */) { + throw new Error(result.exception || "Sandbox snapshot failed"); + } + return new SandboxSnapshot(this.#client, snapshotId); + } + /** + * Check if the Sandbox has finished running. + * + * Returns `null` if the Sandbox is still running, else returns the exit code. + */ + async poll() { + const resp = await this.#client.cpClient.sandboxWait({ + sandboxId: this.sandboxId, + timeout: 0 + }); + return _Sandbox.#getReturnCode(resp.result); + } + /** + * Create a connect token for this Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. The token can be transmitted via: + * - Authorization header: `Authorization: Bearer {token}` + * - Query parameter: `_modal_connect_token` in the URL + * - Cookie: `_modal_connect_token` as a cookie + * + * The service inside the container must listen on port 8080. + * + * @param params - Optional parameters for the connect token + * @returns Promise that resolves to a {@link ConnectToken} + */ + async createConnectToken(params = {}) { + const userMetadata = params.userMetadata ? JSON.stringify(params.userMetadata) : ""; + const resp = await this.#client.cpClient.sandboxCreateConnectToken({ + sandboxId: this.sandboxId, + userMetadata + }); + return { + url: resp.url, + token: resp.token + }; + } + /** + * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. + */ + static async *list(params = {}) { + yield* getDefaultClient().sandboxes.list(params); + } + static #getReturnCode(result) { + if (result === void 0 || result.status === 0 /* GENERIC_STATUS_UNSPECIFIED */) { + return null; + } + if (result.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + return 124; + } else if (result.status === 3 /* GENERIC_STATUS_TERMINATED */) { + return 137; + } else { + return result.exitcode; + } + } +}; +var ContainerProcess = class { + stdin; + stdout; + stderr; + returncode = null; + #client; + #execId; + constructor(client2, execId, params) { + this.#client = client2; + const mode = params?.mode ?? "text"; + const stdout = params?.stdout ?? "pipe"; + const stderr = params?.stderr ?? "pipe"; + this.#execId = execId; + this.stdin = toModalWriteStream(inputStreamCp(client2.cpClient, execId)); + let stdoutStream = streamConsumingIter( + outputStreamCp( + client2.cpClient, + execId, + 1 /* FILE_DESCRIPTOR_STDOUT */ + ) + ); + if (stdout === "ignore") { + stdoutStream.cancel(); + stdoutStream = ReadableStream.from([]); + } + let stderrStream = streamConsumingIter( + outputStreamCp( + client2.cpClient, + execId, + 2 /* FILE_DESCRIPTOR_STDERR */ + ) + ); + if (stderr === "ignore") { + stderrStream.cancel(); + stderrStream = ReadableStream.from([]); + } + if (mode === "text") { + this.stdout = toModalReadStream( + stdoutStream.pipeThrough(new TextDecoderStream()) + ); + this.stderr = toModalReadStream( + stderrStream.pipeThrough(new TextDecoderStream()) + ); + } else { + this.stdout = toModalReadStream(stdoutStream); + this.stderr = toModalReadStream(stderrStream); + } + } + /** Wait for process completion and return the exit code. */ + async wait() { + while (true) { + const resp = await this.#client.cpClient.containerExecWait({ + execId: this.#execId, + timeout: 55 + }); + if (resp.completed) { + return resp.exitCode ?? 0; + } + } + } +}; +async function* outputStreamSb(cpClient, sandboxId, fileDescriptor) { + let lastIndex = "0-0"; + let completed = false; + let retries = 10; + while (!completed) { + try { + const outputIterator = cpClient.sandboxGetLogs({ + sandboxId, + fileDescriptor, + timeout: 55, + lastEntryId: lastIndex + }); + for await (const batch of outputIterator) { + lastIndex = batch.entryId; + yield* batch.items.map((item) => new TextEncoder().encode(item.data)); + if (batch.eof) { + completed = true; + break; + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) retries--; + else throw err; + } + } +} +async function* outputStreamCp(cpClient, execId, fileDescriptor) { + let lastIndex = 0; + let completed = false; + let retries = 10; + while (!completed) { + try { + const outputIterator = cpClient.containerExecGetOutput({ + execId, + fileDescriptor, + timeout: 55, + getRawBytes: true, + lastBatchIndex: lastIndex + }); + for await (const batch of outputIterator) { + lastIndex = batch.batchIndex; + yield* batch.items.map((item) => item.messageBytes); + if (batch.exitCode !== void 0) { + completed = true; + break; + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) retries--; + else throw err; + } + } +} +function inputStreamSb(cpClient, sandboxId) { + let index = 1; + return new WritableStream({ + async write(chunk) { + await cpClient.sandboxStdinWrite({ + sandboxId, + input: encodeIfString(chunk), + index + }); + index++; + }, + async close() { + await cpClient.sandboxStdinWrite({ + sandboxId, + index, + eof: true + }); + } + }); +} +function inputStreamCp(cpClient, execId) { + let messageIndex = 1; + return new WritableStream({ + async write(chunk) { + await cpClient.containerExecPutInput({ + execId, + input: { + message: encodeIfString(chunk), + messageIndex + } + }); + messageIndex++; + }, + async close() { + await cpClient.containerExecPutInput({ + execId, + input: { + messageIndex, + eof: true + } + }); + } + }); +} +function encodeIfString(chunk) { + return typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; +} + +// src/volume.ts +var import_nice_grpc9 = require("nice-grpc"); +var VolumeService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Volume} by its name. + */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.volumeGetOrCreate({ + deploymentName: name, + environmentName: this.#client.environmentName(params?.environment), + objectCreationType: params?.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */ + }); + this.#client.logger.debug( + "Retrieved Volume", + "volume_id", + resp.volumeId, + "volume_name", + name + ); + return new Volume(resp.volumeId, name); + } catch (err) { + if (err instanceof import_nice_grpc9.ClientError && err.code === import_nice_grpc9.Status.NOT_FOUND) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Create a nameless, temporary {@link Volume}. + * It persists until closeEphemeral() is called, or the process exits. + */ + async ephemeral(params = {}) { + const resp = await this.#client.cpClient.volumeGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Created ephemeral Volume", + "volume_id", + resp.volumeId + ); + const ephemeralHbManager = new EphemeralHeartbeatManager( + () => this.#client.cpClient.volumeHeartbeat({ volumeId: resp.volumeId }) + ); + return new Volume(resp.volumeId, void 0, false, ephemeralHbManager); + } + /** + * Delete a named {@link Volume}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Volume. + */ + async delete(name, params) { + try { + const volume = await this.fromName(name, { + environment: params?.environment, + createIfMissing: false + }); + await this.#client.cpClient.volumeDelete({ + volumeId: volume.volumeId + }); + this.#client.logger.debug( + "Deleted Volume", + "volume_name", + name, + "volume_id", + volume.volumeId + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } +}; +var Volume = class _Volume { + volumeId; + name; + _readOnly = false; + #ephemeralHbManager; + /** @ignore */ + constructor(volumeId, name, readOnly = false, ephemeralHbManager) { + this.volumeId = volumeId; + this.name = name; + this._readOnly = readOnly; + this.#ephemeralHbManager = ephemeralHbManager; + } + /** + * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead. + */ + static async fromName(name, options) { + return getDefaultClient().volumes.fromName(name, options); + } + /** Configure Volume to mount as read-only. */ + readOnly() { + return new _Volume(this.volumeId, this.name, true, this.#ephemeralHbManager); + } + get isReadOnly() { + return this._readOnly; + } + /** + * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead. + */ + static async ephemeral(options = {}) { + return getDefaultClient().volumes.ephemeral(options); + } + /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */ + closeEphemeral() { + if (this.#ephemeralHbManager) { + this.#ephemeralHbManager.stop(); + } else { + throw new InvalidError("Volume is not ephemeral."); + } + } +}; + +// src/config.ts +var import_node_fs = require("fs"); +var import_node_os = require("os"); +var import_node_path = __toESM(require("path"), 1); +var import_smol_toml = require("smol-toml"); +function configFilePath() { + const configPath = process.env["MODAL_CONFIG_PATH"]; + if (configPath && configPath !== "") { + return configPath; + } + return import_node_path.default.join((0, import_node_os.homedir)(), ".modal.toml"); +} +function readConfigFile() { + try { + const configPath = configFilePath(); + const configContent = (0, import_node_fs.readFileSync)(configPath, { + encoding: "utf-8" + }); + return (0, import_smol_toml.parse)(configContent); + } catch (err) { + if (err.code === "ENOENT") { + return {}; + } + return {}; + } +} +var config = readConfigFile(); +function getProfile(profileName) { + if (!profileName) { + for (const [name, profileData2] of Object.entries(config)) { + if (profileData2.active) { + profileName = name; + break; + } + } + } + const profileData = profileName && Object.hasOwn(config, profileName) ? config[profileName] : {}; + const profile = { + serverUrl: process.env["MODAL_SERVER_URL"] || profileData.server_url || "https://api.modal.com:443", + tokenId: process.env["MODAL_TOKEN_ID"] || profileData.token_id, + tokenSecret: process.env["MODAL_TOKEN_SECRET"] || profileData.token_secret, + environment: process.env["MODAL_ENVIRONMENT"] || profileData.environment, + imageBuilderVersion: process.env["MODAL_IMAGE_BUILDER_VERSION"] || profileData.imageBuilderVersion, + logLevel: process.env["MODAL_LOGLEVEL"] || profileData.loglevel + }; + return profile; +} + +// src/auth_token_manager.ts +var REFRESH_WINDOW = 5 * 60; +var DEFAULT_EXPIRY_OFFSET = 20 * 60; +var AuthTokenManager = class { + client; + logger; + currentToken = ""; + tokenExpiry = 0; + stopped = false; + timeoutId = null; + initialTokenPromise = null; + constructor(client2, logger) { + this.client = client2; + this.logger = logger; + } + /** + * Returns the current cached token. + * If the initial token fetch is still in progress, waits for it to complete. + */ + async getToken() { + if (this.initialTokenPromise) { + await this.initialTokenPromise; + } + if (this.currentToken && !this.isExpired()) { + return this.currentToken; + } + throw new Error("No valid auth token available"); + } + /** + * Fetches a new auth token from the server and stores it. + */ + async fetchToken() { + const response = await this.client.authTokenGet({}); + const token = response.token; + if (!token) { + throw new Error( + "Internal error: did not receive auth token from server, please contact Modal support" + ); + } + this.currentToken = token; + const exp = this.decodeJWT(token); + if (exp > 0) { + this.tokenExpiry = exp; + } else { + this.logger.warn("x-modal-auth-token does not contain exp field"); + this.tokenExpiry = Math.floor(Date.now() / 1e3) + DEFAULT_EXPIRY_OFFSET; + } + const now = Math.floor(Date.now() / 1e3); + const expiresIn = this.tokenExpiry - now; + const refreshIn = this.tokenExpiry - now - REFRESH_WINDOW; + this.logger.debug( + "Fetched auth token", + "expires_in", + `${expiresIn}s`, + "refresh_in", + `${refreshIn}s` + ); + } + /** + * Background loop that refreshes tokens REFRESH_WINDOW seconds before they expire. + */ + async backgroundRefresh() { + while (!this.stopped) { + const now = Math.floor(Date.now() / 1e3); + const refreshTime = this.tokenExpiry - REFRESH_WINDOW; + const delay = Math.max(0, refreshTime - now) * 1e3; + await new Promise((resolve) => { + this.timeoutId = setTimeout(resolve, delay); + this.timeoutId.unref(); + }); + if (this.stopped) { + return; + } + try { + await this.fetchToken(); + } catch (error) { + this.logger.error("Failed to refresh auth token", "error", error); + await new Promise((resolve) => setTimeout(resolve, 5e3)); + } + } + } + /** + * Fetches the initial token and starts the refresh loop. + * Throws an error if the initial token fetch fails. + */ + async start() { + this.initialTokenPromise = this.fetchToken(); + try { + await this.initialTokenPromise; + } finally { + this.initialTokenPromise = null; + } + this.stopped = false; + this.backgroundRefresh(); + } + /** + * Stops the background refresh. + */ + stop() { + this.stopped = true; + if (this.timeoutId) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } + } + /** + * Extracts the exp claim from a JWT token. + */ + decodeJWT(token) { + try { + const parts = token.split("."); + if (parts.length !== 3) { + return 0; + } + let payload = parts[1]; + while (payload.length % 4 !== 0) { + payload += "="; + } + const decoded = atob(payload); + const claims = JSON.parse(decoded); + return claims.exp || 0; + } catch { + return 0; + } + } + isExpired() { + const now = Math.floor(Date.now() / 1e3); + return now >= this.tokenExpiry; + } + getCurrentToken() { + return this.currentToken; + } + setToken(token, expiry) { + this.currentToken = token; + this.tokenExpiry = expiry; + } +}; + +// src/version.ts +function getSDKVersion() { + return true ? "0.5.5" : "0.0.0"; +} + +// src/logger.ts +var LOG_LEVELS = { + debug: 0, + info: 1, + warn: 2, + error: 3 +}; +function parseLogLevel(level) { + if (!level) { + return "warn"; + } + const normalized = level.toLowerCase(); + if (normalized === "debug" || normalized === "info" || normalized === "warn" || normalized === "warning" || normalized === "error") { + return normalized === "warning" ? "warn" : normalized; + } + throw new Error( + `Invalid log level value: "${level}" (must be debug, info, warn, or error)` + ); +} +var DefaultLogger = class { + levelValue; + constructor(level = "warn") { + this.levelValue = LOG_LEVELS[level]; + } + debug(message, ...args) { + if (this.levelValue <= LOG_LEVELS.debug) { + console.log(this.formatMessage("DEBUG", message, args)); + } + } + info(message, ...args) { + if (this.levelValue <= LOG_LEVELS.info) { + console.log(this.formatMessage("INFO", message, args)); + } + } + warn(message, ...args) { + if (this.levelValue <= LOG_LEVELS.warn) { + console.warn(this.formatMessage("WARN", message, args)); + } + } + error(message, ...args) { + if (this.levelValue <= LOG_LEVELS.error) { + console.error(this.formatMessage("ERROR", message, args)); + } + } + formatMessage(level, message, args) { + const timestamp = (/* @__PURE__ */ new Date()).toISOString(); + let formatted = `time=${timestamp} level=${level} msg="${message}"`; + if (args.length > 0) { + for (let i = 0; i < args.length; i += 2) { + if (i + 1 < args.length) { + const key = args[i]; + const value = args[i + 1]; + formatted += ` ${key}=${this.formatValue(value)}`; + } + } + } + return formatted; + } + formatValue(value) { + if (typeof value === "string") { + return value.includes(" ") ? `"${value}"` : value; + } + if (value instanceof Error) { + return `"${value.message}"`; + } + if (Array.isArray(value)) { + return `[${value.join(",")}]`; + } + return String(value); + } +}; +var FilteredLogger = class { + constructor(logger, level) { + this.logger = logger; + this.levelValue = LOG_LEVELS[level]; + } + levelValue; + debug(message, ...args) { + if (this.levelValue <= LOG_LEVELS.debug) { + this.logger.debug(message, ...args); + } + } + info(message, ...args) { + if (this.levelValue <= LOG_LEVELS.info) { + this.logger.info(message, ...args); + } + } + warn(message, ...args) { + if (this.levelValue <= LOG_LEVELS.warn) { + this.logger.warn(message, ...args); + } + } + error(message, ...args) { + if (this.levelValue <= LOG_LEVELS.error) { + this.logger.error(message, ...args); + } + } +}; +function createLogger(logger, logLevel = "") { + const level = parseLogLevel(logLevel); + if (logger) { + return new FilteredLogger(logger, level); + } + return new DefaultLogger(level); +} + +// src/client.ts +var ModalClient3 = class { + apps; + cloudBucketMounts; + cls; + functions; + functionCalls; + images; + proxies; + queues; + sandboxes; + sandboxSnapshots; + secrets; + volumes; + /** @ignore */ + cpClient; + profile; + logger; + ipClients; + authTokenManager = null; + customMiddleware; + constructor(params) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const baseProfile = getProfile(process.env["MODAL_PROFILE"]); + this.profile = { + ...baseProfile, + ...params?.tokenId && { tokenId: params.tokenId }, + ...params?.tokenSecret && { tokenSecret: params.tokenSecret }, + ...params?.environment && { environment: params.environment } + }; + const logLevelValue = params?.logLevel || this.profile.logLevel || ""; + this.logger = createLogger(params?.logger, logLevelValue); + this.logger.debug( + "Initializing Modal client", + "version", + getSDKVersion(), + "server_url", + this.profile.serverUrl + ); + this.customMiddleware = params?.grpcMiddleware ?? []; + this.ipClients = /* @__PURE__ */ new Map(); + this.cpClient = params?.cpClient ?? this.createClient(this.profile); + this.logger.debug("Modal client initialized successfully"); + this.apps = new AppService(this); + this.cloudBucketMounts = new CloudBucketMountService(this); + this.cls = new ClsService(this); + this.functions = new FunctionService(this); + this.functionCalls = new FunctionCallService(this); + this.images = new ImageService(this); + this.proxies = new ProxyService(this); + this.queues = new QueueService(this); + this.sandboxes = new SandboxService(this); + this.sandboxSnapshots = new SandboxSnapshotService(this); + this.secrets = new SecretService(this); + this.volumes = new VolumeService(this); + } + environmentName(environment) { + return environment || this.profile.environment || ""; + } + imageBuilderVersion(version) { + return version || this.profile.imageBuilderVersion || "2024.10"; + } + /** @ignore */ + ipClient(serverUrl) { + const existing = this.ipClients.get(serverUrl); + if (existing) { + return existing; + } + this.logger.debug("Creating input plane client", "server_url", serverUrl); + const profile = { ...this.profile, serverUrl }; + const newClient = this.createClient(profile); + this.ipClients.set(serverUrl, newClient); + return newClient; + } + close() { + this.logger.debug("Closing Modal client"); + if (this.authTokenManager) { + this.authTokenManager.stop(); + this.authTokenManager = null; + } + this.logger.debug("Modal client closed"); + } + version() { + return getSDKVersion(); + } + createClient(profile) { + const channel = (0, import_nice_grpc10.createChannel)(profile.serverUrl, void 0, { + "grpc.max_receive_message_length": 100 * 1024 * 1024, + "grpc.max_send_message_length": 100 * 1024 * 1024, + "grpc-node.flow_control_window": 64 * 1024 * 1024 + }); + let factory = (0, import_nice_grpc10.createClientFactory)().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(timeoutMiddleware); + for (const middleware of this.customMiddleware) { + factory = factory.use(middleware); + } + return factory.create(ModalClientDefinition, channel); + } + /** Middleware to retry transient errors and timeouts for unary requests. */ + retryMiddleware() { + const logger = this.logger; + return async function* retryMiddleware(call, options) { + const { + retries = 3, + baseDelay = 100, + maxDelay = 1e3, + delayFactor = 2, + additionalStatusCodes = [], + signal, + ...restOptions + } = options; + if (call.requestStream || call.responseStream || !retries) { + return yield* call.next(call.request, restOptions); + } + const retryableCodes = /* @__PURE__ */ new Set([ + ...retryableGrpcStatusCodes, + ...additionalStatusCodes + ]); + const idempotencyKey = (0, import_uuid.v4)(); + const startTime = Date.now(); + let attempt = 0; + let delayMs = baseDelay; + logger.debug("Sending gRPC request", "method", call.method.path); + while (true) { + const metadata = new import_nice_grpc10.Metadata(restOptions.metadata ?? {}); + metadata.set("x-idempotency-key", idempotencyKey); + metadata.set("x-retry-attempt", String(attempt)); + if (attempt > 0) { + metadata.set( + "x-retry-delay", + ((Date.now() - startTime) / 1e3).toFixed(3) + ); + } + try { + return yield* call.next(call.request, { + ...restOptions, + metadata, + signal + }); + } catch (err) { + if (!(err instanceof import_nice_grpc10.ClientError) || !retryableCodes.has(err.code) || attempt >= retries) { + if (attempt === retries && attempt > 0) { + logger.debug( + "Final retry attempt failed", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8) + ); + } + throw err; + } + if (attempt > 0) { + logger.debug( + "Retryable failure", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8) + ); + } + await sleep(delayMs, signal); + delayMs = Math.min(delayMs * delayFactor, maxDelay); + attempt += 1; + } + } + }; + } + authMiddleware(profile) { + const getOrCreateAuthTokenManager = () => { + if (!this.authTokenManager) { + this.authTokenManager = new AuthTokenManager( + this.cpClient, + this.logger + ); + this.authTokenManager.start(); + } + return this.authTokenManager; + }; + return async function* authMiddleware(call, options) { + if (!profile.tokenId || !profile.tokenSecret) { + throw new Error( + `Profile is missing token_id or token_secret. Please set them in .modal.toml, or as environment variables, or via ModalClient constructor.` + ); + } + const { tokenId, tokenSecret } = profile; + options.metadata ??= new import_nice_grpc10.Metadata(); + options.metadata.set( + "x-modal-client-type", + String(8 /* CLIENT_TYPE_LIBMODAL_JS */) + ); + options.metadata.set("x-modal-client-version", "1.0.0"); + options.metadata.set( + "x-modal-libmodal-version", + `modal-js/${getSDKVersion()}` + ); + options.metadata.set("x-modal-token-id", tokenId); + options.metadata.set("x-modal-token-secret", tokenSecret); + if (call.method.path !== "/modal.client.ModalClient/AuthTokenGet") { + const tokenManager = getOrCreateAuthTokenManager(); + const token = await tokenManager.getToken(); + if (token) { + options.metadata.set("x-modal-auth-token", token); + } + } + return yield* call.next(call.request, options); + }; + } +}; +var timeoutMiddleware = async function* timeoutMiddleware2(call, options) { + if (!options.timeoutMs || options.signal?.aborted) { + return yield* call.next(call.request, options); + } + const { timeoutMs, signal: origSignal, ...restOptions } = options; + const abortController = new AbortController(); + const abortListener = () => abortController.abort(); + origSignal?.addEventListener("abort", abortListener); + let timedOut = false; + const timer = setTimeout(() => { + timedOut = true; + abortController.abort(); + }, timeoutMs); + try { + return yield* call.next(call.request, { + ...restOptions, + signal: abortController.signal + }); + } finally { + origSignal?.removeEventListener("abort", abortListener); + clearTimeout(timer); + if (timedOut) { + throw new import_nice_grpc10.ClientError( + call.method.path, + import_nice_grpc10.Status.DEADLINE_EXCEEDED, + `Timed out after ${timeoutMs}ms` + ); + } + } +}; +var retryableGrpcStatusCodes = /* @__PURE__ */ new Set([ + import_nice_grpc10.Status.DEADLINE_EXCEEDED, + import_nice_grpc10.Status.UNAVAILABLE, + import_nice_grpc10.Status.CANCELLED, + import_nice_grpc10.Status.INTERNAL, + import_nice_grpc10.Status.UNKNOWN +]); +function isRetryableGrpc(err) { + if (err instanceof import_nice_grpc10.ClientError) { + return retryableGrpcStatusCodes.has(err.code); + } + return false; +} +var sleep = (ms, signal) => new Promise((resolve, reject) => { + if (signal?.aborted) return reject(signal.reason); + const t = setTimeout(resolve, ms); + signal?.addEventListener( + "abort", + () => { + clearTimeout(t); + reject(signal.reason); + }, + { once: true } + ); +}); +var defaultClient; +var defaultClientOptions; +function getDefaultClient() { + if (!defaultClient) { + defaultClient = new ModalClient3(defaultClientOptions); + } + return defaultClient; +} +var client = new Proxy({}, { + get(_target, prop) { + return getDefaultClient().cpClient[prop]; + } +}); +function initializeClient(options) { + defaultClientOptions = { + tokenId: options.tokenId, + tokenSecret: options.tokenSecret, + environment: options.environment + }; + defaultClient = new ModalClient3(defaultClientOptions); +} +function close() { + if (defaultClient) { + defaultClient.close(); + } +} + +// src/app.ts +var AppService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a deployed {@link App} by name, or create if it does not exist. + */ + async fromName(name, params = {}) { + try { + const resp = await this.#client.cpClient.appGetOrCreate({ + appName: name, + environmentName: this.#client.environmentName(params.environment), + objectCreationType: params.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */ + }); + this.#client.logger.debug( + "Retrieved App", + "app_id", + resp.appId, + "app_name", + name + ); + return new App2(resp.appId, name); + } catch (err) { + if (err instanceof import_nice_grpc11.ClientError && err.code === import_nice_grpc11.Status.NOT_FOUND) + throw new NotFoundError(`App '${name}' not found`); + throw err; + } + } +}; +function parseGpuConfig(gpu) { + if (!gpu) { + return GPUConfig.create({}); + } + let gpuType = gpu; + let count = 1; + if (gpu.includes(":")) { + const [type, countStr] = gpu.split(":", 2); + gpuType = type; + count = parseInt(countStr, 10); + if (isNaN(count) || count < 1) { + throw new Error( + `Invalid GPU count: ${countStr}. Value must be a positive integer.` + ); + } + } + return GPUConfig.create({ + count, + gpuType: gpuType.toUpperCase() + }); +} +var App2 = class { + appId; + name; + /** @ignore */ + constructor(appId, name) { + this.appId = appId; + this.name = name; + } + /** + * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. + */ + // eslint-disable-next-line @typescript-eslint/no-deprecated + static async lookup(name, options = {}) { + return getDefaultClient().apps.fromName(name, options); + } + /** + * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead. + */ + async createSandbox(image, options = {}) { + return getDefaultClient().sandboxes.create(this, image, options); + } + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + async imageFromRegistry(tag, secret) { + return getDefaultClient().images.fromRegistry(tag, secret).build(this); + } + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + async imageFromAwsEcr(tag, secret) { + return getDefaultClient().images.fromAwsEcr(tag, secret).build(this); + } + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + async imageFromGcpArtifactRegistry(tag, secret) { + return getDefaultClient().images.fromGcpArtifactRegistry(tag, secret).build(this); + } +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + AlreadyExistsError, + App, + AppService, + CloudBucketMount, + CloudBucketMountService, + Cls, + ClsInstance, + ClsService, + ContainerProcess, + FunctionCall, + FunctionCallService, + FunctionService, + FunctionTimeoutError, + Function_, + Image, + ImageService, + InternalFailure, + InvalidError, + ModalClient, + NotFoundError, + Proxy, + ProxyService, + Queue, + QueueEmptyError, + QueueFullError, + QueueService, + RemoteError, + Retries, + Sandbox, + SandboxFile, + SandboxService, + SandboxSnapshot, + SandboxSnapshotService, + SandboxTimeoutError, + Secret, + SecretService, + Volume, + VolumeService, + checkForRenamedParams, + close, + initializeClient +}); diff --git a/modal-js/dist/index.d.cts b/modal-js/dist/index.d.cts new file mode 100644 index 00000000..beb863cf --- /dev/null +++ b/modal-js/dist/index.d.cts @@ -0,0 +1,6246 @@ +import { Client, Status, ClientMiddleware } from 'nice-grpc'; +import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire'; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +interface Empty { +} +declare const Empty: MessageFns$1; +type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined; +type DeepPartial$1 = T extends Builtin$1 ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial$1; +} : Partial; +interface MessageFns$1 { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial$1): T; + fromPartial(object: DeepPartial$1): T; +} + +declare enum AppDeployVisibility { + APP_DEPLOY_VISIBILITY_UNSPECIFIED = 0, + APP_DEPLOY_VISIBILITY_WORKSPACE = 1, + APP_DEPLOY_VISIBILITY_PUBLIC = 2, + UNRECOGNIZED = -1 +} +declare enum AppDisconnectReason { + APP_DISCONNECT_REASON_UNSPECIFIED = 0, + APP_DISCONNECT_REASON_LOCAL_EXCEPTION = 1, + APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT = 2, + APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED = 3, + APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION = 4, + APP_DISCONNECT_REASON_REMOTE_EXCEPTION = 5, + UNRECOGNIZED = -1 +} +/** + * NOTE: make sure to update the frontend if we add a new state here + * https://github.com/modal-labs/modal/blob/main/frontend/src/routes/(dashboard)/%5B%5Bworkspace%5D%5D/apps/+page.svelte#L95 + */ +declare enum AppState { + APP_STATE_UNSPECIFIED = 0, + /** APP_STATE_EPHEMERAL - Will be discharged when the client disconnects */ + APP_STATE_EPHEMERAL = 1, + APP_STATE_DETACHED = 2, + /** APP_STATE_DEPLOYED - Will be discharged when overwritten */ + APP_STATE_DEPLOYED = 3, + /** APP_STATE_STOPPING - Winding down app due to user termination. */ + APP_STATE_STOPPING = 4, + /** APP_STATE_STOPPED - Stopped */ + APP_STATE_STOPPED = 5, + /** APP_STATE_INITIALIZING - App is created and in process of deployment. */ + APP_STATE_INITIALIZING = 6, + /** APP_STATE_DISABLED - Same as stopped but prevented from being garbage collected */ + APP_STATE_DISABLED = 7, + /** APP_STATE_DETACHED_DISCONNECTED - App is detached and local client has disconnected. */ + APP_STATE_DETACHED_DISCONNECTED = 8, + /** + * APP_STATE_DERIVED - App is derived from another workspace. Acts as a static, immutable group of functions. + * + * @deprecated + */ + APP_STATE_DERIVED = 9, + UNRECOGNIZED = -1 +} +declare enum AppStopSource { + APP_STOP_SOURCE_UNSPECIFIED = 0, + APP_STOP_SOURCE_CLI = 1, + APP_STOP_SOURCE_PYTHON_CLIENT = 2, + APP_STOP_SOURCE_WEB = 3, + UNRECOGNIZED = -1 +} +declare enum CertificateStatus { + CERTIFICATE_STATUS_PENDING = 0, + CERTIFICATE_STATUS_ISSUED = 1, + CERTIFICATE_STATUS_FAILED = 2, + CERTIFICATE_STATUS_REVOKED = 3, + UNRECOGNIZED = -1 +} +declare enum CheckpointStatus { + CHECKPOINT_STATUS_UNSPECIFIED = 0, + CHECKPOINT_STATUS_PENDING = 1, + CHECKPOINT_STATUS_PROCESSING = 2, + CHECKPOINT_STATUS_READY = 3, + CHECKPOINT_STATUS_FAILED = 4, + UNRECOGNIZED = -1 +} +declare enum CloudProvider { + CLOUD_PROVIDER_UNSPECIFIED = 0, + CLOUD_PROVIDER_AWS = 1, + CLOUD_PROVIDER_GCP = 2, + CLOUD_PROVIDER_AUTO = 3, + CLOUD_PROVIDER_OCI = 4, + UNRECOGNIZED = -1 +} +declare enum DNSRecordType { + DNS_RECORD_TYPE_A = 0, + DNS_RECORD_TYPE_TXT = 1, + DNS_RECORD_TYPE_CNAME = 2, + UNRECOGNIZED = -1 +} +/** Which data format a binary message is encoded with. */ +declare enum DataFormat { + DATA_FORMAT_UNSPECIFIED = 0, + /** DATA_FORMAT_PICKLE - Cloudpickle */ + DATA_FORMAT_PICKLE = 1, + /** DATA_FORMAT_ASGI - "Asgi" protobuf message */ + DATA_FORMAT_ASGI = 2, + /** DATA_FORMAT_GENERATOR_DONE - "GeneratorDone" protobuf message */ + DATA_FORMAT_GENERATOR_DONE = 3, + DATA_FORMAT_CBOR = 4, + UNRECOGNIZED = -1 +} +declare enum DeploymentNamespace { + DEPLOYMENT_NAMESPACE_UNSPECIFIED = 0, + DEPLOYMENT_NAMESPACE_WORKSPACE = 1, + DEPLOYMENT_NAMESPACE_GLOBAL = 3, + UNRECOGNIZED = -1 +} +declare enum ExecOutputOption { + EXEC_OUTPUT_OPTION_UNSPECIFIED = 0, + EXEC_OUTPUT_OPTION_DEVNULL = 1, + EXEC_OUTPUT_OPTION_PIPE = 2, + EXEC_OUTPUT_OPTION_STDOUT = 3, + UNRECOGNIZED = -1 +} +declare enum FileDescriptor { + FILE_DESCRIPTOR_UNSPECIFIED = 0, + FILE_DESCRIPTOR_STDOUT = 1, + FILE_DESCRIPTOR_STDERR = 2, + FILE_DESCRIPTOR_INFO = 3, + UNRECOGNIZED = -1 +} +declare enum FunctionCallInvocationType { + FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED = 0, + FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY = 1, + FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY = 2, + FUNCTION_CALL_INVOCATION_TYPE_ASYNC = 3, + FUNCTION_CALL_INVOCATION_TYPE_SYNC = 4, + UNRECOGNIZED = -1 +} +declare enum FunctionCallType { + FUNCTION_CALL_TYPE_UNSPECIFIED = 0, + FUNCTION_CALL_TYPE_UNARY = 1, + FUNCTION_CALL_TYPE_MAP = 2, + UNRECOGNIZED = -1 +} +declare enum GPUType { + /** + * GPU_TYPE_UNSPECIFIED - Note: this enum is no longer used by current clients - don't add new types + * Old clients still send it, so we use it server-side for compatibility + */ + GPU_TYPE_UNSPECIFIED = 0, + GPU_TYPE_T4 = 1, + GPU_TYPE_A100 = 2, + GPU_TYPE_A10G = 3, + GPU_TYPE_ANY = 4, + GPU_TYPE_A100_80GB = 8, + GPU_TYPE_L4 = 9, + GPU_TYPE_H100 = 10, + GPU_TYPE_L40S = 11, + GPU_TYPE_H200 = 12, + UNRECOGNIZED = -1 +} +declare enum ObjectCreationType { + /** OBJECT_CREATION_TYPE_UNSPECIFIED - just lookup */ + OBJECT_CREATION_TYPE_UNSPECIFIED = 0, + OBJECT_CREATION_TYPE_CREATE_IF_MISSING = 1, + OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS = 2, + OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS = 3, + /** OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP - deprecate at some point */ + OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP = 4, + OBJECT_CREATION_TYPE_EPHEMERAL = 5, + UNRECOGNIZED = -1 +} +declare enum ParameterType { + PARAM_TYPE_UNSPECIFIED = 0, + PARAM_TYPE_STRING = 1, + PARAM_TYPE_INT = 2, + /** PARAM_TYPE_PICKLE - currently unused */ + PARAM_TYPE_PICKLE = 3, + PARAM_TYPE_BYTES = 4, + /** PARAM_TYPE_UNKNOWN - used in schemas to signify unrecognized or un-annotated types */ + PARAM_TYPE_UNKNOWN = 5, + PARAM_TYPE_LIST = 6, + PARAM_TYPE_DICT = 7, + PARAM_TYPE_NONE = 8, + PARAM_TYPE_BOOL = 9, + UNRECOGNIZED = -1 +} +declare enum ProgressType { + /** IMAGE_SNAPSHOT_UPLOAD - TODO(erikbern): shouldn't be zero, and needs prefix */ + IMAGE_SNAPSHOT_UPLOAD = 0, + /** FUNCTION_QUEUED - TODO(erikbern): needs_prefix */ + FUNCTION_QUEUED = 1, + UNRECOGNIZED = -1 +} +declare enum ProxyIpStatus { + PROXY_IP_STATUS_UNSPECIFIED = 0, + PROXY_IP_STATUS_CREATING = 1, + PROXY_IP_STATUS_ONLINE = 2, + PROXY_IP_STATUS_TERMINATED = 3, + PROXY_IP_STATUS_UNHEALTHY = 4, + UNRECOGNIZED = -1 +} +declare enum RateLimitInterval { + RATE_LIMIT_INTERVAL_UNSPECIFIED = 0, + RATE_LIMIT_INTERVAL_SECOND = 1, + RATE_LIMIT_INTERVAL_MINUTE = 2, + UNRECOGNIZED = -1 +} +declare enum RegistryAuthType { + /** REGISTRY_AUTH_TYPE_UNSPECIFIED - Older clients send this instead of "public". */ + REGISTRY_AUTH_TYPE_UNSPECIFIED = 0, + REGISTRY_AUTH_TYPE_AWS = 1, + REGISTRY_AUTH_TYPE_GCP = 2, + REGISTRY_AUTH_TYPE_PUBLIC = 3, + REGISTRY_AUTH_TYPE_STATIC_CREDS = 4, + UNRECOGNIZED = -1 +} +declare enum SeekWhence { + SEEK_SET = 0, + SEEK_CUR = 1, + SEEK_END = 2, + UNRECOGNIZED = -1 +} +declare enum SystemErrorCode { + SYSTEM_ERROR_CODE_UNSPECIFIED = 0, + /** SYSTEM_ERROR_CODE_PERM - EPERM: Operation not permitted */ + SYSTEM_ERROR_CODE_PERM = 1, + /** SYSTEM_ERROR_CODE_NOENT - ENOENT: No such file or directory */ + SYSTEM_ERROR_CODE_NOENT = 2, + /** SYSTEM_ERROR_CODE_IO - EIO: Input/output error */ + SYSTEM_ERROR_CODE_IO = 5, + /** SYSTEM_ERROR_CODE_NXIO - ENXIO: No such device or address */ + SYSTEM_ERROR_CODE_NXIO = 6, + /** SYSTEM_ERROR_CODE_NOMEM - ENOMEM: Out of memory */ + SYSTEM_ERROR_CODE_NOMEM = 12, + /** SYSTEM_ERROR_CODE_ACCES - EACCES: Permission denied */ + SYSTEM_ERROR_CODE_ACCES = 13, + /** SYSTEM_ERROR_CODE_EXIST - EEXIST: File exists */ + SYSTEM_ERROR_CODE_EXIST = 17, + /** SYSTEM_ERROR_CODE_NOTDIR - ENOTDIR: Not a directory */ + SYSTEM_ERROR_CODE_NOTDIR = 20, + /** SYSTEM_ERROR_CODE_ISDIR - EISDIR: Is a directory */ + SYSTEM_ERROR_CODE_ISDIR = 21, + /** SYSTEM_ERROR_CODE_INVAL - EINVAL: Invalid argument */ + SYSTEM_ERROR_CODE_INVAL = 22, + /** SYSTEM_ERROR_CODE_MFILE - EMFILE: Too many open files */ + SYSTEM_ERROR_CODE_MFILE = 24, + /** SYSTEM_ERROR_CODE_FBIG - EFBIG: File too large */ + SYSTEM_ERROR_CODE_FBIG = 27, + /** SYSTEM_ERROR_CODE_NOSPC - ENOSPC: No space left on device */ + SYSTEM_ERROR_CODE_NOSPC = 28, + UNRECOGNIZED = -1 +} +declare enum TaskSnapshotBehavior { + TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED = 0, + TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT = 1, + TASK_SNAPSHOT_BEHAVIOR_RESTORE = 2, + TASK_SNAPSHOT_BEHAVIOR_NONE = 3, + UNRECOGNIZED = -1 +} +declare enum TaskState { + TASK_STATE_UNSPECIFIED = 0, + TASK_STATE_CREATED = 6, + TASK_STATE_QUEUED = 1, + TASK_STATE_WORKER_ASSIGNED = 2, + TASK_STATE_LOADING_IMAGE = 3, + TASK_STATE_ACTIVE = 4, + TASK_STATE_COMPLETED = 5, + TASK_STATE_CREATING_CONTAINER = 7, + TASK_STATE_IDLE = 8, + TASK_STATE_PREEMPTIBLE = 9, + TASK_STATE_PREEMPTED = 10, + TASK_STATE_LOADING_CHECKPOINT_IMAGE = 11, + UNRECOGNIZED = -1 +} +declare enum TunnelType { + TUNNEL_TYPE_UNSPECIFIED = 0, + /** TUNNEL_TYPE_H2 - HTTP/2 tunnel */ + TUNNEL_TYPE_H2 = 1, + UNRECOGNIZED = -1 +} +declare enum VolumeFsVersion { + VOLUME_FS_VERSION_UNSPECIFIED = 0, + VOLUME_FS_VERSION_V1 = 1, + VOLUME_FS_VERSION_V2 = 2, + UNRECOGNIZED = -1 +} +declare enum WebhookAsyncMode { + WEBHOOK_ASYNC_MODE_UNSPECIFIED = 0, + /** WEBHOOK_ASYNC_MODE_DISABLED - No longer used by client */ + WEBHOOK_ASYNC_MODE_DISABLED = 2, + /** WEBHOOK_ASYNC_MODE_TRIGGER - No longer used by client (previously used when wait_for_response=False) */ + WEBHOOK_ASYNC_MODE_TRIGGER = 3, + /** WEBHOOK_ASYNC_MODE_AUTO - The default */ + WEBHOOK_ASYNC_MODE_AUTO = 4, + UNRECOGNIZED = -1 +} +declare enum WebhookType { + WEBHOOK_TYPE_UNSPECIFIED = 0, + WEBHOOK_TYPE_ASGI_APP = 1, + WEBHOOK_TYPE_FUNCTION = 2, + WEBHOOK_TYPE_WSGI_APP = 3, + WEBHOOK_TYPE_WEB_SERVER = 4, + UNRECOGNIZED = -1 +} +declare enum ClassParameterInfo_ParameterSerializationFormat { + PARAM_SERIALIZATION_FORMAT_UNSPECIFIED = 0, + /** PARAM_SERIALIZATION_FORMAT_PICKLE - legacy format - pickle of (args, kwargs) tuple */ + PARAM_SERIALIZATION_FORMAT_PICKLE = 1, + /** PARAM_SERIALIZATION_FORMAT_PROTO - new format using api.FunctionParameterSet */ + PARAM_SERIALIZATION_FORMAT_PROTO = 2, + UNRECOGNIZED = -1 +} +declare enum CloudBucketMount_BucketType { + UNSPECIFIED = 0, + S3 = 1, + R2 = 2, + GCP = 3, + UNRECOGNIZED = -1 +} +declare enum FileEntry_FileType { + UNSPECIFIED = 0, + FILE = 1, + DIRECTORY = 2, + SYMLINK = 3, + FIFO = 4, + SOCKET = 5, + UNRECOGNIZED = -1 +} +declare enum Function_DefinitionType { + DEFINITION_TYPE_UNSPECIFIED = 0, + DEFINITION_TYPE_SERIALIZED = 1, + DEFINITION_TYPE_FILE = 2, + UNRECOGNIZED = -1 +} +declare enum Function_FunctionType { + FUNCTION_TYPE_UNSPECIFIED = 0, + FUNCTION_TYPE_GENERATOR = 1, + FUNCTION_TYPE_FUNCTION = 2, + UNRECOGNIZED = -1 +} +declare enum FunctionSchema_FunctionSchemaType { + FUNCTION_SCHEMA_UNSPECIFIED = 0, + FUNCTION_SCHEMA_V1 = 1, + UNRECOGNIZED = -1 +} +declare enum GenericResult_GenericStatus { + GENERIC_STATUS_UNSPECIFIED = 0, + GENERIC_STATUS_SUCCESS = 1, + GENERIC_STATUS_FAILURE = 2, + /** GENERIC_STATUS_TERMINATED - Used when a task was killed using an external signal. */ + GENERIC_STATUS_TERMINATED = 3, + GENERIC_STATUS_TIMEOUT = 4, + /** + * GENERIC_STATUS_INIT_FAILURE - Used when the user's function fails to initialize (ex. S3 mount failed due to invalid credentials). + * Terminates the function and all remaining inputs. + */ + GENERIC_STATUS_INIT_FAILURE = 5, + GENERIC_STATUS_INTERNAL_FAILURE = 6, + /** GENERIC_STATUS_IDLE_TIMEOUT - Used when sandboxes are terminated due to idle_timeout */ + GENERIC_STATUS_IDLE_TIMEOUT = 7, + UNRECOGNIZED = -1 +} +declare enum NetworkAccess_NetworkAccessType { + UNSPECIFIED = 0, + OPEN = 1, + BLOCKED = 2, + ALLOWLIST = 3, + UNRECOGNIZED = -1 +} +declare enum PTYInfo_PTYType { + /** PTY_TYPE_UNSPECIFIED - Nothing */ + PTY_TYPE_UNSPECIFIED = 0, + /** PTY_TYPE_FUNCTION - Run function in PTY */ + PTY_TYPE_FUNCTION = 1, + /** PTY_TYPE_SHELL - Replace function with shell */ + PTY_TYPE_SHELL = 2, + UNRECOGNIZED = -1 +} +declare enum SandboxRestoreRequest_SandboxNameOverrideType { + SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED = 0, + SANDBOX_NAME_OVERRIDE_TYPE_NONE = 1, + SANDBOX_NAME_OVERRIDE_TYPE_STRING = 2, + UNRECOGNIZED = -1 +} +declare enum Warning_WarningType { + WARNING_TYPE_UNSPECIFIED = 0, + WARNING_TYPE_CLIENT_DEPRECATION = 1, + WARNING_TYPE_RESOURCE_LIMIT = 2, + WARNING_TYPE_FUNCTION_CONFIGURATION = 3, + UNRECOGNIZED = -1 +} +interface AppClientDisconnectRequest { + appId: string; + reason: AppDisconnectReason; + exception: string; +} +declare const AppClientDisconnectRequest: MessageFns; +interface AppCreateRequest { + clientId: string; + /** Human readable label for the app */ + description: string; + environmentName: string; + appState: AppState; +} +declare const AppCreateRequest: MessageFns; +interface AppCreateResponse { + appId: string; + appPageUrl: string; + appLogsUrl: string; +} +declare const AppCreateResponse: MessageFns; +interface AppDeployRequest { + appId: string; + name: string; + objectEntity: string; + visibility: AppDeployVisibility; + tag: string; +} +declare const AppDeployRequest: MessageFns; +interface AppDeployResponse { + url: string; +} +declare const AppDeployResponse: MessageFns; +interface AppDeploymentHistory { + appId: string; + version: number; + clientVersion: string; + deployedAt: number; + deployedBy: string; + deployedByAvatarUrl: string; + tag: string; + rollbackVersion: number; + rollbackAllowed: boolean; + commitInfo?: CommitInfo | undefined; +} +declare const AppDeploymentHistory: MessageFns; +interface AppDeploymentHistoryRequest { + appId: string; +} +declare const AppDeploymentHistoryRequest: MessageFns; +interface AppDeploymentHistoryResponse { + appDeploymentHistories: AppDeploymentHistory[]; +} +declare const AppDeploymentHistoryResponse: MessageFns; +interface AppGetByDeploymentNameRequest { + name: string; + environmentName: string; +} +declare const AppGetByDeploymentNameRequest: MessageFns; +interface AppGetByDeploymentNameResponse { + appId: string; +} +declare const AppGetByDeploymentNameResponse: MessageFns; +interface AppGetLayoutRequest { + appId: string; +} +declare const AppGetLayoutRequest: MessageFns; +interface AppGetLayoutResponse { + appLayout: AppLayout | undefined; +} +declare const AppGetLayoutResponse: MessageFns; +interface AppGetLogsRequest { + appId: string; + timeout: number; + lastEntryId: string; + functionId: string; + inputId: string; + taskId: string; + functionCallId: string; + fileDescriptor: FileDescriptor; + sandboxId: string; +} +declare const AppGetLogsRequest: MessageFns; +interface AppGetObjectsItem { + tag: string; + object: Object_ | undefined; +} +declare const AppGetObjectsItem: MessageFns; +interface AppGetObjectsRequest { + appId: string; + includeUnindexed: boolean; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const AppGetObjectsRequest: MessageFns; +interface AppGetObjectsResponse { + items: AppGetObjectsItem[]; +} +declare const AppGetObjectsResponse: MessageFns; +interface AppGetOrCreateRequest { + appName: string; + environmentName: string; + objectCreationType: ObjectCreationType; +} +declare const AppGetOrCreateRequest: MessageFns; +interface AppGetOrCreateResponse { + appId: string; +} +declare const AppGetOrCreateResponse: MessageFns; +interface AppGetTagsRequest { + appId: string; +} +declare const AppGetTagsRequest: MessageFns; +interface AppGetTagsResponse { + tags: { + [key: string]: string; + }; +} +declare const AppGetTagsResponse: MessageFns; +interface AppHeartbeatRequest { + appId: string; +} +declare const AppHeartbeatRequest: MessageFns; +interface AppLayout { + objects: Object_[]; + /** tag -> function id */ + functionIds: { + [key: string]: string; + }; + /** tag -> class id */ + classIds: { + [key: string]: string; + }; +} +declare const AppLayout: MessageFns; +interface AppListRequest { + environmentName: string; +} +declare const AppListRequest: MessageFns; +interface AppListResponse { + apps: AppListResponse_AppListItem[]; +} +declare const AppListResponse: MessageFns; +interface AppListResponse_AppListItem { + appId: string; + description: string; + state: AppState; + createdAt: number; + stoppedAt: number; + nRunningTasks: number; + name: string; +} +declare const AppListResponse_AppListItem: MessageFns; +interface AppLookupRequest { + appName: string; + environmentName: string; +} +declare const AppLookupRequest: MessageFns; +interface AppLookupResponse { + appId: string; +} +declare const AppLookupResponse: MessageFns; +interface AppPublishRequest { + appId: string; + name: string; + /** Additional metadata to identify a deployment */ + deploymentTag: string; + /** Published app will be in this state */ + appState: AppState; + /** function_name -> function_id */ + functionIds: { + [key: string]: string; + }; + /** class_name -> class_id */ + classIds: { + [key: string]: string; + }; + /** function_id -> definition_id */ + definitionIds: { + [key: string]: string; + }; + /** Unused by client, but used internally */ + rollbackVersion: number; + /** Unused by client, but used internally */ + clientVersion: string; + /** Git information for deployment tracking */ + commitInfo: CommitInfo | undefined; + /** Additional metadata to attach to the App */ + tags: { + [key: string]: string; + }; +} +declare const AppPublishRequest: MessageFns; +interface AppPublishResponse { + url: string; + serverWarnings: Warning[]; +} +declare const AppPublishResponse: MessageFns; +interface AppRollbackRequest { + appId: string; + /** signed as we support negative "roll back n versions" requests */ + version: number; +} +declare const AppRollbackRequest: MessageFns; +interface AppSetObjectsRequest { + appId: string; + indexedObjectIds: { + [key: string]: string; + }; + clientId: string; + unindexedObjectIds: string[]; + /** promotes an app from initializing to this new state */ + newAppState: AppState; +} +declare const AppSetObjectsRequest: MessageFns; +interface AppSetTagsRequest { + appId: string; + tags: { + [key: string]: string; + }; +} +declare const AppSetTagsRequest: MessageFns; +interface AppStopRequest { + appId: string; + source: AppStopSource; +} +declare const AppStopRequest: MessageFns; +interface AttemptAwaitRequest { + attemptToken: string; + /** Used for waypoints. */ + requestedAt: number; + timeoutSecs: number; +} +declare const AttemptAwaitRequest: MessageFns; +interface AttemptAwaitResponse { + output?: FunctionGetOutputsItem | undefined; +} +declare const AttemptAwaitResponse: MessageFns; +interface AttemptRetryRequest { + functionId: string; + parentInputId: string; + input: FunctionPutInputsItem | undefined; + attemptToken: string; +} +declare const AttemptRetryRequest: MessageFns; +interface AttemptRetryResponse { + attemptToken: string; +} +declare const AttemptRetryResponse: MessageFns; +interface AttemptStartRequest { + functionId: string; + parentInputId: string; + input: FunctionPutInputsItem | undefined; +} +declare const AttemptStartRequest: MessageFns; +interface AttemptStartResponse { + attemptToken: string; + retryPolicy: FunctionRetryPolicy | undefined; +} +declare const AttemptStartResponse: MessageFns; +interface AuthTokenGetRequest { +} +declare const AuthTokenGetRequest: MessageFns; +interface AuthTokenGetResponse { + token: string; +} +declare const AuthTokenGetResponse: MessageFns; +/** + * A collection of user-configurable settings for Function autoscaling + * These are used for static configuration and for dynamic autoscaler updates + */ +interface AutoscalerSettings { + /** Minimum containers when scale-to-zero is not desired; pka "keep_warm" or "warm_pool_size" */ + minContainers?: number | undefined; + /** Limit on the number of containers that can be running for each Function; pka "concurrency_limit" */ + maxContainers?: number | undefined; + /** Additional container to spin up when Function is active */ + bufferContainers?: number | undefined; + /** Currently unused; a placeholder in case we decide to expose scaleup control to users */ + scaleupWindow?: number | undefined; + /** Maximum amount of time a container can be idle before being scaled down, in seconds; pka "container_idle_timeout" */ + scaledownWindow?: number | undefined; +} +declare const AutoscalerSettings: MessageFns; +/** Used for flash autoscaling */ +interface AutoscalingMetrics { + cpuUsagePercent: number; + memoryUsagePercent: number; + concurrentRequests: number; + timestamp: number; +} +declare const AutoscalingMetrics: MessageFns; +interface BaseImage { + imageId: string; + dockerTag: string; +} +declare const BaseImage: MessageFns; +interface BlobCreateRequest { + /** + * TODO(erikbern): how are these garbage collected? + * Shouldn't they belong to an app? + */ + contentMd5: string; + contentSha256Base64: string; + contentLength: number; +} +declare const BlobCreateRequest: MessageFns; +interface BlobCreateResponse { + blobId: string; + uploadUrl?: string | undefined; + multipart?: MultiPartUpload | undefined; + blobIds: string[]; + uploadUrls?: UploadUrlList | undefined; + multiparts?: MultiPartUploadList | undefined; +} +declare const BlobCreateResponse: MessageFns; +interface BlobGetRequest { + blobId: string; +} +declare const BlobGetRequest: MessageFns; +interface BlobGetResponse { + downloadUrl: string; +} +declare const BlobGetResponse: MessageFns; +interface BuildFunction { + definition: string; + globals: Uint8Array; + input: FunctionInput | undefined; +} +declare const BuildFunction: MessageFns; +interface CancelInputEvent { + inputIds: string[]; + terminateContainers: boolean; +} +declare const CancelInputEvent: MessageFns; +interface CheckpointInfo { + checksum: string; + status: CheckpointStatus; + checkpointId: string; + runtimeFingerprint: string; + size: number; + checksumIsFileIndex: boolean; + originalTaskId: string; + runscRuntimeVersion: string; +} +declare const CheckpointInfo: MessageFns; +interface ClassCreateRequest { + appId: string; + existingClassId: string; + methods: ClassMethod[]; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const ClassCreateRequest: MessageFns; +interface ClassCreateResponse { + classId: string; + handleMetadata: ClassHandleMetadata | undefined; +} +declare const ClassCreateResponse: MessageFns; +interface ClassGetRequest { + appName: string; + objectTag: string; + environmentName: string; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const ClassGetRequest: MessageFns; +interface ClassGetResponse { + classId: string; + handleMetadata: ClassHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const ClassGetResponse: MessageFns; +interface ClassHandleMetadata { + methods: ClassMethod[]; + classFunctionId: string; + classFunctionMetadata: FunctionHandleMetadata | undefined; +} +declare const ClassHandleMetadata: MessageFns; +interface ClassMethod { + functionName: string; + functionId: string; + /** Class methods need to hydrate all functions on the class */ + functionHandleMetadata: FunctionHandleMetadata | undefined; +} +declare const ClassMethod: MessageFns; +interface ClassParameterInfo { + format: ClassParameterInfo_ParameterSerializationFormat; + /** only set for PARAM_SERIALIZATION_FORMAT_PROTO */ + schema: ClassParameterSpec[]; +} +declare const ClassParameterInfo: MessageFns; +/** TODO: rename into NamedPayloadType or similar */ +interface ClassParameterSpec { + name: string; + /** TODO: deprecate - use full_type instead */ + type: ParameterType; + hasDefault: boolean; + /** Default *values* are only registered for class parameters */ + stringDefault?: string | undefined; + intDefault?: number | undefined; + pickleDefault?: Uint8Array | undefined; + bytesDefault?: Uint8Array | undefined; + boolDefault?: boolean | undefined; + /** supersedes `type` */ + fullType: GenericPayloadType | undefined; +} +declare const ClassParameterSpec: MessageFns; +interface ClientHelloResponse { + warning: string; + /** Deprecated, no longer used in client */ + imageBuilderVersion: string; + serverWarnings: Warning[]; +} +declare const ClientHelloResponse: MessageFns; +interface CloudBucketMount$1 { + bucketName: string; + mountPath: string; + credentialsSecretId: string; + readOnly: boolean; + bucketType: CloudBucketMount_BucketType; + requesterPays: boolean; + bucketEndpointUrl?: string | undefined; + keyPrefix?: string | undefined; + oidcAuthRoleArn?: string | undefined; +} +declare const CloudBucketMount$1: MessageFns; +interface ClusterGetRequest { + clusterId: string; +} +declare const ClusterGetRequest: MessageFns; +interface ClusterGetResponse { + cluster: ClusterStats | undefined; +} +declare const ClusterGetResponse: MessageFns; +interface ClusterListRequest { + environmentName: string; +} +declare const ClusterListRequest: MessageFns; +interface ClusterListResponse { + clusters: ClusterStats[]; +} +declare const ClusterListResponse: MessageFns; +interface ClusterStats { + appId: string; + taskIds: string[]; + clusterId: string; + /** Defined as start time of the first task in the cluster */ + startedAt: number; +} +declare const ClusterStats: MessageFns; +interface CommitInfo { + /** Only git is supported for now */ + vcs: string; + branch: string; + commitHash: string; + commitTimestamp: number; + dirty: boolean; + authorName: string; + authorEmail: string; + repoUrl: string; +} +declare const CommitInfo: MessageFns; +interface ContainerCheckpointRequest { + checkpointId: string; +} +declare const ContainerCheckpointRequest: MessageFns; +interface ContainerExecGetOutputRequest { + execId: string; + timeout: number; + lastBatchIndex: number; + fileDescriptor: FileDescriptor; + /** Old clients (up to 0.65.39) expect string output. Newer clients stream raw bytes */ + getRawBytes: boolean; +} +declare const ContainerExecGetOutputRequest: MessageFns; +interface ContainerExecPutInputRequest { + execId: string; + input: RuntimeInputMessage | undefined; +} +declare const ContainerExecPutInputRequest: MessageFns; +interface ContainerExecRequest { + taskId: string; + command: string[]; + /** + * If pty_info is provided, open a PTY, but also this container exec is treated an + * "interactive shell" request, and it will be terminated if messages are not periodically + * sent on the stdin stream on some interval (currently 40 seconds). + */ + ptyInfo?: PTYInfo | undefined; + /** + * Send SIGTERM to running container on exit of exec command. + * + * @deprecated + */ + terminateContainerOnExit: boolean; + /** For internal debugging use only. */ + runtimeDebug: boolean; + stdoutOutput: ExecOutputOption; + stderrOutput: ExecOutputOption; + timeoutSecs: number; + workdir?: string | undefined; + secretIds: string[]; +} +declare const ContainerExecRequest: MessageFns; +interface ContainerExecResponse { + execId: string; +} +declare const ContainerExecResponse: MessageFns; +interface ContainerExecWaitRequest { + execId: string; + timeout: number; +} +declare const ContainerExecWaitRequest: MessageFns; +interface ContainerExecWaitResponse { + exitCode?: number | undefined; + completed: boolean; +} +declare const ContainerExecWaitResponse: MessageFns; +interface ContainerFileCloseRequest { + fileDescriptor: string; +} +declare const ContainerFileCloseRequest: MessageFns; +interface ContainerFileDeleteBytesRequest { + fileDescriptor: string; + startInclusive?: number | undefined; + endExclusive?: number | undefined; +} +declare const ContainerFileDeleteBytesRequest: MessageFns; +interface ContainerFileFlushRequest { + fileDescriptor: string; +} +declare const ContainerFileFlushRequest: MessageFns; +interface ContainerFileLsRequest { + path: string; +} +declare const ContainerFileLsRequest: MessageFns; +interface ContainerFileMkdirRequest { + path: string; + makeParents: boolean; +} +declare const ContainerFileMkdirRequest: MessageFns; +interface ContainerFileOpenRequest { + /** file descriptor is hydrated when sent from server -> worker */ + fileDescriptor?: string | undefined; + path: string; + mode: string; +} +declare const ContainerFileOpenRequest: MessageFns; +interface ContainerFileReadLineRequest { + fileDescriptor: string; +} +declare const ContainerFileReadLineRequest: MessageFns; +interface ContainerFileReadRequest { + fileDescriptor: string; + n?: number | undefined; +} +declare const ContainerFileReadRequest: MessageFns; +interface ContainerFileRmRequest { + path: string; + recursive: boolean; +} +declare const ContainerFileRmRequest: MessageFns; +interface ContainerFileSeekRequest { + fileDescriptor: string; + offset: number; + whence: SeekWhence; +} +declare const ContainerFileSeekRequest: MessageFns; +interface ContainerFileWatchRequest { + path: string; + recursive: boolean; + timeoutSecs?: number | undefined; +} +declare const ContainerFileWatchRequest: MessageFns; +interface ContainerFileWriteReplaceBytesRequest { + fileDescriptor: string; + data: Uint8Array; + startInclusive?: number | undefined; + endExclusive?: number | undefined; +} +declare const ContainerFileWriteReplaceBytesRequest: MessageFns; +interface ContainerFileWriteRequest { + fileDescriptor: string; + data: Uint8Array; +} +declare const ContainerFileWriteRequest: MessageFns; +interface ContainerFilesystemExecGetOutputRequest { + execId: string; + timeout: number; +} +declare const ContainerFilesystemExecGetOutputRequest: MessageFns; +interface ContainerFilesystemExecRequest { + fileOpenRequest?: ContainerFileOpenRequest | undefined; + fileWriteRequest?: ContainerFileWriteRequest | undefined; + fileReadRequest?: ContainerFileReadRequest | undefined; + fileFlushRequest?: ContainerFileFlushRequest | undefined; + fileReadLineRequest?: ContainerFileReadLineRequest | undefined; + fileSeekRequest?: ContainerFileSeekRequest | undefined; + fileDeleteBytesRequest?: ContainerFileDeleteBytesRequest | undefined; + fileWriteReplaceBytesRequest?: ContainerFileWriteReplaceBytesRequest | undefined; + fileCloseRequest?: ContainerFileCloseRequest | undefined; + fileLsRequest?: ContainerFileLsRequest | undefined; + fileMkdirRequest?: ContainerFileMkdirRequest | undefined; + fileRmRequest?: ContainerFileRmRequest | undefined; + fileWatchRequest?: ContainerFileWatchRequest | undefined; + taskId: string; +} +declare const ContainerFilesystemExecRequest: MessageFns; +interface ContainerFilesystemExecResponse { + execId: string; + /** only set when the request opens a new file, i.e., ContainerFileOpenRequest */ + fileDescriptor?: string | undefined; +} +declare const ContainerFilesystemExecResponse: MessageFns; +interface ContainerHeartbeatRequest { + /** Bad client version. */ + canceledInputsReturnOutputs: boolean; + canceledInputsReturnOutputsV2: boolean; +} +declare const ContainerHeartbeatRequest: MessageFns; +interface ContainerHeartbeatResponse { + cancelInputEvent?: CancelInputEvent | undefined; +} +declare const ContainerHeartbeatResponse: MessageFns; +interface ContainerLogRequest { + logs: TaskLogs[]; +} +declare const ContainerLogRequest: MessageFns; +interface ContainerReloadVolumesRequest { + taskId: string; +} +declare const ContainerReloadVolumesRequest: MessageFns; +interface ContainerReloadVolumesResponse { +} +declare const ContainerReloadVolumesResponse: MessageFns; +interface ContainerStopRequest { + taskId: string; +} +declare const ContainerStopRequest: MessageFns; +interface ContainerStopResponse { +} +declare const ContainerStopResponse: MessageFns; +interface CreationInfo { + /** This message is used in metadata for resource objects like Dict, Queue, Volume, etc. */ + createdAt: number; + /** User name or service name */ + createdBy: string; +} +declare const CreationInfo: MessageFns; +interface CustomDomainConfig { + name: string; +} +declare const CustomDomainConfig: MessageFns; +interface CustomDomainInfo { + url: string; +} +declare const CustomDomainInfo: MessageFns; +interface DNSRecord { + type: DNSRecordType; + name: string; + value: string; +} +declare const DNSRecord: MessageFns; +/** Chunks of data that can be streamed in and out of tasks. */ +interface DataChunk { + dataFormat: DataFormat; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** Index of this data chunk in the stream. */ + index: number; +} +declare const DataChunk: MessageFns; +interface DictClearRequest { + dictId: string; +} +declare const DictClearRequest: MessageFns; +interface DictContainsRequest { + dictId: string; + key: Uint8Array; +} +declare const DictContainsRequest: MessageFns; +interface DictContainsResponse { + found: boolean; +} +declare const DictContainsResponse: MessageFns; +interface DictContentsRequest { + dictId: string; + /** + * Setting these to True will populate the corresponding field in the response, otherwise it will be null + * This lets us support the keys/values/items SDK API through one RPC without unnecessary data transfer + */ + keys: boolean; + values: boolean; +} +declare const DictContentsRequest: MessageFns; +interface DictDeleteRequest { + dictId: string; +} +declare const DictDeleteRequest: MessageFns; +interface DictEntry { + key: Uint8Array; + value: Uint8Array; +} +declare const DictEntry: MessageFns; +interface DictGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + data: DictEntry[]; +} +declare const DictGetOrCreateRequest: MessageFns; +interface DictGetOrCreateResponse { + dictId: string; + metadata: DictMetadata | undefined; +} +declare const DictGetOrCreateResponse: MessageFns; +interface DictGetRequest { + dictId: string; + key: Uint8Array; +} +declare const DictGetRequest: MessageFns; +interface DictGetResponse { + found: boolean; + value?: Uint8Array | undefined; +} +declare const DictGetResponse: MessageFns; +interface DictHeartbeatRequest { + dictId: string; +} +declare const DictHeartbeatRequest: MessageFns; +interface DictLenRequest { + dictId: string; +} +declare const DictLenRequest: MessageFns; +interface DictLenResponse { + len: number; +} +declare const DictLenResponse: MessageFns; +interface DictListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const DictListRequest: MessageFns; +interface DictListResponse { + dicts: DictListResponse_DictInfo[]; + environmentName: string; +} +declare const DictListResponse: MessageFns; +interface DictListResponse_DictInfo { + name: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + dictId: string; + metadata: DictMetadata | undefined; +} +declare const DictListResponse_DictInfo: MessageFns; +interface DictMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const DictMetadata: MessageFns; +interface DictPopRequest { + dictId: string; + key: Uint8Array; +} +declare const DictPopRequest: MessageFns; +interface DictPopResponse { + found: boolean; + value?: Uint8Array | undefined; +} +declare const DictPopResponse: MessageFns; +interface DictUpdateRequest { + dictId: string; + updates: DictEntry[]; + ifNotExists: boolean; +} +declare const DictUpdateRequest: MessageFns; +interface DictUpdateResponse { + created: boolean; +} +declare const DictUpdateResponse: MessageFns; +interface Domain { + domainId: string; + domainName: string; + createdAt: number; + certificateStatus: CertificateStatus; + dnsRecords: DNSRecord[]; +} +declare const Domain: MessageFns; +interface DomainCertificateVerifyRequest { + domainId: string; +} +declare const DomainCertificateVerifyRequest: MessageFns; +interface DomainCertificateVerifyResponse { + domain: Domain | undefined; +} +declare const DomainCertificateVerifyResponse: MessageFns; +interface DomainCreateRequest { + domainName: string; +} +declare const DomainCreateRequest: MessageFns; +interface DomainCreateResponse { + domainId: string; + dnsRecords: DNSRecord[]; +} +declare const DomainCreateResponse: MessageFns; +interface DomainListRequest { +} +declare const DomainListRequest: MessageFns; +interface DomainListResponse { + domains: Domain[]; +} +declare const DomainListResponse: MessageFns; +interface EnvironmentCreateRequest { + name: string; +} +declare const EnvironmentCreateRequest: MessageFns; +interface EnvironmentDeleteRequest { + name: string; +} +declare const EnvironmentDeleteRequest: MessageFns; +interface EnvironmentGetOrCreateRequest { + deploymentName: string; + objectCreationType: ObjectCreationType; +} +declare const EnvironmentGetOrCreateRequest: MessageFns; +interface EnvironmentGetOrCreateResponse { + environmentId: string; + metadata: EnvironmentMetadata | undefined; +} +declare const EnvironmentGetOrCreateResponse: MessageFns; +interface EnvironmentListItem { + name: string; + webhookSuffix: string; + createdAt: number; + default: boolean; + isManaged: boolean; + environmentId: string; +} +declare const EnvironmentListItem: MessageFns; +interface EnvironmentListResponse { + items: EnvironmentListItem[]; +} +declare const EnvironmentListResponse: MessageFns; +interface EnvironmentMetadata { + name: string; + settings: EnvironmentSettings | undefined; +} +declare const EnvironmentMetadata: MessageFns; +/** + * Environment-scoped settings, with workspace-level defaults. + * Note that we use MergeFrom to combine workspace / environment settings, + * which will *append* any `repeated` fields! + */ +interface EnvironmentSettings { + imageBuilderVersion: string; + webhookSuffix: string; +} +declare const EnvironmentSettings: MessageFns; +interface EnvironmentUpdateRequest { + currentName: string; + name: string | undefined; + webSuffix: string | undefined; +} +declare const EnvironmentUpdateRequest: MessageFns; +/** A file entry when listing files in a volume or network file system. */ +interface FileEntry { + path: string; + type: FileEntry_FileType; + mtime: number; + size: number; +} +declare const FileEntry: MessageFns; +interface FilesystemRuntimeOutputBatch { + output: Uint8Array[]; + error?: SystemErrorMessage | undefined; + batchIndex: number; + eof: boolean; +} +declare const FilesystemRuntimeOutputBatch: MessageFns; +interface FlashContainerDeregisterRequest { + serviceName: string; +} +declare const FlashContainerDeregisterRequest: MessageFns; +interface FlashContainerListRequest { + functionId: string; +} +declare const FlashContainerListRequest: MessageFns; +interface FlashContainerListResponse { + containers: FlashContainerListResponse_Container[]; +} +declare const FlashContainerListResponse: MessageFns; +interface FlashContainerListResponse_Container { + taskId: string; + host: string; + port: number; +} +declare const FlashContainerListResponse_Container: MessageFns; +interface FlashContainerRegisterRequest { + /** not used? */ + serviceName: string; + priority: number; + weight: number; + host: string; + port: number; +} +declare const FlashContainerRegisterRequest: MessageFns; +interface FlashContainerRegisterResponse { + url: string; +} +declare const FlashContainerRegisterResponse: MessageFns; +interface FlashSetTargetSlotsMetricsRequest { + /** TODO(claudia): add other metrics to use in autoscaling decisions */ + functionId: string; + targetSlots: number; +} +declare const FlashSetTargetSlotsMetricsRequest: MessageFns; +interface FlashSetTargetSlotsMetricsResponse { +} +declare const FlashSetTargetSlotsMetricsResponse: MessageFns; +interface FunctionMessage { + moduleName: string; + functionName: string; + mountIds: string[]; + imageId: string; + functionSerialized: Uint8Array; + definitionType: Function_DefinitionType; + functionType: Function_FunctionType; + resources: Resources | undefined; + secretIds: string[]; + rateLimit: RateLimit | undefined; + webhookConfig: WebhookConfig | undefined; + sharedVolumeMounts: SharedVolumeMount[]; + proxyId?: string | undefined; + retryPolicy: FunctionRetryPolicy | undefined; + /** To be replaced by autoscaler_settings.max_containers */ + concurrencyLimit: number; + timeoutSecs: number; + ptyInfo: PTYInfo | undefined; + classSerialized: Uint8Array; + /** To be replaced by autoscaler_settings.scaledown_period */ + taskIdleTimeoutSecs: number; + /** Deprecated at some point */ + cloudProvider?: CloudProvider | undefined; + /** To be replaced by autoscaler_settings.min_containers */ + warmPoolSize: number; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */ + runtime: string; + /** Formerly stub_name */ + appName: string; + volumeMounts: VolumeMount[]; + maxConcurrentInputs: number; + customDomainInfo: CustomDomainInfo[]; + /** For internal debugging use only. */ + workerId: string; + /** For internal debugging use only. */ + runtimeDebug: boolean; + /** TODO: combine into enum? */ + isBuilderFunction: boolean; + isAutoSnapshot: boolean; + isMethod: boolean; + isCheckpointingFunction: boolean; + checkpointingEnabled: boolean; + checkpoint: CheckpointInfo | undefined; + objectDependencies: ObjectDependency[]; + blockNetwork: boolean; + maxInputs: number; + s3Mounts: S3Mount[]; + cloudBucketMounts: CloudBucketMount$1[]; + schedulerPlacement?: SchedulerPlacement | undefined; + /** if "Function" is actually a class grouping multiple methods */ + isClass: boolean; + /** for class methods use this function id instead for invocations - the *referenced* function should have is_class=True */ + useFunctionId: string; + /** for class methods - this method name needs to be included in the FunctionInput */ + useMethodName: string; + classParameterInfo: ClassParameterInfo | undefined; + /** Maximum number of inputs to fetch at once */ + batchMaxSize: number; + /** Miliseconds to block before a response is needed */ + batchLingerMs: number; + i6pnEnabled: boolean; + ExperimentalConcurrentCancellations: boolean; + targetConcurrentInputs: number; + /** TODO(irfansharif): Remove, once https://github.com/modal-labs/modal/pull/15645 lands. */ + ExperimentalTaskTemplatesEnabled: boolean; + /** for fallback options, where the first/most-preferred "template" is derived from fields above */ + ExperimentalTaskTemplates: TaskTemplate[]; + /** + * When the function is a "grouped" one, this records the # of tasks we want + * to schedule in tandem. + */ + ExperimentalGroupSize: number; + /** If set, the function will be run in an untrusted environment. */ + untrusted: boolean; + /** To be replaced by autoscaler_settings.buffer_containers */ + ExperimentalBufferContainers: number; + /** + * _experimental_proxy_ip -> ProxyInfo + * TODO: deprecate. + */ + ExperimentalProxyIp?: string | undefined; + /** For internal debugging use only. */ + runtimePerfRecord: boolean; + schedule: Schedule | undefined; + /** For internal debugging use only. */ + snapshotDebug: boolean; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + methodDefinitionsSet: boolean; + ExperimentalCustomScaling: boolean; + /** Supersedes cloud_provider */ + cloudProviderStr: string; + /** Experimental support for GPU snapshotting */ + ExperimentalEnableGpuSnapshot: boolean; + /** Bundle of parameters related to autoscaling */ + autoscalerSettings: AutoscalerSettings | undefined; + /** Function schema, may be missing: client doesn't block deployment if it fails to get it */ + functionSchema: FunctionSchema | undefined; + /** + * For server-side experimental functionality. Prefer using this over individual _experimental_* fields. + * Note the value type as string. Internally we'll coerce all values to string with str(). + * On the server, it's necessary to convert back to the most natural type (e.g. int) when relevant. + */ + experimentalOptions: { + [key: string]: string; + }; + /** + * If set, client deps will be mounted into the container, and are + * no longer expected to exist in the image itself. + */ + mountClientDependencies: boolean; + flashServiceUrls: string[]; + flashServiceLabel: string; + /** GPU memory snapshotting (alpha) */ + enableGpuSnapshot: boolean; + startupTimeoutSecs: number; + /** can be used as inputs */ + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionMessage: MessageFns; +interface FunctionAsyncInvokeRequest { + functionId: string; + parentInputId: string; + input: FunctionInput | undefined; +} +declare const FunctionAsyncInvokeRequest: MessageFns; +interface FunctionAsyncInvokeResponse { + retryWithBlobUpload: boolean; + functionCallId: string; +} +declare const FunctionAsyncInvokeResponse: MessageFns; +interface FunctionBindParamsRequest { + functionId: string; + serializedParams: Uint8Array; + functionOptions: FunctionOptions | undefined; + environmentName: string; + /** Only used for the input plane. */ + authSecret: string; +} +declare const FunctionBindParamsRequest: MessageFns; +interface FunctionBindParamsResponse { + boundFunctionId: string; + handleMetadata: FunctionHandleMetadata | undefined; +} +declare const FunctionBindParamsResponse: MessageFns; +interface FunctionCallCallGraphInfo { + functionCallId: string; + parentInputId: string; + functionName: string; + moduleName: string; +} +declare const FunctionCallCallGraphInfo: MessageFns; +interface FunctionCallCancelRequest { + functionCallId: string; + terminateContainers: boolean; + /** Only provided for sync input cancellation on the input plane. Async input cancellation does not provide this field this. */ + functionId?: string | undefined; +} +declare const FunctionCallCancelRequest: MessageFns; +interface FunctionCallFromIdRequest { + functionCallId: string; +} +declare const FunctionCallFromIdRequest: MessageFns; +/** Everything you need to build a FunctionCallHandler. */ +interface FunctionCallFromIdResponse { + functionCallId: string; + numInputs: number; +} +declare const FunctionCallFromIdResponse: MessageFns; +interface FunctionCallGetDataRequest { + functionCallId?: string | undefined; + attemptToken?: string | undefined; + lastIndex: number; +} +declare const FunctionCallGetDataRequest: MessageFns; +interface FunctionCallInfo { + functionCallId: string; + idx: number; + /** when the call was created */ + createdAt: number; + /** if cron job, when run was scheduled */ + scheduledAt: number; + pendingInputs: InputCategoryInfo | undefined; + failedInputs: InputCategoryInfo | undefined; + succeededInputs: InputCategoryInfo | undefined; + timeoutInputs: InputCategoryInfo | undefined; + cancelledInputs: InputCategoryInfo | undefined; + totalInputs: number; +} +declare const FunctionCallInfo: MessageFns; +interface FunctionCallListRequest { + functionId: string; +} +declare const FunctionCallListRequest: MessageFns; +interface FunctionCallListResponse { + functionCalls: FunctionCallInfo[]; +} +declare const FunctionCallListResponse: MessageFns; +interface FunctionCallPutDataRequest { + functionCallId?: string | undefined; + attemptToken?: string | undefined; + dataChunks: DataChunk[]; +} +declare const FunctionCallPutDataRequest: MessageFns; +interface FunctionCreateRequest { + function: FunctionMessage | undefined; + appId: string; + /** + * Deprecated: now passed in the Function definition + * + * @deprecated + */ + schedule: Schedule | undefined; + existingFunctionId: string; + /** supersedes 'function' field above */ + functionData: FunctionData | undefined; +} +declare const FunctionCreateRequest: MessageFns; +interface FunctionCreateResponse { + functionId: string; + /** + * Used up until 0.62.212 + * + * @deprecated + */ + DeprecatedWebUrl: string; + function: FunctionMessage | undefined; + handleMetadata: FunctionHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const FunctionCreateResponse: MessageFns; +/** + * Note: FunctionData pulls "up" a subset of fields from Function message that + * will get deprecated there and made authoritative here, at the top-level. + * All remaining fields will stay within the Function message itself and a + * single FunctionData will contain a list of such (ranked) Functions. The + * top-level fields capture data not specific to any particular underlying + * task (like warm-pool-size, applicable across all tasks), while fields + * specific to the task (like the resource request) will exist at the bottom + * level. + */ +interface FunctionData { + moduleName: string; + functionName: string; + functionType: Function_FunctionType; + /** Scheduling related fields. */ + warmPoolSize: number; + concurrencyLimit: number; + taskIdleTimeoutSecs: number; + /** + * When the function is a "grouped" one, this records the # of tasks we want + * to schedule in tandem. + */ + ExperimentalGroupSize: number; + ExperimentalBufferContainers: number; + ExperimentalCustomScaling: boolean; + ExperimentalEnableGpuSnapshot: boolean; + /** for internal debugging use only */ + workerId: string; + timeoutSecs: number; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + webhookConfig: WebhookConfig | undefined; + customDomainInfo: CustomDomainInfo[]; + /** + * _experimental_proxy_ip -> ProxyInfo + * TODO: deprecate. + */ + ExperimentalProxyIp?: string | undefined; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + methodDefinitionsSet: boolean; + /** if "Function" is actually a class grouping multiple methods - applies across all underlying tasks */ + isClass: boolean; + classParameterInfo: ClassParameterInfo | undefined; + isMethod: boolean; + /** used for methods */ + useFunctionId: string; + /** used for methods */ + useMethodName: string; + rankedFunctions: FunctionData_RankedFunction[]; + schedule: Schedule | undefined; + /** If set, the function will be run in an untrusted environment. */ + untrusted: boolean; + /** For internal debugging use only. */ + snapshotDebug: boolean; + /** For internal debugging use only. */ + runtimePerfRecord: boolean; + /** Bundle of parameters related to autoscaling */ + autoscalerSettings: AutoscalerSettings | undefined; + functionSchema: FunctionSchema | undefined; + experimentalOptions: { + [key: string]: string; + }; + flashServiceUrls: string[]; + flashServiceLabel: string; + startupTimeoutSecs: number; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionData: MessageFns; +interface FunctionData_RankedFunction { + rank: number; + function: FunctionMessage | undefined; +} +declare const FunctionData_RankedFunction: MessageFns; +interface FunctionFinishInputsRequest { + functionId: string; + functionCallId: string; + numInputs: number; +} +declare const FunctionFinishInputsRequest: MessageFns; +interface FunctionGetCallGraphRequest { + /** TODO: use input_id once we switch client submit API to return those. */ + functionCallId: string; +} +declare const FunctionGetCallGraphRequest: MessageFns; +interface FunctionGetCallGraphResponse { + inputs: InputCallGraphInfo[]; + functionCalls: FunctionCallCallGraphInfo[]; +} +declare const FunctionGetCallGraphResponse: MessageFns; +interface FunctionGetCurrentStatsRequest { + functionId: string; +} +declare const FunctionGetCurrentStatsRequest: MessageFns; +interface FunctionGetDynamicConcurrencyRequest { + functionId: string; + targetConcurrency: number; + maxConcurrency: number; +} +declare const FunctionGetDynamicConcurrencyRequest: MessageFns; +interface FunctionGetDynamicConcurrencyResponse { + concurrency: number; +} +declare const FunctionGetDynamicConcurrencyResponse: MessageFns; +interface FunctionGetInputsItem { + inputId: string; + input: FunctionInput | undefined; + killSwitch: boolean; + functionCallId: string; + functionCallInvocationType: FunctionCallInvocationType; + retryCount: number; + /** intercepted and only used by the worker. */ + functionMapIdx?: number | undefined; + attemptToken: string; +} +declare const FunctionGetInputsItem: MessageFns; +interface FunctionGetInputsRequest { + functionId: string; + maxValues: number; + averageCallTime: number; + /** Container aims to fetch multiple inputs at the same time */ + inputConcurrency: number; + /** Maximum number of inputs to fetch at once */ + batchMaxSize: number; + /** Miliseconds to block before a response is needed */ + batchLingerMs: number; +} +declare const FunctionGetInputsRequest: MessageFns; +interface FunctionGetInputsResponse { + inputs: FunctionGetInputsItem[]; + /** How long to sleep before requesting another input. */ + rateLimitSleepDuration: number; +} +declare const FunctionGetInputsResponse: MessageFns; +interface FunctionGetOutputsItem { + result: GenericResult | undefined; + idx: number; + inputId: string; + /** for result.data_oneof */ + dataFormat: DataFormat; + taskId: string; + inputStartedAt: number; + outputCreatedAt: number; + retryCount: number; + /** datadog function call trace tag */ + fcTraceTag: string; +} +declare const FunctionGetOutputsItem: MessageFns; +interface FunctionGetOutputsRequest { + functionCallId: string; + maxValues: number; + timeout: number; + lastEntryId: string; + /** expires *any* remaining outputs soon after this call, not just the returned ones */ + clearOnSuccess: boolean; + /** Used for waypoints. */ + requestedAt: number; + /** The jwts the client expects the server to be processing. This is optional and used for sync inputs only. */ + inputJwts: string[]; + /** for async batch requests. this indicates which index to start from. */ + startIdx?: number | undefined; + /** for async batch requests. this indicates which index to end at. */ + endIdx?: number | undefined; +} +declare const FunctionGetOutputsRequest: MessageFns; +interface FunctionGetOutputsResponse { + idxs: number[]; + outputs: FunctionGetOutputsItem[]; + lastEntryId: string; + numUnfinishedInputs: number; +} +declare const FunctionGetOutputsResponse: MessageFns; +interface FunctionGetRequest { + appName: string; + objectTag: string; + environmentName: string; +} +declare const FunctionGetRequest: MessageFns; +interface FunctionGetResponse { + functionId: string; + handleMetadata: FunctionHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const FunctionGetResponse: MessageFns; +interface FunctionGetSerializedRequest { + functionId: string; +} +declare const FunctionGetSerializedRequest: MessageFns; +interface FunctionGetSerializedResponse { + functionSerialized: Uint8Array; + classSerialized: Uint8Array; +} +declare const FunctionGetSerializedResponse: MessageFns; +/** + * contains all the info about a function that is needed to trigger the right + * behaviour when using a FunctionHandler. Notably excludes things purely + * used for *executing* the function in a container entrypoint + */ +interface FunctionHandleMetadata { + /** Should be a subset and use IDs/types from `Function` above */ + functionName: string; + functionType: Function_FunctionType; + webUrl: string; + isMethod: boolean; + /** used for methods */ + useFunctionId: string; + /** used for methods */ + useMethodName: string; + definitionId: string; + classParameterInfo: ClassParameterInfo | undefined; + /** Mapping of method names to their metadata, only non-empty for class service functions */ + methodHandleMetadata: { + [key: string]: FunctionHandleMetadata; + }; + functionSchema: FunctionSchema | undefined; + inputPlaneUrl?: string | undefined; + inputPlaneRegion?: string | undefined; + /** Use optional to ensure unset values default to None instead of 0 */ + maxObjectSizeBytes?: number | undefined; + /** (Optional) urls for flash services */ + ExperimentalFlashUrls: string[]; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionHandleMetadata: MessageFns; +interface FunctionInput { + args?: Uint8Array | undefined; + argsBlobId?: string | undefined; + finalInput: boolean; + /** For args_oneof. */ + dataFormat: DataFormat; + /** specifies which method to call when calling a class/object function */ + methodName?: string | undefined; +} +declare const FunctionInput: MessageFns; +interface FunctionMapRequest { + functionId: string; + parentInputId: string; + returnExceptions: boolean; + functionCallType: FunctionCallType; + pipelinedInputs: FunctionPutInputsItem[]; + functionCallInvocationType: FunctionCallInvocationType; + fromSpawnMap: boolean; +} +declare const FunctionMapRequest: MessageFns; +interface FunctionMapResponse { + functionCallId: string; + pipelinedInputs: FunctionPutInputsResponseItem[]; + retryPolicy: FunctionRetryPolicy | undefined; + functionCallJwt: string; + syncClientRetriesEnabled: boolean; + maxInputsOutstanding: number; +} +declare const FunctionMapResponse: MessageFns; +interface FunctionOptions { + secretIds: string[]; + /** Currently not supported */ + mountIds: string[]; + resources?: Resources | undefined; + retryPolicy?: FunctionRetryPolicy | undefined; + concurrencyLimit?: number | undefined; + timeoutSecs?: number | undefined; + taskIdleTimeoutSecs?: number | undefined; + warmPoolSize?: number | undefined; + volumeMounts: VolumeMount[]; + targetConcurrentInputs?: number | undefined; + replaceVolumeMounts: boolean; + replaceSecretIds: boolean; + bufferContainers?: number | undefined; + maxConcurrentInputs?: number | undefined; + batchMaxSize?: number | undefined; + batchLingerMs?: number | undefined; + schedulerPlacement?: SchedulerPlacement | undefined; + cloudProviderStr?: string | undefined; + replaceCloudBucketMounts: boolean; + cloudBucketMounts: CloudBucketMount$1[]; +} +declare const FunctionOptions: MessageFns; +interface FunctionPrecreateRequest { + appId: string; + functionName: string; + existingFunctionId: string; + functionType: Function_FunctionType; + webhookConfig: WebhookConfig | undefined; + /** for class methods - use this function id instead for invocations - the *referenced* function should have is_class=True */ + useFunctionId: string; + /** for class methods - this method name needs to be included in the FunctionInput */ + useMethodName: string; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + functionSchema: FunctionSchema | undefined; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionPrecreateRequest: MessageFns; +interface FunctionPrecreateResponse { + functionId: string; + handleMetadata: FunctionHandleMetadata | undefined; +} +declare const FunctionPrecreateResponse: MessageFns; +interface FunctionPutInputsItem { + idx: number; + input: FunctionInput | undefined; + r2Failed: boolean; + r2ThroughputBytesS: number; +} +declare const FunctionPutInputsItem: MessageFns; +interface FunctionPutInputsRequest { + functionId: string; + functionCallId: string; + inputs: FunctionPutInputsItem[]; +} +declare const FunctionPutInputsRequest: MessageFns; +interface FunctionPutInputsResponse { + inputs: FunctionPutInputsResponseItem[]; +} +declare const FunctionPutInputsResponse: MessageFns; +interface FunctionPutInputsResponseItem { + idx: number; + inputId: string; + inputJwt: string; +} +declare const FunctionPutInputsResponseItem: MessageFns; +interface FunctionPutOutputsItem { + inputId: string; + result: GenericResult | undefined; + inputStartedAt: number; + outputCreatedAt: number; + /** for result.data_oneof */ + dataFormat: DataFormat; + retryCount: number; + /** injected by the worker */ + functionCallId: string; + /** injected by the worker */ + functionMapIdx?: number | undefined; +} +declare const FunctionPutOutputsItem: MessageFns; +interface FunctionPutOutputsRequest { + outputs: FunctionPutOutputsItem[]; + /** Used for waypoints. */ + requestedAt: number; +} +declare const FunctionPutOutputsRequest: MessageFns; +interface FunctionRetryInputsItem { + inputJwt: string; + input: FunctionInput | undefined; + retryCount: number; +} +declare const FunctionRetryInputsItem: MessageFns; +interface FunctionRetryInputsRequest { + functionCallJwt: string; + inputs: FunctionRetryInputsItem[]; +} +declare const FunctionRetryInputsRequest: MessageFns; +interface FunctionRetryInputsResponse { + inputJwts: string[]; +} +declare const FunctionRetryInputsResponse: MessageFns; +interface FunctionRetryPolicy { + backoffCoefficient: number; + initialDelayMs: number; + maxDelayMs: number; + /** NOTE: two-byte field number not used for special reason. copy-paste error. Ref: PR #2542 */ + retries: number; +} +declare const FunctionRetryPolicy: MessageFns; +interface FunctionSchema { + /** allows easy disambiguation between empty schema and no schema collection etc. */ + schemaType: FunctionSchema_FunctionSchemaType; + arguments: ClassParameterSpec[]; + returnType: GenericPayloadType | undefined; +} +declare const FunctionSchema: MessageFns; +interface FunctionStats$1 { + backlog: number; + numTotalTasks: number; +} +declare const FunctionStats$1: MessageFns; +interface FunctionUpdateSchedulingParamsRequest { + functionId: string; + warmPoolSizeOverride: number; + settings: AutoscalerSettings | undefined; +} +declare const FunctionUpdateSchedulingParamsRequest: MessageFns; +interface FunctionUpdateSchedulingParamsResponse { +} +declare const FunctionUpdateSchedulingParamsResponse: MessageFns; +interface GPUConfig { + /** Deprecated, at some point */ + type: GPUType; + count: number; + gpuType: string; +} +declare const GPUConfig: MessageFns; +interface GenericPayloadType { + baseType: ParameterType; + /** sub-type for generic types like lists */ + subTypes: GenericPayloadType[]; +} +declare const GenericPayloadType: MessageFns; +/** Used for both tasks and function outputs */ +interface GenericResult { + /** Status of the task or function output. */ + status: GenericResult_GenericStatus; + /** Exception message for failures, if available. */ + exception: string; + /** Status code of the container entrypoint or builder process if it terminates unexpectedly. */ + exitcode: number; + /** String value of the Python traceback. */ + traceback: string; + /** Pickled traceback object. */ + serializedTb: Uint8Array; + /** Pickled line cache for traceback object. */ + tbLineCache: Uint8Array; + /** Inline data of the result. */ + data?: Uint8Array | undefined; + /** Blob ID for large data. */ + dataBlobId?: string | undefined; + /** (?) */ + propagationReason: string; +} +declare const GenericResult: MessageFns; +interface Image$1 { + baseImages: BaseImage[]; + dockerfileCommands: string[]; + contextFiles: ImageContextFile[]; + version: string; + secretIds: string[]; + /** + * Part of Image definition, because presence of GPU drivers + * affects the image that's built. + */ + contextMountId: string; + gpuConfig: GPUConfig | undefined; + imageRegistryConfig: ImageRegistryConfig | undefined; + /** deprecated after 0.58.96 */ + buildFunctionDef: string; + /** deprecated after 0.58.96 */ + buildFunctionGlobals: Uint8Array; + /** If set, overrides the runtime used by the function. Specify either "runc" or "gvisor". */ + runtime: string; + /** Not included in image definition checksum as debug features do not affect built image. */ + runtimeDebug: boolean; + buildFunction: BuildFunction | undefined; + /** Build arguments for the image (--build-arg) for ARG substitution in Dockerfile. */ + buildArgs: { + [key: string]: string; + }; + /** Volume mount for RUN commands */ + volumeMounts: VolumeMount[]; +} +declare const Image$1: MessageFns; +interface ImageContextFile { + filename: string; + data: Uint8Array; +} +declare const ImageContextFile: MessageFns; +interface ImageDeleteRequest { + imageId: string; +} +declare const ImageDeleteRequest: MessageFns; +interface ImageFromIdRequest { + imageId: string; +} +declare const ImageFromIdRequest: MessageFns; +interface ImageFromIdResponse { + imageId: string; + metadata: ImageMetadata | undefined; +} +declare const ImageFromIdResponse: MessageFns; +interface ImageGetOrCreateRequest { + image: Image$1 | undefined; + appId: string; + /** ignored */ + existingImageId: string; + buildFunctionId: string; + forceBuild: boolean; + namespace: DeploymentNamespace; + builderVersion: string; + /** Only admins can publish global images, but this provides an extra failsafe */ + allowGlobalDeployment: boolean; + /** Force the Image to build but don't clobber any Images with the same recipe in the cache */ + ignoreCache: boolean; +} +declare const ImageGetOrCreateRequest: MessageFns; +interface ImageGetOrCreateResponse { + /** image_id is set regardless if the image is built (use ImageJoinStreaming to wait for build) */ + imageId: string; + /** result of build - only set if the image has finished building (regardless if success or not) */ + result: GenericResult | undefined; + /** image metadata - only set if the image has built successfully */ + metadata: ImageMetadata | undefined; +} +declare const ImageGetOrCreateResponse: MessageFns; +interface ImageJoinStreamingRequest { + imageId: string; + timeout: number; + lastEntryId: string; + includeLogsForFinished: boolean; +} +declare const ImageJoinStreamingRequest: MessageFns; +interface ImageJoinStreamingResponse { + result: GenericResult | undefined; + taskLogs: TaskLogs[]; + entryId: string; + eof: boolean; + /** set on success */ + metadata: ImageMetadata | undefined; +} +declare const ImageJoinStreamingResponse: MessageFns; +interface ImageMetadata { + /** The output of `python -VV. Not set if missing */ + pythonVersionInfo?: string | undefined; + /** + * Installed python packages, as listed by by `pip list`. + * package name -> version. Empty if missing + */ + pythonPackages: { + [key: string]: string; + }; + /** + * The working directory of the image, as an absolute file path. + * + * For most images, this is not set, which means to use the default workdir: + * - On function runners, the default is `/root` (home directory). + * - For image builds and sandbox environments, it is `/`. + */ + workdir?: string | undefined; + /** The version of glibc in this image, if any. */ + libcVersionInfo?: string | undefined; + /** The builder version for/with which the image was created. */ + imageBuilderVersion?: string | undefined; +} +declare const ImageMetadata: MessageFns; +interface ImageRegistryConfig { + registryAuthType: RegistryAuthType; + secretId: string; +} +declare const ImageRegistryConfig: MessageFns; +interface InputCallGraphInfo { + inputId: string; + status: GenericResult_GenericStatus; + functionCallId: string; + taskId: string; +} +declare const InputCallGraphInfo: MessageFns; +interface InputCategoryInfo { + total: number; + latest: InputInfo[]; +} +declare const InputCategoryInfo: MessageFns; +interface InputInfo { + inputId: string; + idx: number; + taskId: string; + startedAt: number; + finishedAt: number; + taskStartupTime: number; + taskFirstInput: boolean; +} +declare const InputInfo: MessageFns; +interface ListPagination { + maxObjects: number; + createdBefore: number; +} +declare const ListPagination: MessageFns; +interface MapAwaitRequest { + functionCallId?: string | undefined; + mapToken?: string | undefined; + lastEntryId: string; + /** Used for waypoints. */ + requestedAt: number; + timeout: number; +} +declare const MapAwaitRequest: MessageFns; +interface MapAwaitResponse { + outputs: FunctionGetOutputsItem[]; + lastEntryId: string; +} +declare const MapAwaitResponse: MessageFns; +interface MapCheckInputsRequest { + lastEntryId: string; + timeout: number; + attemptTokens: string[]; +} +declare const MapCheckInputsRequest: MessageFns; +interface MapCheckInputsResponse { + lost: boolean[]; +} +declare const MapCheckInputsResponse: MessageFns; +interface MapStartOrContinueItem { + input: FunctionPutInputsItem | undefined; + /** None if this is a fresh input, otherwise it is the attempt token for a retry. */ + attemptToken?: string | undefined; +} +declare const MapStartOrContinueItem: MessageFns; +interface MapStartOrContinueRequest { + functionId: string; + parentInputId: string; + functionCallId?: string | undefined; + mapToken?: string | undefined; + items: MapStartOrContinueItem[]; +} +declare const MapStartOrContinueRequest: MessageFns; +interface MapStartOrContinueResponse { + /** + * function_id and function_call_id are not necessary if map_token is provided. + * All 3 will be sent until it is safe to only send map_token. + */ + mapToken: string; + functionId: string; + functionCallId: string; + maxInputsOutstanding: number; + attemptTokens: string[]; + retryPolicy: FunctionRetryPolicy | undefined; +} +declare const MapStartOrContinueResponse: MessageFns; +interface MethodDefinition { + functionName: string; + functionType: Function_FunctionType; + webhookConfig: WebhookConfig | undefined; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + customDomainInfo: CustomDomainInfo[]; + functionSchema: FunctionSchema | undefined; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const MethodDefinition: MessageFns; +interface MountFile { + filename: string; + /** SHA-256 checksum of the file. */ + sha256Hex: string; + /** Size of the file in bytes — ignored in MountBuild(). */ + size?: number | undefined; + /** Unix file permission bits `st_mode`. */ + mode?: number | undefined; +} +declare const MountFile: MessageFns; +interface MountGetOrCreateRequest { + deploymentName: string; + namespace: DeploymentNamespace; + environmentName: string; + objectCreationType: ObjectCreationType; + files: MountFile[]; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; +} +declare const MountGetOrCreateRequest: MessageFns; +interface MountGetOrCreateResponse { + mountId: string; + handleMetadata: MountHandleMetadata | undefined; +} +declare const MountGetOrCreateResponse: MessageFns; +interface MountHandleMetadata { + contentChecksumSha256Hex: string; +} +declare const MountHandleMetadata: MessageFns; +interface MountPutFileRequest { + sha256Hex: string; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; +} +declare const MountPutFileRequest: MessageFns; +interface MountPutFileResponse { + exists: boolean; +} +declare const MountPutFileResponse: MessageFns; +interface MultiPartUpload { + /** split upload based on this part length - all except the last part must have this length */ + partLength: number; + uploadUrls: string[]; + completionUrl: string; +} +declare const MultiPartUpload: MessageFns; +interface MultiPartUploadList { + items: MultiPartUpload[]; +} +declare const MultiPartUploadList: MessageFns; +interface NetworkAccess { + networkAccessType: NetworkAccess_NetworkAccessType; + allowedCidrs: string[]; +} +declare const NetworkAccess: MessageFns; +interface NotebookKernelPublishResultsRequest { + notebookId: string; + results: NotebookKernelPublishResultsRequest_CellResult[]; +} +declare const NotebookKernelPublishResultsRequest: MessageFns; +/** + * See kernelshim.py for the differences between this and `ExecuteResult`. + * https://jupyter-client.readthedocs.io/en/stable/messaging.html#execution-results + */ +interface NotebookKernelPublishResultsRequest_ExecuteReply { + status: string; + executionCount: number; + duration: number; +} +declare const NotebookKernelPublishResultsRequest_ExecuteReply: MessageFns; +/** IOPub message or reply received from the kernel for a cell. */ +interface NotebookKernelPublishResultsRequest_CellResult { + cellId: string; + /** Persistent output that is saved in the notebook. */ + output?: NotebookOutput | undefined; + /** Clear all previous outputs of the cell. */ + clearOutput?: boolean | undefined; + /** Cell has finished executing, return the kernel's execute_reply. */ + executeReply?: NotebookKernelPublishResultsRequest_ExecuteReply | undefined; +} +declare const NotebookKernelPublishResultsRequest_CellResult: MessageFns; +/** + * A single output from a notebook. When you execute a cell, it produces an + * array of these outputs as the code runs. + * + * https://github.com/jupyter/nbformat/blob/v5.10.4/nbformat/v4/nbformat.v4.schema.json#L301-L309 + */ +interface NotebookOutput { + executeResult?: NotebookOutput_ExecuteResult | undefined; + displayData?: NotebookOutput_DisplayData | undefined; + stream?: NotebookOutput_Stream | undefined; + error?: NotebookOutput_Error | undefined; +} +declare const NotebookOutput: MessageFns; +/** Result of executing a code cell. */ +interface NotebookOutput_ExecuteResult { + executionCount: number; + /** mimebundle */ + data: { + [key: string]: any; + } | undefined; + metadata: { + [key: string]: any; + } | undefined; +} +declare const NotebookOutput_ExecuteResult: MessageFns; +/** Data displayed as a result of code cell execution. */ +interface NotebookOutput_DisplayData { + /** mimebundle */ + data: { + [key: string]: any; + } | undefined; + metadata: { + [key: string]: any; + } | undefined; + /** This should not be included in saved notebook. */ + transientDisplayId?: string | undefined; +} +declare const NotebookOutput_DisplayData: MessageFns; +/** Stream output from a code cell (stdout / stderr). */ +interface NotebookOutput_Stream { + /** stdout | stderr */ + name: string; + /** multiline_string */ + text: string; +} +declare const NotebookOutput_Stream: MessageFns; +/** Output of an error that occurred during code cell execution. */ +interface NotebookOutput_Error { + ename: string; + evalue: string; + traceback: string[]; +} +declare const NotebookOutput_Error: MessageFns; +interface Object_ { + objectId: string; + functionHandleMetadata?: FunctionHandleMetadata | undefined; + mountHandleMetadata?: MountHandleMetadata | undefined; + classHandleMetadata?: ClassHandleMetadata | undefined; + sandboxHandleMetadata?: SandboxHandleMetadata | undefined; + volumeMetadata?: VolumeMetadata | undefined; +} +declare const Object_: MessageFns; +interface ObjectDependency { + objectId: string; +} +declare const ObjectDependency: MessageFns; +interface PTYInfo { + /** Soon deprecated */ + enabled: boolean; + winszRows: number; + winszCols: number; + envTerm: string; + envColorterm: string; + envTermProgram: string; + ptyType: PTYInfo_PTYType; + noTerminateOnIdleStdin: boolean; +} +declare const PTYInfo: MessageFns; +interface PortSpec { + port: number; + unencrypted: boolean; + tunnelType?: TunnelType | undefined; +} +declare const PortSpec: MessageFns; +interface PortSpecs { + ports: PortSpec[]; +} +declare const PortSpecs: MessageFns; +interface Proxy$1 { + name: string; + createdAt: number; + environmentName: string; + proxyId: string; + proxyIps: ProxyIp[]; +} +declare const Proxy$1: MessageFns; +interface ProxyAddIpRequest { + proxyId: string; +} +declare const ProxyAddIpRequest: MessageFns; +interface ProxyAddIpResponse { + proxyIp: ProxyIp | undefined; +} +declare const ProxyAddIpResponse: MessageFns; +interface ProxyCreateRequest { + name: string; + environmentName: string; +} +declare const ProxyCreateRequest: MessageFns; +interface ProxyCreateResponse { + proxy: Proxy$1 | undefined; +} +declare const ProxyCreateResponse: MessageFns; +interface ProxyDeleteRequest { + proxyId: string; +} +declare const ProxyDeleteRequest: MessageFns; +interface ProxyGetOrCreateRequest { + deploymentName: string; + environmentName: string; + /** must be UNSPECIFIED */ + objectCreationType: ObjectCreationType; +} +declare const ProxyGetOrCreateRequest: MessageFns; +interface ProxyGetOrCreateResponse { + proxyId: string; +} +declare const ProxyGetOrCreateResponse: MessageFns; +interface ProxyGetRequest { + name: string; + environmentName: string; +} +declare const ProxyGetRequest: MessageFns; +interface ProxyGetResponse { + proxy: Proxy$1 | undefined; +} +declare const ProxyGetResponse: MessageFns; +interface ProxyIp { + proxyIp: string; + status: ProxyIpStatus; + createdAt: number; + environmentName: string; +} +declare const ProxyIp: MessageFns; +interface ProxyListResponse { + proxies: Proxy$1[]; +} +declare const ProxyListResponse: MessageFns; +interface ProxyRemoveIpRequest { + proxyIp: string; +} +declare const ProxyRemoveIpRequest: MessageFns; +interface QueueClearRequest { + queueId: string; + partitionKey: Uint8Array; + allPartitions: boolean; +} +declare const QueueClearRequest: MessageFns; +interface QueueDeleteRequest { + queueId: string; +} +declare const QueueDeleteRequest: MessageFns; +interface QueueGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; +} +declare const QueueGetOrCreateRequest: MessageFns; +interface QueueGetOrCreateResponse { + queueId: string; + metadata: QueueMetadata | undefined; +} +declare const QueueGetOrCreateResponse: MessageFns; +interface QueueGetRequest { + queueId: string; + timeout: number; + nValues: number; + partitionKey: Uint8Array; +} +declare const QueueGetRequest: MessageFns; +interface QueueGetResponse { + values: Uint8Array[]; +} +declare const QueueGetResponse: MessageFns; +interface QueueHeartbeatRequest { + queueId: string; +} +declare const QueueHeartbeatRequest: MessageFns; +interface QueueItem { + value: Uint8Array; + entryId: string; +} +declare const QueueItem: MessageFns; +interface QueueLenRequest { + queueId: string; + partitionKey: Uint8Array; + total: boolean; +} +declare const QueueLenRequest: MessageFns; +interface QueueLenResponse { + len: number; +} +declare const QueueLenResponse: MessageFns; +interface QueueListRequest { + environmentName: string; + /** Limit on "number of partitions" reported, since checking them is costly */ + totalSizeLimit: number; + pagination: ListPagination | undefined; +} +declare const QueueListRequest: MessageFns; +interface QueueListResponse { + queues: QueueListResponse_QueueInfo[]; + environmentName: string; +} +declare const QueueListResponse: MessageFns; +interface QueueListResponse_QueueInfo { + name: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + numPartitions: number; + totalSize: number; + queueId: string; + metadata: QueueMetadata | undefined; +} +declare const QueueListResponse_QueueInfo: MessageFns; +interface QueueMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const QueueMetadata: MessageFns; +interface QueueNextItemsRequest { + queueId: string; + partitionKey: Uint8Array; + lastEntryId: string; + /** seconds */ + itemPollTimeout: number; +} +declare const QueueNextItemsRequest: MessageFns; +interface QueueNextItemsResponse { + items: QueueItem[]; +} +declare const QueueNextItemsResponse: MessageFns; +interface QueuePutRequest { + queueId: string; + values: Uint8Array[]; + partitionKey: Uint8Array; + partitionTtlSeconds: number; +} +declare const QueuePutRequest: MessageFns; +interface RateLimit { + limit: number; + interval: RateLimitInterval; +} +declare const RateLimit: MessageFns; +interface Resources { + /** MiB */ + memoryMb: number; + /** milli CPU cores */ + milliCpu: number; + gpuConfig: GPUConfig | undefined; + /** MiB */ + memoryMbMax: number; + /** MiB */ + ephemeralDiskMb: number; + /** milli CPU cores */ + milliCpuMax: number; + /** Whether to use RDMA interfaces */ + rdma: boolean; +} +declare const Resources: MessageFns; +interface RuntimeInputMessage { + message: Uint8Array; + messageIndex: number; + eof: boolean; +} +declare const RuntimeInputMessage: MessageFns; +interface RuntimeOutputBatch { + items: RuntimeOutputMessage[]; + batchIndex: number; + /** if an exit code is given, this is the final message that will be sent. */ + exitCode?: number | undefined; + stdout: RuntimeOutputMessage[]; + stderr: RuntimeOutputMessage[]; + info: RuntimeOutputMessage[]; +} +declare const RuntimeOutputBatch: MessageFns; +/** Used for `modal container exec`, `modal shell`, and Sandboxes */ +interface RuntimeOutputMessage { + /** only stdout / stderr is used */ + fileDescriptor: FileDescriptor; + message: string; + messageBytes: Uint8Array; +} +declare const RuntimeOutputMessage: MessageFns; +interface S3Mount { + bucketName: string; + mountPath: string; + credentialsSecretId: string; + readOnly: boolean; +} +declare const S3Mount: MessageFns; +interface Sandbox$1 { + entrypointArgs: string[]; + mountIds: string[]; + imageId: string; + secretIds: string[]; + resources: Resources | undefined; + /** Deprecated at some point */ + cloudProvider: CloudProvider; + /** The max lifetime of a sandbox in seconds. */ + timeoutSecs: number; + workdir?: string | undefined; + nfsMounts: SharedVolumeMount[]; + /** For internal debugging use only. */ + runtimeDebug: boolean; + blockNetwork: boolean; + s3Mounts: S3Mount[]; + cloudBucketMounts: CloudBucketMount$1[]; + volumeMounts: VolumeMount[]; + ptyInfo: PTYInfo | undefined; + schedulerPlacement?: SchedulerPlacement | undefined; + /** for internal debugging use only */ + workerId: string; + openPorts?: PortSpecs | undefined; + i6pnEnabled: boolean; + /** Network access configuration beyond simple allow/block. */ + networkAccess: NetworkAccess | undefined; + proxyId?: string | undefined; + /** + * Enable snapshotting the sandbox (both memory and filesystem). + * This doesn't need to be enabled to save the filesystem as an image (i.e. a filesystem-only snapshot). + */ + enableSnapshot: boolean; + /** + * Used to pin gVisor version for memory-snapshottable sandboxes. + * This field is set by the server, not the client. + */ + snapshotVersion?: number | undefined; + /** Supersedes cloud_provider */ + cloudProviderStr: string; + /** + * Specifies container runtime behavior for sandboxes which are restored from a snapshot. + * Set by the backend at snapshot creation time. + */ + runscRuntimeVersion?: string | undefined; + /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */ + runtime?: string | undefined; + /** If set, the sandbox will be created with verbose logging enabled. */ + verbose: boolean; + /** If set, the sandbox will be created with a name. */ + name?: string | undefined; + /** Experimental options */ + experimentalOptions: { + [key: string]: boolean; + }; + /** Internal use only. */ + preloadPathPrefixes: string[]; + /** Optional idle timeout in seconds. If set, the sandbox will be terminated after being idle for this duration. */ + idleTimeoutSecs?: number | undefined; + /** + * If set, the sandbox will be created with direct sandbox commands enabled. + * Exec commands for the sandbox will be issued directly to the sandbox + * command router running on the Modal worker. + */ + directSandboxCommandsEnabled: boolean; +} +declare const Sandbox$1: MessageFns; +interface SandboxCreateConnectTokenRequest { + sandboxId: string; + userMetadata: string; +} +declare const SandboxCreateConnectTokenRequest: MessageFns; +interface SandboxCreateConnectTokenResponse { + url: string; + token: string; +} +declare const SandboxCreateConnectTokenResponse: MessageFns; +interface SandboxCreateRequest { + appId: string; + definition: Sandbox$1 | undefined; + /** DEPRECATED* 7/16/2025 */ + environmentName: string; +} +declare const SandboxCreateRequest: MessageFns; +interface SandboxCreateResponse { + sandboxId: string; +} +declare const SandboxCreateResponse: MessageFns; +/** + * Used to get a JWT and URL for direct access to a sandbox router server + * running on the modal-worker, so the client can issue exec commands (and other + * operations as they become available) directly to the worker. + * DEPRECATED: Use TaskGetCommandRouterAccessRequest instead. + * TODO(saltzm): Remove this. + */ +interface SandboxGetCommandRouterAccessRequest { + sandboxId: string; +} +declare const SandboxGetCommandRouterAccessRequest: MessageFns; +interface SandboxGetCommandRouterAccessResponse { + jwt: string; + url: string; +} +declare const SandboxGetCommandRouterAccessResponse: MessageFns; +interface SandboxGetFromNameRequest { + sandboxName: string; + environmentName: string; + appName: string; +} +declare const SandboxGetFromNameRequest: MessageFns; +interface SandboxGetFromNameResponse { + sandboxId: string; +} +declare const SandboxGetFromNameResponse: MessageFns; +interface SandboxGetLogsRequest { + sandboxId: string; + fileDescriptor: FileDescriptor; + timeout: number; + lastEntryId: string; +} +declare const SandboxGetLogsRequest: MessageFns; +interface SandboxGetResourceUsageRequest { + sandboxId: string; +} +declare const SandboxGetResourceUsageRequest: MessageFns; +interface SandboxGetResourceUsageResponse { + cpuCoreNanosecs: number; + memGibNanosecs: number; + gpuNanosecs: number; + gpuType?: string | undefined; +} +declare const SandboxGetResourceUsageResponse: MessageFns; +interface SandboxGetTaskIdRequest { + sandboxId: string; + /** Legacy clients do not provide a timeout. New clients must always provide a timeout. */ + timeout?: number | undefined; + /** If true, waits until the container's postStart hook has been run before returning. Useful for detecting init failures. */ + waitUntilReady: boolean; +} +declare const SandboxGetTaskIdRequest: MessageFns; +interface SandboxGetTaskIdResponse { + /** This is None if the sandbox was terminated before a task could be scheduled. */ + taskId?: string | undefined; + /** If the task has already exited, this is the result. */ + taskResult?: GenericResult | undefined; +} +declare const SandboxGetTaskIdResponse: MessageFns; +interface SandboxGetTunnelsRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxGetTunnelsRequest: MessageFns; +interface SandboxGetTunnelsResponse { + result: GenericResult | undefined; + tunnels: TunnelData[]; +} +declare const SandboxGetTunnelsResponse: MessageFns; +interface SandboxHandleMetadata { + result: GenericResult | undefined; +} +declare const SandboxHandleMetadata: MessageFns; +interface SandboxInfo { + id: string; + createdAt: number; + taskInfo: TaskInfo | undefined; + appId: string; + /** TODO: Not yet exposed in client library. */ + tags: SandboxTag[]; + name: string; +} +declare const SandboxInfo: MessageFns; +interface SandboxListRequest { + appId: string; + beforeTimestamp: number; + environmentName: string; + includeFinished: boolean; + tags: SandboxTag[]; +} +declare const SandboxListRequest: MessageFns; +interface SandboxListResponse { + sandboxes: SandboxInfo[]; +} +declare const SandboxListResponse: MessageFns; +interface SandboxRestoreRequest { + snapshotId: string; + sandboxNameOverride: string; + sandboxNameOverrideType: SandboxRestoreRequest_SandboxNameOverrideType; +} +declare const SandboxRestoreRequest: MessageFns; +interface SandboxRestoreResponse { + sandboxId: string; +} +declare const SandboxRestoreResponse: MessageFns; +interface SandboxSnapshotFsAsyncGetRequest { + imageId: string; + timeout: number; +} +declare const SandboxSnapshotFsAsyncGetRequest: MessageFns; +interface SandboxSnapshotFsAsyncRequest { + sandboxId: string; +} +declare const SandboxSnapshotFsAsyncRequest: MessageFns; +interface SandboxSnapshotFsAsyncResponse { + imageId: string; +} +declare const SandboxSnapshotFsAsyncResponse: MessageFns; +interface SandboxSnapshotFsRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxSnapshotFsRequest: MessageFns; +interface SandboxSnapshotFsResponse { + imageId: string; + result: GenericResult | undefined; + /** Metadata may be empty since we may skip it for performance reasons. */ + imageMetadata: ImageMetadata | undefined; +} +declare const SandboxSnapshotFsResponse: MessageFns; +interface SandboxSnapshotGetRequest { + snapshotId: string; +} +declare const SandboxSnapshotGetRequest: MessageFns; +interface SandboxSnapshotGetResponse { + snapshotId: string; +} +declare const SandboxSnapshotGetResponse: MessageFns; +interface SandboxSnapshotRequest { + sandboxId: string; +} +declare const SandboxSnapshotRequest: MessageFns; +interface SandboxSnapshotResponse { + snapshotId: string; +} +declare const SandboxSnapshotResponse: MessageFns; +interface SandboxSnapshotWaitRequest { + snapshotId: string; + timeout: number; +} +declare const SandboxSnapshotWaitRequest: MessageFns; +interface SandboxSnapshotWaitResponse { + result: GenericResult | undefined; +} +declare const SandboxSnapshotWaitResponse: MessageFns; +interface SandboxStdinWriteRequest { + sandboxId: string; + input: Uint8Array; + index: number; + eof: boolean; +} +declare const SandboxStdinWriteRequest: MessageFns; +interface SandboxStdinWriteResponse { +} +declare const SandboxStdinWriteResponse: MessageFns; +interface SandboxTag { + tagName: string; + tagValue: string; +} +declare const SandboxTag: MessageFns; +interface SandboxTagsGetRequest { + sandboxId: string; +} +declare const SandboxTagsGetRequest: MessageFns; +interface SandboxTagsGetResponse { + tags: SandboxTag[]; +} +declare const SandboxTagsGetResponse: MessageFns; +interface SandboxTagsSetRequest { + environmentName: string; + sandboxId: string; + tags: SandboxTag[]; +} +declare const SandboxTagsSetRequest: MessageFns; +interface SandboxTerminateRequest { + sandboxId: string; +} +declare const SandboxTerminateRequest: MessageFns; +interface SandboxTerminateResponse { + existingResult: GenericResult | undefined; +} +declare const SandboxTerminateResponse: MessageFns; +interface SandboxWaitRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxWaitRequest: MessageFns; +interface SandboxWaitResponse { + result: GenericResult | undefined; +} +declare const SandboxWaitResponse: MessageFns; +interface Schedule { + cron?: Schedule_Cron | undefined; + period?: Schedule_Period | undefined; +} +declare const Schedule: MessageFns; +interface Schedule_Cron { + cronString: string; + timezone: string; +} +declare const Schedule_Cron: MessageFns; +interface Schedule_Period { + years: number; + months: number; + weeks: number; + days: number; + hours: number; + minutes: number; + seconds: number; +} +declare const Schedule_Period: MessageFns; +/** + * TODO(irfansharif): + * - Fold in cloud, resource needs here too. + * - Allow specifying list of zones, cloud, fallback and alternative + * GPU types. + */ +interface SchedulerPlacement { + regions: string[]; + /** TODO(irfansharif): Make these two repeated. */ + Zone?: string | undefined; + /** admin-only, "on-demand" or "spot", else ignored */ + Lifecycle?: string | undefined; + /** admin-only */ + InstanceTypes: string[]; +} +declare const SchedulerPlacement: MessageFns; +interface SecretDeleteRequest { + secretId: string; +} +declare const SecretDeleteRequest: MessageFns; +interface SecretGetOrCreateRequest { + deploymentName: string; + environmentName: string; + /** Not used atm */ + objectCreationType: ObjectCreationType; + envDict: { + [key: string]: string; + }; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; + requiredKeys: string[]; +} +declare const SecretGetOrCreateRequest: MessageFns; +interface SecretGetOrCreateResponse { + secretId: string; + metadata: SecretMetadata | undefined; +} +declare const SecretGetOrCreateResponse: MessageFns; +interface SecretListItem { + label: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + lastUsedAt: number; + /** Unused by client */ + environmentName: string; + secretId: string; + metadata: SecretMetadata | undefined; +} +declare const SecretListItem: MessageFns; +interface SecretListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const SecretListRequest: MessageFns; +interface SecretListResponse { + items: SecretListItem[]; + environmentName: string; +} +declare const SecretListResponse: MessageFns; +interface SecretMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const SecretMetadata: MessageFns; +interface SharedVolumeDeleteRequest { + sharedVolumeId: string; +} +declare const SharedVolumeDeleteRequest: MessageFns; +interface SharedVolumeGetFileRequest { + sharedVolumeId: string; + path: string; +} +declare const SharedVolumeGetFileRequest: MessageFns; +interface SharedVolumeGetFileResponse { + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; +} +declare const SharedVolumeGetFileResponse: MessageFns; +interface SharedVolumeGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; +} +declare const SharedVolumeGetOrCreateRequest: MessageFns; +interface SharedVolumeGetOrCreateResponse { + sharedVolumeId: string; +} +declare const SharedVolumeGetOrCreateResponse: MessageFns; +interface SharedVolumeHeartbeatRequest { + sharedVolumeId: string; +} +declare const SharedVolumeHeartbeatRequest: MessageFns; +interface SharedVolumeListFilesRequest { + sharedVolumeId: string; + path: string; +} +declare const SharedVolumeListFilesRequest: MessageFns; +interface SharedVolumeListFilesResponse { + entries: FileEntry[]; +} +declare const SharedVolumeListFilesResponse: MessageFns; +interface SharedVolumeListItem { + /** app name of object entity app */ + label: string; + sharedVolumeId: string; + createdAt: number; + cloudProvider: CloudProvider; +} +declare const SharedVolumeListItem: MessageFns; +interface SharedVolumeListRequest { + environmentName: string; +} +declare const SharedVolumeListRequest: MessageFns; +interface SharedVolumeListResponse { + items: SharedVolumeListItem[]; + environmentName: string; +} +declare const SharedVolumeListResponse: MessageFns; +interface SharedVolumeMount { + mountPath: string; + sharedVolumeId: string; + cloudProvider: CloudProvider; +} +declare const SharedVolumeMount: MessageFns; +interface SharedVolumePutFileRequest { + sharedVolumeId: string; + path: string; + sha256Hex: string; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** remove when required client version >= 47 */ + resumable: boolean; +} +declare const SharedVolumePutFileRequest: MessageFns; +interface SharedVolumePutFileResponse { + exists: boolean; +} +declare const SharedVolumePutFileResponse: MessageFns; +interface SharedVolumeRemoveFileRequest { + sharedVolumeId: string; + path: string; + recursive: boolean; +} +declare const SharedVolumeRemoveFileRequest: MessageFns; +interface SystemErrorMessage { + errorCode: SystemErrorCode; + errorMessage: string; +} +declare const SystemErrorMessage: MessageFns; +interface TaskClusterHelloRequest { + taskId: string; + containerIp: string; +} +declare const TaskClusterHelloRequest: MessageFns; +interface TaskClusterHelloResponse { + clusterId: string; + clusterRank: number; + /** All IPv6 addresses in cluster, ordered by cluster rank */ + containerIps: string[]; + containerIpv4Ips: string[]; +} +declare const TaskClusterHelloResponse: MessageFns; +interface TaskCurrentInputsResponse { + inputIds: string[]; +} +declare const TaskCurrentInputsResponse: MessageFns; +interface TaskGetAutoscalingMetricsRequest { + taskId: string; +} +declare const TaskGetAutoscalingMetricsRequest: MessageFns; +interface TaskGetAutoscalingMetricsResponse { + metrics: AutoscalingMetrics | undefined; +} +declare const TaskGetAutoscalingMetricsResponse: MessageFns; +/** + * Used to get a JWT and URL for direct access to a task command router + * running on the modal-worker, so the client can issue exec commands (and other + * operations as they become available) directly to the worker. + */ +interface TaskGetCommandRouterAccessRequest { + taskId: string; +} +declare const TaskGetCommandRouterAccessRequest: MessageFns; +interface TaskGetCommandRouterAccessResponse { + jwt: string; + url: string; +} +declare const TaskGetCommandRouterAccessResponse: MessageFns; +interface TaskInfo { + id: string; + startedAt: number; + finishedAt: number; + result: GenericResult | undefined; + enqueuedAt: number; + gpuType: string; + sandboxId: string; + snapshotBehavior: TaskSnapshotBehavior; + gpuConfig: GPUConfig | undefined; +} +declare const TaskInfo: MessageFns; +interface TaskListRequest { + environmentName: string; +} +declare const TaskListRequest: MessageFns; +interface TaskListResponse { + tasks: TaskStats[]; +} +declare const TaskListResponse: MessageFns; +interface TaskLogs { + data: string; + taskState: TaskState; + timestamp: number; + fileDescriptor: FileDescriptor; + taskProgress: TaskProgress | undefined; + functionCallId: string; + inputId: string; + timestampNs: number; +} +declare const TaskLogs: MessageFns; +interface TaskLogsBatch { + taskId: string; + items: TaskLogs[]; + entryId: string; + appDone: boolean; + functionId: string; + inputId: string; + /** Used for image logs */ + imageId: string; + eof: boolean; + /** Used for interactive functions */ + ptyExecId: string; + rootFunctionId: string; + ttlDays: number; +} +declare const TaskLogsBatch: MessageFns; +interface TaskProgress { + len: number; + pos: number; + progressType: ProgressType; + description: string; +} +declare const TaskProgress: MessageFns; +interface TaskResultRequest { + result: GenericResult | undefined; +} +declare const TaskResultRequest: MessageFns; +interface TaskStats { + taskId: string; + appId: string; + appDescription: string; + startedAt: number; +} +declare const TaskStats: MessageFns; +interface TaskTemplate { + rank: number; + resources: Resources | undefined; + targetConcurrentInputs: number; + maxConcurrentInputs: number; + /** + * TODO(irfansharif): Just move this into a column in the task table instead? + * Deprecate all above fields and get rid of this message altogether + */ + index: number; +} +declare const TaskTemplate: MessageFns; +interface TokenFlowCreateRequest { + utmSource: string; + localhostPort: number; + nextUrl: string; +} +declare const TokenFlowCreateRequest: MessageFns; +interface TokenFlowCreateResponse { + tokenFlowId: string; + webUrl: string; + code: string; + waitSecret: string; +} +declare const TokenFlowCreateResponse: MessageFns; +interface TokenFlowWaitRequest { + timeout: number; + tokenFlowId: string; + waitSecret: string; +} +declare const TokenFlowWaitRequest: MessageFns; +interface TokenFlowWaitResponse { + tokenId: string; + tokenSecret: string; + timeout: boolean; + workspaceUsername: string; +} +declare const TokenFlowWaitResponse: MessageFns; +interface TunnelData { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; + containerPort: number; +} +declare const TunnelData: MessageFns; +interface TunnelStartRequest { + port: number; + unencrypted: boolean; + tunnelType?: TunnelType | undefined; +} +declare const TunnelStartRequest: MessageFns; +interface TunnelStartResponse { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; +} +declare const TunnelStartResponse: MessageFns; +interface TunnelStopRequest { + port: number; +} +declare const TunnelStopRequest: MessageFns; +interface TunnelStopResponse { + exists: boolean; +} +declare const TunnelStopResponse: MessageFns; +interface UploadUrlList { + items: string[]; +} +declare const UploadUrlList: MessageFns; +interface VolumeCommitRequest { + /** + * NOTE(staffan): Mounting a volume in multiple locations is not supported, so volume_id alone uniquely identifies + * a volume mount. + */ + volumeId: string; +} +declare const VolumeCommitRequest: MessageFns; +interface VolumeCommitResponse { + skipReload: boolean; +} +declare const VolumeCommitResponse: MessageFns; +interface VolumeCopyFiles2Request { + volumeId: string; + srcPaths: string[]; + dstPath: string; + recursive: boolean; +} +declare const VolumeCopyFiles2Request: MessageFns; +interface VolumeCopyFilesRequest { + volumeId: string; + srcPaths: string[]; + dstPath: string; + recursive: boolean; +} +declare const VolumeCopyFilesRequest: MessageFns; +interface VolumeDeleteRequest { + volumeId: string; + /** @deprecated */ + environmentName: string; +} +declare const VolumeDeleteRequest: MessageFns; +interface VolumeGetFile2Request { + volumeId: string; + path: string; + start: number; + /** 0 is interpreted as 'read to end' */ + len: number; +} +declare const VolumeGetFile2Request: MessageFns; +interface VolumeGetFile2Response { + getUrls: string[]; + /** total file size */ + size: number; + /** file position of first byte returned */ + start: number; + /** number of bytes returned */ + len: number; +} +declare const VolumeGetFile2Response: MessageFns; +interface VolumeGetFileRequest { + volumeId: string; + path: string; + start: number; + /** 0 is interpreted as 'read to end' */ + len: number; +} +declare const VolumeGetFileRequest: MessageFns; +interface VolumeGetFileResponse { + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** total file size */ + size: number; + /** file position of first byte returned */ + start: number; + /** number of bytes returned */ + len: number; +} +declare const VolumeGetFileResponse: MessageFns; +interface VolumeGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; + version: VolumeFsVersion; +} +declare const VolumeGetOrCreateRequest: MessageFns; +interface VolumeGetOrCreateResponse { + volumeId: string; + /** Not used directly; version is part of the metadata */ + version: VolumeFsVersion; + metadata: VolumeMetadata | undefined; +} +declare const VolumeGetOrCreateResponse: MessageFns; +interface VolumeHeartbeatRequest { + volumeId: string; +} +declare const VolumeHeartbeatRequest: MessageFns; +interface VolumeListFiles2Request { + volumeId: string; + path: string; + recursive: boolean; + maxEntries?: number | undefined; +} +declare const VolumeListFiles2Request: MessageFns; +interface VolumeListFiles2Response { + entries: FileEntry[]; +} +declare const VolumeListFiles2Response: MessageFns; +interface VolumeListFilesRequest { + volumeId: string; + path: string; + recursive: boolean; + maxEntries?: number | undefined; +} +declare const VolumeListFilesRequest: MessageFns; +interface VolumeListFilesResponse { + entries: FileEntry[]; +} +declare const VolumeListFilesResponse: MessageFns; +interface VolumeListItem { + /** app name of object entity app */ + label: string; + volumeId: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + metadata: VolumeMetadata | undefined; +} +declare const VolumeListItem: MessageFns; +interface VolumeListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const VolumeListRequest: MessageFns; +interface VolumeListResponse { + items: VolumeListItem[]; + environmentName: string; +} +declare const VolumeListResponse: MessageFns; +interface VolumeMetadata { + version: VolumeFsVersion; + name: string; + creationInfo: CreationInfo | undefined; +} +declare const VolumeMetadata: MessageFns; +interface VolumeMount { + volumeId: string; + mountPath: string; + allowBackgroundCommits: boolean; + readOnly: boolean; +} +declare const VolumeMount: MessageFns; +interface VolumePutFiles2Request { + /** The ID of the volume to put/upload files into. */ + volumeId: string; + /** List of files to put/upload. */ + files: VolumePutFiles2Request_File[]; + /** + * If set to true, prevent overwriting existing files. (Note that we don't + * allow overwriting existing directories with uploaded files regardless.) + */ + disallowOverwriteExistingFiles: boolean; +} +declare const VolumePutFiles2Request: MessageFns; +interface VolumePutFiles2Request_File { + /** + * Destination path of the file to be uploaded, including any parent dirs + * etc.; for example "foo/bar/baz.txt" + */ + path: string; + /** The total size of the file, in bytes. */ + size: number; + /** The blocks, in units of 8MiB, that this file consists of. */ + blocks: VolumePutFiles2Request_Block[]; + /** Unix file permission bits `st_mode`. */ + mode?: number | undefined; +} +declare const VolumePutFiles2Request_File: MessageFns; +interface VolumePutFiles2Request_Block { + /** + * The SHA256 digest of the contents of this block, in raw (ie. 32 bytes) + * form for compactness. + */ + contentsSha256: Uint8Array; + /** + * From a previous call to `VolumePutFiles2`, we might have gotten a + * response indicating that this block was missing. + * + * For such a block, this field contains the raw bytes of the body that + * was returned from the HTTP PUT request when the client made a request + * for the `put_url` returned in the previous `VolumePutFiles2Response`. + */ + putResponse?: Uint8Array | undefined; +} +declare const VolumePutFiles2Request_Block: MessageFns; +interface VolumePutFiles2Response { + /** + * Blocks that are currently missing in the volume, because the file did not + * exist, or because the block checksum from `blocks_sha256` in the request + * did not match the current contents of the file. + * + * Values will be returned sorted by `(file_index, block_index)`. + * + * If this field is empty, it means that the files were uploaded successfully + * and/or that the request was an idempotent no-op. + */ + missingBlocks: VolumePutFiles2Response_MissingBlock[]; +} +declare const VolumePutFiles2Response: MessageFns; +interface VolumePutFiles2Response_MissingBlock { + /** Index of the file in the original `files` field of the request. */ + fileIndex: number; + /** + * The index of the block in the original `files[file_index].blocks` of the + * request. + */ + blockIndex: number; + /** + * Make a HTTP PUT request to this endpoint with the blocks' contents as + * the body. + */ + putUrl: string; +} +declare const VolumePutFiles2Response_MissingBlock: MessageFns; +interface VolumePutFilesRequest { + volumeId: string; + /** TODO(staffan): This is obviously unfortunately named, but provides what we need - consider renaming. */ + files: MountFile[]; + /** + * If set to true, prevent overwriting existing files. (Note that we don't allow overwriting + * existing directories with uploaded files regardless.) + */ + disallowOverwriteExistingFiles: boolean; +} +declare const VolumePutFilesRequest: MessageFns; +interface VolumeReloadRequest { + /** + * NOTE(staffan): Mounting a volume in multiple locations is not supported, so volume_id alone uniquely identifies + * a volume mount. + */ + volumeId: string; +} +declare const VolumeReloadRequest: MessageFns; +interface VolumeRemoveFile2Request { + volumeId: string; + path: string; + recursive: boolean; +} +declare const VolumeRemoveFile2Request: MessageFns; +interface VolumeRemoveFileRequest { + volumeId: string; + path: string; + recursive: boolean; +} +declare const VolumeRemoveFileRequest: MessageFns; +interface VolumeRenameRequest { + volumeId: string; + name: string; +} +declare const VolumeRenameRequest: MessageFns; +interface Warning { + type: Warning_WarningType; + message: string; +} +declare const Warning: MessageFns; +interface WebUrlInfo { + truncated: boolean; + /** @deprecated */ + hasUniqueHash: boolean; + labelStolen: boolean; +} +declare const WebUrlInfo: MessageFns; +interface WebhookConfig { + type: WebhookType; + method: string; + requestedSuffix: string; + asyncMode: WebhookAsyncMode; + customDomains: CustomDomainConfig[]; + webServerPort: number; + webServerStartupTimeout: number; + webEndpointDocs: boolean; + requiresProxyAuth: boolean; +} +declare const WebhookConfig: MessageFns; +interface WorkspaceBillingReportItem { + objectId: string; + description: string; + environmentName: string; + interval: Date | undefined; + cost: string; + tags: { + [key: string]: string; + }; +} +declare const WorkspaceBillingReportItem: MessageFns; +interface WorkspaceBillingReportRequest { + /** Workspace ID will be implicit in the request metadata */ + startTimestamp: Date | undefined; + endTimestamp: Date | undefined; + /** e.g. 'd' or 'h'; server defines what we accept */ + resolution: string; + tagNames: string[]; +} +declare const WorkspaceBillingReportRequest: MessageFns; +interface WorkspaceNameLookupResponse { + /** @deprecated */ + workspaceName: string; + username: string; +} +declare const WorkspaceNameLookupResponse: MessageFns; +type ModalClientDefinition = typeof ModalClientDefinition; +declare const ModalClientDefinition: { + readonly name: "ModalClient"; + readonly fullName: "modal.client.ModalClient"; + readonly methods: { + /** Apps */ + readonly appClientDisconnect: { + readonly name: "AppClientDisconnect"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appCreate: { + readonly name: "AppCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appDeploy: { + readonly name: "AppDeploy"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appDeploymentHistory: { + readonly name: "AppDeploymentHistory"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetByDeploymentName: { + readonly name: "AppGetByDeploymentName"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetLayout: { + readonly name: "AppGetLayout"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetLogs: { + readonly name: "AppGetLogs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly appGetObjects: { + readonly name: "AppGetObjects"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetOrCreate: { + readonly name: "AppGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetTags: { + readonly name: "AppGetTags"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appHeartbeat: { + readonly name: "AppHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appList: { + readonly name: "AppList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appLookup: { + readonly name: "AppLookup"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appPublish: { + readonly name: "AppPublish"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appRollback: { + readonly name: "AppRollback"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appSetObjects: { + readonly name: "AppSetObjects"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appSetTags: { + readonly name: "AppSetTags"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appStop: { + readonly name: "AppStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Input Plane */ + readonly attemptAwait: { + readonly name: "AttemptAwait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly attemptRetry: { + readonly name: "AttemptRetry"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly attemptStart: { + readonly name: "AttemptStart"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Auth Token */ + readonly authTokenGet: { + readonly name: "AuthTokenGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Blobs */ + readonly blobCreate: { + readonly name: "BlobCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly blobGet: { + readonly name: "BlobGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Classes */ + readonly classCreate: { + readonly name: "ClassCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly classGet: { + readonly name: "ClassGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Clients */ + readonly clientHello: { + readonly name: "ClientHello"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Clusters */ + readonly clusterGet: { + readonly name: "ClusterGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly clusterList: { + readonly name: "ClusterList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Container */ + readonly containerCheckpoint: { + readonly name: "ContainerCheckpoint"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExec: { + readonly name: "ContainerExec"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExecGetOutput: { + readonly name: "ContainerExecGetOutput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly containerExecPutInput: { + readonly name: "ContainerExecPutInput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExecWait: { + readonly name: "ContainerExecWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerFilesystemExec: { + readonly name: "ContainerFilesystemExec"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerFilesystemExecGetOutput: { + readonly name: "ContainerFilesystemExecGetOutput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly containerHeartbeat: { + readonly name: "ContainerHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerHello: { + readonly name: "ContainerHello"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerLog: { + readonly name: "ContainerLog"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerReloadVolumes: { + readonly name: "ContainerReloadVolumes"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerStop: { + readonly name: "ContainerStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Dicts */ + readonly dictClear: { + readonly name: "DictClear"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictContains: { + readonly name: "DictContains"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictContents: { + readonly name: "DictContents"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly dictDelete: { + readonly name: "DictDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictGet: { + readonly name: "DictGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictGetOrCreate: { + readonly name: "DictGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictHeartbeat: { + readonly name: "DictHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictLen: { + readonly name: "DictLen"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictList: { + readonly name: "DictList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictPop: { + readonly name: "DictPop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictUpdate: { + readonly name: "DictUpdate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Domains */ + readonly domainCertificateVerify: { + readonly name: "DomainCertificateVerify"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly domainCreate: { + readonly name: "DomainCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly domainList: { + readonly name: "DomainList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Environments */ + readonly environmentCreate: { + readonly name: "EnvironmentCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentDelete: { + readonly name: "EnvironmentDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentGetOrCreate: { + readonly name: "EnvironmentGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentList: { + readonly name: "EnvironmentList"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentUpdate: { + readonly name: "EnvironmentUpdate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Modal Flash (experimental) */ + readonly flashContainerDeregister: { + readonly name: "FlashContainerDeregister"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashContainerList: { + readonly name: "FlashContainerList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashContainerRegister: { + readonly name: "FlashContainerRegister"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashSetTargetSlotsMetrics: { + readonly name: "FlashSetTargetSlotsMetrics"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Functions */ + readonly functionAsyncInvoke: { + readonly name: "FunctionAsyncInvoke"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionBindParams: { + readonly name: "FunctionBindParams"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallCancel: { + readonly name: "FunctionCallCancel"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallFromId: { + readonly name: "FunctionCallFromId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallGetDataIn: { + readonly name: "FunctionCallGetDataIn"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly functionCallGetDataOut: { + readonly name: "FunctionCallGetDataOut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly functionCallList: { + readonly name: "FunctionCallList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallPutDataOut: { + readonly name: "FunctionCallPutDataOut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCreate: { + readonly name: "FunctionCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For map RPCs, to signal that all inputs have been sent */ + readonly functionFinishInputs: { + readonly name: "FunctionFinishInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGet: { + readonly name: "FunctionGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetCallGraph: { + readonly name: "FunctionGetCallGraph"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetCurrentStats: { + readonly name: "FunctionGetCurrentStats"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetDynamicConcurrency: { + readonly name: "FunctionGetDynamicConcurrency"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For containers to request next call */ + readonly functionGetInputs: { + readonly name: "FunctionGetInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Returns the next result(s) for an entire function call (FunctionMap) */ + readonly functionGetOutputs: { + readonly name: "FunctionGetOutputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetSerialized: { + readonly name: "FunctionGetSerialized"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionMap: { + readonly name: "FunctionMap"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionPrecreate: { + readonly name: "FunctionPrecreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionPutInputs: { + readonly name: "FunctionPutInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For containers to return result */ + readonly functionPutOutputs: { + readonly name: "FunctionPutOutputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionRetryInputs: { + readonly name: "FunctionRetryInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionStartPtyShell: { + readonly name: "FunctionStartPtyShell"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionUpdateSchedulingParams: { + readonly name: "FunctionUpdateSchedulingParams"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Images */ + readonly imageDelete: { + readonly name: "ImageDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageFromId: { + readonly name: "ImageFromId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageGetOrCreate: { + readonly name: "ImageGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageJoinStreaming: { + readonly name: "ImageJoinStreaming"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + /** Input Plane Map */ + readonly mapAwait: { + readonly name: "MapAwait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mapCheckInputs: { + readonly name: "MapCheckInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mapStartOrContinue: { + readonly name: "MapStartOrContinue"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Mounts */ + readonly mountGetOrCreate: { + readonly name: "MountGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mountPutFile: { + readonly name: "MountPutFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Notebooks */ + readonly notebookKernelPublishResults: { + readonly name: "NotebookKernelPublishResults"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Proxies */ + readonly proxyAddIp: { + readonly name: "ProxyAddIp"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyCreate: { + readonly name: "ProxyCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyDelete: { + readonly name: "ProxyDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyGet: { + readonly name: "ProxyGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyGetOrCreate: { + readonly name: "ProxyGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyList: { + readonly name: "ProxyList"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyRemoveIp: { + readonly name: "ProxyRemoveIp"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Queues */ + readonly queueClear: { + readonly name: "QueueClear"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueDelete: { + readonly name: "QueueDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueGet: { + readonly name: "QueueGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueGetOrCreate: { + readonly name: "QueueGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueHeartbeat: { + readonly name: "QueueHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueLen: { + readonly name: "QueueLen"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueList: { + readonly name: "QueueList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueNextItems: { + readonly name: "QueueNextItems"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queuePut: { + readonly name: "QueuePut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Sandboxes */ + readonly sandboxCreate: { + readonly name: "SandboxCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxCreateConnectToken: { + readonly name: "SandboxCreateConnectToken"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetCommandRouterAccess: { + readonly name: "SandboxGetCommandRouterAccess"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetFromName: { + readonly name: "SandboxGetFromName"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetLogs: { + readonly name: "SandboxGetLogs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly sandboxGetResourceUsage: { + readonly name: "SandboxGetResourceUsage"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** needed for modal container exec */ + readonly sandboxGetTaskId: { + readonly name: "SandboxGetTaskId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetTunnels: { + readonly name: "SandboxGetTunnels"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxList: { + readonly name: "SandboxList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxRestore: { + readonly name: "SandboxRestore"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshot: { + readonly name: "SandboxSnapshot"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFs: { + readonly name: "SandboxSnapshotFs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFsAsync: { + readonly name: "SandboxSnapshotFsAsync"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFsAsyncGet: { + readonly name: "SandboxSnapshotFsAsyncGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotGet: { + readonly name: "SandboxSnapshotGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotWait: { + readonly name: "SandboxSnapshotWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxStdinWrite: { + readonly name: "SandboxStdinWrite"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTagsGet: { + readonly name: "SandboxTagsGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTagsSet: { + readonly name: "SandboxTagsSet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTerminate: { + readonly name: "SandboxTerminate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxWait: { + readonly name: "SandboxWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Secrets */ + readonly secretDelete: { + readonly name: "SecretDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly secretGetOrCreate: { + readonly name: "SecretGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly secretList: { + readonly name: "SecretList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** SharedVolumes */ + readonly sharedVolumeDelete: { + readonly name: "SharedVolumeDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeGetFile: { + readonly name: "SharedVolumeGetFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeGetOrCreate: { + readonly name: "SharedVolumeGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeHeartbeat: { + readonly name: "SharedVolumeHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeList: { + readonly name: "SharedVolumeList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeListFiles: { + readonly name: "SharedVolumeListFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeListFilesStream: { + readonly name: "SharedVolumeListFilesStream"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly sharedVolumePutFile: { + readonly name: "SharedVolumePutFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeRemoveFile: { + readonly name: "SharedVolumeRemoveFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Tasks */ + readonly taskClusterHello: { + readonly name: "TaskClusterHello"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskCurrentInputs: { + readonly name: "TaskCurrentInputs"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Used for flash autoscaling */ + readonly taskGetAutoscalingMetrics: { + readonly name: "TaskGetAutoscalingMetrics"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskGetCommandRouterAccess: { + readonly name: "TaskGetCommandRouterAccess"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskList: { + readonly name: "TaskList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskResult: { + readonly name: "TaskResult"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Tokens (web auth flow) */ + readonly tokenFlowCreate: { + readonly name: "TokenFlowCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly tokenFlowWait: { + readonly name: "TokenFlowWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Tunnels */ + readonly tunnelStart: { + readonly name: "TunnelStart"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly tunnelStop: { + readonly name: "TunnelStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Volumes */ + readonly volumeCommit: { + readonly name: "VolumeCommit"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeCopyFiles: { + readonly name: "VolumeCopyFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeCopyFiles2: { + readonly name: "VolumeCopyFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeDelete: { + readonly name: "VolumeDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetFile: { + readonly name: "VolumeGetFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetFile2: { + readonly name: "VolumeGetFile2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetOrCreate: { + readonly name: "VolumeGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeHeartbeat: { + readonly name: "VolumeHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeList: { + readonly name: "VolumeList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeListFiles: { + readonly name: "VolumeListFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly volumeListFiles2: { + readonly name: "VolumeListFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly volumePutFiles: { + readonly name: "VolumePutFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumePutFiles2: { + readonly name: "VolumePutFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeReload: { + readonly name: "VolumeReload"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRemoveFile: { + readonly name: "VolumeRemoveFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRemoveFile2: { + readonly name: "VolumeRemoveFile2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRename: { + readonly name: "VolumeRename"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Workspaces */ + readonly workspaceBillingReport: { + readonly name: "WorkspaceBillingReport"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly workspaceNameLookup: { + readonly name: "WorkspaceNameLookup"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + }; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} + +/** Optional parameters for {@link SecretService#fromName client.secrets.fromName()}. */ +type SecretFromNameParams = { + environment?: string; + requiredKeys?: string[]; +}; +/** Optional parameters for {@link SecretService#fromObject client.secrets.fromObject()}. */ +type SecretFromObjectParams = { + environment?: string; +}; +/** Optional parameters for {@link SecretService#delete client.secrets.delete()}. */ +type SecretDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** + * Service for managing {@link Secret Secrets}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const secret = await modal.secrets.fromName("my-secret"); + * ``` + */ +declare class SecretService { + #private; + constructor(client: ModalClient); + /** Reference a {@link Secret} by its name. */ + fromName(name: string, params?: SecretFromNameParams): Promise; + /** Create a {@link Secret} from a plain object of key-value pairs. */ + fromObject(entries: Record, params?: SecretFromObjectParams): Promise; + /** + * Delete a named {@link Secret}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Secret. + */ + delete(name: string, params?: SecretDeleteParams): Promise; +} +/** Secrets provide a dictionary of environment variables for {@link Image}s. */ +declare class Secret { + readonly secretId: string; + readonly name?: string; + /** @ignore */ + constructor(secretId: string, name?: string); + /** + * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead. + */ + static fromName(name: string, params?: SecretFromNameParams): Promise; + /** + * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead. + */ + static fromObject(entries: Record, params?: SecretFromObjectParams): Promise; +} + +declare class CloudBucketMountService { + #private; + constructor(client: ModalClient); + create(bucketName: string, params?: { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }): CloudBucketMount; +} +/** Cloud Bucket Mounts provide access to cloud storage buckets within Modal Functions. */ +declare class CloudBucketMount { + #private; + readonly bucketName: string; + readonly secret?: Secret; + readonly readOnly: boolean; + readonly requesterPays: boolean; + readonly bucketEndpointUrl?: string; + readonly keyPrefix?: string; + readonly oidcAuthRoleArn?: string; + /** + * @deprecated Use {@link CloudBucketMountService#create client.cloudBucketMounts.create()} instead. + */ + constructor(bucketName: string, params?: { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }); + /** @ignore */ + constructor(bucketName: string, secret: Secret | undefined, readOnly: boolean, requesterPays: boolean, bucketEndpointUrl: string | undefined, keyPrefix: string | undefined, oidcAuthRoleArn: string | undefined, bucketType: CloudBucketMount_BucketType); + /** @ignore */ + toProto(mountPath: string): CloudBucketMount$1; +} + +/** + * Service for managing {@link FunctionCall}s. + * + * Normally only ever accessed via the client as: + * + * ```typescript + * const modal = new ModalClient(); + * const functionCall = await modal.functionCalls.fromId("123"); + * ``` + */ +declare class FunctionCallService { + #private; + constructor(client: ModalClient); + /** + * Create a new {@link FunctionCall} from ID. + */ + fromId(functionCallId: string): Promise; +} +/** Optional parameters for {@link FunctionCall#get FunctionCall.get()}. */ +type FunctionCallGetParams = { + timeoutMs?: number; +}; +/** Optional parameters for {@link FunctionCall#cancel FunctionCall.cancel()}. */ +type FunctionCallCancelParams = { + terminateContainers?: boolean; +}; +/** + * Represents a Modal FunctionCall. FunctionCalls are {@link Function_ Function} invocations with + * a given input. They can be consumed asynchronously (see {@link FunctionCall#get FunctionCall.get()}) or cancelled + * (see {@link FunctionCall#cancel FunctionCall.cancel()}). + */ +declare class FunctionCall { + #private; + readonly functionCallId: string; + /** @ignore */ + constructor(client: ModalClient | undefined, functionCallId: string); + /** + * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead. + */ + static fromId(functionCallId: string): FunctionCall; + /** Get the result of a FunctionCall, optionally waiting with a timeout. */ + get(params?: FunctionCallGetParams): Promise; + /** Cancel a running FunctionCall. */ + cancel(params?: FunctionCallCancelParams): Promise; +} + +/** Optional parameters for `client.functions.fromName()`. */ +type FunctionFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** + * Service for managing {@link Function_ Function}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const function = await modal.functions.fromName("my-app", "my-function"); + * ``` + */ +declare class FunctionService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Function_ Function} by its name in an App. + */ + fromName(appName: string, name: string, params?: FunctionFromNameParams): Promise; +} +/** Simple data structure storing stats for a running {@link Function_ Function}. */ +interface FunctionStats { + backlog: number; + numTotalRunners: number; +} +/** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */ +interface FunctionUpdateAutoscalerParams { + minContainers?: number; + maxContainers?: number; + bufferContainers?: number; + scaledownWindowMs?: number; +} +/** Represents a deployed Modal Function, which can be invoked remotely. */ +declare class Function_ { + #private; + readonly functionId: string; + readonly methodName?: string; + /** @ignore */ + constructor(client: ModalClient, functionId: string, methodName?: string, functionHandleMetadata?: FunctionHandleMetadata); + /** + * @deprecated Use `client.functions.fromName()` instead. + */ + static lookup(appName: string, name: string, params?: FunctionFromNameParams): Promise; + remote(args?: any[], kwargs?: Record): Promise; + spawn(args?: any[], kwargs?: Record): Promise; + getCurrentStats(): Promise; + updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise; + /** + * URL of a Function running as a web endpoint. + * @returns The web URL if this Function is a web endpoint, otherwise undefined + */ + getWebUrl(): Promise; +} + +/** Retry policy configuration for a Modal Function/Cls. */ +declare class Retries { + readonly maxRetries: number; + readonly backoffCoefficient: number; + readonly initialDelayMs: number; + readonly maxDelayMs: number; + constructor(params: { + maxRetries: number; + backoffCoefficient?: number; + initialDelayMs?: number; + maxDelayMs?: number; + }); +} + +type HeartbeatFunction = () => Promise; +declare class EphemeralHeartbeatManager { + private readonly heartbeatFn; + private readonly abortController; + constructor(heartbeatFn: HeartbeatFunction); + private start; + stop(): void; +} + +/** Optional parameters for {@link VolumeService#fromName client.volumes.fromName()}. */ +type VolumeFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** Optional parameters for {@link VolumeService#ephemeral client.volumes.ephemeral()}. */ +type VolumeEphemeralParams = { + environment?: string; +}; +/** Optional parameters for {@link VolumeService#delete client.volumes.delete()}. */ +type VolumeDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** + * Service for managing {@link Volume}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const volume = await modal.volumes.fromName("my-volume"); + * ``` + */ +declare class VolumeService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Volume} by its name. + */ + fromName(name: string, params?: VolumeFromNameParams): Promise; + /** + * Create a nameless, temporary {@link Volume}. + * It persists until closeEphemeral() is called, or the process exits. + */ + ephemeral(params?: VolumeEphemeralParams): Promise; + /** + * Delete a named {@link Volume}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Volume. + */ + delete(name: string, params?: VolumeDeleteParams): Promise; +} +/** Volumes provide persistent storage that can be mounted in Modal {@link Function_ Function}s. */ +declare class Volume { + #private; + readonly volumeId: string; + readonly name?: string; + private _readOnly; + /** @ignore */ + constructor(volumeId: string, name?: string, readOnly?: boolean, ephemeralHbManager?: EphemeralHeartbeatManager); + /** + * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead. + */ + static fromName(name: string, options?: VolumeFromNameParams): Promise; + /** Configure Volume to mount as read-only. */ + readOnly(): Volume; + get isReadOnly(): boolean; + /** + * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead. + */ + static ephemeral(options?: VolumeEphemeralParams): Promise; + /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */ + closeEphemeral(): void; +} + +/** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */ +type ClsFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** + * Service for managing {@link Cls}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const cls = await modal.cls.fromName("my-app", "MyCls"); + * ``` + */ +declare class ClsService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Cls} from a deployed {@link App} by its name. + */ + fromName(appName: string, name: string, params?: ClsFromNameParams): Promise; +} +type ClsWithOptionsParams = { + cpu?: number; + cpuLimit?: number; + memoryMiB?: number; + memoryLimitMiB?: number; + gpu?: string; + env?: Record; + secrets?: Secret[]; + volumes?: Record; + retries?: number | Retries; + maxContainers?: number; + bufferContainers?: number; + scaledownWindowMs?: number; + timeoutMs?: number; +}; +type ClsWithConcurrencyParams = { + maxInputs: number; + targetInputs?: number; +}; +type ClsWithBatchingParams = { + maxBatchSize: number; + waitMs: number; +}; +type ServiceOptions = ClsWithOptionsParams & { + maxConcurrentInputs?: number; + targetConcurrentInputs?: number; + batchMaxSize?: number; + batchWaitMs?: number; +}; +/** Represents a deployed Modal Cls. */ +declare class Cls { + #private; + /** @ignore */ + constructor(client: ModalClient, serviceFunctionId: string, serviceFunctionMetadata: FunctionHandleMetadata, options?: ServiceOptions); + /** + * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead. + */ + static lookup(appName: string, name: string, params?: ClsFromNameParams): Promise; + /** Create a new instance of the Cls with parameters and/or runtime options. */ + instance(parameters?: Record): Promise; + /** Override the static Function configuration at runtime. */ + withOptions(options: ClsWithOptionsParams): Cls; + /** Create an instance of the Cls with input concurrency enabled or overridden with new values. */ + withConcurrency(params: ClsWithConcurrencyParams): Cls; + /** Create an instance of the Cls with dynamic batching enabled or overridden with new values. */ + withBatching(params: ClsWithBatchingParams): Cls; +} +/** Represents an instance of a deployed Modal {@link Cls}, optionally with parameters. */ +declare class ClsInstance { + #private; + constructor(methods: Map); + method(name: string): Function_; +} + +/** + * Service for managing {@link Image}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const image = await modal.images.fromRegistry("alpine"); + * ``` + */ +declare class ImageService { + #private; + constructor(client: ModalClient); + /** + * Creates an {@link Image} from an Image ID + * + * @param imageId - Image ID. + */ + fromId(imageId: string): Promise; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - Optional. A Secret containing credentials for registry authentication. + */ + fromRegistry(tag: string, secret?: Secret): Image; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromAwsEcr(tag: string, secret: Secret): Image; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromGcpArtifactRegistry(tag: string, secret: Secret): Image; + /** + * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. + */ + delete(imageId: string, _?: ImageDeleteParams): Promise; +} +/** Optional parameters for {@link ImageService#delete client.images.delete()}. */ +type ImageDeleteParams = Record; +/** Optional parameters for {@link Image#dockerfileCommands Image.dockerfileCommands()}. */ +type ImageDockerfileCommandsParams = { + /** Environment variables to set in the build environment. */ + env?: Record; + /** {@link Secret}s that will be made available as environment variables to this layer's build environment. */ + secrets?: Secret[]; + /** GPU reservation for this layer's build environment (e.g. "A100", "T4:2", "A100-80GB:4"). */ + gpu?: string; + /** Ignore cached builds for this layer, similar to 'docker build --no-cache'. */ + forceBuild?: boolean; +}; +/** Represents a single image layer with its build configuration. */ +type Layer = { + commands: string[]; + env?: Record; + secrets?: Secret[]; + gpuConfig?: GPUConfig; + forceBuild?: boolean; +}; +/** A container image, used for starting {@link Sandbox}es. */ +declare class Image { + #private; + /** @ignore */ + constructor(client: ModalClient, imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[]); + get imageId(): string; + /** + * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead. + */ + static fromId(imageId: string): Promise; + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + static fromRegistry(tag: string, secret?: Secret): Image; + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + static fromAwsEcr(tag: string, secret: Secret): Image; + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + static fromGcpArtifactRegistry(tag: string, secret: Secret): Image; + private static validateDockerfileCommands; + /** + * Extend an image with arbitrary Dockerfile-like commands. + * + * Each call creates a new Image layer that will be built sequentially. + * The provided options apply only to this layer. + * + * @param commands - Array of Dockerfile commands as strings + * @param params - Optional configuration for this layer's build + * @returns A new Image instance + */ + dockerfileCommands(commands: string[], params?: ImageDockerfileCommandsParams): Image; + /** + * Eagerly builds an Image on Modal. + * + * @param app - App to use to build the Image. + */ + build(app: App): Promise; + /** + * @deprecated Use {@link ImageService#delete client.images.delete()} instead. + */ + static delete(imageId: string, _?: ImageDeleteParams): Promise; +} + +/** + * Service for managing {@link Proxy Proxies}. + */ +declare class ProxyService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Proxy} by its name. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const proxy = await modal.proxies.fromName("my-proxy"); + * ``` + */ + fromName(name: string, params?: ProxyFromNameParams): Promise; +} +/** Optional parameters for {@link ProxyService#fromName client.proxies.fromName()}. */ +type ProxyFromNameParams = { + environment?: string; +}; +/** Proxy objects give your Modal containers a static outbound IP address. */ +declare class Proxy { + readonly proxyId: string; + /** @ignore */ + constructor(proxyId: string); + /** + * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead. + */ + static fromName(name: string, params?: ProxyFromNameParams): Promise; +} + +/** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */ +type QueueFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** Optional parameters for {@link QueueService#delete client.queues.delete()}. */ +type QueueDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** Optional parameters for {@link QueueService#ephemeral client.queues.ephemeral()}. */ +type QueueEphemeralParams = { + environment?: string; +}; +/** + * Service for managing {@link Queue}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const queue = await modal.queues.fromName("my-queue"); + * ``` + */ +declare class QueueService { + #private; + constructor(client: ModalClient); + /** + * Create a nameless, temporary {@link Queue}. + * You will need to call {@link Queue#closeEphemeral Queue.closeEphemeral()} to delete the Queue. + */ + ephemeral(params?: QueueEphemeralParams): Promise; + /** + * Reference a {@link Queue} by name. + */ + fromName(name: string, params?: QueueFromNameParams): Promise; + /** + * Delete a {@link Queue} by name. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Queue. + */ + delete(name: string, params?: QueueDeleteParams): Promise; +} +/** Optional parameters for {@link Queue#clear Queue.clear()}. */ +type QueueClearParams = { + /** Partition to clear, uses default partition if not set. */ + partition?: string; + /** Set to clear all Queue partitions. */ + all?: boolean; +}; +/** Optional parameters for {@link Queue#get Queue.get()}. */ +type QueueGetParams = { + /** How long to wait if the Queue is empty in milliseconds (default: indefinite). */ + timeoutMs?: number; + /** Partition to fetch values from, uses default partition if not set. */ + partition?: string; +}; +/** Optional parameters for {@link Queue#getMany Queue.getMany()}. */ +type QueueGetManyParams = QueueGetParams; +/** Optional parameters for {@link Queue#put Queue.put()}. */ +type QueuePutParams = { + /** How long to wait if the Queue is full in milliseconds (default: indefinite). */ + timeoutMs?: number; + /** Partition to add items to, uses default partition if not set. */ + partition?: string; + /** TTL for the partition in milliseconds (default: 1 day). */ + partitionTtlMs?: number; +}; +/** Optional parameters for {@link Queue#putMany Queue.putMany()}. */ +type QueuePutManyParams = QueuePutParams; +/** Optional parameters for {@link Queue#len Queue.len()}. */ +type QueueLenParams = { + /** Partition to compute length, uses default partition if not set. */ + partition?: string; + /** Return the total length across all partitions. */ + total?: boolean; +}; +/** Optional parameters for {@link Queue#iterate Queue.iterate()}. */ +type QueueIterateParams = { + /** How long to wait between successive items before exiting iteration in milliseconds (default: 0). */ + itemPollTimeoutMs?: number; + /** Partition to iterate, uses default partition if not set. */ + partition?: string; +}; +/** + * Distributed, FIFO queue for data flow in Modal {@link App Apps}. + */ +declare class Queue { + #private; + readonly queueId: string; + readonly name?: string; + /** @ignore */ + constructor(client: ModalClient, queueId: string, name?: string, ephemeralHbManager?: EphemeralHeartbeatManager); + /** + * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead. + */ + static ephemeral(params?: QueueEphemeralParams): Promise; + /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */ + closeEphemeral(): void; + /** + * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead. + */ + static lookup(name: string, options?: QueueFromNameParams): Promise; + /** + * @deprecated Use {@link QueueService#delete client.queues.delete()} instead. + */ + static delete(name: string, options?: QueueDeleteParams): Promise; + /** + * Remove all objects from a Queue partition. + */ + clear(params?: QueueClearParams): Promise; + /** + * Remove and return the next object from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + get(params?: QueueGetParams): Promise; + /** + * Remove and return up to `n` objects from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + getMany(n: number, params?: QueueGetManyParams): Promise; + /** + * Add an item to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + put(v: any, params?: QueuePutParams): Promise; + /** + * Add several items to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + putMany(values: any[], params?: QueuePutManyParams): Promise; + /** Return the number of objects in the Queue. */ + len(params?: QueueLenParams): Promise; + /** Iterate through items in a Queue without mutation. */ + iterate(params?: QueueIterateParams): AsyncGenerator; +} + +/** + * Represents a memory snapshot of a Sandbox. + * This is an experimental feature. + */ +declare class SandboxSnapshot { + readonly snapshotId: string; + /** @ignore */ + constructor(client: ModalClient, snapshotId: string); + /** + * @deprecated Use {@link SandboxSnapshotService#fromId client.sandboxSnapshots.fromId()} instead. + */ + static fromId(snapshotId: string): Promise; +} +/** + * Service for managing {@link SandboxSnapshot}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const snapshot = await modal.sandboxSnapshots.fromId("..."); + * ``` + */ +declare class SandboxSnapshotService { + #private; + constructor(client: ModalClient); + /** + * Get a {@link SandboxSnapshot} by ID. + */ + fromId(snapshotId: string): Promise; +} + +/** File open modes supported by the filesystem API. */ +type SandboxFileMode = "r" | "w" | "a" | "r+" | "w+" | "a+"; +/** + * SandboxFile represents an open file in the {@link Sandbox} filesystem. + * Provides read/write operations similar to Node.js `fsPromises.FileHandle`. + */ +declare class SandboxFile { + #private; + /** @ignore */ + constructor(client: ModalClient, fileDescriptor: string, taskId: string); + /** + * Read data from the file. + * @returns Promise that resolves to the read data as Uint8Array + */ + read(): Promise; + /** + * Write data to the file. + * @param data - Data to write (string or Uint8Array) + */ + write(data: Uint8Array): Promise; + /** + * Flush any buffered data to the file. + */ + flush(): Promise; + /** + * Close the file handle. + */ + close(): Promise; +} + +/** + * Wrapper around `ReadableStream` with convenience functions. + * + * The Stream API is a modern standard for asynchronous data streams across + * network and process boundaries. It allows you to read data in chunks, pipe + * and transform it, and handle backpressure. + * + * This wrapper adds some extra functions like `.readText()` to read the entire + * stream as a string, or `readBytes()` to read binary data. + * + * Background: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API + */ +interface ModalReadStream extends ReadableStream { + /** Read the entire stream as a string. */ + readText(): Promise; + /** Read the entire stream as a byte array. */ + readBytes(): Promise; +} +/** + * Wrapper around `WritableStream` with convenience functions. + * + * The Stream API is a modern standard for asynchronous data streams across + * network and process boundaries. It allows you to read data in chunks, pipe + * and transform it, and handle backpressure. + * + * This wrapper adds some extra functions like `.writeText()` to write a string + * to the stream, or `writeBytes()` to write binary data. + * + * Background: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API + */ +interface ModalWriteStream extends WritableStream { + /** Write a string to the stream. Only if this is a text stream. */ + writeText(text: string): Promise; + /** Write a byte array to the stream. Only if this is a byte stream. */ + writeBytes(bytes: Uint8Array): Promise; +} + +/** + * Stdin is always present, but this option allow you to drop stdout or stderr + * if you don't need them. The default is "pipe", matching Node.js behavior. + * + * If behavior is set to "ignore", the output streams will be empty. + */ +type StdioBehavior = "pipe" | "ignore"; +/** + * Specifies the type of data that will be read from the Sandbox or container + * process. "text" means the data will be read as UTF-8 text, while "binary" + * means the data will be read as raw bytes (Uint8Array). + */ +type StreamMode = "text" | "binary"; +/** Optional parameters for {@link SandboxService#create client.sandboxes.create()}. */ +type SandboxCreateParams = { + /** Reservation of physical CPU cores for the Sandbox, can be fractional. */ + cpu?: number; + /** Hard limit of physical CPU cores for the Sandbox, can be fractional. */ + cpuLimit?: number; + /** Reservation of memory in MiB. */ + memoryMiB?: number; + /** Hard limit of memory in MiB. */ + memoryLimitMiB?: number; + /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */ + gpu?: string; + /** Timeout of the Sandbox container in milliseconds, defaults to 10 minutes. */ + timeoutMs?: number; + /** The amount of time in milliseconds that a Sandbox can be idle before being terminated. */ + idleTimeoutMs?: number; + /** Working directory of the Sandbox. */ + workdir?: string; + /** + * Sequence of program arguments for the main process. + * Default behavior is to sleep indefinitely until timeout or termination. + */ + command?: string[]; + /** Environment variables to set in the Sandbox. */ + env?: Record; + /** {@link Secret}s to inject into the Sandbox as environment variables. */ + secrets?: Secret[]; + /** Mount points for Modal {@link Volume}s. */ + volumes?: Record; + /** Mount points for {@link CloudBucketMount}s. */ + cloudBucketMounts?: Record; + /** Enable a PTY for the Sandbox. */ + pty?: boolean; + /** List of ports to tunnel into the Sandbox. Encrypted ports are tunneled with TLS. */ + encryptedPorts?: number[]; + /** List of encrypted ports to tunnel into the Sandbox, using HTTP/2. */ + h2Ports?: number[]; + /** List of ports to tunnel into the Sandbox without encryption. */ + unencryptedPorts?: number[]; + /** Whether to block all network access from the Sandbox. */ + blockNetwork?: boolean; + /** List of CIDRs the Sandbox is allowed to access. If None, all CIDRs are allowed. Cannot be used with blockNetwork. */ + cidrAllowlist?: string[]; + /** Cloud provider to run the Sandbox on. */ + cloud?: string; + /** Region(s) to run the Sandbox on. */ + regions?: string[]; + /** Enable verbose logging. */ + verbose?: boolean; + /** Reference to a Modal {@link Proxy} to use in front of this Sandbox. */ + proxy?: Proxy; + /** Optional name for the Sandbox. Unique within an App. */ + name?: string; + /** Experimental options for the sandbox. */ + experimentalOptions?: Record; + /** Enable memory snapshot support (experimental). */ + experimentalEnableSnapshot?: boolean; +}; +/** + * Service for managing {@link Sandbox}es. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const sb = await modal.sandboxes.create(app, image); + * ``` + */ +declare class SandboxService { + #private; + constructor(client: ModalClient); + /** + * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options. + */ + create(app: App, image: Image, params?: SandboxCreateParams): Promise; + /** Returns a running {@link Sandbox} object from an ID. + * + * @returns Sandbox with ID + */ + fromId(sandboxId: string, params?: SandboxFromIdParams): Promise; + /** Get a running {@link Sandbox} by name from a deployed {@link App}. + * + * Raises a {@link NotFoundError} if no running Sandbox is found with the given name. + * A Sandbox's name is the `name` argument passed to {@link SandboxService#create sandboxes.create()}. + * + * @param appName - Name of the deployed App + * @param name - Name of the Sandbox + * @param params - Optional parameters for getting the Sandbox + * @returns Promise that resolves to a Sandbox + */ + fromName(appName: string, name: string, params?: SandboxFromNameParams): Promise; + /** + * Restore a {@link Sandbox} from a {@link SandboxSnapshot} (experimental). + * + * @param snapshot - The snapshot to restore from + * @param params - Optional parameters for restoring the Sandbox + * @returns Promise that resolves to a Sandbox + */ + experimentalFromSnapshot(snapshot: SandboxSnapshot, params?: SandboxRestoreParams): Promise; + /** + * List all {@link Sandbox}es for the current Environment or App ID (if specified). + * If tags are specified, only Sandboxes that have at least those tags are returned. + */ + list(params?: SandboxListParams): AsyncGenerator; +} +/** Optional parameters for {@link SandboxService#list client.sandboxes.list()}. */ +type SandboxListParams = { + /** Filter Sandboxes for a specific {@link App}. */ + appId?: string; + /** Only return Sandboxes that include all specified tags. */ + tags?: Record; + /** Override environment for the request; defaults to current profile. */ + environment?: string; +}; +/** Optional parameters for {@link SandboxService#fromId client.sandboxes.fromId()}. */ +type SandboxFromIdParams = { + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; +/** Optional parameters for {@link SandboxService#fromName client.sandboxes.fromName()}. */ +type SandboxFromNameParams = { + environment?: string; + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; +/** Optional parameters for {@link SandboxService#experimentalFromSnapshot client.sandboxes.experimentalFromSnapshot()}. */ +type SandboxRestoreParams = { + /** Optional sandbox name override. Use null to clear name. */ + name?: string | null; +}; +/** Optional parameters for {@link Sandbox#createConnectToken Sandbox.createConnectToken()}. */ +type CreateConnectTokenParams = { + /** + * Optional user metadata to attach to the token. Must be JSON-serializable. + * When a request arrives with a valid token, the service receives an + * `X-Verified-User-Data` header with this data as a JSON-serialized string. + * Serialized metadata cannot exceed 512 characters. + */ + userMetadata?: Record; +}; +/** + * A connect token for a Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. + */ +type ConnectToken = { + /** The URL to connect to the Sandbox service. */ + url: string; + /** The authentication token. */ + token: string; +}; +/** Optional parameters for {@link Sandbox#exec Sandbox.exec()}. */ +type SandboxExecParams = { + /** Specifies text or binary encoding for input and output streams. */ + mode?: StreamMode; + /** Whether to pipe or ignore standard output. */ + stdout?: StdioBehavior; + /** Whether to pipe or ignore standard error. */ + stderr?: StdioBehavior; + /** Working directory to run the command in. */ + workdir?: string; + /** Timeout for the process in milliseconds. Defaults to 0 (no timeout). */ + timeoutMs?: number; + /** Environment variables to set for the command. */ + env?: Record; + /** {@link Secret}s to inject as environment variables for the commmand.*/ + secrets?: Secret[]; + /** Enable a PTY for the command. */ + pty?: boolean; +}; +/** A port forwarded from within a running Modal {@link Sandbox}. */ +declare class Tunnel { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; + /** @ignore */ + constructor(host: string, port: number, unencryptedHost?: string | undefined, unencryptedPort?: number | undefined); + /** Get the public HTTPS URL of the forwarded port. */ + get url(): string; + /** Get the public TLS socket as a [host, port] tuple. */ + get tlsSocket(): [string, number]; + /** Get the public TCP socket as a [host, port] tuple. */ + get tcpSocket(): [string, number]; +} +type SandboxConstructorOptions = { + memorySnapshotsEnabled?: boolean; +}; +/** Sandboxes are secure, isolated containers in Modal that boot in seconds. */ +declare class Sandbox { + #private; + readonly sandboxId: string; + stdin: ModalWriteStream; + stdout: ModalReadStream; + stderr: ModalReadStream; + /** @ignore */ + constructor(client: ModalClient, sandboxId: string, options?: SandboxConstructorOptions); + /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */ + setTags(tags: Record): Promise; + /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */ + getTags(): Promise>; + /** + * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead. + */ + static fromId(sandboxId: string): Promise; + /** + * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead. + */ + static fromName(appName: string, name: string, environment?: string): Promise; + /** + * Open a file in the Sandbox filesystem. + * @param path - Path to the file to open + * @param mode - File open mode (r, w, a, r+, w+, a+) + * @returns Promise that resolves to a {@link SandboxFile} + */ + open(path: string, mode?: SandboxFileMode): Promise; + exec(command: string[], params?: SandboxExecParams & { + mode?: "text"; + }): Promise>; + exec(command: string[], params: SandboxExecParams & { + mode: "binary"; + }): Promise>; + terminate(): Promise; + wait(): Promise; + /** Get {@link Tunnel} metadata for the Sandbox. + * + * Raises {@link SandboxTimeoutError} if the tunnels are not available after the timeout. + * + * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. + */ + tunnels(timeoutMs?: number): Promise>; + /** + * Snapshot the filesystem of the Sandbox. + * + * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. + * + * @param timeoutMs - Timeout for the snapshot operation in milliseconds + * @returns Promise that resolves to an {@link Image} + */ + snapshotFilesystem(timeoutMs?: number): Promise; + /** + * Take a memory snapshot of the Sandbox (experimental). + * + * Returns a {@link SandboxSnapshot} object which can be used to restore a new Sandbox. + * + * @returns Promise that resolves to a {@link SandboxSnapshot} + */ + experimentalSnapshot(): Promise; + /** + * Check if the Sandbox has finished running. + * + * Returns `null` if the Sandbox is still running, else returns the exit code. + */ + poll(): Promise; + /** + * Create a connect token for this Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. The token can be transmitted via: + * - Authorization header: `Authorization: Bearer {token}` + * - Query parameter: `_modal_connect_token` in the URL + * - Cookie: `_modal_connect_token` as a cookie + * + * The service inside the container must listen on port 8080. + * + * @param params - Optional parameters for the connect token + * @returns Promise that resolves to a {@link ConnectToken} + */ + createConnectToken(params?: CreateConnectTokenParams): Promise; + /** + * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. + */ + static list(params?: SandboxListParams): AsyncGenerator; +} +declare class ContainerProcess { + #private; + stdin: ModalWriteStream; + stdout: ModalReadStream; + stderr: ModalReadStream; + returncode: number | null; + constructor(client: ModalClient, execId: string, params?: SandboxExecParams); + /** Wait for process completion and return the exit code. */ + wait(): Promise; +} + +/** Resolved configuration object from `Config` and environment variables. */ +interface Profile { + serverUrl: string; + tokenId?: string; + tokenSecret?: string; + environment?: string; + imageBuilderVersion?: string; + logLevel?: string; +} + +type LogLevel = "debug" | "info" | "warn" | "error"; +interface Logger { + debug(message: string, ...args: any[]): void; + info(message: string, ...args: any[]): void; + warn(message: string, ...args: any[]): void; + error(message: string, ...args: any[]): void; +} + +interface ModalClientParams { + tokenId?: string; + tokenSecret?: string; + environment?: string; + endpoint?: string; + timeoutMs?: number; + maxRetries?: number; + logger?: Logger; + logLevel?: LogLevel; + /** + * Custom gRPC middleware to be applied to all API calls. + * These middleware are appended after Modal's built-in middleware + * (authentication, retry logic, and timeouts), allowing you to add + * telemetry, tracing, or other observability features. + * + * Note that the Modal gRPC API is not considered a public API, and + * can change without warning. + */ + grpcMiddleware?: ClientMiddleware[]; + /** @ignore */ + cpClient?: ModalGrpcClient; +} +type ModalGrpcClient = Client; +/** + * The main client for interacting with Modal's cloud infrastructure. + * + * ModalClient provides access to all Modal services through service properties. + * Create a client instance and use its service properties to manage {@link App}s, + * {@link Function_ Function}s, * {@link Sandbox}es, and other Modal resources. + * + * @example + * ```typescript + * import { ModalClient } from "modal"; + * + * const modal = new ModalClient(); + * + * const app = await modal.apps.fromName("my-app"); + * const image = modal.images.fromRegistry("python:3.13"); + * const sb = await modal.sandboxes.create(app, image); + * ``` + */ +declare class ModalClient { + readonly apps: AppService; + readonly cloudBucketMounts: CloudBucketMountService; + readonly cls: ClsService; + readonly functions: FunctionService; + readonly functionCalls: FunctionCallService; + readonly images: ImageService; + readonly proxies: ProxyService; + readonly queues: QueueService; + readonly sandboxes: SandboxService; + readonly sandboxSnapshots: SandboxSnapshotService; + readonly secrets: SecretService; + readonly volumes: VolumeService; + /** @ignore */ + readonly cpClient: ModalGrpcClient; + readonly profile: Profile; + readonly logger: Logger; + private ipClients; + private authTokenManager; + private customMiddleware; + constructor(params?: ModalClientParams); + environmentName(environment?: string): string; + imageBuilderVersion(version?: string): string; + /** @ignore */ + ipClient(serverUrl: string): ModalGrpcClient; + close(): void; + version(): string; + private createClient; + /** Middleware to retry transient errors and timeouts for unary requests. */ + private retryMiddleware; + private authMiddleware; +} +type TimeoutOptions = { + /** Timeout for this call, interpreted as a duration in milliseconds */ + timeoutMs?: number; +}; +type RetryOptions = { + /** Number of retries to take. */ + retries?: number; + /** Base delay in milliseconds. */ + baseDelay?: number; + /** Maximum delay in milliseconds. */ + maxDelay?: number; + /** Exponential factor to multiply successive delays. */ + delayFactor?: number; + /** Additional status codes to retry. */ + additionalStatusCodes?: Status[]; +}; +/** + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. + */ +type ClientOptions = { + tokenId: string; + tokenSecret: string; + environment?: string; +}; +/** + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. + */ +declare function initializeClient(options: ClientOptions): void; +/** + * Stops the auth token refresh. + * @deprecated Use {@link ModalClient#close modalClient.close()} instead. + */ +declare function close(): void; + +/** + * Service for managing {@link App}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const app = await modal.apps.fromName("my-app"); + * ``` + */ +declare class AppService { + #private; + constructor(client: ModalClient); + /** + * Reference a deployed {@link App} by name, or create if it does not exist. + */ + fromName(name: string, params?: AppFromNameParams): Promise; +} +/** Optional parameters for {@link AppService#fromName client.apps.fromName()}. */ +type AppFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** @deprecated Use specific Params types instead. */ +type LookupOptions = { + environment?: string; + createIfMissing?: boolean; +}; +/** @deprecated Use specific Params types instead. */ +type DeleteOptions = { + environment?: string; +}; +/** @deprecated Use specific Params types instead. */ +type EphemeralOptions = { + environment?: string; +}; +/** Represents a deployed Modal App. */ +declare class App { + readonly appId: string; + readonly name?: string; + /** @ignore */ + constructor(appId: string, name?: string); + /** + * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. + */ + static lookup(name: string, options?: LookupOptions): Promise; + /** + * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead. + */ + createSandbox(image: Image, options?: SandboxCreateParams): Promise; + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + imageFromRegistry(tag: string, secret?: Secret): Promise; + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + imageFromAwsEcr(tag: string, secret: Secret): Promise; + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + imageFromGcpArtifactRegistry(tag: string, secret: Secret): Promise; +} + +/** Function execution exceeds the allowed time limit. */ +declare class FunctionTimeoutError extends Error { + constructor(message: string); +} +/** An error on the Modal server, or a Python exception. */ +declare class RemoteError extends Error { + constructor(message: string); +} +/** A retryable internal error from Modal. */ +declare class InternalFailure extends Error { + constructor(message: string); +} +/** Some resource was not found. */ +declare class NotFoundError extends Error { + constructor(message: string); +} +/** A resource already exists. */ +declare class AlreadyExistsError extends Error { + constructor(message: string); +} +/** A request or other operation was invalid. */ +declare class InvalidError extends Error { + constructor(message: string); +} +/** The Queue is empty. */ +declare class QueueEmptyError extends Error { + constructor(message: string); +} +/** The Queue is full. */ +declare class QueueFullError extends Error { + constructor(message: string); +} +/** Sandbox operations that exceed the allowed time limit. */ +declare class SandboxTimeoutError extends Error { + constructor(message?: string); +} + +declare function checkForRenamedParams(params: any, renames: Record): void; + +export { AlreadyExistsError, App, type AppFromNameParams, AppService, type ClientOptions, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, type ConnectToken, ContainerProcess, type CreateConnectTokenParams, type DeleteOptions, type EphemeralOptions, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, FunctionCallService, type FunctionFromNameParams, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, ImageService, InternalFailure, InvalidError, type LogLevel, type Logger, type LookupOptions, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateParams, type SandboxExecParams, SandboxFile, type SandboxFileMode, type SandboxFromIdParams, type SandboxFromNameParams, type SandboxListParams, type SandboxRestoreParams, SandboxService, SandboxSnapshot, SandboxSnapshotService, SandboxTimeoutError, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, type StdioBehavior, type StreamMode, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, VolumeService, checkForRenamedParams, close, initializeClient }; diff --git a/modal-js/dist/index.d.ts b/modal-js/dist/index.d.ts new file mode 100644 index 00000000..beb863cf --- /dev/null +++ b/modal-js/dist/index.d.ts @@ -0,0 +1,6246 @@ +import { Client, Status, ClientMiddleware } from 'nice-grpc'; +import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire'; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +interface Empty { +} +declare const Empty: MessageFns$1; +type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined; +type DeepPartial$1 = T extends Builtin$1 ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial$1; +} : Partial; +interface MessageFns$1 { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial$1): T; + fromPartial(object: DeepPartial$1): T; +} + +declare enum AppDeployVisibility { + APP_DEPLOY_VISIBILITY_UNSPECIFIED = 0, + APP_DEPLOY_VISIBILITY_WORKSPACE = 1, + APP_DEPLOY_VISIBILITY_PUBLIC = 2, + UNRECOGNIZED = -1 +} +declare enum AppDisconnectReason { + APP_DISCONNECT_REASON_UNSPECIFIED = 0, + APP_DISCONNECT_REASON_LOCAL_EXCEPTION = 1, + APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT = 2, + APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED = 3, + APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION = 4, + APP_DISCONNECT_REASON_REMOTE_EXCEPTION = 5, + UNRECOGNIZED = -1 +} +/** + * NOTE: make sure to update the frontend if we add a new state here + * https://github.com/modal-labs/modal/blob/main/frontend/src/routes/(dashboard)/%5B%5Bworkspace%5D%5D/apps/+page.svelte#L95 + */ +declare enum AppState { + APP_STATE_UNSPECIFIED = 0, + /** APP_STATE_EPHEMERAL - Will be discharged when the client disconnects */ + APP_STATE_EPHEMERAL = 1, + APP_STATE_DETACHED = 2, + /** APP_STATE_DEPLOYED - Will be discharged when overwritten */ + APP_STATE_DEPLOYED = 3, + /** APP_STATE_STOPPING - Winding down app due to user termination. */ + APP_STATE_STOPPING = 4, + /** APP_STATE_STOPPED - Stopped */ + APP_STATE_STOPPED = 5, + /** APP_STATE_INITIALIZING - App is created and in process of deployment. */ + APP_STATE_INITIALIZING = 6, + /** APP_STATE_DISABLED - Same as stopped but prevented from being garbage collected */ + APP_STATE_DISABLED = 7, + /** APP_STATE_DETACHED_DISCONNECTED - App is detached and local client has disconnected. */ + APP_STATE_DETACHED_DISCONNECTED = 8, + /** + * APP_STATE_DERIVED - App is derived from another workspace. Acts as a static, immutable group of functions. + * + * @deprecated + */ + APP_STATE_DERIVED = 9, + UNRECOGNIZED = -1 +} +declare enum AppStopSource { + APP_STOP_SOURCE_UNSPECIFIED = 0, + APP_STOP_SOURCE_CLI = 1, + APP_STOP_SOURCE_PYTHON_CLIENT = 2, + APP_STOP_SOURCE_WEB = 3, + UNRECOGNIZED = -1 +} +declare enum CertificateStatus { + CERTIFICATE_STATUS_PENDING = 0, + CERTIFICATE_STATUS_ISSUED = 1, + CERTIFICATE_STATUS_FAILED = 2, + CERTIFICATE_STATUS_REVOKED = 3, + UNRECOGNIZED = -1 +} +declare enum CheckpointStatus { + CHECKPOINT_STATUS_UNSPECIFIED = 0, + CHECKPOINT_STATUS_PENDING = 1, + CHECKPOINT_STATUS_PROCESSING = 2, + CHECKPOINT_STATUS_READY = 3, + CHECKPOINT_STATUS_FAILED = 4, + UNRECOGNIZED = -1 +} +declare enum CloudProvider { + CLOUD_PROVIDER_UNSPECIFIED = 0, + CLOUD_PROVIDER_AWS = 1, + CLOUD_PROVIDER_GCP = 2, + CLOUD_PROVIDER_AUTO = 3, + CLOUD_PROVIDER_OCI = 4, + UNRECOGNIZED = -1 +} +declare enum DNSRecordType { + DNS_RECORD_TYPE_A = 0, + DNS_RECORD_TYPE_TXT = 1, + DNS_RECORD_TYPE_CNAME = 2, + UNRECOGNIZED = -1 +} +/** Which data format a binary message is encoded with. */ +declare enum DataFormat { + DATA_FORMAT_UNSPECIFIED = 0, + /** DATA_FORMAT_PICKLE - Cloudpickle */ + DATA_FORMAT_PICKLE = 1, + /** DATA_FORMAT_ASGI - "Asgi" protobuf message */ + DATA_FORMAT_ASGI = 2, + /** DATA_FORMAT_GENERATOR_DONE - "GeneratorDone" protobuf message */ + DATA_FORMAT_GENERATOR_DONE = 3, + DATA_FORMAT_CBOR = 4, + UNRECOGNIZED = -1 +} +declare enum DeploymentNamespace { + DEPLOYMENT_NAMESPACE_UNSPECIFIED = 0, + DEPLOYMENT_NAMESPACE_WORKSPACE = 1, + DEPLOYMENT_NAMESPACE_GLOBAL = 3, + UNRECOGNIZED = -1 +} +declare enum ExecOutputOption { + EXEC_OUTPUT_OPTION_UNSPECIFIED = 0, + EXEC_OUTPUT_OPTION_DEVNULL = 1, + EXEC_OUTPUT_OPTION_PIPE = 2, + EXEC_OUTPUT_OPTION_STDOUT = 3, + UNRECOGNIZED = -1 +} +declare enum FileDescriptor { + FILE_DESCRIPTOR_UNSPECIFIED = 0, + FILE_DESCRIPTOR_STDOUT = 1, + FILE_DESCRIPTOR_STDERR = 2, + FILE_DESCRIPTOR_INFO = 3, + UNRECOGNIZED = -1 +} +declare enum FunctionCallInvocationType { + FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED = 0, + FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY = 1, + FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY = 2, + FUNCTION_CALL_INVOCATION_TYPE_ASYNC = 3, + FUNCTION_CALL_INVOCATION_TYPE_SYNC = 4, + UNRECOGNIZED = -1 +} +declare enum FunctionCallType { + FUNCTION_CALL_TYPE_UNSPECIFIED = 0, + FUNCTION_CALL_TYPE_UNARY = 1, + FUNCTION_CALL_TYPE_MAP = 2, + UNRECOGNIZED = -1 +} +declare enum GPUType { + /** + * GPU_TYPE_UNSPECIFIED - Note: this enum is no longer used by current clients - don't add new types + * Old clients still send it, so we use it server-side for compatibility + */ + GPU_TYPE_UNSPECIFIED = 0, + GPU_TYPE_T4 = 1, + GPU_TYPE_A100 = 2, + GPU_TYPE_A10G = 3, + GPU_TYPE_ANY = 4, + GPU_TYPE_A100_80GB = 8, + GPU_TYPE_L4 = 9, + GPU_TYPE_H100 = 10, + GPU_TYPE_L40S = 11, + GPU_TYPE_H200 = 12, + UNRECOGNIZED = -1 +} +declare enum ObjectCreationType { + /** OBJECT_CREATION_TYPE_UNSPECIFIED - just lookup */ + OBJECT_CREATION_TYPE_UNSPECIFIED = 0, + OBJECT_CREATION_TYPE_CREATE_IF_MISSING = 1, + OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS = 2, + OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS = 3, + /** OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP - deprecate at some point */ + OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP = 4, + OBJECT_CREATION_TYPE_EPHEMERAL = 5, + UNRECOGNIZED = -1 +} +declare enum ParameterType { + PARAM_TYPE_UNSPECIFIED = 0, + PARAM_TYPE_STRING = 1, + PARAM_TYPE_INT = 2, + /** PARAM_TYPE_PICKLE - currently unused */ + PARAM_TYPE_PICKLE = 3, + PARAM_TYPE_BYTES = 4, + /** PARAM_TYPE_UNKNOWN - used in schemas to signify unrecognized or un-annotated types */ + PARAM_TYPE_UNKNOWN = 5, + PARAM_TYPE_LIST = 6, + PARAM_TYPE_DICT = 7, + PARAM_TYPE_NONE = 8, + PARAM_TYPE_BOOL = 9, + UNRECOGNIZED = -1 +} +declare enum ProgressType { + /** IMAGE_SNAPSHOT_UPLOAD - TODO(erikbern): shouldn't be zero, and needs prefix */ + IMAGE_SNAPSHOT_UPLOAD = 0, + /** FUNCTION_QUEUED - TODO(erikbern): needs_prefix */ + FUNCTION_QUEUED = 1, + UNRECOGNIZED = -1 +} +declare enum ProxyIpStatus { + PROXY_IP_STATUS_UNSPECIFIED = 0, + PROXY_IP_STATUS_CREATING = 1, + PROXY_IP_STATUS_ONLINE = 2, + PROXY_IP_STATUS_TERMINATED = 3, + PROXY_IP_STATUS_UNHEALTHY = 4, + UNRECOGNIZED = -1 +} +declare enum RateLimitInterval { + RATE_LIMIT_INTERVAL_UNSPECIFIED = 0, + RATE_LIMIT_INTERVAL_SECOND = 1, + RATE_LIMIT_INTERVAL_MINUTE = 2, + UNRECOGNIZED = -1 +} +declare enum RegistryAuthType { + /** REGISTRY_AUTH_TYPE_UNSPECIFIED - Older clients send this instead of "public". */ + REGISTRY_AUTH_TYPE_UNSPECIFIED = 0, + REGISTRY_AUTH_TYPE_AWS = 1, + REGISTRY_AUTH_TYPE_GCP = 2, + REGISTRY_AUTH_TYPE_PUBLIC = 3, + REGISTRY_AUTH_TYPE_STATIC_CREDS = 4, + UNRECOGNIZED = -1 +} +declare enum SeekWhence { + SEEK_SET = 0, + SEEK_CUR = 1, + SEEK_END = 2, + UNRECOGNIZED = -1 +} +declare enum SystemErrorCode { + SYSTEM_ERROR_CODE_UNSPECIFIED = 0, + /** SYSTEM_ERROR_CODE_PERM - EPERM: Operation not permitted */ + SYSTEM_ERROR_CODE_PERM = 1, + /** SYSTEM_ERROR_CODE_NOENT - ENOENT: No such file or directory */ + SYSTEM_ERROR_CODE_NOENT = 2, + /** SYSTEM_ERROR_CODE_IO - EIO: Input/output error */ + SYSTEM_ERROR_CODE_IO = 5, + /** SYSTEM_ERROR_CODE_NXIO - ENXIO: No such device or address */ + SYSTEM_ERROR_CODE_NXIO = 6, + /** SYSTEM_ERROR_CODE_NOMEM - ENOMEM: Out of memory */ + SYSTEM_ERROR_CODE_NOMEM = 12, + /** SYSTEM_ERROR_CODE_ACCES - EACCES: Permission denied */ + SYSTEM_ERROR_CODE_ACCES = 13, + /** SYSTEM_ERROR_CODE_EXIST - EEXIST: File exists */ + SYSTEM_ERROR_CODE_EXIST = 17, + /** SYSTEM_ERROR_CODE_NOTDIR - ENOTDIR: Not a directory */ + SYSTEM_ERROR_CODE_NOTDIR = 20, + /** SYSTEM_ERROR_CODE_ISDIR - EISDIR: Is a directory */ + SYSTEM_ERROR_CODE_ISDIR = 21, + /** SYSTEM_ERROR_CODE_INVAL - EINVAL: Invalid argument */ + SYSTEM_ERROR_CODE_INVAL = 22, + /** SYSTEM_ERROR_CODE_MFILE - EMFILE: Too many open files */ + SYSTEM_ERROR_CODE_MFILE = 24, + /** SYSTEM_ERROR_CODE_FBIG - EFBIG: File too large */ + SYSTEM_ERROR_CODE_FBIG = 27, + /** SYSTEM_ERROR_CODE_NOSPC - ENOSPC: No space left on device */ + SYSTEM_ERROR_CODE_NOSPC = 28, + UNRECOGNIZED = -1 +} +declare enum TaskSnapshotBehavior { + TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED = 0, + TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT = 1, + TASK_SNAPSHOT_BEHAVIOR_RESTORE = 2, + TASK_SNAPSHOT_BEHAVIOR_NONE = 3, + UNRECOGNIZED = -1 +} +declare enum TaskState { + TASK_STATE_UNSPECIFIED = 0, + TASK_STATE_CREATED = 6, + TASK_STATE_QUEUED = 1, + TASK_STATE_WORKER_ASSIGNED = 2, + TASK_STATE_LOADING_IMAGE = 3, + TASK_STATE_ACTIVE = 4, + TASK_STATE_COMPLETED = 5, + TASK_STATE_CREATING_CONTAINER = 7, + TASK_STATE_IDLE = 8, + TASK_STATE_PREEMPTIBLE = 9, + TASK_STATE_PREEMPTED = 10, + TASK_STATE_LOADING_CHECKPOINT_IMAGE = 11, + UNRECOGNIZED = -1 +} +declare enum TunnelType { + TUNNEL_TYPE_UNSPECIFIED = 0, + /** TUNNEL_TYPE_H2 - HTTP/2 tunnel */ + TUNNEL_TYPE_H2 = 1, + UNRECOGNIZED = -1 +} +declare enum VolumeFsVersion { + VOLUME_FS_VERSION_UNSPECIFIED = 0, + VOLUME_FS_VERSION_V1 = 1, + VOLUME_FS_VERSION_V2 = 2, + UNRECOGNIZED = -1 +} +declare enum WebhookAsyncMode { + WEBHOOK_ASYNC_MODE_UNSPECIFIED = 0, + /** WEBHOOK_ASYNC_MODE_DISABLED - No longer used by client */ + WEBHOOK_ASYNC_MODE_DISABLED = 2, + /** WEBHOOK_ASYNC_MODE_TRIGGER - No longer used by client (previously used when wait_for_response=False) */ + WEBHOOK_ASYNC_MODE_TRIGGER = 3, + /** WEBHOOK_ASYNC_MODE_AUTO - The default */ + WEBHOOK_ASYNC_MODE_AUTO = 4, + UNRECOGNIZED = -1 +} +declare enum WebhookType { + WEBHOOK_TYPE_UNSPECIFIED = 0, + WEBHOOK_TYPE_ASGI_APP = 1, + WEBHOOK_TYPE_FUNCTION = 2, + WEBHOOK_TYPE_WSGI_APP = 3, + WEBHOOK_TYPE_WEB_SERVER = 4, + UNRECOGNIZED = -1 +} +declare enum ClassParameterInfo_ParameterSerializationFormat { + PARAM_SERIALIZATION_FORMAT_UNSPECIFIED = 0, + /** PARAM_SERIALIZATION_FORMAT_PICKLE - legacy format - pickle of (args, kwargs) tuple */ + PARAM_SERIALIZATION_FORMAT_PICKLE = 1, + /** PARAM_SERIALIZATION_FORMAT_PROTO - new format using api.FunctionParameterSet */ + PARAM_SERIALIZATION_FORMAT_PROTO = 2, + UNRECOGNIZED = -1 +} +declare enum CloudBucketMount_BucketType { + UNSPECIFIED = 0, + S3 = 1, + R2 = 2, + GCP = 3, + UNRECOGNIZED = -1 +} +declare enum FileEntry_FileType { + UNSPECIFIED = 0, + FILE = 1, + DIRECTORY = 2, + SYMLINK = 3, + FIFO = 4, + SOCKET = 5, + UNRECOGNIZED = -1 +} +declare enum Function_DefinitionType { + DEFINITION_TYPE_UNSPECIFIED = 0, + DEFINITION_TYPE_SERIALIZED = 1, + DEFINITION_TYPE_FILE = 2, + UNRECOGNIZED = -1 +} +declare enum Function_FunctionType { + FUNCTION_TYPE_UNSPECIFIED = 0, + FUNCTION_TYPE_GENERATOR = 1, + FUNCTION_TYPE_FUNCTION = 2, + UNRECOGNIZED = -1 +} +declare enum FunctionSchema_FunctionSchemaType { + FUNCTION_SCHEMA_UNSPECIFIED = 0, + FUNCTION_SCHEMA_V1 = 1, + UNRECOGNIZED = -1 +} +declare enum GenericResult_GenericStatus { + GENERIC_STATUS_UNSPECIFIED = 0, + GENERIC_STATUS_SUCCESS = 1, + GENERIC_STATUS_FAILURE = 2, + /** GENERIC_STATUS_TERMINATED - Used when a task was killed using an external signal. */ + GENERIC_STATUS_TERMINATED = 3, + GENERIC_STATUS_TIMEOUT = 4, + /** + * GENERIC_STATUS_INIT_FAILURE - Used when the user's function fails to initialize (ex. S3 mount failed due to invalid credentials). + * Terminates the function and all remaining inputs. + */ + GENERIC_STATUS_INIT_FAILURE = 5, + GENERIC_STATUS_INTERNAL_FAILURE = 6, + /** GENERIC_STATUS_IDLE_TIMEOUT - Used when sandboxes are terminated due to idle_timeout */ + GENERIC_STATUS_IDLE_TIMEOUT = 7, + UNRECOGNIZED = -1 +} +declare enum NetworkAccess_NetworkAccessType { + UNSPECIFIED = 0, + OPEN = 1, + BLOCKED = 2, + ALLOWLIST = 3, + UNRECOGNIZED = -1 +} +declare enum PTYInfo_PTYType { + /** PTY_TYPE_UNSPECIFIED - Nothing */ + PTY_TYPE_UNSPECIFIED = 0, + /** PTY_TYPE_FUNCTION - Run function in PTY */ + PTY_TYPE_FUNCTION = 1, + /** PTY_TYPE_SHELL - Replace function with shell */ + PTY_TYPE_SHELL = 2, + UNRECOGNIZED = -1 +} +declare enum SandboxRestoreRequest_SandboxNameOverrideType { + SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED = 0, + SANDBOX_NAME_OVERRIDE_TYPE_NONE = 1, + SANDBOX_NAME_OVERRIDE_TYPE_STRING = 2, + UNRECOGNIZED = -1 +} +declare enum Warning_WarningType { + WARNING_TYPE_UNSPECIFIED = 0, + WARNING_TYPE_CLIENT_DEPRECATION = 1, + WARNING_TYPE_RESOURCE_LIMIT = 2, + WARNING_TYPE_FUNCTION_CONFIGURATION = 3, + UNRECOGNIZED = -1 +} +interface AppClientDisconnectRequest { + appId: string; + reason: AppDisconnectReason; + exception: string; +} +declare const AppClientDisconnectRequest: MessageFns; +interface AppCreateRequest { + clientId: string; + /** Human readable label for the app */ + description: string; + environmentName: string; + appState: AppState; +} +declare const AppCreateRequest: MessageFns; +interface AppCreateResponse { + appId: string; + appPageUrl: string; + appLogsUrl: string; +} +declare const AppCreateResponse: MessageFns; +interface AppDeployRequest { + appId: string; + name: string; + objectEntity: string; + visibility: AppDeployVisibility; + tag: string; +} +declare const AppDeployRequest: MessageFns; +interface AppDeployResponse { + url: string; +} +declare const AppDeployResponse: MessageFns; +interface AppDeploymentHistory { + appId: string; + version: number; + clientVersion: string; + deployedAt: number; + deployedBy: string; + deployedByAvatarUrl: string; + tag: string; + rollbackVersion: number; + rollbackAllowed: boolean; + commitInfo?: CommitInfo | undefined; +} +declare const AppDeploymentHistory: MessageFns; +interface AppDeploymentHistoryRequest { + appId: string; +} +declare const AppDeploymentHistoryRequest: MessageFns; +interface AppDeploymentHistoryResponse { + appDeploymentHistories: AppDeploymentHistory[]; +} +declare const AppDeploymentHistoryResponse: MessageFns; +interface AppGetByDeploymentNameRequest { + name: string; + environmentName: string; +} +declare const AppGetByDeploymentNameRequest: MessageFns; +interface AppGetByDeploymentNameResponse { + appId: string; +} +declare const AppGetByDeploymentNameResponse: MessageFns; +interface AppGetLayoutRequest { + appId: string; +} +declare const AppGetLayoutRequest: MessageFns; +interface AppGetLayoutResponse { + appLayout: AppLayout | undefined; +} +declare const AppGetLayoutResponse: MessageFns; +interface AppGetLogsRequest { + appId: string; + timeout: number; + lastEntryId: string; + functionId: string; + inputId: string; + taskId: string; + functionCallId: string; + fileDescriptor: FileDescriptor; + sandboxId: string; +} +declare const AppGetLogsRequest: MessageFns; +interface AppGetObjectsItem { + tag: string; + object: Object_ | undefined; +} +declare const AppGetObjectsItem: MessageFns; +interface AppGetObjectsRequest { + appId: string; + includeUnindexed: boolean; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const AppGetObjectsRequest: MessageFns; +interface AppGetObjectsResponse { + items: AppGetObjectsItem[]; +} +declare const AppGetObjectsResponse: MessageFns; +interface AppGetOrCreateRequest { + appName: string; + environmentName: string; + objectCreationType: ObjectCreationType; +} +declare const AppGetOrCreateRequest: MessageFns; +interface AppGetOrCreateResponse { + appId: string; +} +declare const AppGetOrCreateResponse: MessageFns; +interface AppGetTagsRequest { + appId: string; +} +declare const AppGetTagsRequest: MessageFns; +interface AppGetTagsResponse { + tags: { + [key: string]: string; + }; +} +declare const AppGetTagsResponse: MessageFns; +interface AppHeartbeatRequest { + appId: string; +} +declare const AppHeartbeatRequest: MessageFns; +interface AppLayout { + objects: Object_[]; + /** tag -> function id */ + functionIds: { + [key: string]: string; + }; + /** tag -> class id */ + classIds: { + [key: string]: string; + }; +} +declare const AppLayout: MessageFns; +interface AppListRequest { + environmentName: string; +} +declare const AppListRequest: MessageFns; +interface AppListResponse { + apps: AppListResponse_AppListItem[]; +} +declare const AppListResponse: MessageFns; +interface AppListResponse_AppListItem { + appId: string; + description: string; + state: AppState; + createdAt: number; + stoppedAt: number; + nRunningTasks: number; + name: string; +} +declare const AppListResponse_AppListItem: MessageFns; +interface AppLookupRequest { + appName: string; + environmentName: string; +} +declare const AppLookupRequest: MessageFns; +interface AppLookupResponse { + appId: string; +} +declare const AppLookupResponse: MessageFns; +interface AppPublishRequest { + appId: string; + name: string; + /** Additional metadata to identify a deployment */ + deploymentTag: string; + /** Published app will be in this state */ + appState: AppState; + /** function_name -> function_id */ + functionIds: { + [key: string]: string; + }; + /** class_name -> class_id */ + classIds: { + [key: string]: string; + }; + /** function_id -> definition_id */ + definitionIds: { + [key: string]: string; + }; + /** Unused by client, but used internally */ + rollbackVersion: number; + /** Unused by client, but used internally */ + clientVersion: string; + /** Git information for deployment tracking */ + commitInfo: CommitInfo | undefined; + /** Additional metadata to attach to the App */ + tags: { + [key: string]: string; + }; +} +declare const AppPublishRequest: MessageFns; +interface AppPublishResponse { + url: string; + serverWarnings: Warning[]; +} +declare const AppPublishResponse: MessageFns; +interface AppRollbackRequest { + appId: string; + /** signed as we support negative "roll back n versions" requests */ + version: number; +} +declare const AppRollbackRequest: MessageFns; +interface AppSetObjectsRequest { + appId: string; + indexedObjectIds: { + [key: string]: string; + }; + clientId: string; + unindexedObjectIds: string[]; + /** promotes an app from initializing to this new state */ + newAppState: AppState; +} +declare const AppSetObjectsRequest: MessageFns; +interface AppSetTagsRequest { + appId: string; + tags: { + [key: string]: string; + }; +} +declare const AppSetTagsRequest: MessageFns; +interface AppStopRequest { + appId: string; + source: AppStopSource; +} +declare const AppStopRequest: MessageFns; +interface AttemptAwaitRequest { + attemptToken: string; + /** Used for waypoints. */ + requestedAt: number; + timeoutSecs: number; +} +declare const AttemptAwaitRequest: MessageFns; +interface AttemptAwaitResponse { + output?: FunctionGetOutputsItem | undefined; +} +declare const AttemptAwaitResponse: MessageFns; +interface AttemptRetryRequest { + functionId: string; + parentInputId: string; + input: FunctionPutInputsItem | undefined; + attemptToken: string; +} +declare const AttemptRetryRequest: MessageFns; +interface AttemptRetryResponse { + attemptToken: string; +} +declare const AttemptRetryResponse: MessageFns; +interface AttemptStartRequest { + functionId: string; + parentInputId: string; + input: FunctionPutInputsItem | undefined; +} +declare const AttemptStartRequest: MessageFns; +interface AttemptStartResponse { + attemptToken: string; + retryPolicy: FunctionRetryPolicy | undefined; +} +declare const AttemptStartResponse: MessageFns; +interface AuthTokenGetRequest { +} +declare const AuthTokenGetRequest: MessageFns; +interface AuthTokenGetResponse { + token: string; +} +declare const AuthTokenGetResponse: MessageFns; +/** + * A collection of user-configurable settings for Function autoscaling + * These are used for static configuration and for dynamic autoscaler updates + */ +interface AutoscalerSettings { + /** Minimum containers when scale-to-zero is not desired; pka "keep_warm" or "warm_pool_size" */ + minContainers?: number | undefined; + /** Limit on the number of containers that can be running for each Function; pka "concurrency_limit" */ + maxContainers?: number | undefined; + /** Additional container to spin up when Function is active */ + bufferContainers?: number | undefined; + /** Currently unused; a placeholder in case we decide to expose scaleup control to users */ + scaleupWindow?: number | undefined; + /** Maximum amount of time a container can be idle before being scaled down, in seconds; pka "container_idle_timeout" */ + scaledownWindow?: number | undefined; +} +declare const AutoscalerSettings: MessageFns; +/** Used for flash autoscaling */ +interface AutoscalingMetrics { + cpuUsagePercent: number; + memoryUsagePercent: number; + concurrentRequests: number; + timestamp: number; +} +declare const AutoscalingMetrics: MessageFns; +interface BaseImage { + imageId: string; + dockerTag: string; +} +declare const BaseImage: MessageFns; +interface BlobCreateRequest { + /** + * TODO(erikbern): how are these garbage collected? + * Shouldn't they belong to an app? + */ + contentMd5: string; + contentSha256Base64: string; + contentLength: number; +} +declare const BlobCreateRequest: MessageFns; +interface BlobCreateResponse { + blobId: string; + uploadUrl?: string | undefined; + multipart?: MultiPartUpload | undefined; + blobIds: string[]; + uploadUrls?: UploadUrlList | undefined; + multiparts?: MultiPartUploadList | undefined; +} +declare const BlobCreateResponse: MessageFns; +interface BlobGetRequest { + blobId: string; +} +declare const BlobGetRequest: MessageFns; +interface BlobGetResponse { + downloadUrl: string; +} +declare const BlobGetResponse: MessageFns; +interface BuildFunction { + definition: string; + globals: Uint8Array; + input: FunctionInput | undefined; +} +declare const BuildFunction: MessageFns; +interface CancelInputEvent { + inputIds: string[]; + terminateContainers: boolean; +} +declare const CancelInputEvent: MessageFns; +interface CheckpointInfo { + checksum: string; + status: CheckpointStatus; + checkpointId: string; + runtimeFingerprint: string; + size: number; + checksumIsFileIndex: boolean; + originalTaskId: string; + runscRuntimeVersion: string; +} +declare const CheckpointInfo: MessageFns; +interface ClassCreateRequest { + appId: string; + existingClassId: string; + methods: ClassMethod[]; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const ClassCreateRequest: MessageFns; +interface ClassCreateResponse { + classId: string; + handleMetadata: ClassHandleMetadata | undefined; +} +declare const ClassCreateResponse: MessageFns; +interface ClassGetRequest { + appName: string; + objectTag: string; + environmentName: string; + /** True starting with 0.67.x clients, which don't create method placeholder functions */ + onlyClassFunction: boolean; +} +declare const ClassGetRequest: MessageFns; +interface ClassGetResponse { + classId: string; + handleMetadata: ClassHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const ClassGetResponse: MessageFns; +interface ClassHandleMetadata { + methods: ClassMethod[]; + classFunctionId: string; + classFunctionMetadata: FunctionHandleMetadata | undefined; +} +declare const ClassHandleMetadata: MessageFns; +interface ClassMethod { + functionName: string; + functionId: string; + /** Class methods need to hydrate all functions on the class */ + functionHandleMetadata: FunctionHandleMetadata | undefined; +} +declare const ClassMethod: MessageFns; +interface ClassParameterInfo { + format: ClassParameterInfo_ParameterSerializationFormat; + /** only set for PARAM_SERIALIZATION_FORMAT_PROTO */ + schema: ClassParameterSpec[]; +} +declare const ClassParameterInfo: MessageFns; +/** TODO: rename into NamedPayloadType or similar */ +interface ClassParameterSpec { + name: string; + /** TODO: deprecate - use full_type instead */ + type: ParameterType; + hasDefault: boolean; + /** Default *values* are only registered for class parameters */ + stringDefault?: string | undefined; + intDefault?: number | undefined; + pickleDefault?: Uint8Array | undefined; + bytesDefault?: Uint8Array | undefined; + boolDefault?: boolean | undefined; + /** supersedes `type` */ + fullType: GenericPayloadType | undefined; +} +declare const ClassParameterSpec: MessageFns; +interface ClientHelloResponse { + warning: string; + /** Deprecated, no longer used in client */ + imageBuilderVersion: string; + serverWarnings: Warning[]; +} +declare const ClientHelloResponse: MessageFns; +interface CloudBucketMount$1 { + bucketName: string; + mountPath: string; + credentialsSecretId: string; + readOnly: boolean; + bucketType: CloudBucketMount_BucketType; + requesterPays: boolean; + bucketEndpointUrl?: string | undefined; + keyPrefix?: string | undefined; + oidcAuthRoleArn?: string | undefined; +} +declare const CloudBucketMount$1: MessageFns; +interface ClusterGetRequest { + clusterId: string; +} +declare const ClusterGetRequest: MessageFns; +interface ClusterGetResponse { + cluster: ClusterStats | undefined; +} +declare const ClusterGetResponse: MessageFns; +interface ClusterListRequest { + environmentName: string; +} +declare const ClusterListRequest: MessageFns; +interface ClusterListResponse { + clusters: ClusterStats[]; +} +declare const ClusterListResponse: MessageFns; +interface ClusterStats { + appId: string; + taskIds: string[]; + clusterId: string; + /** Defined as start time of the first task in the cluster */ + startedAt: number; +} +declare const ClusterStats: MessageFns; +interface CommitInfo { + /** Only git is supported for now */ + vcs: string; + branch: string; + commitHash: string; + commitTimestamp: number; + dirty: boolean; + authorName: string; + authorEmail: string; + repoUrl: string; +} +declare const CommitInfo: MessageFns; +interface ContainerCheckpointRequest { + checkpointId: string; +} +declare const ContainerCheckpointRequest: MessageFns; +interface ContainerExecGetOutputRequest { + execId: string; + timeout: number; + lastBatchIndex: number; + fileDescriptor: FileDescriptor; + /** Old clients (up to 0.65.39) expect string output. Newer clients stream raw bytes */ + getRawBytes: boolean; +} +declare const ContainerExecGetOutputRequest: MessageFns; +interface ContainerExecPutInputRequest { + execId: string; + input: RuntimeInputMessage | undefined; +} +declare const ContainerExecPutInputRequest: MessageFns; +interface ContainerExecRequest { + taskId: string; + command: string[]; + /** + * If pty_info is provided, open a PTY, but also this container exec is treated an + * "interactive shell" request, and it will be terminated if messages are not periodically + * sent on the stdin stream on some interval (currently 40 seconds). + */ + ptyInfo?: PTYInfo | undefined; + /** + * Send SIGTERM to running container on exit of exec command. + * + * @deprecated + */ + terminateContainerOnExit: boolean; + /** For internal debugging use only. */ + runtimeDebug: boolean; + stdoutOutput: ExecOutputOption; + stderrOutput: ExecOutputOption; + timeoutSecs: number; + workdir?: string | undefined; + secretIds: string[]; +} +declare const ContainerExecRequest: MessageFns; +interface ContainerExecResponse { + execId: string; +} +declare const ContainerExecResponse: MessageFns; +interface ContainerExecWaitRequest { + execId: string; + timeout: number; +} +declare const ContainerExecWaitRequest: MessageFns; +interface ContainerExecWaitResponse { + exitCode?: number | undefined; + completed: boolean; +} +declare const ContainerExecWaitResponse: MessageFns; +interface ContainerFileCloseRequest { + fileDescriptor: string; +} +declare const ContainerFileCloseRequest: MessageFns; +interface ContainerFileDeleteBytesRequest { + fileDescriptor: string; + startInclusive?: number | undefined; + endExclusive?: number | undefined; +} +declare const ContainerFileDeleteBytesRequest: MessageFns; +interface ContainerFileFlushRequest { + fileDescriptor: string; +} +declare const ContainerFileFlushRequest: MessageFns; +interface ContainerFileLsRequest { + path: string; +} +declare const ContainerFileLsRequest: MessageFns; +interface ContainerFileMkdirRequest { + path: string; + makeParents: boolean; +} +declare const ContainerFileMkdirRequest: MessageFns; +interface ContainerFileOpenRequest { + /** file descriptor is hydrated when sent from server -> worker */ + fileDescriptor?: string | undefined; + path: string; + mode: string; +} +declare const ContainerFileOpenRequest: MessageFns; +interface ContainerFileReadLineRequest { + fileDescriptor: string; +} +declare const ContainerFileReadLineRequest: MessageFns; +interface ContainerFileReadRequest { + fileDescriptor: string; + n?: number | undefined; +} +declare const ContainerFileReadRequest: MessageFns; +interface ContainerFileRmRequest { + path: string; + recursive: boolean; +} +declare const ContainerFileRmRequest: MessageFns; +interface ContainerFileSeekRequest { + fileDescriptor: string; + offset: number; + whence: SeekWhence; +} +declare const ContainerFileSeekRequest: MessageFns; +interface ContainerFileWatchRequest { + path: string; + recursive: boolean; + timeoutSecs?: number | undefined; +} +declare const ContainerFileWatchRequest: MessageFns; +interface ContainerFileWriteReplaceBytesRequest { + fileDescriptor: string; + data: Uint8Array; + startInclusive?: number | undefined; + endExclusive?: number | undefined; +} +declare const ContainerFileWriteReplaceBytesRequest: MessageFns; +interface ContainerFileWriteRequest { + fileDescriptor: string; + data: Uint8Array; +} +declare const ContainerFileWriteRequest: MessageFns; +interface ContainerFilesystemExecGetOutputRequest { + execId: string; + timeout: number; +} +declare const ContainerFilesystemExecGetOutputRequest: MessageFns; +interface ContainerFilesystemExecRequest { + fileOpenRequest?: ContainerFileOpenRequest | undefined; + fileWriteRequest?: ContainerFileWriteRequest | undefined; + fileReadRequest?: ContainerFileReadRequest | undefined; + fileFlushRequest?: ContainerFileFlushRequest | undefined; + fileReadLineRequest?: ContainerFileReadLineRequest | undefined; + fileSeekRequest?: ContainerFileSeekRequest | undefined; + fileDeleteBytesRequest?: ContainerFileDeleteBytesRequest | undefined; + fileWriteReplaceBytesRequest?: ContainerFileWriteReplaceBytesRequest | undefined; + fileCloseRequest?: ContainerFileCloseRequest | undefined; + fileLsRequest?: ContainerFileLsRequest | undefined; + fileMkdirRequest?: ContainerFileMkdirRequest | undefined; + fileRmRequest?: ContainerFileRmRequest | undefined; + fileWatchRequest?: ContainerFileWatchRequest | undefined; + taskId: string; +} +declare const ContainerFilesystemExecRequest: MessageFns; +interface ContainerFilesystemExecResponse { + execId: string; + /** only set when the request opens a new file, i.e., ContainerFileOpenRequest */ + fileDescriptor?: string | undefined; +} +declare const ContainerFilesystemExecResponse: MessageFns; +interface ContainerHeartbeatRequest { + /** Bad client version. */ + canceledInputsReturnOutputs: boolean; + canceledInputsReturnOutputsV2: boolean; +} +declare const ContainerHeartbeatRequest: MessageFns; +interface ContainerHeartbeatResponse { + cancelInputEvent?: CancelInputEvent | undefined; +} +declare const ContainerHeartbeatResponse: MessageFns; +interface ContainerLogRequest { + logs: TaskLogs[]; +} +declare const ContainerLogRequest: MessageFns; +interface ContainerReloadVolumesRequest { + taskId: string; +} +declare const ContainerReloadVolumesRequest: MessageFns; +interface ContainerReloadVolumesResponse { +} +declare const ContainerReloadVolumesResponse: MessageFns; +interface ContainerStopRequest { + taskId: string; +} +declare const ContainerStopRequest: MessageFns; +interface ContainerStopResponse { +} +declare const ContainerStopResponse: MessageFns; +interface CreationInfo { + /** This message is used in metadata for resource objects like Dict, Queue, Volume, etc. */ + createdAt: number; + /** User name or service name */ + createdBy: string; +} +declare const CreationInfo: MessageFns; +interface CustomDomainConfig { + name: string; +} +declare const CustomDomainConfig: MessageFns; +interface CustomDomainInfo { + url: string; +} +declare const CustomDomainInfo: MessageFns; +interface DNSRecord { + type: DNSRecordType; + name: string; + value: string; +} +declare const DNSRecord: MessageFns; +/** Chunks of data that can be streamed in and out of tasks. */ +interface DataChunk { + dataFormat: DataFormat; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** Index of this data chunk in the stream. */ + index: number; +} +declare const DataChunk: MessageFns; +interface DictClearRequest { + dictId: string; +} +declare const DictClearRequest: MessageFns; +interface DictContainsRequest { + dictId: string; + key: Uint8Array; +} +declare const DictContainsRequest: MessageFns; +interface DictContainsResponse { + found: boolean; +} +declare const DictContainsResponse: MessageFns; +interface DictContentsRequest { + dictId: string; + /** + * Setting these to True will populate the corresponding field in the response, otherwise it will be null + * This lets us support the keys/values/items SDK API through one RPC without unnecessary data transfer + */ + keys: boolean; + values: boolean; +} +declare const DictContentsRequest: MessageFns; +interface DictDeleteRequest { + dictId: string; +} +declare const DictDeleteRequest: MessageFns; +interface DictEntry { + key: Uint8Array; + value: Uint8Array; +} +declare const DictEntry: MessageFns; +interface DictGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + data: DictEntry[]; +} +declare const DictGetOrCreateRequest: MessageFns; +interface DictGetOrCreateResponse { + dictId: string; + metadata: DictMetadata | undefined; +} +declare const DictGetOrCreateResponse: MessageFns; +interface DictGetRequest { + dictId: string; + key: Uint8Array; +} +declare const DictGetRequest: MessageFns; +interface DictGetResponse { + found: boolean; + value?: Uint8Array | undefined; +} +declare const DictGetResponse: MessageFns; +interface DictHeartbeatRequest { + dictId: string; +} +declare const DictHeartbeatRequest: MessageFns; +interface DictLenRequest { + dictId: string; +} +declare const DictLenRequest: MessageFns; +interface DictLenResponse { + len: number; +} +declare const DictLenResponse: MessageFns; +interface DictListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const DictListRequest: MessageFns; +interface DictListResponse { + dicts: DictListResponse_DictInfo[]; + environmentName: string; +} +declare const DictListResponse: MessageFns; +interface DictListResponse_DictInfo { + name: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + dictId: string; + metadata: DictMetadata | undefined; +} +declare const DictListResponse_DictInfo: MessageFns; +interface DictMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const DictMetadata: MessageFns; +interface DictPopRequest { + dictId: string; + key: Uint8Array; +} +declare const DictPopRequest: MessageFns; +interface DictPopResponse { + found: boolean; + value?: Uint8Array | undefined; +} +declare const DictPopResponse: MessageFns; +interface DictUpdateRequest { + dictId: string; + updates: DictEntry[]; + ifNotExists: boolean; +} +declare const DictUpdateRequest: MessageFns; +interface DictUpdateResponse { + created: boolean; +} +declare const DictUpdateResponse: MessageFns; +interface Domain { + domainId: string; + domainName: string; + createdAt: number; + certificateStatus: CertificateStatus; + dnsRecords: DNSRecord[]; +} +declare const Domain: MessageFns; +interface DomainCertificateVerifyRequest { + domainId: string; +} +declare const DomainCertificateVerifyRequest: MessageFns; +interface DomainCertificateVerifyResponse { + domain: Domain | undefined; +} +declare const DomainCertificateVerifyResponse: MessageFns; +interface DomainCreateRequest { + domainName: string; +} +declare const DomainCreateRequest: MessageFns; +interface DomainCreateResponse { + domainId: string; + dnsRecords: DNSRecord[]; +} +declare const DomainCreateResponse: MessageFns; +interface DomainListRequest { +} +declare const DomainListRequest: MessageFns; +interface DomainListResponse { + domains: Domain[]; +} +declare const DomainListResponse: MessageFns; +interface EnvironmentCreateRequest { + name: string; +} +declare const EnvironmentCreateRequest: MessageFns; +interface EnvironmentDeleteRequest { + name: string; +} +declare const EnvironmentDeleteRequest: MessageFns; +interface EnvironmentGetOrCreateRequest { + deploymentName: string; + objectCreationType: ObjectCreationType; +} +declare const EnvironmentGetOrCreateRequest: MessageFns; +interface EnvironmentGetOrCreateResponse { + environmentId: string; + metadata: EnvironmentMetadata | undefined; +} +declare const EnvironmentGetOrCreateResponse: MessageFns; +interface EnvironmentListItem { + name: string; + webhookSuffix: string; + createdAt: number; + default: boolean; + isManaged: boolean; + environmentId: string; +} +declare const EnvironmentListItem: MessageFns; +interface EnvironmentListResponse { + items: EnvironmentListItem[]; +} +declare const EnvironmentListResponse: MessageFns; +interface EnvironmentMetadata { + name: string; + settings: EnvironmentSettings | undefined; +} +declare const EnvironmentMetadata: MessageFns; +/** + * Environment-scoped settings, with workspace-level defaults. + * Note that we use MergeFrom to combine workspace / environment settings, + * which will *append* any `repeated` fields! + */ +interface EnvironmentSettings { + imageBuilderVersion: string; + webhookSuffix: string; +} +declare const EnvironmentSettings: MessageFns; +interface EnvironmentUpdateRequest { + currentName: string; + name: string | undefined; + webSuffix: string | undefined; +} +declare const EnvironmentUpdateRequest: MessageFns; +/** A file entry when listing files in a volume or network file system. */ +interface FileEntry { + path: string; + type: FileEntry_FileType; + mtime: number; + size: number; +} +declare const FileEntry: MessageFns; +interface FilesystemRuntimeOutputBatch { + output: Uint8Array[]; + error?: SystemErrorMessage | undefined; + batchIndex: number; + eof: boolean; +} +declare const FilesystemRuntimeOutputBatch: MessageFns; +interface FlashContainerDeregisterRequest { + serviceName: string; +} +declare const FlashContainerDeregisterRequest: MessageFns; +interface FlashContainerListRequest { + functionId: string; +} +declare const FlashContainerListRequest: MessageFns; +interface FlashContainerListResponse { + containers: FlashContainerListResponse_Container[]; +} +declare const FlashContainerListResponse: MessageFns; +interface FlashContainerListResponse_Container { + taskId: string; + host: string; + port: number; +} +declare const FlashContainerListResponse_Container: MessageFns; +interface FlashContainerRegisterRequest { + /** not used? */ + serviceName: string; + priority: number; + weight: number; + host: string; + port: number; +} +declare const FlashContainerRegisterRequest: MessageFns; +interface FlashContainerRegisterResponse { + url: string; +} +declare const FlashContainerRegisterResponse: MessageFns; +interface FlashSetTargetSlotsMetricsRequest { + /** TODO(claudia): add other metrics to use in autoscaling decisions */ + functionId: string; + targetSlots: number; +} +declare const FlashSetTargetSlotsMetricsRequest: MessageFns; +interface FlashSetTargetSlotsMetricsResponse { +} +declare const FlashSetTargetSlotsMetricsResponse: MessageFns; +interface FunctionMessage { + moduleName: string; + functionName: string; + mountIds: string[]; + imageId: string; + functionSerialized: Uint8Array; + definitionType: Function_DefinitionType; + functionType: Function_FunctionType; + resources: Resources | undefined; + secretIds: string[]; + rateLimit: RateLimit | undefined; + webhookConfig: WebhookConfig | undefined; + sharedVolumeMounts: SharedVolumeMount[]; + proxyId?: string | undefined; + retryPolicy: FunctionRetryPolicy | undefined; + /** To be replaced by autoscaler_settings.max_containers */ + concurrencyLimit: number; + timeoutSecs: number; + ptyInfo: PTYInfo | undefined; + classSerialized: Uint8Array; + /** To be replaced by autoscaler_settings.scaledown_period */ + taskIdleTimeoutSecs: number; + /** Deprecated at some point */ + cloudProvider?: CloudProvider | undefined; + /** To be replaced by autoscaler_settings.min_containers */ + warmPoolSize: number; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */ + runtime: string; + /** Formerly stub_name */ + appName: string; + volumeMounts: VolumeMount[]; + maxConcurrentInputs: number; + customDomainInfo: CustomDomainInfo[]; + /** For internal debugging use only. */ + workerId: string; + /** For internal debugging use only. */ + runtimeDebug: boolean; + /** TODO: combine into enum? */ + isBuilderFunction: boolean; + isAutoSnapshot: boolean; + isMethod: boolean; + isCheckpointingFunction: boolean; + checkpointingEnabled: boolean; + checkpoint: CheckpointInfo | undefined; + objectDependencies: ObjectDependency[]; + blockNetwork: boolean; + maxInputs: number; + s3Mounts: S3Mount[]; + cloudBucketMounts: CloudBucketMount$1[]; + schedulerPlacement?: SchedulerPlacement | undefined; + /** if "Function" is actually a class grouping multiple methods */ + isClass: boolean; + /** for class methods use this function id instead for invocations - the *referenced* function should have is_class=True */ + useFunctionId: string; + /** for class methods - this method name needs to be included in the FunctionInput */ + useMethodName: string; + classParameterInfo: ClassParameterInfo | undefined; + /** Maximum number of inputs to fetch at once */ + batchMaxSize: number; + /** Miliseconds to block before a response is needed */ + batchLingerMs: number; + i6pnEnabled: boolean; + ExperimentalConcurrentCancellations: boolean; + targetConcurrentInputs: number; + /** TODO(irfansharif): Remove, once https://github.com/modal-labs/modal/pull/15645 lands. */ + ExperimentalTaskTemplatesEnabled: boolean; + /** for fallback options, where the first/most-preferred "template" is derived from fields above */ + ExperimentalTaskTemplates: TaskTemplate[]; + /** + * When the function is a "grouped" one, this records the # of tasks we want + * to schedule in tandem. + */ + ExperimentalGroupSize: number; + /** If set, the function will be run in an untrusted environment. */ + untrusted: boolean; + /** To be replaced by autoscaler_settings.buffer_containers */ + ExperimentalBufferContainers: number; + /** + * _experimental_proxy_ip -> ProxyInfo + * TODO: deprecate. + */ + ExperimentalProxyIp?: string | undefined; + /** For internal debugging use only. */ + runtimePerfRecord: boolean; + schedule: Schedule | undefined; + /** For internal debugging use only. */ + snapshotDebug: boolean; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + methodDefinitionsSet: boolean; + ExperimentalCustomScaling: boolean; + /** Supersedes cloud_provider */ + cloudProviderStr: string; + /** Experimental support for GPU snapshotting */ + ExperimentalEnableGpuSnapshot: boolean; + /** Bundle of parameters related to autoscaling */ + autoscalerSettings: AutoscalerSettings | undefined; + /** Function schema, may be missing: client doesn't block deployment if it fails to get it */ + functionSchema: FunctionSchema | undefined; + /** + * For server-side experimental functionality. Prefer using this over individual _experimental_* fields. + * Note the value type as string. Internally we'll coerce all values to string with str(). + * On the server, it's necessary to convert back to the most natural type (e.g. int) when relevant. + */ + experimentalOptions: { + [key: string]: string; + }; + /** + * If set, client deps will be mounted into the container, and are + * no longer expected to exist in the image itself. + */ + mountClientDependencies: boolean; + flashServiceUrls: string[]; + flashServiceLabel: string; + /** GPU memory snapshotting (alpha) */ + enableGpuSnapshot: boolean; + startupTimeoutSecs: number; + /** can be used as inputs */ + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionMessage: MessageFns; +interface FunctionAsyncInvokeRequest { + functionId: string; + parentInputId: string; + input: FunctionInput | undefined; +} +declare const FunctionAsyncInvokeRequest: MessageFns; +interface FunctionAsyncInvokeResponse { + retryWithBlobUpload: boolean; + functionCallId: string; +} +declare const FunctionAsyncInvokeResponse: MessageFns; +interface FunctionBindParamsRequest { + functionId: string; + serializedParams: Uint8Array; + functionOptions: FunctionOptions | undefined; + environmentName: string; + /** Only used for the input plane. */ + authSecret: string; +} +declare const FunctionBindParamsRequest: MessageFns; +interface FunctionBindParamsResponse { + boundFunctionId: string; + handleMetadata: FunctionHandleMetadata | undefined; +} +declare const FunctionBindParamsResponse: MessageFns; +interface FunctionCallCallGraphInfo { + functionCallId: string; + parentInputId: string; + functionName: string; + moduleName: string; +} +declare const FunctionCallCallGraphInfo: MessageFns; +interface FunctionCallCancelRequest { + functionCallId: string; + terminateContainers: boolean; + /** Only provided for sync input cancellation on the input plane. Async input cancellation does not provide this field this. */ + functionId?: string | undefined; +} +declare const FunctionCallCancelRequest: MessageFns; +interface FunctionCallFromIdRequest { + functionCallId: string; +} +declare const FunctionCallFromIdRequest: MessageFns; +/** Everything you need to build a FunctionCallHandler. */ +interface FunctionCallFromIdResponse { + functionCallId: string; + numInputs: number; +} +declare const FunctionCallFromIdResponse: MessageFns; +interface FunctionCallGetDataRequest { + functionCallId?: string | undefined; + attemptToken?: string | undefined; + lastIndex: number; +} +declare const FunctionCallGetDataRequest: MessageFns; +interface FunctionCallInfo { + functionCallId: string; + idx: number; + /** when the call was created */ + createdAt: number; + /** if cron job, when run was scheduled */ + scheduledAt: number; + pendingInputs: InputCategoryInfo | undefined; + failedInputs: InputCategoryInfo | undefined; + succeededInputs: InputCategoryInfo | undefined; + timeoutInputs: InputCategoryInfo | undefined; + cancelledInputs: InputCategoryInfo | undefined; + totalInputs: number; +} +declare const FunctionCallInfo: MessageFns; +interface FunctionCallListRequest { + functionId: string; +} +declare const FunctionCallListRequest: MessageFns; +interface FunctionCallListResponse { + functionCalls: FunctionCallInfo[]; +} +declare const FunctionCallListResponse: MessageFns; +interface FunctionCallPutDataRequest { + functionCallId?: string | undefined; + attemptToken?: string | undefined; + dataChunks: DataChunk[]; +} +declare const FunctionCallPutDataRequest: MessageFns; +interface FunctionCreateRequest { + function: FunctionMessage | undefined; + appId: string; + /** + * Deprecated: now passed in the Function definition + * + * @deprecated + */ + schedule: Schedule | undefined; + existingFunctionId: string; + /** supersedes 'function' field above */ + functionData: FunctionData | undefined; +} +declare const FunctionCreateRequest: MessageFns; +interface FunctionCreateResponse { + functionId: string; + /** + * Used up until 0.62.212 + * + * @deprecated + */ + DeprecatedWebUrl: string; + function: FunctionMessage | undefined; + handleMetadata: FunctionHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const FunctionCreateResponse: MessageFns; +/** + * Note: FunctionData pulls "up" a subset of fields from Function message that + * will get deprecated there and made authoritative here, at the top-level. + * All remaining fields will stay within the Function message itself and a + * single FunctionData will contain a list of such (ranked) Functions. The + * top-level fields capture data not specific to any particular underlying + * task (like warm-pool-size, applicable across all tasks), while fields + * specific to the task (like the resource request) will exist at the bottom + * level. + */ +interface FunctionData { + moduleName: string; + functionName: string; + functionType: Function_FunctionType; + /** Scheduling related fields. */ + warmPoolSize: number; + concurrencyLimit: number; + taskIdleTimeoutSecs: number; + /** + * When the function is a "grouped" one, this records the # of tasks we want + * to schedule in tandem. + */ + ExperimentalGroupSize: number; + ExperimentalBufferContainers: number; + ExperimentalCustomScaling: boolean; + ExperimentalEnableGpuSnapshot: boolean; + /** for internal debugging use only */ + workerId: string; + timeoutSecs: number; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + webhookConfig: WebhookConfig | undefined; + customDomainInfo: CustomDomainInfo[]; + /** + * _experimental_proxy_ip -> ProxyInfo + * TODO: deprecate. + */ + ExperimentalProxyIp?: string | undefined; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + methodDefinitionsSet: boolean; + /** if "Function" is actually a class grouping multiple methods - applies across all underlying tasks */ + isClass: boolean; + classParameterInfo: ClassParameterInfo | undefined; + isMethod: boolean; + /** used for methods */ + useFunctionId: string; + /** used for methods */ + useMethodName: string; + rankedFunctions: FunctionData_RankedFunction[]; + schedule: Schedule | undefined; + /** If set, the function will be run in an untrusted environment. */ + untrusted: boolean; + /** For internal debugging use only. */ + snapshotDebug: boolean; + /** For internal debugging use only. */ + runtimePerfRecord: boolean; + /** Bundle of parameters related to autoscaling */ + autoscalerSettings: AutoscalerSettings | undefined; + functionSchema: FunctionSchema | undefined; + experimentalOptions: { + [key: string]: string; + }; + flashServiceUrls: string[]; + flashServiceLabel: string; + startupTimeoutSecs: number; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionData: MessageFns; +interface FunctionData_RankedFunction { + rank: number; + function: FunctionMessage | undefined; +} +declare const FunctionData_RankedFunction: MessageFns; +interface FunctionFinishInputsRequest { + functionId: string; + functionCallId: string; + numInputs: number; +} +declare const FunctionFinishInputsRequest: MessageFns; +interface FunctionGetCallGraphRequest { + /** TODO: use input_id once we switch client submit API to return those. */ + functionCallId: string; +} +declare const FunctionGetCallGraphRequest: MessageFns; +interface FunctionGetCallGraphResponse { + inputs: InputCallGraphInfo[]; + functionCalls: FunctionCallCallGraphInfo[]; +} +declare const FunctionGetCallGraphResponse: MessageFns; +interface FunctionGetCurrentStatsRequest { + functionId: string; +} +declare const FunctionGetCurrentStatsRequest: MessageFns; +interface FunctionGetDynamicConcurrencyRequest { + functionId: string; + targetConcurrency: number; + maxConcurrency: number; +} +declare const FunctionGetDynamicConcurrencyRequest: MessageFns; +interface FunctionGetDynamicConcurrencyResponse { + concurrency: number; +} +declare const FunctionGetDynamicConcurrencyResponse: MessageFns; +interface FunctionGetInputsItem { + inputId: string; + input: FunctionInput | undefined; + killSwitch: boolean; + functionCallId: string; + functionCallInvocationType: FunctionCallInvocationType; + retryCount: number; + /** intercepted and only used by the worker. */ + functionMapIdx?: number | undefined; + attemptToken: string; +} +declare const FunctionGetInputsItem: MessageFns; +interface FunctionGetInputsRequest { + functionId: string; + maxValues: number; + averageCallTime: number; + /** Container aims to fetch multiple inputs at the same time */ + inputConcurrency: number; + /** Maximum number of inputs to fetch at once */ + batchMaxSize: number; + /** Miliseconds to block before a response is needed */ + batchLingerMs: number; +} +declare const FunctionGetInputsRequest: MessageFns; +interface FunctionGetInputsResponse { + inputs: FunctionGetInputsItem[]; + /** How long to sleep before requesting another input. */ + rateLimitSleepDuration: number; +} +declare const FunctionGetInputsResponse: MessageFns; +interface FunctionGetOutputsItem { + result: GenericResult | undefined; + idx: number; + inputId: string; + /** for result.data_oneof */ + dataFormat: DataFormat; + taskId: string; + inputStartedAt: number; + outputCreatedAt: number; + retryCount: number; + /** datadog function call trace tag */ + fcTraceTag: string; +} +declare const FunctionGetOutputsItem: MessageFns; +interface FunctionGetOutputsRequest { + functionCallId: string; + maxValues: number; + timeout: number; + lastEntryId: string; + /** expires *any* remaining outputs soon after this call, not just the returned ones */ + clearOnSuccess: boolean; + /** Used for waypoints. */ + requestedAt: number; + /** The jwts the client expects the server to be processing. This is optional and used for sync inputs only. */ + inputJwts: string[]; + /** for async batch requests. this indicates which index to start from. */ + startIdx?: number | undefined; + /** for async batch requests. this indicates which index to end at. */ + endIdx?: number | undefined; +} +declare const FunctionGetOutputsRequest: MessageFns; +interface FunctionGetOutputsResponse { + idxs: number[]; + outputs: FunctionGetOutputsItem[]; + lastEntryId: string; + numUnfinishedInputs: number; +} +declare const FunctionGetOutputsResponse: MessageFns; +interface FunctionGetRequest { + appName: string; + objectTag: string; + environmentName: string; +} +declare const FunctionGetRequest: MessageFns; +interface FunctionGetResponse { + functionId: string; + handleMetadata: FunctionHandleMetadata | undefined; + serverWarnings: Warning[]; +} +declare const FunctionGetResponse: MessageFns; +interface FunctionGetSerializedRequest { + functionId: string; +} +declare const FunctionGetSerializedRequest: MessageFns; +interface FunctionGetSerializedResponse { + functionSerialized: Uint8Array; + classSerialized: Uint8Array; +} +declare const FunctionGetSerializedResponse: MessageFns; +/** + * contains all the info about a function that is needed to trigger the right + * behaviour when using a FunctionHandler. Notably excludes things purely + * used for *executing* the function in a container entrypoint + */ +interface FunctionHandleMetadata { + /** Should be a subset and use IDs/types from `Function` above */ + functionName: string; + functionType: Function_FunctionType; + webUrl: string; + isMethod: boolean; + /** used for methods */ + useFunctionId: string; + /** used for methods */ + useMethodName: string; + definitionId: string; + classParameterInfo: ClassParameterInfo | undefined; + /** Mapping of method names to their metadata, only non-empty for class service functions */ + methodHandleMetadata: { + [key: string]: FunctionHandleMetadata; + }; + functionSchema: FunctionSchema | undefined; + inputPlaneUrl?: string | undefined; + inputPlaneRegion?: string | undefined; + /** Use optional to ensure unset values default to None instead of 0 */ + maxObjectSizeBytes?: number | undefined; + /** (Optional) urls for flash services */ + ExperimentalFlashUrls: string[]; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionHandleMetadata: MessageFns; +interface FunctionInput { + args?: Uint8Array | undefined; + argsBlobId?: string | undefined; + finalInput: boolean; + /** For args_oneof. */ + dataFormat: DataFormat; + /** specifies which method to call when calling a class/object function */ + methodName?: string | undefined; +} +declare const FunctionInput: MessageFns; +interface FunctionMapRequest { + functionId: string; + parentInputId: string; + returnExceptions: boolean; + functionCallType: FunctionCallType; + pipelinedInputs: FunctionPutInputsItem[]; + functionCallInvocationType: FunctionCallInvocationType; + fromSpawnMap: boolean; +} +declare const FunctionMapRequest: MessageFns; +interface FunctionMapResponse { + functionCallId: string; + pipelinedInputs: FunctionPutInputsResponseItem[]; + retryPolicy: FunctionRetryPolicy | undefined; + functionCallJwt: string; + syncClientRetriesEnabled: boolean; + maxInputsOutstanding: number; +} +declare const FunctionMapResponse: MessageFns; +interface FunctionOptions { + secretIds: string[]; + /** Currently not supported */ + mountIds: string[]; + resources?: Resources | undefined; + retryPolicy?: FunctionRetryPolicy | undefined; + concurrencyLimit?: number | undefined; + timeoutSecs?: number | undefined; + taskIdleTimeoutSecs?: number | undefined; + warmPoolSize?: number | undefined; + volumeMounts: VolumeMount[]; + targetConcurrentInputs?: number | undefined; + replaceVolumeMounts: boolean; + replaceSecretIds: boolean; + bufferContainers?: number | undefined; + maxConcurrentInputs?: number | undefined; + batchMaxSize?: number | undefined; + batchLingerMs?: number | undefined; + schedulerPlacement?: SchedulerPlacement | undefined; + cloudProviderStr?: string | undefined; + replaceCloudBucketMounts: boolean; + cloudBucketMounts: CloudBucketMount$1[]; +} +declare const FunctionOptions: MessageFns; +interface FunctionPrecreateRequest { + appId: string; + functionName: string; + existingFunctionId: string; + functionType: Function_FunctionType; + webhookConfig: WebhookConfig | undefined; + /** for class methods - use this function id instead for invocations - the *referenced* function should have is_class=True */ + useFunctionId: string; + /** for class methods - this method name needs to be included in the FunctionInput */ + useMethodName: string; + /** Mapping of method names to method definitions, only non-empty for class service functions */ + methodDefinitions: { + [key: string]: MethodDefinition; + }; + functionSchema: FunctionSchema | undefined; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const FunctionPrecreateRequest: MessageFns; +interface FunctionPrecreateResponse { + functionId: string; + handleMetadata: FunctionHandleMetadata | undefined; +} +declare const FunctionPrecreateResponse: MessageFns; +interface FunctionPutInputsItem { + idx: number; + input: FunctionInput | undefined; + r2Failed: boolean; + r2ThroughputBytesS: number; +} +declare const FunctionPutInputsItem: MessageFns; +interface FunctionPutInputsRequest { + functionId: string; + functionCallId: string; + inputs: FunctionPutInputsItem[]; +} +declare const FunctionPutInputsRequest: MessageFns; +interface FunctionPutInputsResponse { + inputs: FunctionPutInputsResponseItem[]; +} +declare const FunctionPutInputsResponse: MessageFns; +interface FunctionPutInputsResponseItem { + idx: number; + inputId: string; + inputJwt: string; +} +declare const FunctionPutInputsResponseItem: MessageFns; +interface FunctionPutOutputsItem { + inputId: string; + result: GenericResult | undefined; + inputStartedAt: number; + outputCreatedAt: number; + /** for result.data_oneof */ + dataFormat: DataFormat; + retryCount: number; + /** injected by the worker */ + functionCallId: string; + /** injected by the worker */ + functionMapIdx?: number | undefined; +} +declare const FunctionPutOutputsItem: MessageFns; +interface FunctionPutOutputsRequest { + outputs: FunctionPutOutputsItem[]; + /** Used for waypoints. */ + requestedAt: number; +} +declare const FunctionPutOutputsRequest: MessageFns; +interface FunctionRetryInputsItem { + inputJwt: string; + input: FunctionInput | undefined; + retryCount: number; +} +declare const FunctionRetryInputsItem: MessageFns; +interface FunctionRetryInputsRequest { + functionCallJwt: string; + inputs: FunctionRetryInputsItem[]; +} +declare const FunctionRetryInputsRequest: MessageFns; +interface FunctionRetryInputsResponse { + inputJwts: string[]; +} +declare const FunctionRetryInputsResponse: MessageFns; +interface FunctionRetryPolicy { + backoffCoefficient: number; + initialDelayMs: number; + maxDelayMs: number; + /** NOTE: two-byte field number not used for special reason. copy-paste error. Ref: PR #2542 */ + retries: number; +} +declare const FunctionRetryPolicy: MessageFns; +interface FunctionSchema { + /** allows easy disambiguation between empty schema and no schema collection etc. */ + schemaType: FunctionSchema_FunctionSchemaType; + arguments: ClassParameterSpec[]; + returnType: GenericPayloadType | undefined; +} +declare const FunctionSchema: MessageFns; +interface FunctionStats$1 { + backlog: number; + numTotalTasks: number; +} +declare const FunctionStats$1: MessageFns; +interface FunctionUpdateSchedulingParamsRequest { + functionId: string; + warmPoolSizeOverride: number; + settings: AutoscalerSettings | undefined; +} +declare const FunctionUpdateSchedulingParamsRequest: MessageFns; +interface FunctionUpdateSchedulingParamsResponse { +} +declare const FunctionUpdateSchedulingParamsResponse: MessageFns; +interface GPUConfig { + /** Deprecated, at some point */ + type: GPUType; + count: number; + gpuType: string; +} +declare const GPUConfig: MessageFns; +interface GenericPayloadType { + baseType: ParameterType; + /** sub-type for generic types like lists */ + subTypes: GenericPayloadType[]; +} +declare const GenericPayloadType: MessageFns; +/** Used for both tasks and function outputs */ +interface GenericResult { + /** Status of the task or function output. */ + status: GenericResult_GenericStatus; + /** Exception message for failures, if available. */ + exception: string; + /** Status code of the container entrypoint or builder process if it terminates unexpectedly. */ + exitcode: number; + /** String value of the Python traceback. */ + traceback: string; + /** Pickled traceback object. */ + serializedTb: Uint8Array; + /** Pickled line cache for traceback object. */ + tbLineCache: Uint8Array; + /** Inline data of the result. */ + data?: Uint8Array | undefined; + /** Blob ID for large data. */ + dataBlobId?: string | undefined; + /** (?) */ + propagationReason: string; +} +declare const GenericResult: MessageFns; +interface Image$1 { + baseImages: BaseImage[]; + dockerfileCommands: string[]; + contextFiles: ImageContextFile[]; + version: string; + secretIds: string[]; + /** + * Part of Image definition, because presence of GPU drivers + * affects the image that's built. + */ + contextMountId: string; + gpuConfig: GPUConfig | undefined; + imageRegistryConfig: ImageRegistryConfig | undefined; + /** deprecated after 0.58.96 */ + buildFunctionDef: string; + /** deprecated after 0.58.96 */ + buildFunctionGlobals: Uint8Array; + /** If set, overrides the runtime used by the function. Specify either "runc" or "gvisor". */ + runtime: string; + /** Not included in image definition checksum as debug features do not affect built image. */ + runtimeDebug: boolean; + buildFunction: BuildFunction | undefined; + /** Build arguments for the image (--build-arg) for ARG substitution in Dockerfile. */ + buildArgs: { + [key: string]: string; + }; + /** Volume mount for RUN commands */ + volumeMounts: VolumeMount[]; +} +declare const Image$1: MessageFns; +interface ImageContextFile { + filename: string; + data: Uint8Array; +} +declare const ImageContextFile: MessageFns; +interface ImageDeleteRequest { + imageId: string; +} +declare const ImageDeleteRequest: MessageFns; +interface ImageFromIdRequest { + imageId: string; +} +declare const ImageFromIdRequest: MessageFns; +interface ImageFromIdResponse { + imageId: string; + metadata: ImageMetadata | undefined; +} +declare const ImageFromIdResponse: MessageFns; +interface ImageGetOrCreateRequest { + image: Image$1 | undefined; + appId: string; + /** ignored */ + existingImageId: string; + buildFunctionId: string; + forceBuild: boolean; + namespace: DeploymentNamespace; + builderVersion: string; + /** Only admins can publish global images, but this provides an extra failsafe */ + allowGlobalDeployment: boolean; + /** Force the Image to build but don't clobber any Images with the same recipe in the cache */ + ignoreCache: boolean; +} +declare const ImageGetOrCreateRequest: MessageFns; +interface ImageGetOrCreateResponse { + /** image_id is set regardless if the image is built (use ImageJoinStreaming to wait for build) */ + imageId: string; + /** result of build - only set if the image has finished building (regardless if success or not) */ + result: GenericResult | undefined; + /** image metadata - only set if the image has built successfully */ + metadata: ImageMetadata | undefined; +} +declare const ImageGetOrCreateResponse: MessageFns; +interface ImageJoinStreamingRequest { + imageId: string; + timeout: number; + lastEntryId: string; + includeLogsForFinished: boolean; +} +declare const ImageJoinStreamingRequest: MessageFns; +interface ImageJoinStreamingResponse { + result: GenericResult | undefined; + taskLogs: TaskLogs[]; + entryId: string; + eof: boolean; + /** set on success */ + metadata: ImageMetadata | undefined; +} +declare const ImageJoinStreamingResponse: MessageFns; +interface ImageMetadata { + /** The output of `python -VV. Not set if missing */ + pythonVersionInfo?: string | undefined; + /** + * Installed python packages, as listed by by `pip list`. + * package name -> version. Empty if missing + */ + pythonPackages: { + [key: string]: string; + }; + /** + * The working directory of the image, as an absolute file path. + * + * For most images, this is not set, which means to use the default workdir: + * - On function runners, the default is `/root` (home directory). + * - For image builds and sandbox environments, it is `/`. + */ + workdir?: string | undefined; + /** The version of glibc in this image, if any. */ + libcVersionInfo?: string | undefined; + /** The builder version for/with which the image was created. */ + imageBuilderVersion?: string | undefined; +} +declare const ImageMetadata: MessageFns; +interface ImageRegistryConfig { + registryAuthType: RegistryAuthType; + secretId: string; +} +declare const ImageRegistryConfig: MessageFns; +interface InputCallGraphInfo { + inputId: string; + status: GenericResult_GenericStatus; + functionCallId: string; + taskId: string; +} +declare const InputCallGraphInfo: MessageFns; +interface InputCategoryInfo { + total: number; + latest: InputInfo[]; +} +declare const InputCategoryInfo: MessageFns; +interface InputInfo { + inputId: string; + idx: number; + taskId: string; + startedAt: number; + finishedAt: number; + taskStartupTime: number; + taskFirstInput: boolean; +} +declare const InputInfo: MessageFns; +interface ListPagination { + maxObjects: number; + createdBefore: number; +} +declare const ListPagination: MessageFns; +interface MapAwaitRequest { + functionCallId?: string | undefined; + mapToken?: string | undefined; + lastEntryId: string; + /** Used for waypoints. */ + requestedAt: number; + timeout: number; +} +declare const MapAwaitRequest: MessageFns; +interface MapAwaitResponse { + outputs: FunctionGetOutputsItem[]; + lastEntryId: string; +} +declare const MapAwaitResponse: MessageFns; +interface MapCheckInputsRequest { + lastEntryId: string; + timeout: number; + attemptTokens: string[]; +} +declare const MapCheckInputsRequest: MessageFns; +interface MapCheckInputsResponse { + lost: boolean[]; +} +declare const MapCheckInputsResponse: MessageFns; +interface MapStartOrContinueItem { + input: FunctionPutInputsItem | undefined; + /** None if this is a fresh input, otherwise it is the attempt token for a retry. */ + attemptToken?: string | undefined; +} +declare const MapStartOrContinueItem: MessageFns; +interface MapStartOrContinueRequest { + functionId: string; + parentInputId: string; + functionCallId?: string | undefined; + mapToken?: string | undefined; + items: MapStartOrContinueItem[]; +} +declare const MapStartOrContinueRequest: MessageFns; +interface MapStartOrContinueResponse { + /** + * function_id and function_call_id are not necessary if map_token is provided. + * All 3 will be sent until it is safe to only send map_token. + */ + mapToken: string; + functionId: string; + functionCallId: string; + maxInputsOutstanding: number; + attemptTokens: string[]; + retryPolicy: FunctionRetryPolicy | undefined; +} +declare const MapStartOrContinueResponse: MessageFns; +interface MethodDefinition { + functionName: string; + functionType: Function_FunctionType; + webhookConfig: WebhookConfig | undefined; + webUrl: string; + webUrlInfo: WebUrlInfo | undefined; + customDomainInfo: CustomDomainInfo[]; + functionSchema: FunctionSchema | undefined; + supportedInputFormats: DataFormat[]; + supportedOutputFormats: DataFormat[]; +} +declare const MethodDefinition: MessageFns; +interface MountFile { + filename: string; + /** SHA-256 checksum of the file. */ + sha256Hex: string; + /** Size of the file in bytes — ignored in MountBuild(). */ + size?: number | undefined; + /** Unix file permission bits `st_mode`. */ + mode?: number | undefined; +} +declare const MountFile: MessageFns; +interface MountGetOrCreateRequest { + deploymentName: string; + namespace: DeploymentNamespace; + environmentName: string; + objectCreationType: ObjectCreationType; + files: MountFile[]; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; +} +declare const MountGetOrCreateRequest: MessageFns; +interface MountGetOrCreateResponse { + mountId: string; + handleMetadata: MountHandleMetadata | undefined; +} +declare const MountGetOrCreateResponse: MessageFns; +interface MountHandleMetadata { + contentChecksumSha256Hex: string; +} +declare const MountHandleMetadata: MessageFns; +interface MountPutFileRequest { + sha256Hex: string; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; +} +declare const MountPutFileRequest: MessageFns; +interface MountPutFileResponse { + exists: boolean; +} +declare const MountPutFileResponse: MessageFns; +interface MultiPartUpload { + /** split upload based on this part length - all except the last part must have this length */ + partLength: number; + uploadUrls: string[]; + completionUrl: string; +} +declare const MultiPartUpload: MessageFns; +interface MultiPartUploadList { + items: MultiPartUpload[]; +} +declare const MultiPartUploadList: MessageFns; +interface NetworkAccess { + networkAccessType: NetworkAccess_NetworkAccessType; + allowedCidrs: string[]; +} +declare const NetworkAccess: MessageFns; +interface NotebookKernelPublishResultsRequest { + notebookId: string; + results: NotebookKernelPublishResultsRequest_CellResult[]; +} +declare const NotebookKernelPublishResultsRequest: MessageFns; +/** + * See kernelshim.py for the differences between this and `ExecuteResult`. + * https://jupyter-client.readthedocs.io/en/stable/messaging.html#execution-results + */ +interface NotebookKernelPublishResultsRequest_ExecuteReply { + status: string; + executionCount: number; + duration: number; +} +declare const NotebookKernelPublishResultsRequest_ExecuteReply: MessageFns; +/** IOPub message or reply received from the kernel for a cell. */ +interface NotebookKernelPublishResultsRequest_CellResult { + cellId: string; + /** Persistent output that is saved in the notebook. */ + output?: NotebookOutput | undefined; + /** Clear all previous outputs of the cell. */ + clearOutput?: boolean | undefined; + /** Cell has finished executing, return the kernel's execute_reply. */ + executeReply?: NotebookKernelPublishResultsRequest_ExecuteReply | undefined; +} +declare const NotebookKernelPublishResultsRequest_CellResult: MessageFns; +/** + * A single output from a notebook. When you execute a cell, it produces an + * array of these outputs as the code runs. + * + * https://github.com/jupyter/nbformat/blob/v5.10.4/nbformat/v4/nbformat.v4.schema.json#L301-L309 + */ +interface NotebookOutput { + executeResult?: NotebookOutput_ExecuteResult | undefined; + displayData?: NotebookOutput_DisplayData | undefined; + stream?: NotebookOutput_Stream | undefined; + error?: NotebookOutput_Error | undefined; +} +declare const NotebookOutput: MessageFns; +/** Result of executing a code cell. */ +interface NotebookOutput_ExecuteResult { + executionCount: number; + /** mimebundle */ + data: { + [key: string]: any; + } | undefined; + metadata: { + [key: string]: any; + } | undefined; +} +declare const NotebookOutput_ExecuteResult: MessageFns; +/** Data displayed as a result of code cell execution. */ +interface NotebookOutput_DisplayData { + /** mimebundle */ + data: { + [key: string]: any; + } | undefined; + metadata: { + [key: string]: any; + } | undefined; + /** This should not be included in saved notebook. */ + transientDisplayId?: string | undefined; +} +declare const NotebookOutput_DisplayData: MessageFns; +/** Stream output from a code cell (stdout / stderr). */ +interface NotebookOutput_Stream { + /** stdout | stderr */ + name: string; + /** multiline_string */ + text: string; +} +declare const NotebookOutput_Stream: MessageFns; +/** Output of an error that occurred during code cell execution. */ +interface NotebookOutput_Error { + ename: string; + evalue: string; + traceback: string[]; +} +declare const NotebookOutput_Error: MessageFns; +interface Object_ { + objectId: string; + functionHandleMetadata?: FunctionHandleMetadata | undefined; + mountHandleMetadata?: MountHandleMetadata | undefined; + classHandleMetadata?: ClassHandleMetadata | undefined; + sandboxHandleMetadata?: SandboxHandleMetadata | undefined; + volumeMetadata?: VolumeMetadata | undefined; +} +declare const Object_: MessageFns; +interface ObjectDependency { + objectId: string; +} +declare const ObjectDependency: MessageFns; +interface PTYInfo { + /** Soon deprecated */ + enabled: boolean; + winszRows: number; + winszCols: number; + envTerm: string; + envColorterm: string; + envTermProgram: string; + ptyType: PTYInfo_PTYType; + noTerminateOnIdleStdin: boolean; +} +declare const PTYInfo: MessageFns; +interface PortSpec { + port: number; + unencrypted: boolean; + tunnelType?: TunnelType | undefined; +} +declare const PortSpec: MessageFns; +interface PortSpecs { + ports: PortSpec[]; +} +declare const PortSpecs: MessageFns; +interface Proxy$1 { + name: string; + createdAt: number; + environmentName: string; + proxyId: string; + proxyIps: ProxyIp[]; +} +declare const Proxy$1: MessageFns; +interface ProxyAddIpRequest { + proxyId: string; +} +declare const ProxyAddIpRequest: MessageFns; +interface ProxyAddIpResponse { + proxyIp: ProxyIp | undefined; +} +declare const ProxyAddIpResponse: MessageFns; +interface ProxyCreateRequest { + name: string; + environmentName: string; +} +declare const ProxyCreateRequest: MessageFns; +interface ProxyCreateResponse { + proxy: Proxy$1 | undefined; +} +declare const ProxyCreateResponse: MessageFns; +interface ProxyDeleteRequest { + proxyId: string; +} +declare const ProxyDeleteRequest: MessageFns; +interface ProxyGetOrCreateRequest { + deploymentName: string; + environmentName: string; + /** must be UNSPECIFIED */ + objectCreationType: ObjectCreationType; +} +declare const ProxyGetOrCreateRequest: MessageFns; +interface ProxyGetOrCreateResponse { + proxyId: string; +} +declare const ProxyGetOrCreateResponse: MessageFns; +interface ProxyGetRequest { + name: string; + environmentName: string; +} +declare const ProxyGetRequest: MessageFns; +interface ProxyGetResponse { + proxy: Proxy$1 | undefined; +} +declare const ProxyGetResponse: MessageFns; +interface ProxyIp { + proxyIp: string; + status: ProxyIpStatus; + createdAt: number; + environmentName: string; +} +declare const ProxyIp: MessageFns; +interface ProxyListResponse { + proxies: Proxy$1[]; +} +declare const ProxyListResponse: MessageFns; +interface ProxyRemoveIpRequest { + proxyIp: string; +} +declare const ProxyRemoveIpRequest: MessageFns; +interface QueueClearRequest { + queueId: string; + partitionKey: Uint8Array; + allPartitions: boolean; +} +declare const QueueClearRequest: MessageFns; +interface QueueDeleteRequest { + queueId: string; +} +declare const QueueDeleteRequest: MessageFns; +interface QueueGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; +} +declare const QueueGetOrCreateRequest: MessageFns; +interface QueueGetOrCreateResponse { + queueId: string; + metadata: QueueMetadata | undefined; +} +declare const QueueGetOrCreateResponse: MessageFns; +interface QueueGetRequest { + queueId: string; + timeout: number; + nValues: number; + partitionKey: Uint8Array; +} +declare const QueueGetRequest: MessageFns; +interface QueueGetResponse { + values: Uint8Array[]; +} +declare const QueueGetResponse: MessageFns; +interface QueueHeartbeatRequest { + queueId: string; +} +declare const QueueHeartbeatRequest: MessageFns; +interface QueueItem { + value: Uint8Array; + entryId: string; +} +declare const QueueItem: MessageFns; +interface QueueLenRequest { + queueId: string; + partitionKey: Uint8Array; + total: boolean; +} +declare const QueueLenRequest: MessageFns; +interface QueueLenResponse { + len: number; +} +declare const QueueLenResponse: MessageFns; +interface QueueListRequest { + environmentName: string; + /** Limit on "number of partitions" reported, since checking them is costly */ + totalSizeLimit: number; + pagination: ListPagination | undefined; +} +declare const QueueListRequest: MessageFns; +interface QueueListResponse { + queues: QueueListResponse_QueueInfo[]; + environmentName: string; +} +declare const QueueListResponse: MessageFns; +interface QueueListResponse_QueueInfo { + name: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + numPartitions: number; + totalSize: number; + queueId: string; + metadata: QueueMetadata | undefined; +} +declare const QueueListResponse_QueueInfo: MessageFns; +interface QueueMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const QueueMetadata: MessageFns; +interface QueueNextItemsRequest { + queueId: string; + partitionKey: Uint8Array; + lastEntryId: string; + /** seconds */ + itemPollTimeout: number; +} +declare const QueueNextItemsRequest: MessageFns; +interface QueueNextItemsResponse { + items: QueueItem[]; +} +declare const QueueNextItemsResponse: MessageFns; +interface QueuePutRequest { + queueId: string; + values: Uint8Array[]; + partitionKey: Uint8Array; + partitionTtlSeconds: number; +} +declare const QueuePutRequest: MessageFns; +interface RateLimit { + limit: number; + interval: RateLimitInterval; +} +declare const RateLimit: MessageFns; +interface Resources { + /** MiB */ + memoryMb: number; + /** milli CPU cores */ + milliCpu: number; + gpuConfig: GPUConfig | undefined; + /** MiB */ + memoryMbMax: number; + /** MiB */ + ephemeralDiskMb: number; + /** milli CPU cores */ + milliCpuMax: number; + /** Whether to use RDMA interfaces */ + rdma: boolean; +} +declare const Resources: MessageFns; +interface RuntimeInputMessage { + message: Uint8Array; + messageIndex: number; + eof: boolean; +} +declare const RuntimeInputMessage: MessageFns; +interface RuntimeOutputBatch { + items: RuntimeOutputMessage[]; + batchIndex: number; + /** if an exit code is given, this is the final message that will be sent. */ + exitCode?: number | undefined; + stdout: RuntimeOutputMessage[]; + stderr: RuntimeOutputMessage[]; + info: RuntimeOutputMessage[]; +} +declare const RuntimeOutputBatch: MessageFns; +/** Used for `modal container exec`, `modal shell`, and Sandboxes */ +interface RuntimeOutputMessage { + /** only stdout / stderr is used */ + fileDescriptor: FileDescriptor; + message: string; + messageBytes: Uint8Array; +} +declare const RuntimeOutputMessage: MessageFns; +interface S3Mount { + bucketName: string; + mountPath: string; + credentialsSecretId: string; + readOnly: boolean; +} +declare const S3Mount: MessageFns; +interface Sandbox$1 { + entrypointArgs: string[]; + mountIds: string[]; + imageId: string; + secretIds: string[]; + resources: Resources | undefined; + /** Deprecated at some point */ + cloudProvider: CloudProvider; + /** The max lifetime of a sandbox in seconds. */ + timeoutSecs: number; + workdir?: string | undefined; + nfsMounts: SharedVolumeMount[]; + /** For internal debugging use only. */ + runtimeDebug: boolean; + blockNetwork: boolean; + s3Mounts: S3Mount[]; + cloudBucketMounts: CloudBucketMount$1[]; + volumeMounts: VolumeMount[]; + ptyInfo: PTYInfo | undefined; + schedulerPlacement?: SchedulerPlacement | undefined; + /** for internal debugging use only */ + workerId: string; + openPorts?: PortSpecs | undefined; + i6pnEnabled: boolean; + /** Network access configuration beyond simple allow/block. */ + networkAccess: NetworkAccess | undefined; + proxyId?: string | undefined; + /** + * Enable snapshotting the sandbox (both memory and filesystem). + * This doesn't need to be enabled to save the filesystem as an image (i.e. a filesystem-only snapshot). + */ + enableSnapshot: boolean; + /** + * Used to pin gVisor version for memory-snapshottable sandboxes. + * This field is set by the server, not the client. + */ + snapshotVersion?: number | undefined; + /** Supersedes cloud_provider */ + cloudProviderStr: string; + /** + * Specifies container runtime behavior for sandboxes which are restored from a snapshot. + * Set by the backend at snapshot creation time. + */ + runscRuntimeVersion?: string | undefined; + /** If set, overrides the runtime used by the function, either "runc" or "gvisor". */ + runtime?: string | undefined; + /** If set, the sandbox will be created with verbose logging enabled. */ + verbose: boolean; + /** If set, the sandbox will be created with a name. */ + name?: string | undefined; + /** Experimental options */ + experimentalOptions: { + [key: string]: boolean; + }; + /** Internal use only. */ + preloadPathPrefixes: string[]; + /** Optional idle timeout in seconds. If set, the sandbox will be terminated after being idle for this duration. */ + idleTimeoutSecs?: number | undefined; + /** + * If set, the sandbox will be created with direct sandbox commands enabled. + * Exec commands for the sandbox will be issued directly to the sandbox + * command router running on the Modal worker. + */ + directSandboxCommandsEnabled: boolean; +} +declare const Sandbox$1: MessageFns; +interface SandboxCreateConnectTokenRequest { + sandboxId: string; + userMetadata: string; +} +declare const SandboxCreateConnectTokenRequest: MessageFns; +interface SandboxCreateConnectTokenResponse { + url: string; + token: string; +} +declare const SandboxCreateConnectTokenResponse: MessageFns; +interface SandboxCreateRequest { + appId: string; + definition: Sandbox$1 | undefined; + /** DEPRECATED* 7/16/2025 */ + environmentName: string; +} +declare const SandboxCreateRequest: MessageFns; +interface SandboxCreateResponse { + sandboxId: string; +} +declare const SandboxCreateResponse: MessageFns; +/** + * Used to get a JWT and URL for direct access to a sandbox router server + * running on the modal-worker, so the client can issue exec commands (and other + * operations as they become available) directly to the worker. + * DEPRECATED: Use TaskGetCommandRouterAccessRequest instead. + * TODO(saltzm): Remove this. + */ +interface SandboxGetCommandRouterAccessRequest { + sandboxId: string; +} +declare const SandboxGetCommandRouterAccessRequest: MessageFns; +interface SandboxGetCommandRouterAccessResponse { + jwt: string; + url: string; +} +declare const SandboxGetCommandRouterAccessResponse: MessageFns; +interface SandboxGetFromNameRequest { + sandboxName: string; + environmentName: string; + appName: string; +} +declare const SandboxGetFromNameRequest: MessageFns; +interface SandboxGetFromNameResponse { + sandboxId: string; +} +declare const SandboxGetFromNameResponse: MessageFns; +interface SandboxGetLogsRequest { + sandboxId: string; + fileDescriptor: FileDescriptor; + timeout: number; + lastEntryId: string; +} +declare const SandboxGetLogsRequest: MessageFns; +interface SandboxGetResourceUsageRequest { + sandboxId: string; +} +declare const SandboxGetResourceUsageRequest: MessageFns; +interface SandboxGetResourceUsageResponse { + cpuCoreNanosecs: number; + memGibNanosecs: number; + gpuNanosecs: number; + gpuType?: string | undefined; +} +declare const SandboxGetResourceUsageResponse: MessageFns; +interface SandboxGetTaskIdRequest { + sandboxId: string; + /** Legacy clients do not provide a timeout. New clients must always provide a timeout. */ + timeout?: number | undefined; + /** If true, waits until the container's postStart hook has been run before returning. Useful for detecting init failures. */ + waitUntilReady: boolean; +} +declare const SandboxGetTaskIdRequest: MessageFns; +interface SandboxGetTaskIdResponse { + /** This is None if the sandbox was terminated before a task could be scheduled. */ + taskId?: string | undefined; + /** If the task has already exited, this is the result. */ + taskResult?: GenericResult | undefined; +} +declare const SandboxGetTaskIdResponse: MessageFns; +interface SandboxGetTunnelsRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxGetTunnelsRequest: MessageFns; +interface SandboxGetTunnelsResponse { + result: GenericResult | undefined; + tunnels: TunnelData[]; +} +declare const SandboxGetTunnelsResponse: MessageFns; +interface SandboxHandleMetadata { + result: GenericResult | undefined; +} +declare const SandboxHandleMetadata: MessageFns; +interface SandboxInfo { + id: string; + createdAt: number; + taskInfo: TaskInfo | undefined; + appId: string; + /** TODO: Not yet exposed in client library. */ + tags: SandboxTag[]; + name: string; +} +declare const SandboxInfo: MessageFns; +interface SandboxListRequest { + appId: string; + beforeTimestamp: number; + environmentName: string; + includeFinished: boolean; + tags: SandboxTag[]; +} +declare const SandboxListRequest: MessageFns; +interface SandboxListResponse { + sandboxes: SandboxInfo[]; +} +declare const SandboxListResponse: MessageFns; +interface SandboxRestoreRequest { + snapshotId: string; + sandboxNameOverride: string; + sandboxNameOverrideType: SandboxRestoreRequest_SandboxNameOverrideType; +} +declare const SandboxRestoreRequest: MessageFns; +interface SandboxRestoreResponse { + sandboxId: string; +} +declare const SandboxRestoreResponse: MessageFns; +interface SandboxSnapshotFsAsyncGetRequest { + imageId: string; + timeout: number; +} +declare const SandboxSnapshotFsAsyncGetRequest: MessageFns; +interface SandboxSnapshotFsAsyncRequest { + sandboxId: string; +} +declare const SandboxSnapshotFsAsyncRequest: MessageFns; +interface SandboxSnapshotFsAsyncResponse { + imageId: string; +} +declare const SandboxSnapshotFsAsyncResponse: MessageFns; +interface SandboxSnapshotFsRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxSnapshotFsRequest: MessageFns; +interface SandboxSnapshotFsResponse { + imageId: string; + result: GenericResult | undefined; + /** Metadata may be empty since we may skip it for performance reasons. */ + imageMetadata: ImageMetadata | undefined; +} +declare const SandboxSnapshotFsResponse: MessageFns; +interface SandboxSnapshotGetRequest { + snapshotId: string; +} +declare const SandboxSnapshotGetRequest: MessageFns; +interface SandboxSnapshotGetResponse { + snapshotId: string; +} +declare const SandboxSnapshotGetResponse: MessageFns; +interface SandboxSnapshotRequest { + sandboxId: string; +} +declare const SandboxSnapshotRequest: MessageFns; +interface SandboxSnapshotResponse { + snapshotId: string; +} +declare const SandboxSnapshotResponse: MessageFns; +interface SandboxSnapshotWaitRequest { + snapshotId: string; + timeout: number; +} +declare const SandboxSnapshotWaitRequest: MessageFns; +interface SandboxSnapshotWaitResponse { + result: GenericResult | undefined; +} +declare const SandboxSnapshotWaitResponse: MessageFns; +interface SandboxStdinWriteRequest { + sandboxId: string; + input: Uint8Array; + index: number; + eof: boolean; +} +declare const SandboxStdinWriteRequest: MessageFns; +interface SandboxStdinWriteResponse { +} +declare const SandboxStdinWriteResponse: MessageFns; +interface SandboxTag { + tagName: string; + tagValue: string; +} +declare const SandboxTag: MessageFns; +interface SandboxTagsGetRequest { + sandboxId: string; +} +declare const SandboxTagsGetRequest: MessageFns; +interface SandboxTagsGetResponse { + tags: SandboxTag[]; +} +declare const SandboxTagsGetResponse: MessageFns; +interface SandboxTagsSetRequest { + environmentName: string; + sandboxId: string; + tags: SandboxTag[]; +} +declare const SandboxTagsSetRequest: MessageFns; +interface SandboxTerminateRequest { + sandboxId: string; +} +declare const SandboxTerminateRequest: MessageFns; +interface SandboxTerminateResponse { + existingResult: GenericResult | undefined; +} +declare const SandboxTerminateResponse: MessageFns; +interface SandboxWaitRequest { + sandboxId: string; + timeout: number; +} +declare const SandboxWaitRequest: MessageFns; +interface SandboxWaitResponse { + result: GenericResult | undefined; +} +declare const SandboxWaitResponse: MessageFns; +interface Schedule { + cron?: Schedule_Cron | undefined; + period?: Schedule_Period | undefined; +} +declare const Schedule: MessageFns; +interface Schedule_Cron { + cronString: string; + timezone: string; +} +declare const Schedule_Cron: MessageFns; +interface Schedule_Period { + years: number; + months: number; + weeks: number; + days: number; + hours: number; + minutes: number; + seconds: number; +} +declare const Schedule_Period: MessageFns; +/** + * TODO(irfansharif): + * - Fold in cloud, resource needs here too. + * - Allow specifying list of zones, cloud, fallback and alternative + * GPU types. + */ +interface SchedulerPlacement { + regions: string[]; + /** TODO(irfansharif): Make these two repeated. */ + Zone?: string | undefined; + /** admin-only, "on-demand" or "spot", else ignored */ + Lifecycle?: string | undefined; + /** admin-only */ + InstanceTypes: string[]; +} +declare const SchedulerPlacement: MessageFns; +interface SecretDeleteRequest { + secretId: string; +} +declare const SecretDeleteRequest: MessageFns; +interface SecretGetOrCreateRequest { + deploymentName: string; + environmentName: string; + /** Not used atm */ + objectCreationType: ObjectCreationType; + envDict: { + [key: string]: string; + }; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; + requiredKeys: string[]; +} +declare const SecretGetOrCreateRequest: MessageFns; +interface SecretGetOrCreateResponse { + secretId: string; + metadata: SecretMetadata | undefined; +} +declare const SecretGetOrCreateResponse: MessageFns; +interface SecretListItem { + label: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + lastUsedAt: number; + /** Unused by client */ + environmentName: string; + secretId: string; + metadata: SecretMetadata | undefined; +} +declare const SecretListItem: MessageFns; +interface SecretListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const SecretListRequest: MessageFns; +interface SecretListResponse { + items: SecretListItem[]; + environmentName: string; +} +declare const SecretListResponse: MessageFns; +interface SecretMetadata { + name: string; + creationInfo: CreationInfo | undefined; +} +declare const SecretMetadata: MessageFns; +interface SharedVolumeDeleteRequest { + sharedVolumeId: string; +} +declare const SharedVolumeDeleteRequest: MessageFns; +interface SharedVolumeGetFileRequest { + sharedVolumeId: string; + path: string; +} +declare const SharedVolumeGetFileRequest: MessageFns; +interface SharedVolumeGetFileResponse { + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; +} +declare const SharedVolumeGetFileResponse: MessageFns; +interface SharedVolumeGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; +} +declare const SharedVolumeGetOrCreateRequest: MessageFns; +interface SharedVolumeGetOrCreateResponse { + sharedVolumeId: string; +} +declare const SharedVolumeGetOrCreateResponse: MessageFns; +interface SharedVolumeHeartbeatRequest { + sharedVolumeId: string; +} +declare const SharedVolumeHeartbeatRequest: MessageFns; +interface SharedVolumeListFilesRequest { + sharedVolumeId: string; + path: string; +} +declare const SharedVolumeListFilesRequest: MessageFns; +interface SharedVolumeListFilesResponse { + entries: FileEntry[]; +} +declare const SharedVolumeListFilesResponse: MessageFns; +interface SharedVolumeListItem { + /** app name of object entity app */ + label: string; + sharedVolumeId: string; + createdAt: number; + cloudProvider: CloudProvider; +} +declare const SharedVolumeListItem: MessageFns; +interface SharedVolumeListRequest { + environmentName: string; +} +declare const SharedVolumeListRequest: MessageFns; +interface SharedVolumeListResponse { + items: SharedVolumeListItem[]; + environmentName: string; +} +declare const SharedVolumeListResponse: MessageFns; +interface SharedVolumeMount { + mountPath: string; + sharedVolumeId: string; + cloudProvider: CloudProvider; +} +declare const SharedVolumeMount: MessageFns; +interface SharedVolumePutFileRequest { + sharedVolumeId: string; + path: string; + sha256Hex: string; + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** remove when required client version >= 47 */ + resumable: boolean; +} +declare const SharedVolumePutFileRequest: MessageFns; +interface SharedVolumePutFileResponse { + exists: boolean; +} +declare const SharedVolumePutFileResponse: MessageFns; +interface SharedVolumeRemoveFileRequest { + sharedVolumeId: string; + path: string; + recursive: boolean; +} +declare const SharedVolumeRemoveFileRequest: MessageFns; +interface SystemErrorMessage { + errorCode: SystemErrorCode; + errorMessage: string; +} +declare const SystemErrorMessage: MessageFns; +interface TaskClusterHelloRequest { + taskId: string; + containerIp: string; +} +declare const TaskClusterHelloRequest: MessageFns; +interface TaskClusterHelloResponse { + clusterId: string; + clusterRank: number; + /** All IPv6 addresses in cluster, ordered by cluster rank */ + containerIps: string[]; + containerIpv4Ips: string[]; +} +declare const TaskClusterHelloResponse: MessageFns; +interface TaskCurrentInputsResponse { + inputIds: string[]; +} +declare const TaskCurrentInputsResponse: MessageFns; +interface TaskGetAutoscalingMetricsRequest { + taskId: string; +} +declare const TaskGetAutoscalingMetricsRequest: MessageFns; +interface TaskGetAutoscalingMetricsResponse { + metrics: AutoscalingMetrics | undefined; +} +declare const TaskGetAutoscalingMetricsResponse: MessageFns; +/** + * Used to get a JWT and URL for direct access to a task command router + * running on the modal-worker, so the client can issue exec commands (and other + * operations as they become available) directly to the worker. + */ +interface TaskGetCommandRouterAccessRequest { + taskId: string; +} +declare const TaskGetCommandRouterAccessRequest: MessageFns; +interface TaskGetCommandRouterAccessResponse { + jwt: string; + url: string; +} +declare const TaskGetCommandRouterAccessResponse: MessageFns; +interface TaskInfo { + id: string; + startedAt: number; + finishedAt: number; + result: GenericResult | undefined; + enqueuedAt: number; + gpuType: string; + sandboxId: string; + snapshotBehavior: TaskSnapshotBehavior; + gpuConfig: GPUConfig | undefined; +} +declare const TaskInfo: MessageFns; +interface TaskListRequest { + environmentName: string; +} +declare const TaskListRequest: MessageFns; +interface TaskListResponse { + tasks: TaskStats[]; +} +declare const TaskListResponse: MessageFns; +interface TaskLogs { + data: string; + taskState: TaskState; + timestamp: number; + fileDescriptor: FileDescriptor; + taskProgress: TaskProgress | undefined; + functionCallId: string; + inputId: string; + timestampNs: number; +} +declare const TaskLogs: MessageFns; +interface TaskLogsBatch { + taskId: string; + items: TaskLogs[]; + entryId: string; + appDone: boolean; + functionId: string; + inputId: string; + /** Used for image logs */ + imageId: string; + eof: boolean; + /** Used for interactive functions */ + ptyExecId: string; + rootFunctionId: string; + ttlDays: number; +} +declare const TaskLogsBatch: MessageFns; +interface TaskProgress { + len: number; + pos: number; + progressType: ProgressType; + description: string; +} +declare const TaskProgress: MessageFns; +interface TaskResultRequest { + result: GenericResult | undefined; +} +declare const TaskResultRequest: MessageFns; +interface TaskStats { + taskId: string; + appId: string; + appDescription: string; + startedAt: number; +} +declare const TaskStats: MessageFns; +interface TaskTemplate { + rank: number; + resources: Resources | undefined; + targetConcurrentInputs: number; + maxConcurrentInputs: number; + /** + * TODO(irfansharif): Just move this into a column in the task table instead? + * Deprecate all above fields and get rid of this message altogether + */ + index: number; +} +declare const TaskTemplate: MessageFns; +interface TokenFlowCreateRequest { + utmSource: string; + localhostPort: number; + nextUrl: string; +} +declare const TokenFlowCreateRequest: MessageFns; +interface TokenFlowCreateResponse { + tokenFlowId: string; + webUrl: string; + code: string; + waitSecret: string; +} +declare const TokenFlowCreateResponse: MessageFns; +interface TokenFlowWaitRequest { + timeout: number; + tokenFlowId: string; + waitSecret: string; +} +declare const TokenFlowWaitRequest: MessageFns; +interface TokenFlowWaitResponse { + tokenId: string; + tokenSecret: string; + timeout: boolean; + workspaceUsername: string; +} +declare const TokenFlowWaitResponse: MessageFns; +interface TunnelData { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; + containerPort: number; +} +declare const TunnelData: MessageFns; +interface TunnelStartRequest { + port: number; + unencrypted: boolean; + tunnelType?: TunnelType | undefined; +} +declare const TunnelStartRequest: MessageFns; +interface TunnelStartResponse { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; +} +declare const TunnelStartResponse: MessageFns; +interface TunnelStopRequest { + port: number; +} +declare const TunnelStopRequest: MessageFns; +interface TunnelStopResponse { + exists: boolean; +} +declare const TunnelStopResponse: MessageFns; +interface UploadUrlList { + items: string[]; +} +declare const UploadUrlList: MessageFns; +interface VolumeCommitRequest { + /** + * NOTE(staffan): Mounting a volume in multiple locations is not supported, so volume_id alone uniquely identifies + * a volume mount. + */ + volumeId: string; +} +declare const VolumeCommitRequest: MessageFns; +interface VolumeCommitResponse { + skipReload: boolean; +} +declare const VolumeCommitResponse: MessageFns; +interface VolumeCopyFiles2Request { + volumeId: string; + srcPaths: string[]; + dstPath: string; + recursive: boolean; +} +declare const VolumeCopyFiles2Request: MessageFns; +interface VolumeCopyFilesRequest { + volumeId: string; + srcPaths: string[]; + dstPath: string; + recursive: boolean; +} +declare const VolumeCopyFilesRequest: MessageFns; +interface VolumeDeleteRequest { + volumeId: string; + /** @deprecated */ + environmentName: string; +} +declare const VolumeDeleteRequest: MessageFns; +interface VolumeGetFile2Request { + volumeId: string; + path: string; + start: number; + /** 0 is interpreted as 'read to end' */ + len: number; +} +declare const VolumeGetFile2Request: MessageFns; +interface VolumeGetFile2Response { + getUrls: string[]; + /** total file size */ + size: number; + /** file position of first byte returned */ + start: number; + /** number of bytes returned */ + len: number; +} +declare const VolumeGetFile2Response: MessageFns; +interface VolumeGetFileRequest { + volumeId: string; + path: string; + start: number; + /** 0 is interpreted as 'read to end' */ + len: number; +} +declare const VolumeGetFileRequest: MessageFns; +interface VolumeGetFileResponse { + data?: Uint8Array | undefined; + dataBlobId?: string | undefined; + /** total file size */ + size: number; + /** file position of first byte returned */ + start: number; + /** number of bytes returned */ + len: number; +} +declare const VolumeGetFileResponse: MessageFns; +interface VolumeGetOrCreateRequest { + deploymentName: string; + environmentName: string; + objectCreationType: ObjectCreationType; + /** only used with OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */ + appId: string; + version: VolumeFsVersion; +} +declare const VolumeGetOrCreateRequest: MessageFns; +interface VolumeGetOrCreateResponse { + volumeId: string; + /** Not used directly; version is part of the metadata */ + version: VolumeFsVersion; + metadata: VolumeMetadata | undefined; +} +declare const VolumeGetOrCreateResponse: MessageFns; +interface VolumeHeartbeatRequest { + volumeId: string; +} +declare const VolumeHeartbeatRequest: MessageFns; +interface VolumeListFiles2Request { + volumeId: string; + path: string; + recursive: boolean; + maxEntries?: number | undefined; +} +declare const VolumeListFiles2Request: MessageFns; +interface VolumeListFiles2Response { + entries: FileEntry[]; +} +declare const VolumeListFiles2Response: MessageFns; +interface VolumeListFilesRequest { + volumeId: string; + path: string; + recursive: boolean; + maxEntries?: number | undefined; +} +declare const VolumeListFilesRequest: MessageFns; +interface VolumeListFilesResponse { + entries: FileEntry[]; +} +declare const VolumeListFilesResponse: MessageFns; +interface VolumeListItem { + /** app name of object entity app */ + label: string; + volumeId: string; + /** Superseded by metadata, used by clients up to 1.1.2 */ + createdAt: number; + metadata: VolumeMetadata | undefined; +} +declare const VolumeListItem: MessageFns; +interface VolumeListRequest { + environmentName: string; + pagination: ListPagination | undefined; +} +declare const VolumeListRequest: MessageFns; +interface VolumeListResponse { + items: VolumeListItem[]; + environmentName: string; +} +declare const VolumeListResponse: MessageFns; +interface VolumeMetadata { + version: VolumeFsVersion; + name: string; + creationInfo: CreationInfo | undefined; +} +declare const VolumeMetadata: MessageFns; +interface VolumeMount { + volumeId: string; + mountPath: string; + allowBackgroundCommits: boolean; + readOnly: boolean; +} +declare const VolumeMount: MessageFns; +interface VolumePutFiles2Request { + /** The ID of the volume to put/upload files into. */ + volumeId: string; + /** List of files to put/upload. */ + files: VolumePutFiles2Request_File[]; + /** + * If set to true, prevent overwriting existing files. (Note that we don't + * allow overwriting existing directories with uploaded files regardless.) + */ + disallowOverwriteExistingFiles: boolean; +} +declare const VolumePutFiles2Request: MessageFns; +interface VolumePutFiles2Request_File { + /** + * Destination path of the file to be uploaded, including any parent dirs + * etc.; for example "foo/bar/baz.txt" + */ + path: string; + /** The total size of the file, in bytes. */ + size: number; + /** The blocks, in units of 8MiB, that this file consists of. */ + blocks: VolumePutFiles2Request_Block[]; + /** Unix file permission bits `st_mode`. */ + mode?: number | undefined; +} +declare const VolumePutFiles2Request_File: MessageFns; +interface VolumePutFiles2Request_Block { + /** + * The SHA256 digest of the contents of this block, in raw (ie. 32 bytes) + * form for compactness. + */ + contentsSha256: Uint8Array; + /** + * From a previous call to `VolumePutFiles2`, we might have gotten a + * response indicating that this block was missing. + * + * For such a block, this field contains the raw bytes of the body that + * was returned from the HTTP PUT request when the client made a request + * for the `put_url` returned in the previous `VolumePutFiles2Response`. + */ + putResponse?: Uint8Array | undefined; +} +declare const VolumePutFiles2Request_Block: MessageFns; +interface VolumePutFiles2Response { + /** + * Blocks that are currently missing in the volume, because the file did not + * exist, or because the block checksum from `blocks_sha256` in the request + * did not match the current contents of the file. + * + * Values will be returned sorted by `(file_index, block_index)`. + * + * If this field is empty, it means that the files were uploaded successfully + * and/or that the request was an idempotent no-op. + */ + missingBlocks: VolumePutFiles2Response_MissingBlock[]; +} +declare const VolumePutFiles2Response: MessageFns; +interface VolumePutFiles2Response_MissingBlock { + /** Index of the file in the original `files` field of the request. */ + fileIndex: number; + /** + * The index of the block in the original `files[file_index].blocks` of the + * request. + */ + blockIndex: number; + /** + * Make a HTTP PUT request to this endpoint with the blocks' contents as + * the body. + */ + putUrl: string; +} +declare const VolumePutFiles2Response_MissingBlock: MessageFns; +interface VolumePutFilesRequest { + volumeId: string; + /** TODO(staffan): This is obviously unfortunately named, but provides what we need - consider renaming. */ + files: MountFile[]; + /** + * If set to true, prevent overwriting existing files. (Note that we don't allow overwriting + * existing directories with uploaded files regardless.) + */ + disallowOverwriteExistingFiles: boolean; +} +declare const VolumePutFilesRequest: MessageFns; +interface VolumeReloadRequest { + /** + * NOTE(staffan): Mounting a volume in multiple locations is not supported, so volume_id alone uniquely identifies + * a volume mount. + */ + volumeId: string; +} +declare const VolumeReloadRequest: MessageFns; +interface VolumeRemoveFile2Request { + volumeId: string; + path: string; + recursive: boolean; +} +declare const VolumeRemoveFile2Request: MessageFns; +interface VolumeRemoveFileRequest { + volumeId: string; + path: string; + recursive: boolean; +} +declare const VolumeRemoveFileRequest: MessageFns; +interface VolumeRenameRequest { + volumeId: string; + name: string; +} +declare const VolumeRenameRequest: MessageFns; +interface Warning { + type: Warning_WarningType; + message: string; +} +declare const Warning: MessageFns; +interface WebUrlInfo { + truncated: boolean; + /** @deprecated */ + hasUniqueHash: boolean; + labelStolen: boolean; +} +declare const WebUrlInfo: MessageFns; +interface WebhookConfig { + type: WebhookType; + method: string; + requestedSuffix: string; + asyncMode: WebhookAsyncMode; + customDomains: CustomDomainConfig[]; + webServerPort: number; + webServerStartupTimeout: number; + webEndpointDocs: boolean; + requiresProxyAuth: boolean; +} +declare const WebhookConfig: MessageFns; +interface WorkspaceBillingReportItem { + objectId: string; + description: string; + environmentName: string; + interval: Date | undefined; + cost: string; + tags: { + [key: string]: string; + }; +} +declare const WorkspaceBillingReportItem: MessageFns; +interface WorkspaceBillingReportRequest { + /** Workspace ID will be implicit in the request metadata */ + startTimestamp: Date | undefined; + endTimestamp: Date | undefined; + /** e.g. 'd' or 'h'; server defines what we accept */ + resolution: string; + tagNames: string[]; +} +declare const WorkspaceBillingReportRequest: MessageFns; +interface WorkspaceNameLookupResponse { + /** @deprecated */ + workspaceName: string; + username: string; +} +declare const WorkspaceNameLookupResponse: MessageFns; +type ModalClientDefinition = typeof ModalClientDefinition; +declare const ModalClientDefinition: { + readonly name: "ModalClient"; + readonly fullName: "modal.client.ModalClient"; + readonly methods: { + /** Apps */ + readonly appClientDisconnect: { + readonly name: "AppClientDisconnect"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appCreate: { + readonly name: "AppCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appDeploy: { + readonly name: "AppDeploy"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appDeploymentHistory: { + readonly name: "AppDeploymentHistory"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetByDeploymentName: { + readonly name: "AppGetByDeploymentName"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetLayout: { + readonly name: "AppGetLayout"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetLogs: { + readonly name: "AppGetLogs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly appGetObjects: { + readonly name: "AppGetObjects"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetOrCreate: { + readonly name: "AppGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appGetTags: { + readonly name: "AppGetTags"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appHeartbeat: { + readonly name: "AppHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appList: { + readonly name: "AppList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appLookup: { + readonly name: "AppLookup"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appPublish: { + readonly name: "AppPublish"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly appRollback: { + readonly name: "AppRollback"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appSetObjects: { + readonly name: "AppSetObjects"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appSetTags: { + readonly name: "AppSetTags"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly appStop: { + readonly name: "AppStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Input Plane */ + readonly attemptAwait: { + readonly name: "AttemptAwait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly attemptRetry: { + readonly name: "AttemptRetry"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly attemptStart: { + readonly name: "AttemptStart"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Auth Token */ + readonly authTokenGet: { + readonly name: "AuthTokenGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Blobs */ + readonly blobCreate: { + readonly name: "BlobCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly blobGet: { + readonly name: "BlobGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Classes */ + readonly classCreate: { + readonly name: "ClassCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly classGet: { + readonly name: "ClassGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Clients */ + readonly clientHello: { + readonly name: "ClientHello"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Clusters */ + readonly clusterGet: { + readonly name: "ClusterGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly clusterList: { + readonly name: "ClusterList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Container */ + readonly containerCheckpoint: { + readonly name: "ContainerCheckpoint"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExec: { + readonly name: "ContainerExec"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExecGetOutput: { + readonly name: "ContainerExecGetOutput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly containerExecPutInput: { + readonly name: "ContainerExecPutInput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerExecWait: { + readonly name: "ContainerExecWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerFilesystemExec: { + readonly name: "ContainerFilesystemExec"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerFilesystemExecGetOutput: { + readonly name: "ContainerFilesystemExecGetOutput"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly containerHeartbeat: { + readonly name: "ContainerHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerHello: { + readonly name: "ContainerHello"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerLog: { + readonly name: "ContainerLog"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerReloadVolumes: { + readonly name: "ContainerReloadVolumes"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly containerStop: { + readonly name: "ContainerStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Dicts */ + readonly dictClear: { + readonly name: "DictClear"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictContains: { + readonly name: "DictContains"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictContents: { + readonly name: "DictContents"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly dictDelete: { + readonly name: "DictDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictGet: { + readonly name: "DictGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictGetOrCreate: { + readonly name: "DictGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictHeartbeat: { + readonly name: "DictHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictLen: { + readonly name: "DictLen"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictList: { + readonly name: "DictList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictPop: { + readonly name: "DictPop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly dictUpdate: { + readonly name: "DictUpdate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Domains */ + readonly domainCertificateVerify: { + readonly name: "DomainCertificateVerify"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly domainCreate: { + readonly name: "DomainCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly domainList: { + readonly name: "DomainList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Environments */ + readonly environmentCreate: { + readonly name: "EnvironmentCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentDelete: { + readonly name: "EnvironmentDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentGetOrCreate: { + readonly name: "EnvironmentGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentList: { + readonly name: "EnvironmentList"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly environmentUpdate: { + readonly name: "EnvironmentUpdate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Modal Flash (experimental) */ + readonly flashContainerDeregister: { + readonly name: "FlashContainerDeregister"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashContainerList: { + readonly name: "FlashContainerList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashContainerRegister: { + readonly name: "FlashContainerRegister"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly flashSetTargetSlotsMetrics: { + readonly name: "FlashSetTargetSlotsMetrics"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Functions */ + readonly functionAsyncInvoke: { + readonly name: "FunctionAsyncInvoke"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionBindParams: { + readonly name: "FunctionBindParams"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallCancel: { + readonly name: "FunctionCallCancel"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallFromId: { + readonly name: "FunctionCallFromId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallGetDataIn: { + readonly name: "FunctionCallGetDataIn"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly functionCallGetDataOut: { + readonly name: "FunctionCallGetDataOut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly functionCallList: { + readonly name: "FunctionCallList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCallPutDataOut: { + readonly name: "FunctionCallPutDataOut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionCreate: { + readonly name: "FunctionCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For map RPCs, to signal that all inputs have been sent */ + readonly functionFinishInputs: { + readonly name: "FunctionFinishInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGet: { + readonly name: "FunctionGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetCallGraph: { + readonly name: "FunctionGetCallGraph"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetCurrentStats: { + readonly name: "FunctionGetCurrentStats"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetDynamicConcurrency: { + readonly name: "FunctionGetDynamicConcurrency"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For containers to request next call */ + readonly functionGetInputs: { + readonly name: "FunctionGetInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Returns the next result(s) for an entire function call (FunctionMap) */ + readonly functionGetOutputs: { + readonly name: "FunctionGetOutputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionGetSerialized: { + readonly name: "FunctionGetSerialized"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionMap: { + readonly name: "FunctionMap"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionPrecreate: { + readonly name: "FunctionPrecreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionPutInputs: { + readonly name: "FunctionPutInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** For containers to return result */ + readonly functionPutOutputs: { + readonly name: "FunctionPutOutputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionRetryInputs: { + readonly name: "FunctionRetryInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionStartPtyShell: { + readonly name: "FunctionStartPtyShell"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly functionUpdateSchedulingParams: { + readonly name: "FunctionUpdateSchedulingParams"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Images */ + readonly imageDelete: { + readonly name: "ImageDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageFromId: { + readonly name: "ImageFromId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageGetOrCreate: { + readonly name: "ImageGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly imageJoinStreaming: { + readonly name: "ImageJoinStreaming"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + /** Input Plane Map */ + readonly mapAwait: { + readonly name: "MapAwait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mapCheckInputs: { + readonly name: "MapCheckInputs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mapStartOrContinue: { + readonly name: "MapStartOrContinue"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Mounts */ + readonly mountGetOrCreate: { + readonly name: "MountGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly mountPutFile: { + readonly name: "MountPutFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Notebooks */ + readonly notebookKernelPublishResults: { + readonly name: "NotebookKernelPublishResults"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Proxies */ + readonly proxyAddIp: { + readonly name: "ProxyAddIp"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyCreate: { + readonly name: "ProxyCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyDelete: { + readonly name: "ProxyDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyGet: { + readonly name: "ProxyGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyGetOrCreate: { + readonly name: "ProxyGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyList: { + readonly name: "ProxyList"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly proxyRemoveIp: { + readonly name: "ProxyRemoveIp"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Queues */ + readonly queueClear: { + readonly name: "QueueClear"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueDelete: { + readonly name: "QueueDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueGet: { + readonly name: "QueueGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueGetOrCreate: { + readonly name: "QueueGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueHeartbeat: { + readonly name: "QueueHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueLen: { + readonly name: "QueueLen"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueList: { + readonly name: "QueueList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queueNextItems: { + readonly name: "QueueNextItems"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly queuePut: { + readonly name: "QueuePut"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Sandboxes */ + readonly sandboxCreate: { + readonly name: "SandboxCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxCreateConnectToken: { + readonly name: "SandboxCreateConnectToken"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetCommandRouterAccess: { + readonly name: "SandboxGetCommandRouterAccess"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetFromName: { + readonly name: "SandboxGetFromName"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetLogs: { + readonly name: "SandboxGetLogs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly sandboxGetResourceUsage: { + readonly name: "SandboxGetResourceUsage"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** needed for modal container exec */ + readonly sandboxGetTaskId: { + readonly name: "SandboxGetTaskId"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxGetTunnels: { + readonly name: "SandboxGetTunnels"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxList: { + readonly name: "SandboxList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxRestore: { + readonly name: "SandboxRestore"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshot: { + readonly name: "SandboxSnapshot"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFs: { + readonly name: "SandboxSnapshotFs"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFsAsync: { + readonly name: "SandboxSnapshotFsAsync"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotFsAsyncGet: { + readonly name: "SandboxSnapshotFsAsyncGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotGet: { + readonly name: "SandboxSnapshotGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxSnapshotWait: { + readonly name: "SandboxSnapshotWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxStdinWrite: { + readonly name: "SandboxStdinWrite"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTagsGet: { + readonly name: "SandboxTagsGet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTagsSet: { + readonly name: "SandboxTagsSet"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxTerminate: { + readonly name: "SandboxTerminate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sandboxWait: { + readonly name: "SandboxWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Secrets */ + readonly secretDelete: { + readonly name: "SecretDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly secretGetOrCreate: { + readonly name: "SecretGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly secretList: { + readonly name: "SecretList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** SharedVolumes */ + readonly sharedVolumeDelete: { + readonly name: "SharedVolumeDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeGetFile: { + readonly name: "SharedVolumeGetFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeGetOrCreate: { + readonly name: "SharedVolumeGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeHeartbeat: { + readonly name: "SharedVolumeHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeList: { + readonly name: "SharedVolumeList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeListFiles: { + readonly name: "SharedVolumeListFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeListFilesStream: { + readonly name: "SharedVolumeListFilesStream"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly sharedVolumePutFile: { + readonly name: "SharedVolumePutFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly sharedVolumeRemoveFile: { + readonly name: "SharedVolumeRemoveFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Tasks */ + readonly taskClusterHello: { + readonly name: "TaskClusterHello"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskCurrentInputs: { + readonly name: "TaskCurrentInputs"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Used for flash autoscaling */ + readonly taskGetAutoscalingMetrics: { + readonly name: "TaskGetAutoscalingMetrics"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskGetCommandRouterAccess: { + readonly name: "TaskGetCommandRouterAccess"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskList: { + readonly name: "TaskList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly taskResult: { + readonly name: "TaskResult"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Tokens (web auth flow) */ + readonly tokenFlowCreate: { + readonly name: "TokenFlowCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly tokenFlowWait: { + readonly name: "TokenFlowWait"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Tunnels */ + readonly tunnelStart: { + readonly name: "TunnelStart"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly tunnelStop: { + readonly name: "TunnelStop"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + /** Volumes */ + readonly volumeCommit: { + readonly name: "VolumeCommit"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeCopyFiles: { + readonly name: "VolumeCopyFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeCopyFiles2: { + readonly name: "VolumeCopyFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeDelete: { + readonly name: "VolumeDelete"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetFile: { + readonly name: "VolumeGetFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetFile2: { + readonly name: "VolumeGetFile2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeGetOrCreate: { + readonly name: "VolumeGetOrCreate"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeHeartbeat: { + readonly name: "VolumeHeartbeat"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeList: { + readonly name: "VolumeList"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeListFiles: { + readonly name: "VolumeListFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly volumeListFiles2: { + readonly name: "VolumeListFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly volumePutFiles: { + readonly name: "VolumePutFiles"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumePutFiles2: { + readonly name: "VolumePutFiles2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeReload: { + readonly name: "VolumeReload"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRemoveFile: { + readonly name: "VolumeRemoveFile"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRemoveFile2: { + readonly name: "VolumeRemoveFile2"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + readonly volumeRename: { + readonly name: "VolumeRename"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns$1; + readonly responseStream: false; + readonly options: {}; + }; + /** Workspaces */ + readonly workspaceBillingReport: { + readonly name: "WorkspaceBillingReport"; + readonly requestType: MessageFns; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: true; + readonly options: {}; + }; + readonly workspaceNameLookup: { + readonly name: "WorkspaceNameLookup"; + readonly requestType: MessageFns$1; + readonly requestStream: false; + readonly responseType: MessageFns; + readonly responseStream: false; + readonly options: {}; + }; + }; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} + +/** Optional parameters for {@link SecretService#fromName client.secrets.fromName()}. */ +type SecretFromNameParams = { + environment?: string; + requiredKeys?: string[]; +}; +/** Optional parameters for {@link SecretService#fromObject client.secrets.fromObject()}. */ +type SecretFromObjectParams = { + environment?: string; +}; +/** Optional parameters for {@link SecretService#delete client.secrets.delete()}. */ +type SecretDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** + * Service for managing {@link Secret Secrets}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const secret = await modal.secrets.fromName("my-secret"); + * ``` + */ +declare class SecretService { + #private; + constructor(client: ModalClient); + /** Reference a {@link Secret} by its name. */ + fromName(name: string, params?: SecretFromNameParams): Promise; + /** Create a {@link Secret} from a plain object of key-value pairs. */ + fromObject(entries: Record, params?: SecretFromObjectParams): Promise; + /** + * Delete a named {@link Secret}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Secret. + */ + delete(name: string, params?: SecretDeleteParams): Promise; +} +/** Secrets provide a dictionary of environment variables for {@link Image}s. */ +declare class Secret { + readonly secretId: string; + readonly name?: string; + /** @ignore */ + constructor(secretId: string, name?: string); + /** + * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead. + */ + static fromName(name: string, params?: SecretFromNameParams): Promise; + /** + * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead. + */ + static fromObject(entries: Record, params?: SecretFromObjectParams): Promise; +} + +declare class CloudBucketMountService { + #private; + constructor(client: ModalClient); + create(bucketName: string, params?: { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }): CloudBucketMount; +} +/** Cloud Bucket Mounts provide access to cloud storage buckets within Modal Functions. */ +declare class CloudBucketMount { + #private; + readonly bucketName: string; + readonly secret?: Secret; + readonly readOnly: boolean; + readonly requesterPays: boolean; + readonly bucketEndpointUrl?: string; + readonly keyPrefix?: string; + readonly oidcAuthRoleArn?: string; + /** + * @deprecated Use {@link CloudBucketMountService#create client.cloudBucketMounts.create()} instead. + */ + constructor(bucketName: string, params?: { + secret?: Secret; + readOnly?: boolean; + requesterPays?: boolean; + bucketEndpointUrl?: string; + keyPrefix?: string; + oidcAuthRoleArn?: string; + }); + /** @ignore */ + constructor(bucketName: string, secret: Secret | undefined, readOnly: boolean, requesterPays: boolean, bucketEndpointUrl: string | undefined, keyPrefix: string | undefined, oidcAuthRoleArn: string | undefined, bucketType: CloudBucketMount_BucketType); + /** @ignore */ + toProto(mountPath: string): CloudBucketMount$1; +} + +/** + * Service for managing {@link FunctionCall}s. + * + * Normally only ever accessed via the client as: + * + * ```typescript + * const modal = new ModalClient(); + * const functionCall = await modal.functionCalls.fromId("123"); + * ``` + */ +declare class FunctionCallService { + #private; + constructor(client: ModalClient); + /** + * Create a new {@link FunctionCall} from ID. + */ + fromId(functionCallId: string): Promise; +} +/** Optional parameters for {@link FunctionCall#get FunctionCall.get()}. */ +type FunctionCallGetParams = { + timeoutMs?: number; +}; +/** Optional parameters for {@link FunctionCall#cancel FunctionCall.cancel()}. */ +type FunctionCallCancelParams = { + terminateContainers?: boolean; +}; +/** + * Represents a Modal FunctionCall. FunctionCalls are {@link Function_ Function} invocations with + * a given input. They can be consumed asynchronously (see {@link FunctionCall#get FunctionCall.get()}) or cancelled + * (see {@link FunctionCall#cancel FunctionCall.cancel()}). + */ +declare class FunctionCall { + #private; + readonly functionCallId: string; + /** @ignore */ + constructor(client: ModalClient | undefined, functionCallId: string); + /** + * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead. + */ + static fromId(functionCallId: string): FunctionCall; + /** Get the result of a FunctionCall, optionally waiting with a timeout. */ + get(params?: FunctionCallGetParams): Promise; + /** Cancel a running FunctionCall. */ + cancel(params?: FunctionCallCancelParams): Promise; +} + +/** Optional parameters for `client.functions.fromName()`. */ +type FunctionFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** + * Service for managing {@link Function_ Function}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const function = await modal.functions.fromName("my-app", "my-function"); + * ``` + */ +declare class FunctionService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Function_ Function} by its name in an App. + */ + fromName(appName: string, name: string, params?: FunctionFromNameParams): Promise; +} +/** Simple data structure storing stats for a running {@link Function_ Function}. */ +interface FunctionStats { + backlog: number; + numTotalRunners: number; +} +/** Optional parameters for {@link Function_#updateAutoscaler Function_.updateAutoscaler()}. */ +interface FunctionUpdateAutoscalerParams { + minContainers?: number; + maxContainers?: number; + bufferContainers?: number; + scaledownWindowMs?: number; +} +/** Represents a deployed Modal Function, which can be invoked remotely. */ +declare class Function_ { + #private; + readonly functionId: string; + readonly methodName?: string; + /** @ignore */ + constructor(client: ModalClient, functionId: string, methodName?: string, functionHandleMetadata?: FunctionHandleMetadata); + /** + * @deprecated Use `client.functions.fromName()` instead. + */ + static lookup(appName: string, name: string, params?: FunctionFromNameParams): Promise; + remote(args?: any[], kwargs?: Record): Promise; + spawn(args?: any[], kwargs?: Record): Promise; + getCurrentStats(): Promise; + updateAutoscaler(params: FunctionUpdateAutoscalerParams): Promise; + /** + * URL of a Function running as a web endpoint. + * @returns The web URL if this Function is a web endpoint, otherwise undefined + */ + getWebUrl(): Promise; +} + +/** Retry policy configuration for a Modal Function/Cls. */ +declare class Retries { + readonly maxRetries: number; + readonly backoffCoefficient: number; + readonly initialDelayMs: number; + readonly maxDelayMs: number; + constructor(params: { + maxRetries: number; + backoffCoefficient?: number; + initialDelayMs?: number; + maxDelayMs?: number; + }); +} + +type HeartbeatFunction = () => Promise; +declare class EphemeralHeartbeatManager { + private readonly heartbeatFn; + private readonly abortController; + constructor(heartbeatFn: HeartbeatFunction); + private start; + stop(): void; +} + +/** Optional parameters for {@link VolumeService#fromName client.volumes.fromName()}. */ +type VolumeFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** Optional parameters for {@link VolumeService#ephemeral client.volumes.ephemeral()}. */ +type VolumeEphemeralParams = { + environment?: string; +}; +/** Optional parameters for {@link VolumeService#delete client.volumes.delete()}. */ +type VolumeDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** + * Service for managing {@link Volume}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const volume = await modal.volumes.fromName("my-volume"); + * ``` + */ +declare class VolumeService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Volume} by its name. + */ + fromName(name: string, params?: VolumeFromNameParams): Promise; + /** + * Create a nameless, temporary {@link Volume}. + * It persists until closeEphemeral() is called, or the process exits. + */ + ephemeral(params?: VolumeEphemeralParams): Promise; + /** + * Delete a named {@link Volume}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Volume. + */ + delete(name: string, params?: VolumeDeleteParams): Promise; +} +/** Volumes provide persistent storage that can be mounted in Modal {@link Function_ Function}s. */ +declare class Volume { + #private; + readonly volumeId: string; + readonly name?: string; + private _readOnly; + /** @ignore */ + constructor(volumeId: string, name?: string, readOnly?: boolean, ephemeralHbManager?: EphemeralHeartbeatManager); + /** + * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead. + */ + static fromName(name: string, options?: VolumeFromNameParams): Promise; + /** Configure Volume to mount as read-only. */ + readOnly(): Volume; + get isReadOnly(): boolean; + /** + * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead. + */ + static ephemeral(options?: VolumeEphemeralParams): Promise; + /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */ + closeEphemeral(): void; +} + +/** Optional parameters for {@link ClsService#fromName client.cls.fromName()}. */ +type ClsFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** + * Service for managing {@link Cls}. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const cls = await modal.cls.fromName("my-app", "MyCls"); + * ``` + */ +declare class ClsService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Cls} from a deployed {@link App} by its name. + */ + fromName(appName: string, name: string, params?: ClsFromNameParams): Promise; +} +type ClsWithOptionsParams = { + cpu?: number; + cpuLimit?: number; + memoryMiB?: number; + memoryLimitMiB?: number; + gpu?: string; + env?: Record; + secrets?: Secret[]; + volumes?: Record; + retries?: number | Retries; + maxContainers?: number; + bufferContainers?: number; + scaledownWindowMs?: number; + timeoutMs?: number; +}; +type ClsWithConcurrencyParams = { + maxInputs: number; + targetInputs?: number; +}; +type ClsWithBatchingParams = { + maxBatchSize: number; + waitMs: number; +}; +type ServiceOptions = ClsWithOptionsParams & { + maxConcurrentInputs?: number; + targetConcurrentInputs?: number; + batchMaxSize?: number; + batchWaitMs?: number; +}; +/** Represents a deployed Modal Cls. */ +declare class Cls { + #private; + /** @ignore */ + constructor(client: ModalClient, serviceFunctionId: string, serviceFunctionMetadata: FunctionHandleMetadata, options?: ServiceOptions); + /** + * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead. + */ + static lookup(appName: string, name: string, params?: ClsFromNameParams): Promise; + /** Create a new instance of the Cls with parameters and/or runtime options. */ + instance(parameters?: Record): Promise; + /** Override the static Function configuration at runtime. */ + withOptions(options: ClsWithOptionsParams): Cls; + /** Create an instance of the Cls with input concurrency enabled or overridden with new values. */ + withConcurrency(params: ClsWithConcurrencyParams): Cls; + /** Create an instance of the Cls with dynamic batching enabled or overridden with new values. */ + withBatching(params: ClsWithBatchingParams): Cls; +} +/** Represents an instance of a deployed Modal {@link Cls}, optionally with parameters. */ +declare class ClsInstance { + #private; + constructor(methods: Map); + method(name: string): Function_; +} + +/** + * Service for managing {@link Image}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const image = await modal.images.fromRegistry("alpine"); + * ``` + */ +declare class ImageService { + #private; + constructor(client: ModalClient); + /** + * Creates an {@link Image} from an Image ID + * + * @param imageId - Image ID. + */ + fromId(imageId: string): Promise; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - Optional. A Secret containing credentials for registry authentication. + */ + fromRegistry(tag: string, secret?: Secret): Image; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromAwsEcr(tag: string, secret: Secret): Image; + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromGcpArtifactRegistry(tag: string, secret: Secret): Image; + /** + * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. + */ + delete(imageId: string, _?: ImageDeleteParams): Promise; +} +/** Optional parameters for {@link ImageService#delete client.images.delete()}. */ +type ImageDeleteParams = Record; +/** Optional parameters for {@link Image#dockerfileCommands Image.dockerfileCommands()}. */ +type ImageDockerfileCommandsParams = { + /** Environment variables to set in the build environment. */ + env?: Record; + /** {@link Secret}s that will be made available as environment variables to this layer's build environment. */ + secrets?: Secret[]; + /** GPU reservation for this layer's build environment (e.g. "A100", "T4:2", "A100-80GB:4"). */ + gpu?: string; + /** Ignore cached builds for this layer, similar to 'docker build --no-cache'. */ + forceBuild?: boolean; +}; +/** Represents a single image layer with its build configuration. */ +type Layer = { + commands: string[]; + env?: Record; + secrets?: Secret[]; + gpuConfig?: GPUConfig; + forceBuild?: boolean; +}; +/** A container image, used for starting {@link Sandbox}es. */ +declare class Image { + #private; + /** @ignore */ + constructor(client: ModalClient, imageId: string, tag: string, imageRegistryConfig?: ImageRegistryConfig, layers?: Layer[]); + get imageId(): string; + /** + * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead. + */ + static fromId(imageId: string): Promise; + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + static fromRegistry(tag: string, secret?: Secret): Image; + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + static fromAwsEcr(tag: string, secret: Secret): Image; + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + static fromGcpArtifactRegistry(tag: string, secret: Secret): Image; + private static validateDockerfileCommands; + /** + * Extend an image with arbitrary Dockerfile-like commands. + * + * Each call creates a new Image layer that will be built sequentially. + * The provided options apply only to this layer. + * + * @param commands - Array of Dockerfile commands as strings + * @param params - Optional configuration for this layer's build + * @returns A new Image instance + */ + dockerfileCommands(commands: string[], params?: ImageDockerfileCommandsParams): Image; + /** + * Eagerly builds an Image on Modal. + * + * @param app - App to use to build the Image. + */ + build(app: App): Promise; + /** + * @deprecated Use {@link ImageService#delete client.images.delete()} instead. + */ + static delete(imageId: string, _?: ImageDeleteParams): Promise; +} + +/** + * Service for managing {@link Proxy Proxies}. + */ +declare class ProxyService { + #private; + constructor(client: ModalClient); + /** + * Reference a {@link Proxy} by its name. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const proxy = await modal.proxies.fromName("my-proxy"); + * ``` + */ + fromName(name: string, params?: ProxyFromNameParams): Promise; +} +/** Optional parameters for {@link ProxyService#fromName client.proxies.fromName()}. */ +type ProxyFromNameParams = { + environment?: string; +}; +/** Proxy objects give your Modal containers a static outbound IP address. */ +declare class Proxy { + readonly proxyId: string; + /** @ignore */ + constructor(proxyId: string); + /** + * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead. + */ + static fromName(name: string, params?: ProxyFromNameParams): Promise; +} + +/** Optional parameters for {@link QueueService#fromName client.queues.fromName()}. */ +type QueueFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** Optional parameters for {@link QueueService#delete client.queues.delete()}. */ +type QueueDeleteParams = { + environment?: string; + allowMissing?: boolean; +}; +/** Optional parameters for {@link QueueService#ephemeral client.queues.ephemeral()}. */ +type QueueEphemeralParams = { + environment?: string; +}; +/** + * Service for managing {@link Queue}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const queue = await modal.queues.fromName("my-queue"); + * ``` + */ +declare class QueueService { + #private; + constructor(client: ModalClient); + /** + * Create a nameless, temporary {@link Queue}. + * You will need to call {@link Queue#closeEphemeral Queue.closeEphemeral()} to delete the Queue. + */ + ephemeral(params?: QueueEphemeralParams): Promise; + /** + * Reference a {@link Queue} by name. + */ + fromName(name: string, params?: QueueFromNameParams): Promise; + /** + * Delete a {@link Queue} by name. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Queue. + */ + delete(name: string, params?: QueueDeleteParams): Promise; +} +/** Optional parameters for {@link Queue#clear Queue.clear()}. */ +type QueueClearParams = { + /** Partition to clear, uses default partition if not set. */ + partition?: string; + /** Set to clear all Queue partitions. */ + all?: boolean; +}; +/** Optional parameters for {@link Queue#get Queue.get()}. */ +type QueueGetParams = { + /** How long to wait if the Queue is empty in milliseconds (default: indefinite). */ + timeoutMs?: number; + /** Partition to fetch values from, uses default partition if not set. */ + partition?: string; +}; +/** Optional parameters for {@link Queue#getMany Queue.getMany()}. */ +type QueueGetManyParams = QueueGetParams; +/** Optional parameters for {@link Queue#put Queue.put()}. */ +type QueuePutParams = { + /** How long to wait if the Queue is full in milliseconds (default: indefinite). */ + timeoutMs?: number; + /** Partition to add items to, uses default partition if not set. */ + partition?: string; + /** TTL for the partition in milliseconds (default: 1 day). */ + partitionTtlMs?: number; +}; +/** Optional parameters for {@link Queue#putMany Queue.putMany()}. */ +type QueuePutManyParams = QueuePutParams; +/** Optional parameters for {@link Queue#len Queue.len()}. */ +type QueueLenParams = { + /** Partition to compute length, uses default partition if not set. */ + partition?: string; + /** Return the total length across all partitions. */ + total?: boolean; +}; +/** Optional parameters for {@link Queue#iterate Queue.iterate()}. */ +type QueueIterateParams = { + /** How long to wait between successive items before exiting iteration in milliseconds (default: 0). */ + itemPollTimeoutMs?: number; + /** Partition to iterate, uses default partition if not set. */ + partition?: string; +}; +/** + * Distributed, FIFO queue for data flow in Modal {@link App Apps}. + */ +declare class Queue { + #private; + readonly queueId: string; + readonly name?: string; + /** @ignore */ + constructor(client: ModalClient, queueId: string, name?: string, ephemeralHbManager?: EphemeralHeartbeatManager); + /** + * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead. + */ + static ephemeral(params?: QueueEphemeralParams): Promise; + /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */ + closeEphemeral(): void; + /** + * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead. + */ + static lookup(name: string, options?: QueueFromNameParams): Promise; + /** + * @deprecated Use {@link QueueService#delete client.queues.delete()} instead. + */ + static delete(name: string, options?: QueueDeleteParams): Promise; + /** + * Remove all objects from a Queue partition. + */ + clear(params?: QueueClearParams): Promise; + /** + * Remove and return the next object from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + get(params?: QueueGetParams): Promise; + /** + * Remove and return up to `n` objects from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + getMany(n: number, params?: QueueGetManyParams): Promise; + /** + * Add an item to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + put(v: any, params?: QueuePutParams): Promise; + /** + * Add several items to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + putMany(values: any[], params?: QueuePutManyParams): Promise; + /** Return the number of objects in the Queue. */ + len(params?: QueueLenParams): Promise; + /** Iterate through items in a Queue without mutation. */ + iterate(params?: QueueIterateParams): AsyncGenerator; +} + +/** + * Represents a memory snapshot of a Sandbox. + * This is an experimental feature. + */ +declare class SandboxSnapshot { + readonly snapshotId: string; + /** @ignore */ + constructor(client: ModalClient, snapshotId: string); + /** + * @deprecated Use {@link SandboxSnapshotService#fromId client.sandboxSnapshots.fromId()} instead. + */ + static fromId(snapshotId: string): Promise; +} +/** + * Service for managing {@link SandboxSnapshot}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const snapshot = await modal.sandboxSnapshots.fromId("..."); + * ``` + */ +declare class SandboxSnapshotService { + #private; + constructor(client: ModalClient); + /** + * Get a {@link SandboxSnapshot} by ID. + */ + fromId(snapshotId: string): Promise; +} + +/** File open modes supported by the filesystem API. */ +type SandboxFileMode = "r" | "w" | "a" | "r+" | "w+" | "a+"; +/** + * SandboxFile represents an open file in the {@link Sandbox} filesystem. + * Provides read/write operations similar to Node.js `fsPromises.FileHandle`. + */ +declare class SandboxFile { + #private; + /** @ignore */ + constructor(client: ModalClient, fileDescriptor: string, taskId: string); + /** + * Read data from the file. + * @returns Promise that resolves to the read data as Uint8Array + */ + read(): Promise; + /** + * Write data to the file. + * @param data - Data to write (string or Uint8Array) + */ + write(data: Uint8Array): Promise; + /** + * Flush any buffered data to the file. + */ + flush(): Promise; + /** + * Close the file handle. + */ + close(): Promise; +} + +/** + * Wrapper around `ReadableStream` with convenience functions. + * + * The Stream API is a modern standard for asynchronous data streams across + * network and process boundaries. It allows you to read data in chunks, pipe + * and transform it, and handle backpressure. + * + * This wrapper adds some extra functions like `.readText()` to read the entire + * stream as a string, or `readBytes()` to read binary data. + * + * Background: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API + */ +interface ModalReadStream extends ReadableStream { + /** Read the entire stream as a string. */ + readText(): Promise; + /** Read the entire stream as a byte array. */ + readBytes(): Promise; +} +/** + * Wrapper around `WritableStream` with convenience functions. + * + * The Stream API is a modern standard for asynchronous data streams across + * network and process boundaries. It allows you to read data in chunks, pipe + * and transform it, and handle backpressure. + * + * This wrapper adds some extra functions like `.writeText()` to write a string + * to the stream, or `writeBytes()` to write binary data. + * + * Background: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API + */ +interface ModalWriteStream extends WritableStream { + /** Write a string to the stream. Only if this is a text stream. */ + writeText(text: string): Promise; + /** Write a byte array to the stream. Only if this is a byte stream. */ + writeBytes(bytes: Uint8Array): Promise; +} + +/** + * Stdin is always present, but this option allow you to drop stdout or stderr + * if you don't need them. The default is "pipe", matching Node.js behavior. + * + * If behavior is set to "ignore", the output streams will be empty. + */ +type StdioBehavior = "pipe" | "ignore"; +/** + * Specifies the type of data that will be read from the Sandbox or container + * process. "text" means the data will be read as UTF-8 text, while "binary" + * means the data will be read as raw bytes (Uint8Array). + */ +type StreamMode = "text" | "binary"; +/** Optional parameters for {@link SandboxService#create client.sandboxes.create()}. */ +type SandboxCreateParams = { + /** Reservation of physical CPU cores for the Sandbox, can be fractional. */ + cpu?: number; + /** Hard limit of physical CPU cores for the Sandbox, can be fractional. */ + cpuLimit?: number; + /** Reservation of memory in MiB. */ + memoryMiB?: number; + /** Hard limit of memory in MiB. */ + memoryLimitMiB?: number; + /** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */ + gpu?: string; + /** Timeout of the Sandbox container in milliseconds, defaults to 10 minutes. */ + timeoutMs?: number; + /** The amount of time in milliseconds that a Sandbox can be idle before being terminated. */ + idleTimeoutMs?: number; + /** Working directory of the Sandbox. */ + workdir?: string; + /** + * Sequence of program arguments for the main process. + * Default behavior is to sleep indefinitely until timeout or termination. + */ + command?: string[]; + /** Environment variables to set in the Sandbox. */ + env?: Record; + /** {@link Secret}s to inject into the Sandbox as environment variables. */ + secrets?: Secret[]; + /** Mount points for Modal {@link Volume}s. */ + volumes?: Record; + /** Mount points for {@link CloudBucketMount}s. */ + cloudBucketMounts?: Record; + /** Enable a PTY for the Sandbox. */ + pty?: boolean; + /** List of ports to tunnel into the Sandbox. Encrypted ports are tunneled with TLS. */ + encryptedPorts?: number[]; + /** List of encrypted ports to tunnel into the Sandbox, using HTTP/2. */ + h2Ports?: number[]; + /** List of ports to tunnel into the Sandbox without encryption. */ + unencryptedPorts?: number[]; + /** Whether to block all network access from the Sandbox. */ + blockNetwork?: boolean; + /** List of CIDRs the Sandbox is allowed to access. If None, all CIDRs are allowed. Cannot be used with blockNetwork. */ + cidrAllowlist?: string[]; + /** Cloud provider to run the Sandbox on. */ + cloud?: string; + /** Region(s) to run the Sandbox on. */ + regions?: string[]; + /** Enable verbose logging. */ + verbose?: boolean; + /** Reference to a Modal {@link Proxy} to use in front of this Sandbox. */ + proxy?: Proxy; + /** Optional name for the Sandbox. Unique within an App. */ + name?: string; + /** Experimental options for the sandbox. */ + experimentalOptions?: Record; + /** Enable memory snapshot support (experimental). */ + experimentalEnableSnapshot?: boolean; +}; +/** + * Service for managing {@link Sandbox}es. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const sb = await modal.sandboxes.create(app, image); + * ``` + */ +declare class SandboxService { + #private; + constructor(client: ModalClient); + /** + * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options. + */ + create(app: App, image: Image, params?: SandboxCreateParams): Promise; + /** Returns a running {@link Sandbox} object from an ID. + * + * @returns Sandbox with ID + */ + fromId(sandboxId: string, params?: SandboxFromIdParams): Promise; + /** Get a running {@link Sandbox} by name from a deployed {@link App}. + * + * Raises a {@link NotFoundError} if no running Sandbox is found with the given name. + * A Sandbox's name is the `name` argument passed to {@link SandboxService#create sandboxes.create()}. + * + * @param appName - Name of the deployed App + * @param name - Name of the Sandbox + * @param params - Optional parameters for getting the Sandbox + * @returns Promise that resolves to a Sandbox + */ + fromName(appName: string, name: string, params?: SandboxFromNameParams): Promise; + /** + * Restore a {@link Sandbox} from a {@link SandboxSnapshot} (experimental). + * + * @param snapshot - The snapshot to restore from + * @param params - Optional parameters for restoring the Sandbox + * @returns Promise that resolves to a Sandbox + */ + experimentalFromSnapshot(snapshot: SandboxSnapshot, params?: SandboxRestoreParams): Promise; + /** + * List all {@link Sandbox}es for the current Environment or App ID (if specified). + * If tags are specified, only Sandboxes that have at least those tags are returned. + */ + list(params?: SandboxListParams): AsyncGenerator; +} +/** Optional parameters for {@link SandboxService#list client.sandboxes.list()}. */ +type SandboxListParams = { + /** Filter Sandboxes for a specific {@link App}. */ + appId?: string; + /** Only return Sandboxes that include all specified tags. */ + tags?: Record; + /** Override environment for the request; defaults to current profile. */ + environment?: string; +}; +/** Optional parameters for {@link SandboxService#fromId client.sandboxes.fromId()}. */ +type SandboxFromIdParams = { + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; +/** Optional parameters for {@link SandboxService#fromName client.sandboxes.fromName()}. */ +type SandboxFromNameParams = { + environment?: string; + /** Whether memory snapshots are enabled for this Sandbox (experimental). */ + memorySnapshotsEnabled?: boolean; +}; +/** Optional parameters for {@link SandboxService#experimentalFromSnapshot client.sandboxes.experimentalFromSnapshot()}. */ +type SandboxRestoreParams = { + /** Optional sandbox name override. Use null to clear name. */ + name?: string | null; +}; +/** Optional parameters for {@link Sandbox#createConnectToken Sandbox.createConnectToken()}. */ +type CreateConnectTokenParams = { + /** + * Optional user metadata to attach to the token. Must be JSON-serializable. + * When a request arrives with a valid token, the service receives an + * `X-Verified-User-Data` header with this data as a JSON-serialized string. + * Serialized metadata cannot exceed 512 characters. + */ + userMetadata?: Record; +}; +/** + * A connect token for a Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. + */ +type ConnectToken = { + /** The URL to connect to the Sandbox service. */ + url: string; + /** The authentication token. */ + token: string; +}; +/** Optional parameters for {@link Sandbox#exec Sandbox.exec()}. */ +type SandboxExecParams = { + /** Specifies text or binary encoding for input and output streams. */ + mode?: StreamMode; + /** Whether to pipe or ignore standard output. */ + stdout?: StdioBehavior; + /** Whether to pipe or ignore standard error. */ + stderr?: StdioBehavior; + /** Working directory to run the command in. */ + workdir?: string; + /** Timeout for the process in milliseconds. Defaults to 0 (no timeout). */ + timeoutMs?: number; + /** Environment variables to set for the command. */ + env?: Record; + /** {@link Secret}s to inject as environment variables for the commmand.*/ + secrets?: Secret[]; + /** Enable a PTY for the command. */ + pty?: boolean; +}; +/** A port forwarded from within a running Modal {@link Sandbox}. */ +declare class Tunnel { + host: string; + port: number; + unencryptedHost?: string | undefined; + unencryptedPort?: number | undefined; + /** @ignore */ + constructor(host: string, port: number, unencryptedHost?: string | undefined, unencryptedPort?: number | undefined); + /** Get the public HTTPS URL of the forwarded port. */ + get url(): string; + /** Get the public TLS socket as a [host, port] tuple. */ + get tlsSocket(): [string, number]; + /** Get the public TCP socket as a [host, port] tuple. */ + get tcpSocket(): [string, number]; +} +type SandboxConstructorOptions = { + memorySnapshotsEnabled?: boolean; +}; +/** Sandboxes are secure, isolated containers in Modal that boot in seconds. */ +declare class Sandbox { + #private; + readonly sandboxId: string; + stdin: ModalWriteStream; + stdout: ModalReadStream; + stderr: ModalReadStream; + /** @ignore */ + constructor(client: ModalClient, sandboxId: string, options?: SandboxConstructorOptions); + /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */ + setTags(tags: Record): Promise; + /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */ + getTags(): Promise>; + /** + * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead. + */ + static fromId(sandboxId: string): Promise; + /** + * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead. + */ + static fromName(appName: string, name: string, environment?: string): Promise; + /** + * Open a file in the Sandbox filesystem. + * @param path - Path to the file to open + * @param mode - File open mode (r, w, a, r+, w+, a+) + * @returns Promise that resolves to a {@link SandboxFile} + */ + open(path: string, mode?: SandboxFileMode): Promise; + exec(command: string[], params?: SandboxExecParams & { + mode?: "text"; + }): Promise>; + exec(command: string[], params: SandboxExecParams & { + mode: "binary"; + }): Promise>; + terminate(): Promise; + wait(): Promise; + /** Get {@link Tunnel} metadata for the Sandbox. + * + * Raises {@link SandboxTimeoutError} if the tunnels are not available after the timeout. + * + * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. + */ + tunnels(timeoutMs?: number): Promise>; + /** + * Snapshot the filesystem of the Sandbox. + * + * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. + * + * @param timeoutMs - Timeout for the snapshot operation in milliseconds + * @returns Promise that resolves to an {@link Image} + */ + snapshotFilesystem(timeoutMs?: number): Promise; + /** + * Take a memory snapshot of the Sandbox (experimental). + * + * Returns a {@link SandboxSnapshot} object which can be used to restore a new Sandbox. + * + * @returns Promise that resolves to a {@link SandboxSnapshot} + */ + experimentalSnapshot(): Promise; + /** + * Check if the Sandbox has finished running. + * + * Returns `null` if the Sandbox is still running, else returns the exit code. + */ + poll(): Promise; + /** + * Create a connect token for this Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. The token can be transmitted via: + * - Authorization header: `Authorization: Bearer {token}` + * - Query parameter: `_modal_connect_token` in the URL + * - Cookie: `_modal_connect_token` as a cookie + * + * The service inside the container must listen on port 8080. + * + * @param params - Optional parameters for the connect token + * @returns Promise that resolves to a {@link ConnectToken} + */ + createConnectToken(params?: CreateConnectTokenParams): Promise; + /** + * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. + */ + static list(params?: SandboxListParams): AsyncGenerator; +} +declare class ContainerProcess { + #private; + stdin: ModalWriteStream; + stdout: ModalReadStream; + stderr: ModalReadStream; + returncode: number | null; + constructor(client: ModalClient, execId: string, params?: SandboxExecParams); + /** Wait for process completion and return the exit code. */ + wait(): Promise; +} + +/** Resolved configuration object from `Config` and environment variables. */ +interface Profile { + serverUrl: string; + tokenId?: string; + tokenSecret?: string; + environment?: string; + imageBuilderVersion?: string; + logLevel?: string; +} + +type LogLevel = "debug" | "info" | "warn" | "error"; +interface Logger { + debug(message: string, ...args: any[]): void; + info(message: string, ...args: any[]): void; + warn(message: string, ...args: any[]): void; + error(message: string, ...args: any[]): void; +} + +interface ModalClientParams { + tokenId?: string; + tokenSecret?: string; + environment?: string; + endpoint?: string; + timeoutMs?: number; + maxRetries?: number; + logger?: Logger; + logLevel?: LogLevel; + /** + * Custom gRPC middleware to be applied to all API calls. + * These middleware are appended after Modal's built-in middleware + * (authentication, retry logic, and timeouts), allowing you to add + * telemetry, tracing, or other observability features. + * + * Note that the Modal gRPC API is not considered a public API, and + * can change without warning. + */ + grpcMiddleware?: ClientMiddleware[]; + /** @ignore */ + cpClient?: ModalGrpcClient; +} +type ModalGrpcClient = Client; +/** + * The main client for interacting with Modal's cloud infrastructure. + * + * ModalClient provides access to all Modal services through service properties. + * Create a client instance and use its service properties to manage {@link App}s, + * {@link Function_ Function}s, * {@link Sandbox}es, and other Modal resources. + * + * @example + * ```typescript + * import { ModalClient } from "modal"; + * + * const modal = new ModalClient(); + * + * const app = await modal.apps.fromName("my-app"); + * const image = modal.images.fromRegistry("python:3.13"); + * const sb = await modal.sandboxes.create(app, image); + * ``` + */ +declare class ModalClient { + readonly apps: AppService; + readonly cloudBucketMounts: CloudBucketMountService; + readonly cls: ClsService; + readonly functions: FunctionService; + readonly functionCalls: FunctionCallService; + readonly images: ImageService; + readonly proxies: ProxyService; + readonly queues: QueueService; + readonly sandboxes: SandboxService; + readonly sandboxSnapshots: SandboxSnapshotService; + readonly secrets: SecretService; + readonly volumes: VolumeService; + /** @ignore */ + readonly cpClient: ModalGrpcClient; + readonly profile: Profile; + readonly logger: Logger; + private ipClients; + private authTokenManager; + private customMiddleware; + constructor(params?: ModalClientParams); + environmentName(environment?: string): string; + imageBuilderVersion(version?: string): string; + /** @ignore */ + ipClient(serverUrl: string): ModalGrpcClient; + close(): void; + version(): string; + private createClient; + /** Middleware to retry transient errors and timeouts for unary requests. */ + private retryMiddleware; + private authMiddleware; +} +type TimeoutOptions = { + /** Timeout for this call, interpreted as a duration in milliseconds */ + timeoutMs?: number; +}; +type RetryOptions = { + /** Number of retries to take. */ + retries?: number; + /** Base delay in milliseconds. */ + baseDelay?: number; + /** Maximum delay in milliseconds. */ + maxDelay?: number; + /** Exponential factor to multiply successive delays. */ + delayFactor?: number; + /** Additional status codes to retry. */ + additionalStatusCodes?: Status[]; +}; +/** + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. + */ +type ClientOptions = { + tokenId: string; + tokenSecret: string; + environment?: string; +}; +/** + * @deprecated Use {@link ModalClient `new ModalClient()`} instead. + */ +declare function initializeClient(options: ClientOptions): void; +/** + * Stops the auth token refresh. + * @deprecated Use {@link ModalClient#close modalClient.close()} instead. + */ +declare function close(): void; + +/** + * Service for managing {@link App}s. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const app = await modal.apps.fromName("my-app"); + * ``` + */ +declare class AppService { + #private; + constructor(client: ModalClient); + /** + * Reference a deployed {@link App} by name, or create if it does not exist. + */ + fromName(name: string, params?: AppFromNameParams): Promise; +} +/** Optional parameters for {@link AppService#fromName client.apps.fromName()}. */ +type AppFromNameParams = { + environment?: string; + createIfMissing?: boolean; +}; +/** @deprecated Use specific Params types instead. */ +type LookupOptions = { + environment?: string; + createIfMissing?: boolean; +}; +/** @deprecated Use specific Params types instead. */ +type DeleteOptions = { + environment?: string; +}; +/** @deprecated Use specific Params types instead. */ +type EphemeralOptions = { + environment?: string; +}; +/** Represents a deployed Modal App. */ +declare class App { + readonly appId: string; + readonly name?: string; + /** @ignore */ + constructor(appId: string, name?: string); + /** + * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. + */ + static lookup(name: string, options?: LookupOptions): Promise; + /** + * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead. + */ + createSandbox(image: Image, options?: SandboxCreateParams): Promise; + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + imageFromRegistry(tag: string, secret?: Secret): Promise; + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + imageFromAwsEcr(tag: string, secret: Secret): Promise; + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + imageFromGcpArtifactRegistry(tag: string, secret: Secret): Promise; +} + +/** Function execution exceeds the allowed time limit. */ +declare class FunctionTimeoutError extends Error { + constructor(message: string); +} +/** An error on the Modal server, or a Python exception. */ +declare class RemoteError extends Error { + constructor(message: string); +} +/** A retryable internal error from Modal. */ +declare class InternalFailure extends Error { + constructor(message: string); +} +/** Some resource was not found. */ +declare class NotFoundError extends Error { + constructor(message: string); +} +/** A resource already exists. */ +declare class AlreadyExistsError extends Error { + constructor(message: string); +} +/** A request or other operation was invalid. */ +declare class InvalidError extends Error { + constructor(message: string); +} +/** The Queue is empty. */ +declare class QueueEmptyError extends Error { + constructor(message: string); +} +/** The Queue is full. */ +declare class QueueFullError extends Error { + constructor(message: string); +} +/** Sandbox operations that exceed the allowed time limit. */ +declare class SandboxTimeoutError extends Error { + constructor(message?: string); +} + +declare function checkForRenamedParams(params: any, renames: Record): void; + +export { AlreadyExistsError, App, type AppFromNameParams, AppService, type ClientOptions, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, type ConnectToken, ContainerProcess, type CreateConnectTokenParams, type DeleteOptions, type EphemeralOptions, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, FunctionCallService, type FunctionFromNameParams, FunctionService, type FunctionStats, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, ImageService, InternalFailure, InvalidError, type LogLevel, type Logger, type LookupOptions, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, Retries, Sandbox, type SandboxCreateParams, type SandboxExecParams, SandboxFile, type SandboxFileMode, type SandboxFromIdParams, type SandboxFromNameParams, type SandboxListParams, type SandboxRestoreParams, SandboxService, SandboxSnapshot, SandboxSnapshotService, SandboxTimeoutError, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, type StdioBehavior, type StreamMode, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, VolumeService, checkForRenamedParams, close, initializeClient }; diff --git a/modal-js/dist/index.js b/modal-js/dist/index.js new file mode 100644 index 00000000..43746dd9 --- /dev/null +++ b/modal-js/dist/index.js @@ -0,0 +1,47418 @@ +// src/app.ts +import { ClientError as ClientError10, Status as Status10 } from "nice-grpc"; + +// node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +function varint64read() { + let lowBits = 0; + let highBits = 0; + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 127) << shift; + if ((b & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + let middleByte = this.buf[this.pos++]; + lowBits |= (middleByte & 15) << 28; + highBits = (middleByte & 112) >> 4; + if ((middleByte & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 127) << shift; + if ((b & 128) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + throw new Error("invalid varint"); +} +function varint64write(lo, hi, bytes) { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 128 : shift) & 255; + bytes.push(byte); + if (!hasNext) { + return; + } + } + const splitBits = lo >>> 28 & 15 | (hi & 7) << 4; + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255); + if (!hasMoreBits) { + return; + } + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 128 : shift) & 255; + bytes.push(byte); + if (!hasNext) { + return; + } + } + bytes.push(hi >>> 31 & 1); +} +var TWO_PWR_32_DBL = 4294967296; +function int64FromString(dec) { + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + const base = 1e6; + let lowBits = 0; + let highBits = 0; + function add1e6digit(begin, end) { + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} +function int64ToString(lo, hi) { + let bits = newBits(lo, hi); + const negative = bits.hi & 2147483648; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} +function uInt64ToString(lo, hi) { + ({ lo, hi } = toUnsigned(lo, hi)); + if (hi <= 2097151) { + return String(TWO_PWR_32_DBL * hi + lo); + } + const low = lo & 16777215; + const mid = (lo >>> 24 | hi << 8) & 16777215; + const high = hi >> 16 & 65535; + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + const base = 1e7; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA); +} +function toUnsigned(lo, hi) { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} +function newBits(lo, hi) { + return { lo: lo | 0, hi: hi | 0 }; +} +function negate(lowBits, highBits) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + highBits += 1; + } + return newBits(lowBits, highBits); +} +var decimalFrom1e7WithLeadingZeros = (digit1e7) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; +function varint32write(value, bytes) { + if (value >= 0) { + while (value > 127) { + bytes.push(value & 127 | 128); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push(value & 127 | 128); + value = value >> 7; + } + bytes.push(1); + } +} +function varint32read() { + let b = this.buf[this.pos++]; + let result = b & 127; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 7; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 14; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 127) << 21; + if ((b & 128) == 0) { + this.assertBounds(); + return result; + } + b = this.buf[this.pos++]; + result |= (b & 15) << 28; + for (let readBytes = 5; (b & 128) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + if ((b & 128) != 0) + throw new Error("invalid varint"); + this.assertBounds(); + return result >>> 0; +} + +// node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +var protoInt64 = /* @__PURE__ */ makeInt64Support(); +function makeInt64Support() { + const dv = new DataView(new ArrayBuffer(8)); + const ok = typeof BigInt === "function" && typeof dv.getBigInt64 === "function" && typeof dv.getBigUint64 === "function" && typeof dv.setBigInt64 === "function" && typeof dv.setBigUint64 === "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1"); + if (ok) { + const MIN = BigInt("-9223372036854775808"), MAX = BigInt("9223372036854775807"), UMIN = BigInt("0"), UMAX = BigInt("18446744073709551615"); + return { + zero: BigInt(0), + supported: true, + parse(value) { + const bi = typeof value == "bigint" ? value : BigInt(value); + if (bi > MAX || bi < MIN) { + throw new Error(`invalid int64: ${value}`); + } + return bi; + }, + uParse(value) { + const bi = typeof value == "bigint" ? value : BigInt(value); + if (bi > UMAX || bi < UMIN) { + throw new Error(`invalid uint64: ${value}`); + } + return bi; + }, + enc(value) { + dv.setBigInt64(0, this.parse(value), true); + return { + lo: dv.getInt32(0, true), + hi: dv.getInt32(4, true) + }; + }, + uEnc(value) { + dv.setBigInt64(0, this.uParse(value), true); + return { + lo: dv.getInt32(0, true), + hi: dv.getInt32(4, true) + }; + }, + dec(lo, hi) { + dv.setInt32(0, lo, true); + dv.setInt32(4, hi, true); + return dv.getBigInt64(0, true); + }, + uDec(lo, hi) { + dv.setInt32(0, lo, true); + dv.setInt32(4, hi, true); + return dv.getBigUint64(0, true); + } + }; + } + return { + zero: "0", + supported: false, + parse(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertInt64String(value); + return value; + }, + uParse(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertUInt64String(value); + return value; + }, + enc(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertInt64String(value); + return int64FromString(value); + }, + uEnc(value) { + if (typeof value != "string") { + value = value.toString(); + } + assertUInt64String(value); + return int64FromString(value); + }, + dec(lo, hi) { + return int64ToString(lo, hi); + }, + uDec(lo, hi) { + return uInt64ToString(lo, hi); + } + }; +} +function assertInt64String(value) { + if (!/^-?[0-9]+$/.test(value)) { + throw new Error("invalid int64: " + value); + } +} +function assertUInt64String(value) { + if (!/^[0-9]+$/.test(value)) { + throw new Error("invalid uint64: " + value); + } +} + +// node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +var symbol = Symbol.for("@bufbuild/protobuf/text-encoding"); +function getTextEncoding() { + if (globalThis[symbol] == void 0) { + const te = new globalThis.TextEncoder(); + const td = new globalThis.TextDecoder(); + globalThis[symbol] = { + encodeUtf8(text) { + return te.encode(text); + }, + decodeUtf8(bytes) { + return td.decode(bytes); + }, + checkUtf8(text) { + try { + encodeURIComponent(text); + return true; + } catch (e) { + return false; + } + } + }; + } + return globalThis[symbol]; +} + +// node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +var WireType; +(function(WireType2) { + WireType2[WireType2["Varint"] = 0] = "Varint"; + WireType2[WireType2["Bit64"] = 1] = "Bit64"; + WireType2[WireType2["LengthDelimited"] = 2] = "LengthDelimited"; + WireType2[WireType2["StartGroup"] = 3] = "StartGroup"; + WireType2[WireType2["EndGroup"] = 4] = "EndGroup"; + WireType2[WireType2["Bit32"] = 5] = "Bit32"; +})(WireType || (WireType = {})); +var FLOAT32_MAX = 34028234663852886e22; +var FLOAT32_MIN = -34028234663852886e22; +var UINT32_MAX = 4294967295; +var INT32_MAX = 2147483647; +var INT32_MIN = -2147483648; +var BinaryWriter = class { + constructor(encodeUtf8 = getTextEncoding().encodeUtf8) { + this.encodeUtf8 = encodeUtf8; + this.stack = []; + this.chunks = []; + this.buf = []; + } + /** + * Return all bytes written and reset this writer. + */ + finish() { + if (this.buf.length) { + this.chunks.push(new Uint8Array(this.buf)); + this.buf = []; + } + let len = 0; + for (let i = 0; i < this.chunks.length; i++) + len += this.chunks[i].length; + let bytes = new Uint8Array(len); + let offset = 0; + for (let i = 0; i < this.chunks.length; i++) { + bytes.set(this.chunks[i], offset); + offset += this.chunks[i].length; + } + this.chunks = []; + return bytes; + } + /** + * Start a new fork for length-delimited data like a message + * or a packed repeated field. + * + * Must be joined later with `join()`. + */ + fork() { + this.stack.push({ chunks: this.chunks, buf: this.buf }); + this.chunks = []; + this.buf = []; + return this; + } + /** + * Join the last fork. Write its length and bytes, then + * return to the previous state. + */ + join() { + let chunk = this.finish(); + let prev = this.stack.pop(); + if (!prev) + throw new Error("invalid state, fork stack empty"); + this.chunks = prev.chunks; + this.buf = prev.buf; + this.uint32(chunk.byteLength); + return this.raw(chunk); + } + /** + * Writes a tag (field number and wire type). + * + * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`. + * + * Generated code should compute the tag ahead of time and call `uint32()`. + */ + tag(fieldNo, type) { + return this.uint32((fieldNo << 3 | type) >>> 0); + } + /** + * Write a chunk of raw bytes. + */ + raw(chunk) { + if (this.buf.length) { + this.chunks.push(new Uint8Array(this.buf)); + this.buf = []; + } + this.chunks.push(chunk); + return this; + } + /** + * Write a `uint32` value, an unsigned 32 bit varint. + */ + uint32(value) { + assertUInt32(value); + while (value > 127) { + this.buf.push(value & 127 | 128); + value = value >>> 7; + } + this.buf.push(value); + return this; + } + /** + * Write a `int32` value, a signed 32 bit varint. + */ + int32(value) { + assertInt32(value); + varint32write(value, this.buf); + return this; + } + /** + * Write a `bool` value, a variant. + */ + bool(value) { + this.buf.push(value ? 1 : 0); + return this; + } + /** + * Write a `bytes` value, length-delimited arbitrary data. + */ + bytes(value) { + this.uint32(value.byteLength); + return this.raw(value); + } + /** + * Write a `string` value, length-delimited data converted to UTF-8 text. + */ + string(value) { + let chunk = this.encodeUtf8(value); + this.uint32(chunk.byteLength); + return this.raw(chunk); + } + /** + * Write a `float` value, 32-bit floating point number. + */ + float(value) { + assertFloat32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setFloat32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `double` value, a 64-bit floating point number. + */ + double(value) { + let chunk = new Uint8Array(8); + new DataView(chunk.buffer).setFloat64(0, value, true); + return this.raw(chunk); + } + /** + * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer. + */ + fixed32(value) { + assertUInt32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setUint32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `sfixed32` value, a signed, fixed-length 32-bit integer. + */ + sfixed32(value) { + assertInt32(value); + let chunk = new Uint8Array(4); + new DataView(chunk.buffer).setInt32(0, value, true); + return this.raw(chunk); + } + /** + * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint. + */ + sint32(value) { + assertInt32(value); + value = (value << 1 ^ value >> 31) >>> 0; + varint32write(value, this.buf); + return this; + } + /** + * Write a `fixed64` value, a signed, fixed-length 64-bit integer. + */ + sfixed64(value) { + let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.enc(value); + view.setInt32(0, tc.lo, true); + view.setInt32(4, tc.hi, true); + return this.raw(chunk); + } + /** + * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer. + */ + fixed64(value) { + let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.uEnc(value); + view.setInt32(0, tc.lo, true); + view.setInt32(4, tc.hi, true); + return this.raw(chunk); + } + /** + * Write a `int64` value, a signed 64-bit varint. + */ + int64(value) { + let tc = protoInt64.enc(value); + varint64write(tc.lo, tc.hi, this.buf); + return this; + } + /** + * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint. + */ + sint64(value) { + let tc = protoInt64.enc(value), sign = tc.hi >> 31, lo = tc.lo << 1 ^ sign, hi = (tc.hi << 1 | tc.lo >>> 31) ^ sign; + varint64write(lo, hi, this.buf); + return this; + } + /** + * Write a `uint64` value, an unsigned 64-bit varint. + */ + uint64(value) { + let tc = protoInt64.uEnc(value); + varint64write(tc.lo, tc.hi, this.buf); + return this; + } +}; +var BinaryReader = class { + constructor(buf, decodeUtf8 = getTextEncoding().decodeUtf8) { + this.decodeUtf8 = decodeUtf8; + this.varint64 = varint64read; + this.uint32 = varint32read; + this.buf = buf; + this.len = buf.length; + this.pos = 0; + this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength); + } + /** + * Reads a tag - field number and wire type. + */ + tag() { + let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType); + return [fieldNo, wireType]; + } + /** + * Skip one element and return the skipped data. + * + * When skipping StartGroup, provide the tags field number to check for + * matching field number in the EndGroup tag. + */ + skip(wireType, fieldNo) { + let start = this.pos; + switch (wireType) { + case WireType.Varint: + while (this.buf[this.pos++] & 128) { + } + break; + // eslint-disable-next-line + // @ts-expect-error TS7029: Fallthrough case in switch + case WireType.Bit64: + this.pos += 4; + // eslint-disable-next-line no-fallthrough + case WireType.Bit32: + this.pos += 4; + break; + case WireType.LengthDelimited: + let len = this.uint32(); + this.pos += len; + break; + case WireType.StartGroup: + for (; ; ) { + const [fn, wt] = this.tag(); + if (wt === WireType.EndGroup) { + if (fieldNo !== void 0 && fn !== fieldNo) { + throw new Error("invalid end group tag"); + } + break; + } + this.skip(wt, fn); + } + break; + default: + throw new Error("cant skip wire type " + wireType); + } + this.assertBounds(); + return this.buf.subarray(start, this.pos); + } + /** + * Throws error if position in byte array is out of range. + */ + assertBounds() { + if (this.pos > this.len) + throw new RangeError("premature EOF"); + } + /** + * Read a `int32` field, a signed 32 bit varint. + */ + int32() { + return this.uint32() | 0; + } + /** + * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint. + */ + sint32() { + let zze = this.uint32(); + return zze >>> 1 ^ -(zze & 1); + } + /** + * Read a `int64` field, a signed 64-bit varint. + */ + int64() { + return protoInt64.dec(...this.varint64()); + } + /** + * Read a `uint64` field, an unsigned 64-bit varint. + */ + uint64() { + return protoInt64.uDec(...this.varint64()); + } + /** + * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint. + */ + sint64() { + let [lo, hi] = this.varint64(); + let s = -(lo & 1); + lo = (lo >>> 1 | (hi & 1) << 31) ^ s; + hi = hi >>> 1 ^ s; + return protoInt64.dec(lo, hi); + } + /** + * Read a `bool` field, a variant. + */ + bool() { + let [lo, hi] = this.varint64(); + return lo !== 0 || hi !== 0; + } + /** + * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer. + */ + fixed32() { + return this.view.getUint32((this.pos += 4) - 4, true); + } + /** + * Read a `sfixed32` field, a signed, fixed-length 32-bit integer. + */ + sfixed32() { + return this.view.getInt32((this.pos += 4) - 4, true); + } + /** + * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer. + */ + fixed64() { + return protoInt64.uDec(this.sfixed32(), this.sfixed32()); + } + /** + * Read a `fixed64` field, a signed, fixed-length 64-bit integer. + */ + sfixed64() { + return protoInt64.dec(this.sfixed32(), this.sfixed32()); + } + /** + * Read a `float` field, 32-bit floating point number. + */ + float() { + return this.view.getFloat32((this.pos += 4) - 4, true); + } + /** + * Read a `double` field, a 64-bit floating point number. + */ + double() { + return this.view.getFloat64((this.pos += 8) - 8, true); + } + /** + * Read a `bytes` field, length-delimited arbitrary data. + */ + bytes() { + let len = this.uint32(), start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + /** + * Read a `string` field, length-delimited data converted to UTF-8 text. + */ + string() { + return this.decodeUtf8(this.bytes()); + } +}; +function assertInt32(arg) { + if (typeof arg == "string") { + arg = Number(arg); + } else if (typeof arg != "number") { + throw new Error("invalid int32: " + typeof arg); + } + if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN) + throw new Error("invalid int32: " + arg); +} +function assertUInt32(arg) { + if (typeof arg == "string") { + arg = Number(arg); + } else if (typeof arg != "number") { + throw new Error("invalid uint32: " + typeof arg); + } + if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0) + throw new Error("invalid uint32: " + arg); +} +function assertFloat32(arg) { + if (typeof arg == "string") { + const o = arg; + arg = Number(arg); + if (isNaN(arg) && o !== "NaN") { + throw new Error("invalid float32: " + o); + } + } else if (typeof arg != "number") { + throw new Error("invalid float32: " + typeof arg); + } + if (Number.isFinite(arg) && (arg > FLOAT32_MAX || arg < FLOAT32_MIN)) + throw new Error("invalid float32: " + arg); +} + +// proto/google/protobuf/empty.ts +function createBaseEmpty() { + return {}; +} +var Empty = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return Empty.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmpty(); + return message; + } +}; + +// proto/google/protobuf/struct.ts +function nullValueFromJSON(object) { + switch (object) { + case 0: + case "NULL_VALUE": + return 0 /* NULL_VALUE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function nullValueToJSON(object) { + switch (object) { + case 0 /* NULL_VALUE */: + return "NULL_VALUE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function createBaseStruct() { + return { fields: {} }; +} +var Struct = { + encode(message, writer = new BinaryWriter()) { + Object.entries(message.fields).forEach(([key, value]) => { + if (value !== void 0) { + Struct_FieldsEntry.encode({ key, value }, writer.uint32(10).fork()).join(); + } + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStruct(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32()); + if (entry1.value !== void 0) { + message.fields[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fields: isObject(object.fields) ? Object.entries(object.fields).reduce((acc, [key, value]) => { + acc[key] = value; + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.fields) { + const entries = Object.entries(message.fields); + if (entries.length > 0) { + obj.fields = {}; + entries.forEach(([k, v]) => { + obj.fields[k] = v; + }); + } + } + return obj; + }, + create(base) { + return Struct.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStruct(); + message.fields = Object.entries(object.fields ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = value; + } + return acc; + }, + {} + ); + return message; + }, + wrap(object) { + const struct = createBaseStruct(); + if (object !== void 0) { + for (const key of Object.keys(object)) { + struct.fields[key] = object[key]; + } + } + return struct; + }, + unwrap(message) { + const object = {}; + if (message.fields) { + for (const key of Object.keys(message.fields)) { + object[key] = message.fields[key]; + } + } + return object; + } +}; +function createBaseStruct_FieldsEntry() { + return { key: "", value: void 0 }; +} +var Struct_FieldsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStruct_FieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object?.value) ? object.value : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Struct_FieldsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStruct_FieldsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseValue() { + return { + nullValue: void 0, + numberValue: void 0, + stringValue: void 0, + boolValue: void 0, + structValue: void 0, + listValue: void 0 + }; +} +var Value = { + encode(message, writer = new BinaryWriter()) { + if (message.nullValue !== void 0) { + writer.uint32(8).int32(message.nullValue); + } + if (message.numberValue !== void 0) { + writer.uint32(17).double(message.numberValue); + } + if (message.stringValue !== void 0) { + writer.uint32(26).string(message.stringValue); + } + if (message.boolValue !== void 0) { + writer.uint32(32).bool(message.boolValue); + } + if (message.structValue !== void 0) { + Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).join(); + } + if (message.listValue !== void 0) { + ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.nullValue = reader.int32(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.numberValue = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stringValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.boolValue = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : void 0, + numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : void 0, + stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : void 0, + boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0, + structValue: isObject(object.structValue) ? object.structValue : void 0, + listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.nullValue !== void 0) { + obj.nullValue = nullValueToJSON(message.nullValue); + } + if (message.numberValue !== void 0) { + obj.numberValue = message.numberValue; + } + if (message.stringValue !== void 0) { + obj.stringValue = message.stringValue; + } + if (message.boolValue !== void 0) { + obj.boolValue = message.boolValue; + } + if (message.structValue !== void 0) { + obj.structValue = message.structValue; + } + if (message.listValue !== void 0) { + obj.listValue = message.listValue; + } + return obj; + }, + create(base) { + return Value.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValue(); + message.nullValue = object.nullValue ?? void 0; + message.numberValue = object.numberValue ?? void 0; + message.stringValue = object.stringValue ?? void 0; + message.boolValue = object.boolValue ?? void 0; + message.structValue = object.structValue ?? void 0; + message.listValue = object.listValue ?? void 0; + return message; + }, + wrap(value) { + const result = createBaseValue(); + if (value === null) { + result.nullValue = 0 /* NULL_VALUE */; + } else if (typeof value === "boolean") { + result.boolValue = value; + } else if (typeof value === "number") { + result.numberValue = value; + } else if (typeof value === "string") { + result.stringValue = value; + } else if (globalThis.Array.isArray(value)) { + result.listValue = value; + } else if (typeof value === "object") { + result.structValue = value; + } else if (typeof value !== "undefined") { + throw new globalThis.Error("Unsupported any value type: " + typeof value); + } + return result; + }, + unwrap(message) { + if (message.stringValue !== void 0) { + return message.stringValue; + } else if (message?.numberValue !== void 0) { + return message.numberValue; + } else if (message?.boolValue !== void 0) { + return message.boolValue; + } else if (message?.structValue !== void 0) { + return message.structValue; + } else if (message?.listValue !== void 0) { + return message.listValue; + } else if (message?.nullValue !== void 0) { + return null; + } + return void 0; + } +}; +function createBaseListValue() { + return { values: [] }; +} +var ListValue = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.values) { + Value.encode(Value.wrap(v), writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseListValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.values.push(Value.unwrap(Value.decode(reader, reader.uint32()))); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + create(base) { + return ListValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseListValue(); + message.values = object.values?.map((e) => e) || []; + return message; + }, + wrap(array) { + const result = createBaseListValue(); + result.values = array ?? []; + return result; + }, + unwrap(message) { + if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) { + return message.values; + } else { + return message; + } + } +}; +function isObject(value) { + return typeof value === "object" && value !== null; +} +function isSet(value) { + return value !== null && value !== void 0; +} + +// proto/google/protobuf/timestamp.ts +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +var Timestamp = { + encode(message, writer = new BinaryWriter()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet2(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet2(object.nanos) ? globalThis.Number(object.nanos) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + create(base) { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + } +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet2(value) { + return value !== null && value !== void 0; +} + +// proto/google/protobuf/wrappers.ts +function createBaseStringValue() { + return { value: "" }; +} +var StringValue = { + encode(message, writer = new BinaryWriter()) { + if (message.value !== "") { + writer.uint32(10).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseStringValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { value: isSet3(object.value) ? globalThis.String(object.value) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return StringValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStringValue(); + message.value = object.value ?? ""; + return message; + } +}; +function isSet3(value) { + return value !== null && value !== void 0; +} + +// proto/modal_proto/api.ts +function appDeployVisibilityFromJSON(object) { + switch (object) { + case 0: + case "APP_DEPLOY_VISIBILITY_UNSPECIFIED": + return 0 /* APP_DEPLOY_VISIBILITY_UNSPECIFIED */; + case 1: + case "APP_DEPLOY_VISIBILITY_WORKSPACE": + return 1 /* APP_DEPLOY_VISIBILITY_WORKSPACE */; + case 2: + case "APP_DEPLOY_VISIBILITY_PUBLIC": + return 2 /* APP_DEPLOY_VISIBILITY_PUBLIC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appDeployVisibilityToJSON(object) { + switch (object) { + case 0 /* APP_DEPLOY_VISIBILITY_UNSPECIFIED */: + return "APP_DEPLOY_VISIBILITY_UNSPECIFIED"; + case 1 /* APP_DEPLOY_VISIBILITY_WORKSPACE */: + return "APP_DEPLOY_VISIBILITY_WORKSPACE"; + case 2 /* APP_DEPLOY_VISIBILITY_PUBLIC */: + return "APP_DEPLOY_VISIBILITY_PUBLIC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appDisconnectReasonFromJSON(object) { + switch (object) { + case 0: + case "APP_DISCONNECT_REASON_UNSPECIFIED": + return 0 /* APP_DISCONNECT_REASON_UNSPECIFIED */; + case 1: + case "APP_DISCONNECT_REASON_LOCAL_EXCEPTION": + return 1 /* APP_DISCONNECT_REASON_LOCAL_EXCEPTION */; + case 2: + case "APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT": + return 2 /* APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT */; + case 3: + case "APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED": + return 3 /* APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED */; + case 4: + case "APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION": + return 4 /* APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION */; + case 5: + case "APP_DISCONNECT_REASON_REMOTE_EXCEPTION": + return 5 /* APP_DISCONNECT_REASON_REMOTE_EXCEPTION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appDisconnectReasonToJSON(object) { + switch (object) { + case 0 /* APP_DISCONNECT_REASON_UNSPECIFIED */: + return "APP_DISCONNECT_REASON_UNSPECIFIED"; + case 1 /* APP_DISCONNECT_REASON_LOCAL_EXCEPTION */: + return "APP_DISCONNECT_REASON_LOCAL_EXCEPTION"; + case 2 /* APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT */: + return "APP_DISCONNECT_REASON_KEYBOARD_INTERRUPT"; + case 3 /* APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED */: + return "APP_DISCONNECT_REASON_ENTRYPOINT_COMPLETED"; + case 4 /* APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION */: + return "APP_DISCONNECT_REASON_DEPLOYMENT_EXCEPTION"; + case 5 /* APP_DISCONNECT_REASON_REMOTE_EXCEPTION */: + return "APP_DISCONNECT_REASON_REMOTE_EXCEPTION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appStateFromJSON(object) { + switch (object) { + case 0: + case "APP_STATE_UNSPECIFIED": + return 0 /* APP_STATE_UNSPECIFIED */; + case 1: + case "APP_STATE_EPHEMERAL": + return 1 /* APP_STATE_EPHEMERAL */; + case 2: + case "APP_STATE_DETACHED": + return 2 /* APP_STATE_DETACHED */; + case 3: + case "APP_STATE_DEPLOYED": + return 3 /* APP_STATE_DEPLOYED */; + case 4: + case "APP_STATE_STOPPING": + return 4 /* APP_STATE_STOPPING */; + case 5: + case "APP_STATE_STOPPED": + return 5 /* APP_STATE_STOPPED */; + case 6: + case "APP_STATE_INITIALIZING": + return 6 /* APP_STATE_INITIALIZING */; + case 7: + case "APP_STATE_DISABLED": + return 7 /* APP_STATE_DISABLED */; + case 8: + case "APP_STATE_DETACHED_DISCONNECTED": + return 8 /* APP_STATE_DETACHED_DISCONNECTED */; + case 9: + case "APP_STATE_DERIVED": + return 9 /* APP_STATE_DERIVED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appStateToJSON(object) { + switch (object) { + case 0 /* APP_STATE_UNSPECIFIED */: + return "APP_STATE_UNSPECIFIED"; + case 1 /* APP_STATE_EPHEMERAL */: + return "APP_STATE_EPHEMERAL"; + case 2 /* APP_STATE_DETACHED */: + return "APP_STATE_DETACHED"; + case 3 /* APP_STATE_DEPLOYED */: + return "APP_STATE_DEPLOYED"; + case 4 /* APP_STATE_STOPPING */: + return "APP_STATE_STOPPING"; + case 5 /* APP_STATE_STOPPED */: + return "APP_STATE_STOPPED"; + case 6 /* APP_STATE_INITIALIZING */: + return "APP_STATE_INITIALIZING"; + case 7 /* APP_STATE_DISABLED */: + return "APP_STATE_DISABLED"; + case 8 /* APP_STATE_DETACHED_DISCONNECTED */: + return "APP_STATE_DETACHED_DISCONNECTED"; + case 9 /* APP_STATE_DERIVED */: + return "APP_STATE_DERIVED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function appStopSourceFromJSON(object) { + switch (object) { + case 0: + case "APP_STOP_SOURCE_UNSPECIFIED": + return 0 /* APP_STOP_SOURCE_UNSPECIFIED */; + case 1: + case "APP_STOP_SOURCE_CLI": + return 1 /* APP_STOP_SOURCE_CLI */; + case 2: + case "APP_STOP_SOURCE_PYTHON_CLIENT": + return 2 /* APP_STOP_SOURCE_PYTHON_CLIENT */; + case 3: + case "APP_STOP_SOURCE_WEB": + return 3 /* APP_STOP_SOURCE_WEB */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function appStopSourceToJSON(object) { + switch (object) { + case 0 /* APP_STOP_SOURCE_UNSPECIFIED */: + return "APP_STOP_SOURCE_UNSPECIFIED"; + case 1 /* APP_STOP_SOURCE_CLI */: + return "APP_STOP_SOURCE_CLI"; + case 2 /* APP_STOP_SOURCE_PYTHON_CLIENT */: + return "APP_STOP_SOURCE_PYTHON_CLIENT"; + case 3 /* APP_STOP_SOURCE_WEB */: + return "APP_STOP_SOURCE_WEB"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function certificateStatusFromJSON(object) { + switch (object) { + case 0: + case "CERTIFICATE_STATUS_PENDING": + return 0 /* CERTIFICATE_STATUS_PENDING */; + case 1: + case "CERTIFICATE_STATUS_ISSUED": + return 1 /* CERTIFICATE_STATUS_ISSUED */; + case 2: + case "CERTIFICATE_STATUS_FAILED": + return 2 /* CERTIFICATE_STATUS_FAILED */; + case 3: + case "CERTIFICATE_STATUS_REVOKED": + return 3 /* CERTIFICATE_STATUS_REVOKED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function certificateStatusToJSON(object) { + switch (object) { + case 0 /* CERTIFICATE_STATUS_PENDING */: + return "CERTIFICATE_STATUS_PENDING"; + case 1 /* CERTIFICATE_STATUS_ISSUED */: + return "CERTIFICATE_STATUS_ISSUED"; + case 2 /* CERTIFICATE_STATUS_FAILED */: + return "CERTIFICATE_STATUS_FAILED"; + case 3 /* CERTIFICATE_STATUS_REVOKED */: + return "CERTIFICATE_STATUS_REVOKED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function checkpointStatusFromJSON(object) { + switch (object) { + case 0: + case "CHECKPOINT_STATUS_UNSPECIFIED": + return 0 /* CHECKPOINT_STATUS_UNSPECIFIED */; + case 1: + case "CHECKPOINT_STATUS_PENDING": + return 1 /* CHECKPOINT_STATUS_PENDING */; + case 2: + case "CHECKPOINT_STATUS_PROCESSING": + return 2 /* CHECKPOINT_STATUS_PROCESSING */; + case 3: + case "CHECKPOINT_STATUS_READY": + return 3 /* CHECKPOINT_STATUS_READY */; + case 4: + case "CHECKPOINT_STATUS_FAILED": + return 4 /* CHECKPOINT_STATUS_FAILED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function checkpointStatusToJSON(object) { + switch (object) { + case 0 /* CHECKPOINT_STATUS_UNSPECIFIED */: + return "CHECKPOINT_STATUS_UNSPECIFIED"; + case 1 /* CHECKPOINT_STATUS_PENDING */: + return "CHECKPOINT_STATUS_PENDING"; + case 2 /* CHECKPOINT_STATUS_PROCESSING */: + return "CHECKPOINT_STATUS_PROCESSING"; + case 3 /* CHECKPOINT_STATUS_READY */: + return "CHECKPOINT_STATUS_READY"; + case 4 /* CHECKPOINT_STATUS_FAILED */: + return "CHECKPOINT_STATUS_FAILED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function cloudProviderFromJSON(object) { + switch (object) { + case 0: + case "CLOUD_PROVIDER_UNSPECIFIED": + return 0 /* CLOUD_PROVIDER_UNSPECIFIED */; + case 1: + case "CLOUD_PROVIDER_AWS": + return 1 /* CLOUD_PROVIDER_AWS */; + case 2: + case "CLOUD_PROVIDER_GCP": + return 2 /* CLOUD_PROVIDER_GCP */; + case 3: + case "CLOUD_PROVIDER_AUTO": + return 3 /* CLOUD_PROVIDER_AUTO */; + case 4: + case "CLOUD_PROVIDER_OCI": + return 4 /* CLOUD_PROVIDER_OCI */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function cloudProviderToJSON(object) { + switch (object) { + case 0 /* CLOUD_PROVIDER_UNSPECIFIED */: + return "CLOUD_PROVIDER_UNSPECIFIED"; + case 1 /* CLOUD_PROVIDER_AWS */: + return "CLOUD_PROVIDER_AWS"; + case 2 /* CLOUD_PROVIDER_GCP */: + return "CLOUD_PROVIDER_GCP"; + case 3 /* CLOUD_PROVIDER_AUTO */: + return "CLOUD_PROVIDER_AUTO"; + case 4 /* CLOUD_PROVIDER_OCI */: + return "CLOUD_PROVIDER_OCI"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function dNSRecordTypeFromJSON(object) { + switch (object) { + case 0: + case "DNS_RECORD_TYPE_A": + return 0 /* DNS_RECORD_TYPE_A */; + case 1: + case "DNS_RECORD_TYPE_TXT": + return 1 /* DNS_RECORD_TYPE_TXT */; + case 2: + case "DNS_RECORD_TYPE_CNAME": + return 2 /* DNS_RECORD_TYPE_CNAME */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function dNSRecordTypeToJSON(object) { + switch (object) { + case 0 /* DNS_RECORD_TYPE_A */: + return "DNS_RECORD_TYPE_A"; + case 1 /* DNS_RECORD_TYPE_TXT */: + return "DNS_RECORD_TYPE_TXT"; + case 2 /* DNS_RECORD_TYPE_CNAME */: + return "DNS_RECORD_TYPE_CNAME"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function dataFormatFromJSON(object) { + switch (object) { + case 0: + case "DATA_FORMAT_UNSPECIFIED": + return 0 /* DATA_FORMAT_UNSPECIFIED */; + case 1: + case "DATA_FORMAT_PICKLE": + return 1 /* DATA_FORMAT_PICKLE */; + case 2: + case "DATA_FORMAT_ASGI": + return 2 /* DATA_FORMAT_ASGI */; + case 3: + case "DATA_FORMAT_GENERATOR_DONE": + return 3 /* DATA_FORMAT_GENERATOR_DONE */; + case 4: + case "DATA_FORMAT_CBOR": + return 4 /* DATA_FORMAT_CBOR */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function dataFormatToJSON(object) { + switch (object) { + case 0 /* DATA_FORMAT_UNSPECIFIED */: + return "DATA_FORMAT_UNSPECIFIED"; + case 1 /* DATA_FORMAT_PICKLE */: + return "DATA_FORMAT_PICKLE"; + case 2 /* DATA_FORMAT_ASGI */: + return "DATA_FORMAT_ASGI"; + case 3 /* DATA_FORMAT_GENERATOR_DONE */: + return "DATA_FORMAT_GENERATOR_DONE"; + case 4 /* DATA_FORMAT_CBOR */: + return "DATA_FORMAT_CBOR"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function deploymentNamespaceFromJSON(object) { + switch (object) { + case 0: + case "DEPLOYMENT_NAMESPACE_UNSPECIFIED": + return 0 /* DEPLOYMENT_NAMESPACE_UNSPECIFIED */; + case 1: + case "DEPLOYMENT_NAMESPACE_WORKSPACE": + return 1 /* DEPLOYMENT_NAMESPACE_WORKSPACE */; + case 3: + case "DEPLOYMENT_NAMESPACE_GLOBAL": + return 3 /* DEPLOYMENT_NAMESPACE_GLOBAL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function deploymentNamespaceToJSON(object) { + switch (object) { + case 0 /* DEPLOYMENT_NAMESPACE_UNSPECIFIED */: + return "DEPLOYMENT_NAMESPACE_UNSPECIFIED"; + case 1 /* DEPLOYMENT_NAMESPACE_WORKSPACE */: + return "DEPLOYMENT_NAMESPACE_WORKSPACE"; + case 3 /* DEPLOYMENT_NAMESPACE_GLOBAL */: + return "DEPLOYMENT_NAMESPACE_GLOBAL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function execOutputOptionFromJSON(object) { + switch (object) { + case 0: + case "EXEC_OUTPUT_OPTION_UNSPECIFIED": + return 0 /* EXEC_OUTPUT_OPTION_UNSPECIFIED */; + case 1: + case "EXEC_OUTPUT_OPTION_DEVNULL": + return 1 /* EXEC_OUTPUT_OPTION_DEVNULL */; + case 2: + case "EXEC_OUTPUT_OPTION_PIPE": + return 2 /* EXEC_OUTPUT_OPTION_PIPE */; + case 3: + case "EXEC_OUTPUT_OPTION_STDOUT": + return 3 /* EXEC_OUTPUT_OPTION_STDOUT */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function execOutputOptionToJSON(object) { + switch (object) { + case 0 /* EXEC_OUTPUT_OPTION_UNSPECIFIED */: + return "EXEC_OUTPUT_OPTION_UNSPECIFIED"; + case 1 /* EXEC_OUTPUT_OPTION_DEVNULL */: + return "EXEC_OUTPUT_OPTION_DEVNULL"; + case 2 /* EXEC_OUTPUT_OPTION_PIPE */: + return "EXEC_OUTPUT_OPTION_PIPE"; + case 3 /* EXEC_OUTPUT_OPTION_STDOUT */: + return "EXEC_OUTPUT_OPTION_STDOUT"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function fileDescriptorFromJSON(object) { + switch (object) { + case 0: + case "FILE_DESCRIPTOR_UNSPECIFIED": + return 0 /* FILE_DESCRIPTOR_UNSPECIFIED */; + case 1: + case "FILE_DESCRIPTOR_STDOUT": + return 1 /* FILE_DESCRIPTOR_STDOUT */; + case 2: + case "FILE_DESCRIPTOR_STDERR": + return 2 /* FILE_DESCRIPTOR_STDERR */; + case 3: + case "FILE_DESCRIPTOR_INFO": + return 3 /* FILE_DESCRIPTOR_INFO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function fileDescriptorToJSON(object) { + switch (object) { + case 0 /* FILE_DESCRIPTOR_UNSPECIFIED */: + return "FILE_DESCRIPTOR_UNSPECIFIED"; + case 1 /* FILE_DESCRIPTOR_STDOUT */: + return "FILE_DESCRIPTOR_STDOUT"; + case 2 /* FILE_DESCRIPTOR_STDERR */: + return "FILE_DESCRIPTOR_STDERR"; + case 3 /* FILE_DESCRIPTOR_INFO */: + return "FILE_DESCRIPTOR_INFO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionCallInvocationTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY": + return 1 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY */; + case 2: + case "FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY": + return 2 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY */; + case 3: + case "FUNCTION_CALL_INVOCATION_TYPE_ASYNC": + return 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */; + case 4: + case "FUNCTION_CALL_INVOCATION_TYPE_SYNC": + return 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionCallInvocationTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED */: + return "FUNCTION_CALL_INVOCATION_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY */: + return "FUNCTION_CALL_INVOCATION_TYPE_SYNC_LEGACY"; + case 2 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY */: + return "FUNCTION_CALL_INVOCATION_TYPE_ASYNC_LEGACY"; + case 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */: + return "FUNCTION_CALL_INVOCATION_TYPE_ASYNC"; + case 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */: + return "FUNCTION_CALL_INVOCATION_TYPE_SYNC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionCallTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_CALL_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_CALL_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_CALL_TYPE_UNARY": + return 1 /* FUNCTION_CALL_TYPE_UNARY */; + case 2: + case "FUNCTION_CALL_TYPE_MAP": + return 2 /* FUNCTION_CALL_TYPE_MAP */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionCallTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_CALL_TYPE_UNSPECIFIED */: + return "FUNCTION_CALL_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_CALL_TYPE_UNARY */: + return "FUNCTION_CALL_TYPE_UNARY"; + case 2 /* FUNCTION_CALL_TYPE_MAP */: + return "FUNCTION_CALL_TYPE_MAP"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function gPUTypeFromJSON(object) { + switch (object) { + case 0: + case "GPU_TYPE_UNSPECIFIED": + return 0 /* GPU_TYPE_UNSPECIFIED */; + case 1: + case "GPU_TYPE_T4": + return 1 /* GPU_TYPE_T4 */; + case 2: + case "GPU_TYPE_A100": + return 2 /* GPU_TYPE_A100 */; + case 3: + case "GPU_TYPE_A10G": + return 3 /* GPU_TYPE_A10G */; + case 4: + case "GPU_TYPE_ANY": + return 4 /* GPU_TYPE_ANY */; + case 8: + case "GPU_TYPE_A100_80GB": + return 8 /* GPU_TYPE_A100_80GB */; + case 9: + case "GPU_TYPE_L4": + return 9 /* GPU_TYPE_L4 */; + case 10: + case "GPU_TYPE_H100": + return 10 /* GPU_TYPE_H100 */; + case 11: + case "GPU_TYPE_L40S": + return 11 /* GPU_TYPE_L40S */; + case 12: + case "GPU_TYPE_H200": + return 12 /* GPU_TYPE_H200 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function gPUTypeToJSON(object) { + switch (object) { + case 0 /* GPU_TYPE_UNSPECIFIED */: + return "GPU_TYPE_UNSPECIFIED"; + case 1 /* GPU_TYPE_T4 */: + return "GPU_TYPE_T4"; + case 2 /* GPU_TYPE_A100 */: + return "GPU_TYPE_A100"; + case 3 /* GPU_TYPE_A10G */: + return "GPU_TYPE_A10G"; + case 4 /* GPU_TYPE_ANY */: + return "GPU_TYPE_ANY"; + case 8 /* GPU_TYPE_A100_80GB */: + return "GPU_TYPE_A100_80GB"; + case 9 /* GPU_TYPE_L4 */: + return "GPU_TYPE_L4"; + case 10 /* GPU_TYPE_H100 */: + return "GPU_TYPE_H100"; + case 11 /* GPU_TYPE_L40S */: + return "GPU_TYPE_L40S"; + case 12 /* GPU_TYPE_H200 */: + return "GPU_TYPE_H200"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function objectCreationTypeFromJSON(object) { + switch (object) { + case 0: + case "OBJECT_CREATION_TYPE_UNSPECIFIED": + return 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */; + case 1: + case "OBJECT_CREATION_TYPE_CREATE_IF_MISSING": + return 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */; + case 2: + case "OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS": + return 2 /* OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS */; + case 3: + case "OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS": + return 3 /* OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS */; + case 4: + case "OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP": + return 4 /* OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */; + case 5: + case "OBJECT_CREATION_TYPE_EPHEMERAL": + return 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function objectCreationTypeToJSON(object) { + switch (object) { + case 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */: + return "OBJECT_CREATION_TYPE_UNSPECIFIED"; + case 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */: + return "OBJECT_CREATION_TYPE_CREATE_IF_MISSING"; + case 2 /* OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS */: + return "OBJECT_CREATION_TYPE_CREATE_FAIL_IF_EXISTS"; + case 3 /* OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS */: + return "OBJECT_CREATION_TYPE_CREATE_OVERWRITE_IF_EXISTS"; + case 4 /* OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP */: + return "OBJECT_CREATION_TYPE_ANONYMOUS_OWNED_BY_APP"; + case 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */: + return "OBJECT_CREATION_TYPE_EPHEMERAL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function parameterTypeFromJSON(object) { + switch (object) { + case 0: + case "PARAM_TYPE_UNSPECIFIED": + return 0 /* PARAM_TYPE_UNSPECIFIED */; + case 1: + case "PARAM_TYPE_STRING": + return 1 /* PARAM_TYPE_STRING */; + case 2: + case "PARAM_TYPE_INT": + return 2 /* PARAM_TYPE_INT */; + case 3: + case "PARAM_TYPE_PICKLE": + return 3 /* PARAM_TYPE_PICKLE */; + case 4: + case "PARAM_TYPE_BYTES": + return 4 /* PARAM_TYPE_BYTES */; + case 5: + case "PARAM_TYPE_UNKNOWN": + return 5 /* PARAM_TYPE_UNKNOWN */; + case 6: + case "PARAM_TYPE_LIST": + return 6 /* PARAM_TYPE_LIST */; + case 7: + case "PARAM_TYPE_DICT": + return 7 /* PARAM_TYPE_DICT */; + case 8: + case "PARAM_TYPE_NONE": + return 8 /* PARAM_TYPE_NONE */; + case 9: + case "PARAM_TYPE_BOOL": + return 9 /* PARAM_TYPE_BOOL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function parameterTypeToJSON(object) { + switch (object) { + case 0 /* PARAM_TYPE_UNSPECIFIED */: + return "PARAM_TYPE_UNSPECIFIED"; + case 1 /* PARAM_TYPE_STRING */: + return "PARAM_TYPE_STRING"; + case 2 /* PARAM_TYPE_INT */: + return "PARAM_TYPE_INT"; + case 3 /* PARAM_TYPE_PICKLE */: + return "PARAM_TYPE_PICKLE"; + case 4 /* PARAM_TYPE_BYTES */: + return "PARAM_TYPE_BYTES"; + case 5 /* PARAM_TYPE_UNKNOWN */: + return "PARAM_TYPE_UNKNOWN"; + case 6 /* PARAM_TYPE_LIST */: + return "PARAM_TYPE_LIST"; + case 7 /* PARAM_TYPE_DICT */: + return "PARAM_TYPE_DICT"; + case 8 /* PARAM_TYPE_NONE */: + return "PARAM_TYPE_NONE"; + case 9 /* PARAM_TYPE_BOOL */: + return "PARAM_TYPE_BOOL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function progressTypeFromJSON(object) { + switch (object) { + case 0: + case "IMAGE_SNAPSHOT_UPLOAD": + return 0 /* IMAGE_SNAPSHOT_UPLOAD */; + case 1: + case "FUNCTION_QUEUED": + return 1 /* FUNCTION_QUEUED */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function progressTypeToJSON(object) { + switch (object) { + case 0 /* IMAGE_SNAPSHOT_UPLOAD */: + return "IMAGE_SNAPSHOT_UPLOAD"; + case 1 /* FUNCTION_QUEUED */: + return "FUNCTION_QUEUED"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function proxyIpStatusFromJSON(object) { + switch (object) { + case 0: + case "PROXY_IP_STATUS_UNSPECIFIED": + return 0 /* PROXY_IP_STATUS_UNSPECIFIED */; + case 1: + case "PROXY_IP_STATUS_CREATING": + return 1 /* PROXY_IP_STATUS_CREATING */; + case 2: + case "PROXY_IP_STATUS_ONLINE": + return 2 /* PROXY_IP_STATUS_ONLINE */; + case 3: + case "PROXY_IP_STATUS_TERMINATED": + return 3 /* PROXY_IP_STATUS_TERMINATED */; + case 4: + case "PROXY_IP_STATUS_UNHEALTHY": + return 4 /* PROXY_IP_STATUS_UNHEALTHY */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function proxyIpStatusToJSON(object) { + switch (object) { + case 0 /* PROXY_IP_STATUS_UNSPECIFIED */: + return "PROXY_IP_STATUS_UNSPECIFIED"; + case 1 /* PROXY_IP_STATUS_CREATING */: + return "PROXY_IP_STATUS_CREATING"; + case 2 /* PROXY_IP_STATUS_ONLINE */: + return "PROXY_IP_STATUS_ONLINE"; + case 3 /* PROXY_IP_STATUS_TERMINATED */: + return "PROXY_IP_STATUS_TERMINATED"; + case 4 /* PROXY_IP_STATUS_UNHEALTHY */: + return "PROXY_IP_STATUS_UNHEALTHY"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function rateLimitIntervalFromJSON(object) { + switch (object) { + case 0: + case "RATE_LIMIT_INTERVAL_UNSPECIFIED": + return 0 /* RATE_LIMIT_INTERVAL_UNSPECIFIED */; + case 1: + case "RATE_LIMIT_INTERVAL_SECOND": + return 1 /* RATE_LIMIT_INTERVAL_SECOND */; + case 2: + case "RATE_LIMIT_INTERVAL_MINUTE": + return 2 /* RATE_LIMIT_INTERVAL_MINUTE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function rateLimitIntervalToJSON(object) { + switch (object) { + case 0 /* RATE_LIMIT_INTERVAL_UNSPECIFIED */: + return "RATE_LIMIT_INTERVAL_UNSPECIFIED"; + case 1 /* RATE_LIMIT_INTERVAL_SECOND */: + return "RATE_LIMIT_INTERVAL_SECOND"; + case 2 /* RATE_LIMIT_INTERVAL_MINUTE */: + return "RATE_LIMIT_INTERVAL_MINUTE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function registryAuthTypeFromJSON(object) { + switch (object) { + case 0: + case "REGISTRY_AUTH_TYPE_UNSPECIFIED": + return 0 /* REGISTRY_AUTH_TYPE_UNSPECIFIED */; + case 1: + case "REGISTRY_AUTH_TYPE_AWS": + return 1 /* REGISTRY_AUTH_TYPE_AWS */; + case 2: + case "REGISTRY_AUTH_TYPE_GCP": + return 2 /* REGISTRY_AUTH_TYPE_GCP */; + case 3: + case "REGISTRY_AUTH_TYPE_PUBLIC": + return 3 /* REGISTRY_AUTH_TYPE_PUBLIC */; + case 4: + case "REGISTRY_AUTH_TYPE_STATIC_CREDS": + return 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function registryAuthTypeToJSON(object) { + switch (object) { + case 0 /* REGISTRY_AUTH_TYPE_UNSPECIFIED */: + return "REGISTRY_AUTH_TYPE_UNSPECIFIED"; + case 1 /* REGISTRY_AUTH_TYPE_AWS */: + return "REGISTRY_AUTH_TYPE_AWS"; + case 2 /* REGISTRY_AUTH_TYPE_GCP */: + return "REGISTRY_AUTH_TYPE_GCP"; + case 3 /* REGISTRY_AUTH_TYPE_PUBLIC */: + return "REGISTRY_AUTH_TYPE_PUBLIC"; + case 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */: + return "REGISTRY_AUTH_TYPE_STATIC_CREDS"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function seekWhenceFromJSON(object) { + switch (object) { + case 0: + case "SEEK_SET": + return 0 /* SEEK_SET */; + case 1: + case "SEEK_CUR": + return 1 /* SEEK_CUR */; + case 2: + case "SEEK_END": + return 2 /* SEEK_END */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function seekWhenceToJSON(object) { + switch (object) { + case 0 /* SEEK_SET */: + return "SEEK_SET"; + case 1 /* SEEK_CUR */: + return "SEEK_CUR"; + case 2 /* SEEK_END */: + return "SEEK_END"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function systemErrorCodeFromJSON(object) { + switch (object) { + case 0: + case "SYSTEM_ERROR_CODE_UNSPECIFIED": + return 0 /* SYSTEM_ERROR_CODE_UNSPECIFIED */; + case 1: + case "SYSTEM_ERROR_CODE_PERM": + return 1 /* SYSTEM_ERROR_CODE_PERM */; + case 2: + case "SYSTEM_ERROR_CODE_NOENT": + return 2 /* SYSTEM_ERROR_CODE_NOENT */; + case 5: + case "SYSTEM_ERROR_CODE_IO": + return 5 /* SYSTEM_ERROR_CODE_IO */; + case 6: + case "SYSTEM_ERROR_CODE_NXIO": + return 6 /* SYSTEM_ERROR_CODE_NXIO */; + case 12: + case "SYSTEM_ERROR_CODE_NOMEM": + return 12 /* SYSTEM_ERROR_CODE_NOMEM */; + case 13: + case "SYSTEM_ERROR_CODE_ACCES": + return 13 /* SYSTEM_ERROR_CODE_ACCES */; + case 17: + case "SYSTEM_ERROR_CODE_EXIST": + return 17 /* SYSTEM_ERROR_CODE_EXIST */; + case 20: + case "SYSTEM_ERROR_CODE_NOTDIR": + return 20 /* SYSTEM_ERROR_CODE_NOTDIR */; + case 21: + case "SYSTEM_ERROR_CODE_ISDIR": + return 21 /* SYSTEM_ERROR_CODE_ISDIR */; + case 22: + case "SYSTEM_ERROR_CODE_INVAL": + return 22 /* SYSTEM_ERROR_CODE_INVAL */; + case 24: + case "SYSTEM_ERROR_CODE_MFILE": + return 24 /* SYSTEM_ERROR_CODE_MFILE */; + case 27: + case "SYSTEM_ERROR_CODE_FBIG": + return 27 /* SYSTEM_ERROR_CODE_FBIG */; + case 28: + case "SYSTEM_ERROR_CODE_NOSPC": + return 28 /* SYSTEM_ERROR_CODE_NOSPC */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function systemErrorCodeToJSON(object) { + switch (object) { + case 0 /* SYSTEM_ERROR_CODE_UNSPECIFIED */: + return "SYSTEM_ERROR_CODE_UNSPECIFIED"; + case 1 /* SYSTEM_ERROR_CODE_PERM */: + return "SYSTEM_ERROR_CODE_PERM"; + case 2 /* SYSTEM_ERROR_CODE_NOENT */: + return "SYSTEM_ERROR_CODE_NOENT"; + case 5 /* SYSTEM_ERROR_CODE_IO */: + return "SYSTEM_ERROR_CODE_IO"; + case 6 /* SYSTEM_ERROR_CODE_NXIO */: + return "SYSTEM_ERROR_CODE_NXIO"; + case 12 /* SYSTEM_ERROR_CODE_NOMEM */: + return "SYSTEM_ERROR_CODE_NOMEM"; + case 13 /* SYSTEM_ERROR_CODE_ACCES */: + return "SYSTEM_ERROR_CODE_ACCES"; + case 17 /* SYSTEM_ERROR_CODE_EXIST */: + return "SYSTEM_ERROR_CODE_EXIST"; + case 20 /* SYSTEM_ERROR_CODE_NOTDIR */: + return "SYSTEM_ERROR_CODE_NOTDIR"; + case 21 /* SYSTEM_ERROR_CODE_ISDIR */: + return "SYSTEM_ERROR_CODE_ISDIR"; + case 22 /* SYSTEM_ERROR_CODE_INVAL */: + return "SYSTEM_ERROR_CODE_INVAL"; + case 24 /* SYSTEM_ERROR_CODE_MFILE */: + return "SYSTEM_ERROR_CODE_MFILE"; + case 27 /* SYSTEM_ERROR_CODE_FBIG */: + return "SYSTEM_ERROR_CODE_FBIG"; + case 28 /* SYSTEM_ERROR_CODE_NOSPC */: + return "SYSTEM_ERROR_CODE_NOSPC"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function taskSnapshotBehaviorFromJSON(object) { + switch (object) { + case 0: + case "TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED": + return 0 /* TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED */; + case 1: + case "TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT": + return 1 /* TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT */; + case 2: + case "TASK_SNAPSHOT_BEHAVIOR_RESTORE": + return 2 /* TASK_SNAPSHOT_BEHAVIOR_RESTORE */; + case 3: + case "TASK_SNAPSHOT_BEHAVIOR_NONE": + return 3 /* TASK_SNAPSHOT_BEHAVIOR_NONE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function taskSnapshotBehaviorToJSON(object) { + switch (object) { + case 0 /* TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED */: + return "TASK_SNAPSHOT_BEHAVIOR_UNSPECIFIED"; + case 1 /* TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT */: + return "TASK_SNAPSHOT_BEHAVIOR_SNAPSHOT"; + case 2 /* TASK_SNAPSHOT_BEHAVIOR_RESTORE */: + return "TASK_SNAPSHOT_BEHAVIOR_RESTORE"; + case 3 /* TASK_SNAPSHOT_BEHAVIOR_NONE */: + return "TASK_SNAPSHOT_BEHAVIOR_NONE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function taskStateFromJSON(object) { + switch (object) { + case 0: + case "TASK_STATE_UNSPECIFIED": + return 0 /* TASK_STATE_UNSPECIFIED */; + case 6: + case "TASK_STATE_CREATED": + return 6 /* TASK_STATE_CREATED */; + case 1: + case "TASK_STATE_QUEUED": + return 1 /* TASK_STATE_QUEUED */; + case 2: + case "TASK_STATE_WORKER_ASSIGNED": + return 2 /* TASK_STATE_WORKER_ASSIGNED */; + case 3: + case "TASK_STATE_LOADING_IMAGE": + return 3 /* TASK_STATE_LOADING_IMAGE */; + case 4: + case "TASK_STATE_ACTIVE": + return 4 /* TASK_STATE_ACTIVE */; + case 5: + case "TASK_STATE_COMPLETED": + return 5 /* TASK_STATE_COMPLETED */; + case 7: + case "TASK_STATE_CREATING_CONTAINER": + return 7 /* TASK_STATE_CREATING_CONTAINER */; + case 8: + case "TASK_STATE_IDLE": + return 8 /* TASK_STATE_IDLE */; + case 9: + case "TASK_STATE_PREEMPTIBLE": + return 9 /* TASK_STATE_PREEMPTIBLE */; + case 10: + case "TASK_STATE_PREEMPTED": + return 10 /* TASK_STATE_PREEMPTED */; + case 11: + case "TASK_STATE_LOADING_CHECKPOINT_IMAGE": + return 11 /* TASK_STATE_LOADING_CHECKPOINT_IMAGE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function taskStateToJSON(object) { + switch (object) { + case 0 /* TASK_STATE_UNSPECIFIED */: + return "TASK_STATE_UNSPECIFIED"; + case 6 /* TASK_STATE_CREATED */: + return "TASK_STATE_CREATED"; + case 1 /* TASK_STATE_QUEUED */: + return "TASK_STATE_QUEUED"; + case 2 /* TASK_STATE_WORKER_ASSIGNED */: + return "TASK_STATE_WORKER_ASSIGNED"; + case 3 /* TASK_STATE_LOADING_IMAGE */: + return "TASK_STATE_LOADING_IMAGE"; + case 4 /* TASK_STATE_ACTIVE */: + return "TASK_STATE_ACTIVE"; + case 5 /* TASK_STATE_COMPLETED */: + return "TASK_STATE_COMPLETED"; + case 7 /* TASK_STATE_CREATING_CONTAINER */: + return "TASK_STATE_CREATING_CONTAINER"; + case 8 /* TASK_STATE_IDLE */: + return "TASK_STATE_IDLE"; + case 9 /* TASK_STATE_PREEMPTIBLE */: + return "TASK_STATE_PREEMPTIBLE"; + case 10 /* TASK_STATE_PREEMPTED */: + return "TASK_STATE_PREEMPTED"; + case 11 /* TASK_STATE_LOADING_CHECKPOINT_IMAGE */: + return "TASK_STATE_LOADING_CHECKPOINT_IMAGE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function tunnelTypeFromJSON(object) { + switch (object) { + case 0: + case "TUNNEL_TYPE_UNSPECIFIED": + return 0 /* TUNNEL_TYPE_UNSPECIFIED */; + case 1: + case "TUNNEL_TYPE_H2": + return 1 /* TUNNEL_TYPE_H2 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function tunnelTypeToJSON(object) { + switch (object) { + case 0 /* TUNNEL_TYPE_UNSPECIFIED */: + return "TUNNEL_TYPE_UNSPECIFIED"; + case 1 /* TUNNEL_TYPE_H2 */: + return "TUNNEL_TYPE_H2"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function volumeFsVersionFromJSON(object) { + switch (object) { + case 0: + case "VOLUME_FS_VERSION_UNSPECIFIED": + return 0 /* VOLUME_FS_VERSION_UNSPECIFIED */; + case 1: + case "VOLUME_FS_VERSION_V1": + return 1 /* VOLUME_FS_VERSION_V1 */; + case 2: + case "VOLUME_FS_VERSION_V2": + return 2 /* VOLUME_FS_VERSION_V2 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function volumeFsVersionToJSON(object) { + switch (object) { + case 0 /* VOLUME_FS_VERSION_UNSPECIFIED */: + return "VOLUME_FS_VERSION_UNSPECIFIED"; + case 1 /* VOLUME_FS_VERSION_V1 */: + return "VOLUME_FS_VERSION_V1"; + case 2 /* VOLUME_FS_VERSION_V2 */: + return "VOLUME_FS_VERSION_V2"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function webhookAsyncModeFromJSON(object) { + switch (object) { + case 0: + case "WEBHOOK_ASYNC_MODE_UNSPECIFIED": + return 0 /* WEBHOOK_ASYNC_MODE_UNSPECIFIED */; + case 2: + case "WEBHOOK_ASYNC_MODE_DISABLED": + return 2 /* WEBHOOK_ASYNC_MODE_DISABLED */; + case 3: + case "WEBHOOK_ASYNC_MODE_TRIGGER": + return 3 /* WEBHOOK_ASYNC_MODE_TRIGGER */; + case 4: + case "WEBHOOK_ASYNC_MODE_AUTO": + return 4 /* WEBHOOK_ASYNC_MODE_AUTO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function webhookAsyncModeToJSON(object) { + switch (object) { + case 0 /* WEBHOOK_ASYNC_MODE_UNSPECIFIED */: + return "WEBHOOK_ASYNC_MODE_UNSPECIFIED"; + case 2 /* WEBHOOK_ASYNC_MODE_DISABLED */: + return "WEBHOOK_ASYNC_MODE_DISABLED"; + case 3 /* WEBHOOK_ASYNC_MODE_TRIGGER */: + return "WEBHOOK_ASYNC_MODE_TRIGGER"; + case 4 /* WEBHOOK_ASYNC_MODE_AUTO */: + return "WEBHOOK_ASYNC_MODE_AUTO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function webhookTypeFromJSON(object) { + switch (object) { + case 0: + case "WEBHOOK_TYPE_UNSPECIFIED": + return 0 /* WEBHOOK_TYPE_UNSPECIFIED */; + case 1: + case "WEBHOOK_TYPE_ASGI_APP": + return 1 /* WEBHOOK_TYPE_ASGI_APP */; + case 2: + case "WEBHOOK_TYPE_FUNCTION": + return 2 /* WEBHOOK_TYPE_FUNCTION */; + case 3: + case "WEBHOOK_TYPE_WSGI_APP": + return 3 /* WEBHOOK_TYPE_WSGI_APP */; + case 4: + case "WEBHOOK_TYPE_WEB_SERVER": + return 4 /* WEBHOOK_TYPE_WEB_SERVER */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function webhookTypeToJSON(object) { + switch (object) { + case 0 /* WEBHOOK_TYPE_UNSPECIFIED */: + return "WEBHOOK_TYPE_UNSPECIFIED"; + case 1 /* WEBHOOK_TYPE_ASGI_APP */: + return "WEBHOOK_TYPE_ASGI_APP"; + case 2 /* WEBHOOK_TYPE_FUNCTION */: + return "WEBHOOK_TYPE_FUNCTION"; + case 3 /* WEBHOOK_TYPE_WSGI_APP */: + return "WEBHOOK_TYPE_WSGI_APP"; + case 4 /* WEBHOOK_TYPE_WEB_SERVER */: + return "WEBHOOK_TYPE_WEB_SERVER"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function classParameterInfo_ParameterSerializationFormatFromJSON(object) { + switch (object) { + case 0: + case "PARAM_SERIALIZATION_FORMAT_UNSPECIFIED": + return 0 /* PARAM_SERIALIZATION_FORMAT_UNSPECIFIED */; + case 1: + case "PARAM_SERIALIZATION_FORMAT_PICKLE": + return 1 /* PARAM_SERIALIZATION_FORMAT_PICKLE */; + case 2: + case "PARAM_SERIALIZATION_FORMAT_PROTO": + return 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function classParameterInfo_ParameterSerializationFormatToJSON(object) { + switch (object) { + case 0 /* PARAM_SERIALIZATION_FORMAT_UNSPECIFIED */: + return "PARAM_SERIALIZATION_FORMAT_UNSPECIFIED"; + case 1 /* PARAM_SERIALIZATION_FORMAT_PICKLE */: + return "PARAM_SERIALIZATION_FORMAT_PICKLE"; + case 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */: + return "PARAM_SERIALIZATION_FORMAT_PROTO"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function cloudBucketMount_BucketTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "S3": + return 1 /* S3 */; + case 2: + case "R2": + return 2 /* R2 */; + case 3: + case "GCP": + return 3 /* GCP */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function cloudBucketMount_BucketTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* S3 */: + return "S3"; + case 2 /* R2 */: + return "R2"; + case 3 /* GCP */: + return "GCP"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function fileEntry_FileTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "FILE": + return 1 /* FILE */; + case 2: + case "DIRECTORY": + return 2 /* DIRECTORY */; + case 3: + case "SYMLINK": + return 3 /* SYMLINK */; + case 4: + case "FIFO": + return 4 /* FIFO */; + case 5: + case "SOCKET": + return 5 /* SOCKET */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function fileEntry_FileTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* FILE */: + return "FILE"; + case 2 /* DIRECTORY */: + return "DIRECTORY"; + case 3 /* SYMLINK */: + return "SYMLINK"; + case 4 /* FIFO */: + return "FIFO"; + case 5 /* SOCKET */: + return "SOCKET"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function function_DefinitionTypeFromJSON(object) { + switch (object) { + case 0: + case "DEFINITION_TYPE_UNSPECIFIED": + return 0 /* DEFINITION_TYPE_UNSPECIFIED */; + case 1: + case "DEFINITION_TYPE_SERIALIZED": + return 1 /* DEFINITION_TYPE_SERIALIZED */; + case 2: + case "DEFINITION_TYPE_FILE": + return 2 /* DEFINITION_TYPE_FILE */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function function_DefinitionTypeToJSON(object) { + switch (object) { + case 0 /* DEFINITION_TYPE_UNSPECIFIED */: + return "DEFINITION_TYPE_UNSPECIFIED"; + case 1 /* DEFINITION_TYPE_SERIALIZED */: + return "DEFINITION_TYPE_SERIALIZED"; + case 2 /* DEFINITION_TYPE_FILE */: + return "DEFINITION_TYPE_FILE"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function function_FunctionTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_TYPE_UNSPECIFIED": + return 0 /* FUNCTION_TYPE_UNSPECIFIED */; + case 1: + case "FUNCTION_TYPE_GENERATOR": + return 1 /* FUNCTION_TYPE_GENERATOR */; + case 2: + case "FUNCTION_TYPE_FUNCTION": + return 2 /* FUNCTION_TYPE_FUNCTION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function function_FunctionTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_TYPE_UNSPECIFIED */: + return "FUNCTION_TYPE_UNSPECIFIED"; + case 1 /* FUNCTION_TYPE_GENERATOR */: + return "FUNCTION_TYPE_GENERATOR"; + case 2 /* FUNCTION_TYPE_FUNCTION */: + return "FUNCTION_TYPE_FUNCTION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function functionSchema_FunctionSchemaTypeFromJSON(object) { + switch (object) { + case 0: + case "FUNCTION_SCHEMA_UNSPECIFIED": + return 0 /* FUNCTION_SCHEMA_UNSPECIFIED */; + case 1: + case "FUNCTION_SCHEMA_V1": + return 1 /* FUNCTION_SCHEMA_V1 */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function functionSchema_FunctionSchemaTypeToJSON(object) { + switch (object) { + case 0 /* FUNCTION_SCHEMA_UNSPECIFIED */: + return "FUNCTION_SCHEMA_UNSPECIFIED"; + case 1 /* FUNCTION_SCHEMA_V1 */: + return "FUNCTION_SCHEMA_V1"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function genericResult_GenericStatusFromJSON(object) { + switch (object) { + case 0: + case "GENERIC_STATUS_UNSPECIFIED": + return 0 /* GENERIC_STATUS_UNSPECIFIED */; + case 1: + case "GENERIC_STATUS_SUCCESS": + return 1 /* GENERIC_STATUS_SUCCESS */; + case 2: + case "GENERIC_STATUS_FAILURE": + return 2 /* GENERIC_STATUS_FAILURE */; + case 3: + case "GENERIC_STATUS_TERMINATED": + return 3 /* GENERIC_STATUS_TERMINATED */; + case 4: + case "GENERIC_STATUS_TIMEOUT": + return 4 /* GENERIC_STATUS_TIMEOUT */; + case 5: + case "GENERIC_STATUS_INIT_FAILURE": + return 5 /* GENERIC_STATUS_INIT_FAILURE */; + case 6: + case "GENERIC_STATUS_INTERNAL_FAILURE": + return 6 /* GENERIC_STATUS_INTERNAL_FAILURE */; + case 7: + case "GENERIC_STATUS_IDLE_TIMEOUT": + return 7 /* GENERIC_STATUS_IDLE_TIMEOUT */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function genericResult_GenericStatusToJSON(object) { + switch (object) { + case 0 /* GENERIC_STATUS_UNSPECIFIED */: + return "GENERIC_STATUS_UNSPECIFIED"; + case 1 /* GENERIC_STATUS_SUCCESS */: + return "GENERIC_STATUS_SUCCESS"; + case 2 /* GENERIC_STATUS_FAILURE */: + return "GENERIC_STATUS_FAILURE"; + case 3 /* GENERIC_STATUS_TERMINATED */: + return "GENERIC_STATUS_TERMINATED"; + case 4 /* GENERIC_STATUS_TIMEOUT */: + return "GENERIC_STATUS_TIMEOUT"; + case 5 /* GENERIC_STATUS_INIT_FAILURE */: + return "GENERIC_STATUS_INIT_FAILURE"; + case 6 /* GENERIC_STATUS_INTERNAL_FAILURE */: + return "GENERIC_STATUS_INTERNAL_FAILURE"; + case 7 /* GENERIC_STATUS_IDLE_TIMEOUT */: + return "GENERIC_STATUS_IDLE_TIMEOUT"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function networkAccess_NetworkAccessTypeFromJSON(object) { + switch (object) { + case 0: + case "UNSPECIFIED": + return 0 /* UNSPECIFIED */; + case 1: + case "OPEN": + return 1 /* OPEN */; + case 2: + case "BLOCKED": + return 2 /* BLOCKED */; + case 3: + case "ALLOWLIST": + return 3 /* ALLOWLIST */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function networkAccess_NetworkAccessTypeToJSON(object) { + switch (object) { + case 0 /* UNSPECIFIED */: + return "UNSPECIFIED"; + case 1 /* OPEN */: + return "OPEN"; + case 2 /* BLOCKED */: + return "BLOCKED"; + case 3 /* ALLOWLIST */: + return "ALLOWLIST"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function pTYInfo_PTYTypeFromJSON(object) { + switch (object) { + case 0: + case "PTY_TYPE_UNSPECIFIED": + return 0 /* PTY_TYPE_UNSPECIFIED */; + case 1: + case "PTY_TYPE_FUNCTION": + return 1 /* PTY_TYPE_FUNCTION */; + case 2: + case "PTY_TYPE_SHELL": + return 2 /* PTY_TYPE_SHELL */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function pTYInfo_PTYTypeToJSON(object) { + switch (object) { + case 0 /* PTY_TYPE_UNSPECIFIED */: + return "PTY_TYPE_UNSPECIFIED"; + case 1 /* PTY_TYPE_FUNCTION */: + return "PTY_TYPE_FUNCTION"; + case 2 /* PTY_TYPE_SHELL */: + return "PTY_TYPE_SHELL"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(object) { + switch (object) { + case 0: + case "SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED": + return 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */; + case 1: + case "SANDBOX_NAME_OVERRIDE_TYPE_NONE": + return 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */; + case 2: + case "SANDBOX_NAME_OVERRIDE_TYPE_STRING": + return 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function sandboxRestoreRequest_SandboxNameOverrideTypeToJSON(object) { + switch (object) { + case 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */: + return "SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED"; + case 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */: + return "SANDBOX_NAME_OVERRIDE_TYPE_NONE"; + case 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */: + return "SANDBOX_NAME_OVERRIDE_TYPE_STRING"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function warning_WarningTypeFromJSON(object) { + switch (object) { + case 0: + case "WARNING_TYPE_UNSPECIFIED": + return 0 /* WARNING_TYPE_UNSPECIFIED */; + case 1: + case "WARNING_TYPE_CLIENT_DEPRECATION": + return 1 /* WARNING_TYPE_CLIENT_DEPRECATION */; + case 2: + case "WARNING_TYPE_RESOURCE_LIMIT": + return 2 /* WARNING_TYPE_RESOURCE_LIMIT */; + case 3: + case "WARNING_TYPE_FUNCTION_CONFIGURATION": + return 3 /* WARNING_TYPE_FUNCTION_CONFIGURATION */; + case -1: + case "UNRECOGNIZED": + default: + return -1 /* UNRECOGNIZED */; + } +} +function warning_WarningTypeToJSON(object) { + switch (object) { + case 0 /* WARNING_TYPE_UNSPECIFIED */: + return "WARNING_TYPE_UNSPECIFIED"; + case 1 /* WARNING_TYPE_CLIENT_DEPRECATION */: + return "WARNING_TYPE_CLIENT_DEPRECATION"; + case 2 /* WARNING_TYPE_RESOURCE_LIMIT */: + return "WARNING_TYPE_RESOURCE_LIMIT"; + case 3 /* WARNING_TYPE_FUNCTION_CONFIGURATION */: + return "WARNING_TYPE_FUNCTION_CONFIGURATION"; + case -1 /* UNRECOGNIZED */: + default: + return "UNRECOGNIZED"; + } +} +function createBaseAppClientDisconnectRequest() { + return { appId: "", reason: 0, exception: "" }; +} +var AppClientDisconnectRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.reason !== 0) { + writer.uint32(16).int32(message.reason); + } + if (message.exception !== "") { + writer.uint32(26).string(message.exception); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppClientDisconnectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.reason = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.exception = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + reason: isSet4(object.reason) ? appDisconnectReasonFromJSON(object.reason) : 0, + exception: isSet4(object.exception) ? globalThis.String(object.exception) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.reason !== 0) { + obj.reason = appDisconnectReasonToJSON(message.reason); + } + if (message.exception !== "") { + obj.exception = message.exception; + } + return obj; + }, + create(base) { + return AppClientDisconnectRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppClientDisconnectRequest(); + message.appId = object.appId ?? ""; + message.reason = object.reason ?? 0; + message.exception = object.exception ?? ""; + return message; + } +}; +function createBaseAppCreateRequest() { + return { clientId: "", description: "", environmentName: "", appState: 0 }; +} +var AppCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.environmentName !== "") { + writer.uint32(42).string(message.environmentName); + } + if (message.appState !== 0) { + writer.uint32(48).int32(message.appState); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clientId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.appState = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clientId: isSet4(object.clientId) ? globalThis.String(object.clientId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + appState: isSet4(object.appState) ? appStateFromJSON(object.appState) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.appState !== 0) { + obj.appState = appStateToJSON(message.appState); + } + return obj; + }, + create(base) { + return AppCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppCreateRequest(); + message.clientId = object.clientId ?? ""; + message.description = object.description ?? ""; + message.environmentName = object.environmentName ?? ""; + message.appState = object.appState ?? 0; + return message; + } +}; +function createBaseAppCreateResponse() { + return { appId: "", appPageUrl: "", appLogsUrl: "" }; +} +var AppCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.appPageUrl !== "") { + writer.uint32(18).string(message.appPageUrl); + } + if (message.appLogsUrl !== "") { + writer.uint32(26).string(message.appLogsUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appPageUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appLogsUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + appPageUrl: isSet4(object.appPageUrl) ? globalThis.String(object.appPageUrl) : "", + appLogsUrl: isSet4(object.appLogsUrl) ? globalThis.String(object.appLogsUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.appPageUrl !== "") { + obj.appPageUrl = message.appPageUrl; + } + if (message.appLogsUrl !== "") { + obj.appLogsUrl = message.appLogsUrl; + } + return obj; + }, + create(base) { + return AppCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppCreateResponse(); + message.appId = object.appId ?? ""; + message.appPageUrl = object.appPageUrl ?? ""; + message.appLogsUrl = object.appLogsUrl ?? ""; + return message; + } +}; +function createBaseAppDeployRequest() { + return { appId: "", name: "", objectEntity: "", visibility: 0, tag: "" }; +} +var AppDeployRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.objectEntity !== "") { + writer.uint32(34).string(message.objectEntity); + } + if (message.visibility !== 0) { + writer.uint32(40).int32(message.visibility); + } + if (message.tag !== "") { + writer.uint32(50).string(message.tag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeployRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.objectEntity = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.visibility = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "", + objectEntity: isSet4(object.objectEntity) ? globalThis.String(object.objectEntity) : "", + visibility: isSet4(object.visibility) ? appDeployVisibilityFromJSON(object.visibility) : 0, + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.objectEntity !== "") { + obj.objectEntity = message.objectEntity; + } + if (message.visibility !== 0) { + obj.visibility = appDeployVisibilityToJSON(message.visibility); + } + if (message.tag !== "") { + obj.tag = message.tag; + } + return obj; + }, + create(base) { + return AppDeployRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeployRequest(); + message.appId = object.appId ?? ""; + message.name = object.name ?? ""; + message.objectEntity = object.objectEntity ?? ""; + message.visibility = object.visibility ?? 0; + message.tag = object.tag ?? ""; + return message; + } +}; +function createBaseAppDeployResponse() { + return { url: "" }; +} +var AppDeployResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeployResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return AppDeployResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeployResponse(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseAppDeploymentHistory() { + return { + appId: "", + version: 0, + clientVersion: "", + deployedAt: 0, + deployedBy: "", + deployedByAvatarUrl: "", + tag: "", + rollbackVersion: 0, + rollbackAllowed: false, + commitInfo: void 0 + }; +} +var AppDeploymentHistory = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + if (message.clientVersion !== "") { + writer.uint32(26).string(message.clientVersion); + } + if (message.deployedAt !== 0) { + writer.uint32(33).double(message.deployedAt); + } + if (message.deployedBy !== "") { + writer.uint32(42).string(message.deployedBy); + } + if (message.deployedByAvatarUrl !== "") { + writer.uint32(74).string(message.deployedByAvatarUrl); + } + if (message.tag !== "") { + writer.uint32(50).string(message.tag); + } + if (message.rollbackVersion !== 0) { + writer.uint32(56).uint32(message.rollbackVersion); + } + if (message.rollbackAllowed !== false) { + writer.uint32(64).bool(message.rollbackAllowed); + } + if (message.commitInfo !== void 0) { + CommitInfo.encode(message.commitInfo, writer.uint32(82).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistory(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clientVersion = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.deployedAt = reader.double(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.deployedBy = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.deployedByAvatarUrl = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tag = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.rollbackVersion = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rollbackAllowed = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.commitInfo = CommitInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? globalThis.Number(object.version) : 0, + clientVersion: isSet4(object.clientVersion) ? globalThis.String(object.clientVersion) : "", + deployedAt: isSet4(object.deployedAt) ? globalThis.Number(object.deployedAt) : 0, + deployedBy: isSet4(object.deployedBy) ? globalThis.String(object.deployedBy) : "", + deployedByAvatarUrl: isSet4(object.deployedByAvatarUrl) ? globalThis.String(object.deployedByAvatarUrl) : "", + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "", + rollbackVersion: isSet4(object.rollbackVersion) ? globalThis.Number(object.rollbackVersion) : 0, + rollbackAllowed: isSet4(object.rollbackAllowed) ? globalThis.Boolean(object.rollbackAllowed) : false, + commitInfo: isSet4(object.commitInfo) ? CommitInfo.fromJSON(object.commitInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.clientVersion !== "") { + obj.clientVersion = message.clientVersion; + } + if (message.deployedAt !== 0) { + obj.deployedAt = message.deployedAt; + } + if (message.deployedBy !== "") { + obj.deployedBy = message.deployedBy; + } + if (message.deployedByAvatarUrl !== "") { + obj.deployedByAvatarUrl = message.deployedByAvatarUrl; + } + if (message.tag !== "") { + obj.tag = message.tag; + } + if (message.rollbackVersion !== 0) { + obj.rollbackVersion = Math.round(message.rollbackVersion); + } + if (message.rollbackAllowed !== false) { + obj.rollbackAllowed = message.rollbackAllowed; + } + if (message.commitInfo !== void 0) { + obj.commitInfo = CommitInfo.toJSON(message.commitInfo); + } + return obj; + }, + create(base) { + return AppDeploymentHistory.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistory(); + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + message.clientVersion = object.clientVersion ?? ""; + message.deployedAt = object.deployedAt ?? 0; + message.deployedBy = object.deployedBy ?? ""; + message.deployedByAvatarUrl = object.deployedByAvatarUrl ?? ""; + message.tag = object.tag ?? ""; + message.rollbackVersion = object.rollbackVersion ?? 0; + message.rollbackAllowed = object.rollbackAllowed ?? false; + message.commitInfo = object.commitInfo !== void 0 && object.commitInfo !== null ? CommitInfo.fromPartial(object.commitInfo) : void 0; + return message; + } +}; +function createBaseAppDeploymentHistoryRequest() { + return { appId: "" }; +} +var AppDeploymentHistoryRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppDeploymentHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistoryRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppDeploymentHistoryResponse() { + return { appDeploymentHistories: [] }; +} +var AppDeploymentHistoryResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.appDeploymentHistories) { + AppDeploymentHistory.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppDeploymentHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appDeploymentHistories.push(AppDeploymentHistory.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appDeploymentHistories: globalThis.Array.isArray(object?.appDeploymentHistories) ? object.appDeploymentHistories.map((e) => AppDeploymentHistory.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appDeploymentHistories?.length) { + obj.appDeploymentHistories = message.appDeploymentHistories.map((e) => AppDeploymentHistory.toJSON(e)); + } + return obj; + }, + create(base) { + return AppDeploymentHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppDeploymentHistoryResponse(); + message.appDeploymentHistories = object.appDeploymentHistories?.map((e) => AppDeploymentHistory.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppGetByDeploymentNameRequest() { + return { name: "", environmentName: "" }; +} +var AppGetByDeploymentNameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetByDeploymentNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppGetByDeploymentNameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetByDeploymentNameRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppGetByDeploymentNameResponse() { + return { appId: "" }; +} +var AppGetByDeploymentNameResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetByDeploymentNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetByDeploymentNameResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetByDeploymentNameResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetLayoutRequest() { + return { appId: "" }; +} +var AppGetLayoutRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLayoutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetLayoutRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLayoutRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetLayoutResponse() { + return { appLayout: void 0 }; +} +var AppGetLayoutResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appLayout !== void 0) { + AppLayout.encode(message.appLayout, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLayoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appLayout = AppLayout.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appLayout: isSet4(object.appLayout) ? AppLayout.fromJSON(object.appLayout) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.appLayout !== void 0) { + obj.appLayout = AppLayout.toJSON(message.appLayout); + } + return obj; + }, + create(base) { + return AppGetLayoutResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLayoutResponse(); + message.appLayout = object.appLayout !== void 0 && object.appLayout !== null ? AppLayout.fromPartial(object.appLayout) : void 0; + return message; + } +}; +function createBaseAppGetLogsRequest() { + return { + appId: "", + timeout: 0, + lastEntryId: "", + functionId: "", + inputId: "", + taskId: "", + functionCallId: "", + fileDescriptor: 0, + sandboxId: "" + }; +} +var AppGetLogsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(34).string(message.lastEntryId); + } + if (message.functionId !== "") { + writer.uint32(42).string(message.functionId); + } + if (message.inputId !== "") { + writer.uint32(50).string(message.inputId); + } + if (message.taskId !== "") { + writer.uint32(58).string(message.taskId); + } + if (message.functionCallId !== "") { + writer.uint32(74).string(message.functionCallId); + } + if (message.fileDescriptor !== 0) { + writer.uint32(64).int32(message.fileDescriptor); + } + if (message.sandboxId !== "") { + writer.uint32(82).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetLogsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.functionId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.inputId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.taskId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return AppGetLogsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetLogsRequest(); + message.appId = object.appId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.functionId = object.functionId ?? ""; + message.inputId = object.inputId ?? ""; + message.taskId = object.taskId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseAppGetObjectsItem() { + return { tag: "", object: void 0 }; +} +var AppGetObjectsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.tag !== "") { + writer.uint32(10).string(message.tag); + } + if (message.object !== void 0) { + Object_.encode(message.object, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tag = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.object = Object_.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tag: isSet4(object.tag) ? globalThis.String(object.tag) : "", + object: isSet4(object.object) ? Object_.fromJSON(object.object) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.tag !== "") { + obj.tag = message.tag; + } + if (message.object !== void 0) { + obj.object = Object_.toJSON(message.object); + } + return obj; + }, + create(base) { + return AppGetObjectsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsItem(); + message.tag = object.tag ?? ""; + message.object = object.object !== void 0 && object.object !== null ? Object_.fromPartial(object.object) : void 0; + return message; + } +}; +function createBaseAppGetObjectsRequest() { + return { appId: "", includeUnindexed: false, onlyClassFunction: false }; +} +var AppGetObjectsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.includeUnindexed !== false) { + writer.uint32(16).bool(message.includeUnindexed); + } + if (message.onlyClassFunction !== false) { + writer.uint32(24).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.includeUnindexed = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + includeUnindexed: isSet4(object.includeUnindexed) ? globalThis.Boolean(object.includeUnindexed) : false, + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.includeUnindexed !== false) { + obj.includeUnindexed = message.includeUnindexed; + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return AppGetObjectsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsRequest(); + message.appId = object.appId ?? ""; + message.includeUnindexed = object.includeUnindexed ?? false; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseAppGetObjectsResponse() { + return { items: [] }; +} +var AppGetObjectsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + AppGetObjectsItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetObjectsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.items.push(AppGetObjectsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => AppGetObjectsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => AppGetObjectsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return AppGetObjectsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetObjectsResponse(); + message.items = object.items?.map((e) => AppGetObjectsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppGetOrCreateRequest() { + return { appName: "", environmentName: "", objectCreationType: 0 }; +} +var AppGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(24).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return AppGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetOrCreateRequest(); + message.appName = object.appName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseAppGetOrCreateResponse() { + return { appId: "" }; +} +var AppGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetOrCreateResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetTagsRequest() { + return { appId: "" }; +} +var AppGetTagsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppGetTagsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppGetTagsResponse() { + return { tags: {} }; +} +var AppGetTagsResponse = { + encode(message, writer = new BinaryWriter()) { + Object.entries(message.tags).forEach(([key, value]) => { + AppGetTagsResponse_TagsEntry.encode({ key, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + const entry1 = AppGetTagsResponse_TagsEntry.decode(reader, reader.uint32()); + if (entry1.value !== void 0) { + message.tags[entry1.key] = entry1.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppGetTagsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsResponse(); + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppGetTagsResponse_TagsEntry() { + return { key: "", value: "" }; +} +var AppGetTagsResponse_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppGetTagsResponse_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppGetTagsResponse_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppGetTagsResponse_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppHeartbeatRequest() { + return { appId: "" }; +} +var AppHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppHeartbeatRequest(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppLayout() { + return { objects: [], functionIds: {}, classIds: {} }; +} +var AppLayout = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.objects) { + Object_.encode(v, writer.uint32(10).fork()).join(); + } + Object.entries(message.functionIds).forEach(([key, value]) => { + AppLayout_FunctionIdsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + Object.entries(message.classIds).forEach(([key, value]) => { + AppLayout_ClassIdsEntry.encode({ key, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objects.push(Object_.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppLayout_FunctionIdsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.functionIds[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + const entry3 = AppLayout_ClassIdsEntry.decode(reader, reader.uint32()); + if (entry3.value !== void 0) { + message.classIds[entry3.key] = entry3.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objects: globalThis.Array.isArray(object?.objects) ? object.objects.map((e) => Object_.fromJSON(e)) : [], + functionIds: isObject2(object.functionIds) ? Object.entries(object.functionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + classIds: isObject2(object.classIds) ? Object.entries(object.classIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.objects?.length) { + obj.objects = message.objects.map((e) => Object_.toJSON(e)); + } + if (message.functionIds) { + const entries = Object.entries(message.functionIds); + if (entries.length > 0) { + obj.functionIds = {}; + entries.forEach(([k, v]) => { + obj.functionIds[k] = v; + }); + } + } + if (message.classIds) { + const entries = Object.entries(message.classIds); + if (entries.length > 0) { + obj.classIds = {}; + entries.forEach(([k, v]) => { + obj.classIds[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppLayout.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout(); + message.objects = object.objects?.map((e) => Object_.fromPartial(e)) || []; + message.functionIds = Object.entries(object.functionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.classIds = Object.entries(object.classIds ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppLayout_FunctionIdsEntry() { + return { key: "", value: "" }; +} +var AppLayout_FunctionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout_FunctionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppLayout_FunctionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout_FunctionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppLayout_ClassIdsEntry() { + return { key: "", value: "" }; +} +var AppLayout_ClassIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLayout_ClassIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppLayout_ClassIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLayout_ClassIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppListRequest() { + return { environmentName: "" }; +} +var AppListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppListResponse() { + return { apps: [] }; +} +var AppListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.apps) { + AppListResponse_AppListItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.apps.push(AppListResponse_AppListItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + apps: globalThis.Array.isArray(object?.apps) ? object.apps.map((e) => AppListResponse_AppListItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.apps?.length) { + obj.apps = message.apps.map((e) => AppListResponse_AppListItem.toJSON(e)); + } + return obj; + }, + create(base) { + return AppListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListResponse(); + message.apps = object.apps?.map((e) => AppListResponse_AppListItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppListResponse_AppListItem() { + return { appId: "", description: "", state: 0, createdAt: 0, stoppedAt: 0, nRunningTasks: 0, name: "" }; +} +var AppListResponse_AppListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.createdAt !== 0) { + writer.uint32(41).double(message.createdAt); + } + if (message.stoppedAt !== 0) { + writer.uint32(49).double(message.stoppedAt); + } + if (message.nRunningTasks !== 0) { + writer.uint32(64).int32(message.nRunningTasks); + } + if (message.name !== "") { + writer.uint32(82).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppListResponse_AppListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.description = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.state = reader.int32(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.stoppedAt = reader.double(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.nRunningTasks = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + state: isSet4(object.state) ? appStateFromJSON(object.state) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + stoppedAt: isSet4(object.stoppedAt) ? globalThis.Number(object.stoppedAt) : 0, + nRunningTasks: isSet4(object.nRunningTasks) ? globalThis.Number(object.nRunningTasks) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.state !== 0) { + obj.state = appStateToJSON(message.state); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.stoppedAt !== 0) { + obj.stoppedAt = message.stoppedAt; + } + if (message.nRunningTasks !== 0) { + obj.nRunningTasks = Math.round(message.nRunningTasks); + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return AppListResponse_AppListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppListResponse_AppListItem(); + message.appId = object.appId ?? ""; + message.description = object.description ?? ""; + message.state = object.state ?? 0; + message.createdAt = object.createdAt ?? 0; + message.stoppedAt = object.stoppedAt ?? 0; + message.nRunningTasks = object.nRunningTasks ?? 0; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseAppLookupRequest() { + return { appName: "", environmentName: "" }; +} +var AppLookupRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(18).string(message.appName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLookupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.appName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return AppLookupRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLookupRequest(); + message.appName = object.appName ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseAppLookupResponse() { + return { appId: "" }; +} +var AppLookupResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppLookupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return AppLookupResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppLookupResponse(); + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseAppPublishRequest() { + return { + appId: "", + name: "", + deploymentTag: "", + appState: 0, + functionIds: {}, + classIds: {}, + definitionIds: {}, + rollbackVersion: 0, + clientVersion: "", + commitInfo: void 0, + tags: {} + }; +} +var AppPublishRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.deploymentTag !== "") { + writer.uint32(26).string(message.deploymentTag); + } + if (message.appState !== 0) { + writer.uint32(32).int32(message.appState); + } + Object.entries(message.functionIds).forEach(([key, value]) => { + AppPublishRequest_FunctionIdsEntry.encode({ key, value }, writer.uint32(42).fork()).join(); + }); + Object.entries(message.classIds).forEach(([key, value]) => { + AppPublishRequest_ClassIdsEntry.encode({ key, value }, writer.uint32(50).fork()).join(); + }); + Object.entries(message.definitionIds).forEach(([key, value]) => { + AppPublishRequest_DefinitionIdsEntry.encode({ key, value }, writer.uint32(58).fork()).join(); + }); + if (message.rollbackVersion !== 0) { + writer.uint32(64).uint32(message.rollbackVersion); + } + if (message.clientVersion !== "") { + writer.uint32(74).string(message.clientVersion); + } + if (message.commitInfo !== void 0) { + CommitInfo.encode(message.commitInfo, writer.uint32(82).fork()).join(); + } + Object.entries(message.tags).forEach(([key, value]) => { + AppPublishRequest_TagsEntry.encode({ key, value }, writer.uint32(90).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.deploymentTag = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.appState = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + const entry5 = AppPublishRequest_FunctionIdsEntry.decode(reader, reader.uint32()); + if (entry5.value !== void 0) { + message.functionIds[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + const entry6 = AppPublishRequest_ClassIdsEntry.decode(reader, reader.uint32()); + if (entry6.value !== void 0) { + message.classIds[entry6.key] = entry6.value; + } + continue; + } + case 7: { + if (tag !== 58) { + break; + } + const entry7 = AppPublishRequest_DefinitionIdsEntry.decode(reader, reader.uint32()); + if (entry7.value !== void 0) { + message.definitionIds[entry7.key] = entry7.value; + } + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rollbackVersion = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.clientVersion = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.commitInfo = CommitInfo.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + const entry11 = AppPublishRequest_TagsEntry.decode(reader, reader.uint32()); + if (entry11.value !== void 0) { + message.tags[entry11.key] = entry11.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "", + deploymentTag: isSet4(object.deploymentTag) ? globalThis.String(object.deploymentTag) : "", + appState: isSet4(object.appState) ? appStateFromJSON(object.appState) : 0, + functionIds: isObject2(object.functionIds) ? Object.entries(object.functionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + classIds: isObject2(object.classIds) ? Object.entries(object.classIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + definitionIds: isObject2(object.definitionIds) ? Object.entries(object.definitionIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + rollbackVersion: isSet4(object.rollbackVersion) ? globalThis.Number(object.rollbackVersion) : 0, + clientVersion: isSet4(object.clientVersion) ? globalThis.String(object.clientVersion) : "", + commitInfo: isSet4(object.commitInfo) ? CommitInfo.fromJSON(object.commitInfo) : void 0, + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.deploymentTag !== "") { + obj.deploymentTag = message.deploymentTag; + } + if (message.appState !== 0) { + obj.appState = appStateToJSON(message.appState); + } + if (message.functionIds) { + const entries = Object.entries(message.functionIds); + if (entries.length > 0) { + obj.functionIds = {}; + entries.forEach(([k, v]) => { + obj.functionIds[k] = v; + }); + } + } + if (message.classIds) { + const entries = Object.entries(message.classIds); + if (entries.length > 0) { + obj.classIds = {}; + entries.forEach(([k, v]) => { + obj.classIds[k] = v; + }); + } + } + if (message.definitionIds) { + const entries = Object.entries(message.definitionIds); + if (entries.length > 0) { + obj.definitionIds = {}; + entries.forEach(([k, v]) => { + obj.definitionIds[k] = v; + }); + } + } + if (message.rollbackVersion !== 0) { + obj.rollbackVersion = Math.round(message.rollbackVersion); + } + if (message.clientVersion !== "") { + obj.clientVersion = message.clientVersion; + } + if (message.commitInfo !== void 0) { + obj.commitInfo = CommitInfo.toJSON(message.commitInfo); + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppPublishRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest(); + message.appId = object.appId ?? ""; + message.name = object.name ?? ""; + message.deploymentTag = object.deploymentTag ?? ""; + message.appState = object.appState ?? 0; + message.functionIds = Object.entries(object.functionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.classIds = Object.entries(object.classIds ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.definitionIds = Object.entries(object.definitionIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.rollbackVersion = object.rollbackVersion ?? 0; + message.clientVersion = object.clientVersion ?? ""; + message.commitInfo = object.commitInfo !== void 0 && object.commitInfo !== null ? CommitInfo.fromPartial(object.commitInfo) : void 0; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppPublishRequest_FunctionIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_FunctionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_FunctionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_FunctionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_FunctionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_ClassIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_ClassIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_ClassIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_ClassIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_ClassIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_DefinitionIdsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_DefinitionIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_DefinitionIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_DefinitionIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_DefinitionIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishRequest_TagsEntry() { + return { key: "", value: "" }; +} +var AppPublishRequest_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishRequest_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppPublishRequest_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishRequest_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppPublishResponse() { + return { url: "", serverWarnings: [] }; +} +var AppPublishResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppPublishResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + url: isSet4(object.url) ? globalThis.String(object.url) : "", + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return AppPublishResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppPublishResponse(); + message.url = object.url ?? ""; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseAppRollbackRequest() { + return { appId: "", version: 0 }; +} +var AppRollbackRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppRollbackRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? globalThis.Number(object.version) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + create(base) { + return AppRollbackRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppRollbackRequest(); + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + return message; + } +}; +function createBaseAppSetObjectsRequest() { + return { appId: "", indexedObjectIds: {}, clientId: "", unindexedObjectIds: [], newAppState: 0 }; +} +var AppSetObjectsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + Object.entries(message.indexedObjectIds).forEach(([key, value]) => { + AppSetObjectsRequest_IndexedObjectIdsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + if (message.clientId !== "") { + writer.uint32(26).string(message.clientId); + } + for (const v of message.unindexedObjectIds) { + writer.uint32(34).string(v); + } + if (message.newAppState !== 0) { + writer.uint32(40).int32(message.newAppState); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetObjectsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppSetObjectsRequest_IndexedObjectIdsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.indexedObjectIds[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clientId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.unindexedObjectIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.newAppState = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + indexedObjectIds: isObject2(object.indexedObjectIds) ? Object.entries(object.indexedObjectIds).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + clientId: isSet4(object.clientId) ? globalThis.String(object.clientId) : "", + unindexedObjectIds: globalThis.Array.isArray(object?.unindexedObjectIds) ? object.unindexedObjectIds.map((e) => globalThis.String(e)) : [], + newAppState: isSet4(object.newAppState) ? appStateFromJSON(object.newAppState) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.indexedObjectIds) { + const entries = Object.entries(message.indexedObjectIds); + if (entries.length > 0) { + obj.indexedObjectIds = {}; + entries.forEach(([k, v]) => { + obj.indexedObjectIds[k] = v; + }); + } + } + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.unindexedObjectIds?.length) { + obj.unindexedObjectIds = message.unindexedObjectIds; + } + if (message.newAppState !== 0) { + obj.newAppState = appStateToJSON(message.newAppState); + } + return obj; + }, + create(base) { + return AppSetObjectsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetObjectsRequest(); + message.appId = object.appId ?? ""; + message.indexedObjectIds = Object.entries(object.indexedObjectIds ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.clientId = object.clientId ?? ""; + message.unindexedObjectIds = object.unindexedObjectIds?.map((e) => e) || []; + message.newAppState = object.newAppState ?? 0; + return message; + } +}; +function createBaseAppSetObjectsRequest_IndexedObjectIdsEntry() { + return { key: "", value: "" }; +} +var AppSetObjectsRequest_IndexedObjectIdsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetObjectsRequest_IndexedObjectIdsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppSetObjectsRequest_IndexedObjectIdsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetObjectsRequest_IndexedObjectIdsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppSetTagsRequest() { + return { appId: "", tags: {} }; +} +var AppSetTagsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + Object.entries(message.tags).forEach(([key, value]) => { + AppSetTagsRequest_TagsEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetTagsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = AppSetTagsRequest_TagsEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.tags[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return AppSetTagsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetTagsRequest(); + message.appId = object.appId ?? ""; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseAppSetTagsRequest_TagsEntry() { + return { key: "", value: "" }; +} +var AppSetTagsRequest_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppSetTagsRequest_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return AppSetTagsRequest_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppSetTagsRequest_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseAppStopRequest() { + return { appId: "", source: 0 }; +} +var AppStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.source !== 0) { + writer.uint32(16).int32(message.source); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAppStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.source = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + source: isSet4(object.source) ? appStopSourceFromJSON(object.source) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.source !== 0) { + obj.source = appStopSourceToJSON(message.source); + } + return obj; + }, + create(base) { + return AppStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAppStopRequest(); + message.appId = object.appId ?? ""; + message.source = object.source ?? 0; + return message; + } +}; +function createBaseAttemptAwaitRequest() { + return { attemptToken: "", requestedAt: 0, timeoutSecs: 0 }; +} +var AttemptAwaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + if (message.requestedAt !== 0) { + writer.uint32(17).double(message.requestedAt); + } + if (message.timeoutSecs !== 0) { + writer.uint32(29).float(message.timeoutSecs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptAwaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeoutSecs = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "", + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = message.timeoutSecs; + } + return obj; + }, + create(base) { + return AttemptAwaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptAwaitRequest(); + message.attemptToken = object.attemptToken ?? ""; + message.requestedAt = object.requestedAt ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + return message; + } +}; +function createBaseAttemptAwaitResponse() { + return { output: void 0 }; +} +var AttemptAwaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.output !== void 0) { + FunctionGetOutputsItem.encode(message.output, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptAwaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.output = FunctionGetOutputsItem.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { output: isSet4(object.output) ? FunctionGetOutputsItem.fromJSON(object.output) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.output !== void 0) { + obj.output = FunctionGetOutputsItem.toJSON(message.output); + } + return obj; + }, + create(base) { + return AttemptAwaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptAwaitResponse(); + message.output = object.output !== void 0 && object.output !== null ? FunctionGetOutputsItem.fromPartial(object.output) : void 0; + return message; + } +}; +function createBaseAttemptRetryRequest() { + return { functionId: "", parentInputId: "", input: void 0, attemptToken: "" }; +} +var AttemptRetryRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(26).fork()).join(); + } + if (message.attemptToken !== "") { + writer.uint32(34).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptRetryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return AttemptRetryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptRetryRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseAttemptRetryResponse() { + return { attemptToken: "" }; +} +var AttemptRetryResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptRetryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return AttemptRetryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptRetryResponse(); + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseAttemptStartRequest() { + return { functionId: "", parentInputId: "", input: void 0 }; +} +var AttemptStartRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptStartRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + return obj; + }, + create(base) { + return AttemptStartRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptStartRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseAttemptStartResponse() { + return { attemptToken: "", retryPolicy: void 0 }; +} +var AttemptStartResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.attemptToken !== "") { + writer.uint32(10).string(message.attemptToken); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAttemptStartResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "", + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + return obj; + }, + create(base) { + return AttemptStartResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAttemptStartResponse(); + message.attemptToken = object.attemptToken ?? ""; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + return message; + } +}; +function createBaseAuthTokenGetRequest() { + return {}; +} +var AuthTokenGetRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAuthTokenGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return AuthTokenGetRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseAuthTokenGetRequest(); + return message; + } +}; +function createBaseAuthTokenGetResponse() { + return { token: "" }; +} +var AuthTokenGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAuthTokenGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { token: isSet4(object.token) ? globalThis.String(object.token) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + create(base) { + return AuthTokenGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAuthTokenGetResponse(); + message.token = object.token ?? ""; + return message; + } +}; +function createBaseAutoscalerSettings() { + return { + minContainers: void 0, + maxContainers: void 0, + bufferContainers: void 0, + scaleupWindow: void 0, + scaledownWindow: void 0 + }; +} +var AutoscalerSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.minContainers !== void 0) { + writer.uint32(8).uint32(message.minContainers); + } + if (message.maxContainers !== void 0) { + writer.uint32(16).uint32(message.maxContainers); + } + if (message.bufferContainers !== void 0) { + writer.uint32(24).uint32(message.bufferContainers); + } + if (message.scaleupWindow !== void 0) { + writer.uint32(32).uint32(message.scaleupWindow); + } + if (message.scaledownWindow !== void 0) { + writer.uint32(40).uint32(message.scaledownWindow); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAutoscalerSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.minContainers = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.maxContainers = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.bufferContainers = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.scaleupWindow = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.scaledownWindow = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minContainers: isSet4(object.minContainers) ? globalThis.Number(object.minContainers) : void 0, + maxContainers: isSet4(object.maxContainers) ? globalThis.Number(object.maxContainers) : void 0, + bufferContainers: isSet4(object.bufferContainers) ? globalThis.Number(object.bufferContainers) : void 0, + scaleupWindow: isSet4(object.scaleupWindow) ? globalThis.Number(object.scaleupWindow) : void 0, + scaledownWindow: isSet4(object.scaledownWindow) ? globalThis.Number(object.scaledownWindow) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.minContainers !== void 0) { + obj.minContainers = Math.round(message.minContainers); + } + if (message.maxContainers !== void 0) { + obj.maxContainers = Math.round(message.maxContainers); + } + if (message.bufferContainers !== void 0) { + obj.bufferContainers = Math.round(message.bufferContainers); + } + if (message.scaleupWindow !== void 0) { + obj.scaleupWindow = Math.round(message.scaleupWindow); + } + if (message.scaledownWindow !== void 0) { + obj.scaledownWindow = Math.round(message.scaledownWindow); + } + return obj; + }, + create(base) { + return AutoscalerSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAutoscalerSettings(); + message.minContainers = object.minContainers ?? void 0; + message.maxContainers = object.maxContainers ?? void 0; + message.bufferContainers = object.bufferContainers ?? void 0; + message.scaleupWindow = object.scaleupWindow ?? void 0; + message.scaledownWindow = object.scaledownWindow ?? void 0; + return message; + } +}; +function createBaseAutoscalingMetrics() { + return { cpuUsagePercent: 0, memoryUsagePercent: 0, concurrentRequests: 0, timestamp: 0 }; +} +var AutoscalingMetrics = { + encode(message, writer = new BinaryWriter()) { + if (message.cpuUsagePercent !== 0) { + writer.uint32(9).double(message.cpuUsagePercent); + } + if (message.memoryUsagePercent !== 0) { + writer.uint32(17).double(message.memoryUsagePercent); + } + if (message.concurrentRequests !== 0) { + writer.uint32(24).uint32(message.concurrentRequests); + } + if (message.timestamp !== 0) { + writer.uint32(33).double(message.timestamp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseAutoscalingMetrics(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + message.cpuUsagePercent = reader.double(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.memoryUsagePercent = reader.double(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.concurrentRequests = reader.uint32(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.timestamp = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cpuUsagePercent: isSet4(object.cpuUsagePercent) ? globalThis.Number(object.cpuUsagePercent) : 0, + memoryUsagePercent: isSet4(object.memoryUsagePercent) ? globalThis.Number(object.memoryUsagePercent) : 0, + concurrentRequests: isSet4(object.concurrentRequests) ? globalThis.Number(object.concurrentRequests) : 0, + timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cpuUsagePercent !== 0) { + obj.cpuUsagePercent = message.cpuUsagePercent; + } + if (message.memoryUsagePercent !== 0) { + obj.memoryUsagePercent = message.memoryUsagePercent; + } + if (message.concurrentRequests !== 0) { + obj.concurrentRequests = Math.round(message.concurrentRequests); + } + if (message.timestamp !== 0) { + obj.timestamp = message.timestamp; + } + return obj; + }, + create(base) { + return AutoscalingMetrics.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAutoscalingMetrics(); + message.cpuUsagePercent = object.cpuUsagePercent ?? 0; + message.memoryUsagePercent = object.memoryUsagePercent ?? 0; + message.concurrentRequests = object.concurrentRequests ?? 0; + message.timestamp = object.timestamp ?? 0; + return message; + } +}; +function createBaseBaseImage() { + return { imageId: "", dockerTag: "" }; +} +var BaseImage = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.dockerTag !== "") { + writer.uint32(18).string(message.dockerTag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBaseImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dockerTag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + dockerTag: isSet4(object.dockerTag) ? globalThis.String(object.dockerTag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.dockerTag !== "") { + obj.dockerTag = message.dockerTag; + } + return obj; + }, + create(base) { + return BaseImage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBaseImage(); + message.imageId = object.imageId ?? ""; + message.dockerTag = object.dockerTag ?? ""; + return message; + } +}; +function createBaseBlobCreateRequest() { + return { contentMd5: "", contentSha256Base64: "", contentLength: 0 }; +} +var BlobCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.contentMd5 !== "") { + writer.uint32(10).string(message.contentMd5); + } + if (message.contentSha256Base64 !== "") { + writer.uint32(18).string(message.contentSha256Base64); + } + if (message.contentLength !== 0) { + writer.uint32(24).int64(message.contentLength); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentMd5 = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contentSha256Base64 = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.contentLength = longToNumber2(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentMd5: isSet4(object.contentMd5) ? globalThis.String(object.contentMd5) : "", + contentSha256Base64: isSet4(object.contentSha256Base64) ? globalThis.String(object.contentSha256Base64) : "", + contentLength: isSet4(object.contentLength) ? globalThis.Number(object.contentLength) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentMd5 !== "") { + obj.contentMd5 = message.contentMd5; + } + if (message.contentSha256Base64 !== "") { + obj.contentSha256Base64 = message.contentSha256Base64; + } + if (message.contentLength !== 0) { + obj.contentLength = Math.round(message.contentLength); + } + return obj; + }, + create(base) { + return BlobCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobCreateRequest(); + message.contentMd5 = object.contentMd5 ?? ""; + message.contentSha256Base64 = object.contentSha256Base64 ?? ""; + message.contentLength = object.contentLength ?? 0; + return message; + } +}; +function createBaseBlobCreateResponse() { + return { + blobId: "", + uploadUrl: void 0, + multipart: void 0, + blobIds: [], + uploadUrls: void 0, + multiparts: void 0 + }; +} +var BlobCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.blobId !== "") { + writer.uint32(18).string(message.blobId); + } + if (message.uploadUrl !== void 0) { + writer.uint32(10).string(message.uploadUrl); + } + if (message.multipart !== void 0) { + MultiPartUpload.encode(message.multipart, writer.uint32(26).fork()).join(); + } + for (const v of message.blobIds) { + writer.uint32(34).string(v); + } + if (message.uploadUrls !== void 0) { + UploadUrlList.encode(message.uploadUrls, writer.uint32(42).fork()).join(); + } + if (message.multiparts !== void 0) { + MultiPartUploadList.encode(message.multiparts, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.blobId = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + message.uploadUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.multipart = MultiPartUpload.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.blobIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uploadUrls = UploadUrlList.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.multiparts = MultiPartUploadList.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blobId: isSet4(object.blobId) ? globalThis.String(object.blobId) : "", + uploadUrl: isSet4(object.uploadUrl) ? globalThis.String(object.uploadUrl) : void 0, + multipart: isSet4(object.multipart) ? MultiPartUpload.fromJSON(object.multipart) : void 0, + blobIds: globalThis.Array.isArray(object?.blobIds) ? object.blobIds.map((e) => globalThis.String(e)) : [], + uploadUrls: isSet4(object.uploadUrls) ? UploadUrlList.fromJSON(object.uploadUrls) : void 0, + multiparts: isSet4(object.multiparts) ? MultiPartUploadList.fromJSON(object.multiparts) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.blobId !== "") { + obj.blobId = message.blobId; + } + if (message.uploadUrl !== void 0) { + obj.uploadUrl = message.uploadUrl; + } + if (message.multipart !== void 0) { + obj.multipart = MultiPartUpload.toJSON(message.multipart); + } + if (message.blobIds?.length) { + obj.blobIds = message.blobIds; + } + if (message.uploadUrls !== void 0) { + obj.uploadUrls = UploadUrlList.toJSON(message.uploadUrls); + } + if (message.multiparts !== void 0) { + obj.multiparts = MultiPartUploadList.toJSON(message.multiparts); + } + return obj; + }, + create(base) { + return BlobCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobCreateResponse(); + message.blobId = object.blobId ?? ""; + message.uploadUrl = object.uploadUrl ?? void 0; + message.multipart = object.multipart !== void 0 && object.multipart !== null ? MultiPartUpload.fromPartial(object.multipart) : void 0; + message.blobIds = object.blobIds?.map((e) => e) || []; + message.uploadUrls = object.uploadUrls !== void 0 && object.uploadUrls !== null ? UploadUrlList.fromPartial(object.uploadUrls) : void 0; + message.multiparts = object.multiparts !== void 0 && object.multiparts !== null ? MultiPartUploadList.fromPartial(object.multiparts) : void 0; + return message; + } +}; +function createBaseBlobGetRequest() { + return { blobId: "" }; +} +var BlobGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.blobId !== "") { + writer.uint32(10).string(message.blobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.blobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { blobId: isSet4(object.blobId) ? globalThis.String(object.blobId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.blobId !== "") { + obj.blobId = message.blobId; + } + return obj; + }, + create(base) { + return BlobGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobGetRequest(); + message.blobId = object.blobId ?? ""; + return message; + } +}; +function createBaseBlobGetResponse() { + return { downloadUrl: "" }; +} +var BlobGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.downloadUrl !== "") { + writer.uint32(10).string(message.downloadUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBlobGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.downloadUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { downloadUrl: isSet4(object.downloadUrl) ? globalThis.String(object.downloadUrl) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.downloadUrl !== "") { + obj.downloadUrl = message.downloadUrl; + } + return obj; + }, + create(base) { + return BlobGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlobGetResponse(); + message.downloadUrl = object.downloadUrl ?? ""; + return message; + } +}; +function createBaseBuildFunction() { + return { definition: "", globals: new Uint8Array(0), input: void 0 }; +} +var BuildFunction = { + encode(message, writer = new BinaryWriter()) { + if (message.definition !== "") { + writer.uint32(10).string(message.definition); + } + if (message.globals.length !== 0) { + writer.uint32(18).bytes(message.globals); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseBuildFunction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.definition = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.globals = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + definition: isSet4(object.definition) ? globalThis.String(object.definition) : "", + globals: isSet4(object.globals) ? bytesFromBase64(object.globals) : new Uint8Array(0), + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.definition !== "") { + obj.definition = message.definition; + } + if (message.globals.length !== 0) { + obj.globals = base64FromBytes(message.globals); + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + return obj; + }, + create(base) { + return BuildFunction.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBuildFunction(); + message.definition = object.definition ?? ""; + message.globals = object.globals ?? new Uint8Array(0); + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseCancelInputEvent() { + return { inputIds: [], terminateContainers: false }; +} +var CancelInputEvent = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputIds) { + writer.uint32(10).string(v); + } + if (message.terminateContainers !== false) { + writer.uint32(16).bool(message.terminateContainers); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCancelInputEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputIds.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.terminateContainers = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputIds: globalThis.Array.isArray(object?.inputIds) ? object.inputIds.map((e) => globalThis.String(e)) : [], + terminateContainers: isSet4(object.terminateContainers) ? globalThis.Boolean(object.terminateContainers) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputIds?.length) { + obj.inputIds = message.inputIds; + } + if (message.terminateContainers !== false) { + obj.terminateContainers = message.terminateContainers; + } + return obj; + }, + create(base) { + return CancelInputEvent.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCancelInputEvent(); + message.inputIds = object.inputIds?.map((e) => e) || []; + message.terminateContainers = object.terminateContainers ?? false; + return message; + } +}; +function createBaseCheckpointInfo() { + return { + checksum: "", + status: 0, + checkpointId: "", + runtimeFingerprint: "", + size: 0, + checksumIsFileIndex: false, + originalTaskId: "", + runscRuntimeVersion: "" + }; +} +var CheckpointInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.checksum !== "") { + writer.uint32(10).string(message.checksum); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.checkpointId !== "") { + writer.uint32(26).string(message.checkpointId); + } + if (message.runtimeFingerprint !== "") { + writer.uint32(34).string(message.runtimeFingerprint); + } + if (message.size !== 0) { + writer.uint32(40).int64(message.size); + } + if (message.checksumIsFileIndex !== false) { + writer.uint32(48).bool(message.checksumIsFileIndex); + } + if (message.originalTaskId !== "") { + writer.uint32(58).string(message.originalTaskId); + } + if (message.runscRuntimeVersion !== "") { + writer.uint32(74).string(message.runscRuntimeVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCheckpointInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.checksum = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.checkpointId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.runtimeFingerprint = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.size = longToNumber2(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.checksumIsFileIndex = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.originalTaskId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.runscRuntimeVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + checksum: isSet4(object.checksum) ? globalThis.String(object.checksum) : "", + status: isSet4(object.status) ? checkpointStatusFromJSON(object.status) : 0, + checkpointId: isSet4(object.checkpointId) ? globalThis.String(object.checkpointId) : "", + runtimeFingerprint: isSet4(object.runtimeFingerprint) ? globalThis.String(object.runtimeFingerprint) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + checksumIsFileIndex: isSet4(object.checksumIsFileIndex) ? globalThis.Boolean(object.checksumIsFileIndex) : false, + originalTaskId: isSet4(object.originalTaskId) ? globalThis.String(object.originalTaskId) : "", + runscRuntimeVersion: isSet4(object.runscRuntimeVersion) ? globalThis.String(object.runscRuntimeVersion) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.checksum !== "") { + obj.checksum = message.checksum; + } + if (message.status !== 0) { + obj.status = checkpointStatusToJSON(message.status); + } + if (message.checkpointId !== "") { + obj.checkpointId = message.checkpointId; + } + if (message.runtimeFingerprint !== "") { + obj.runtimeFingerprint = message.runtimeFingerprint; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.checksumIsFileIndex !== false) { + obj.checksumIsFileIndex = message.checksumIsFileIndex; + } + if (message.originalTaskId !== "") { + obj.originalTaskId = message.originalTaskId; + } + if (message.runscRuntimeVersion !== "") { + obj.runscRuntimeVersion = message.runscRuntimeVersion; + } + return obj; + }, + create(base) { + return CheckpointInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCheckpointInfo(); + message.checksum = object.checksum ?? ""; + message.status = object.status ?? 0; + message.checkpointId = object.checkpointId ?? ""; + message.runtimeFingerprint = object.runtimeFingerprint ?? ""; + message.size = object.size ?? 0; + message.checksumIsFileIndex = object.checksumIsFileIndex ?? false; + message.originalTaskId = object.originalTaskId ?? ""; + message.runscRuntimeVersion = object.runscRuntimeVersion ?? ""; + return message; + } +}; +function createBaseClassCreateRequest() { + return { appId: "", existingClassId: "", methods: [], onlyClassFunction: false }; +} +var ClassCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.existingClassId !== "") { + writer.uint32(18).string(message.existingClassId); + } + for (const v of message.methods) { + ClassMethod.encode(v, writer.uint32(26).fork()).join(); + } + if (message.onlyClassFunction !== false) { + writer.uint32(40).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.existingClassId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.methods.push(ClassMethod.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + existingClassId: isSet4(object.existingClassId) ? globalThis.String(object.existingClassId) : "", + methods: globalThis.Array.isArray(object?.methods) ? object.methods.map((e) => ClassMethod.fromJSON(e)) : [], + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.existingClassId !== "") { + obj.existingClassId = message.existingClassId; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => ClassMethod.toJSON(e)); + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return ClassCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassCreateRequest(); + message.appId = object.appId ?? ""; + message.existingClassId = object.existingClassId ?? ""; + message.methods = object.methods?.map((e) => ClassMethod.fromPartial(e)) || []; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseClassCreateResponse() { + return { classId: "", handleMetadata: void 0 }; +} +var ClassCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.handleMetadata !== void 0) { + ClassHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet4(object.classId) ? globalThis.String(object.classId) : "", + handleMetadata: isSet4(object.handleMetadata) ? ClassHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = ClassHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return ClassCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassCreateResponse(); + message.classId = object.classId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? ClassHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseClassGetRequest() { + return { appName: "", objectTag: "", environmentName: "", onlyClassFunction: false }; +} +var ClassGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.objectTag !== "") { + writer.uint32(18).string(message.objectTag); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.onlyClassFunction !== false) { + writer.uint32(80).bool(message.onlyClassFunction); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.objectTag = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.onlyClassFunction = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + objectTag: isSet4(object.objectTag) ? globalThis.String(object.objectTag) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + onlyClassFunction: isSet4(object.onlyClassFunction) ? globalThis.Boolean(object.onlyClassFunction) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.objectTag !== "") { + obj.objectTag = message.objectTag; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.onlyClassFunction !== false) { + obj.onlyClassFunction = message.onlyClassFunction; + } + return obj; + }, + create(base) { + return ClassGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassGetRequest(); + message.appName = object.appName ?? ""; + message.objectTag = object.objectTag ?? ""; + message.environmentName = object.environmentName ?? ""; + message.onlyClassFunction = object.onlyClassFunction ?? false; + return message; + } +}; +function createBaseClassGetResponse() { + return { classId: "", handleMetadata: void 0, serverWarnings: [] }; +} +var ClassGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.handleMetadata !== void 0) { + ClassHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet4(object.classId) ? globalThis.String(object.classId) : "", + handleMetadata: isSet4(object.handleMetadata) ? ClassHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = ClassHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassGetResponse(); + message.classId = object.classId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? ClassHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassHandleMetadata() { + return { methods: [], classFunctionId: "", classFunctionMetadata: void 0 }; +} +var ClassHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.methods) { + ClassMethod.encode(v, writer.uint32(10).fork()).join(); + } + if (message.classFunctionId !== "") { + writer.uint32(18).string(message.classFunctionId); + } + if (message.classFunctionMetadata !== void 0) { + FunctionHandleMetadata.encode(message.classFunctionMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.methods.push(ClassMethod.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classFunctionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.classFunctionMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + methods: globalThis.Array.isArray(object?.methods) ? object.methods.map((e) => ClassMethod.fromJSON(e)) : [], + classFunctionId: isSet4(object.classFunctionId) ? globalThis.String(object.classFunctionId) : "", + classFunctionMetadata: isSet4(object.classFunctionMetadata) ? FunctionHandleMetadata.fromJSON(object.classFunctionMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.methods?.length) { + obj.methods = message.methods.map((e) => ClassMethod.toJSON(e)); + } + if (message.classFunctionId !== "") { + obj.classFunctionId = message.classFunctionId; + } + if (message.classFunctionMetadata !== void 0) { + obj.classFunctionMetadata = FunctionHandleMetadata.toJSON(message.classFunctionMetadata); + } + return obj; + }, + create(base) { + return ClassHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassHandleMetadata(); + message.methods = object.methods?.map((e) => ClassMethod.fromPartial(e)) || []; + message.classFunctionId = object.classFunctionId ?? ""; + message.classFunctionMetadata = object.classFunctionMetadata !== void 0 && object.classFunctionMetadata !== null ? FunctionHandleMetadata.fromPartial(object.classFunctionMetadata) : void 0; + return message; + } +}; +function createBaseClassMethod() { + return { functionName: "", functionId: "", functionHandleMetadata: void 0 }; +} +var ClassMethod = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(10).string(message.functionName); + } + if (message.functionId !== "") { + writer.uint32(18).string(message.functionId); + } + if (message.functionHandleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.functionHandleMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassMethod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionHandleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionHandleMetadata: isSet4(object.functionHandleMetadata) ? FunctionHandleMetadata.fromJSON(object.functionHandleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionHandleMetadata !== void 0) { + obj.functionHandleMetadata = FunctionHandleMetadata.toJSON(message.functionHandleMetadata); + } + return obj; + }, + create(base) { + return ClassMethod.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassMethod(); + message.functionName = object.functionName ?? ""; + message.functionId = object.functionId ?? ""; + message.functionHandleMetadata = object.functionHandleMetadata !== void 0 && object.functionHandleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.functionHandleMetadata) : void 0; + return message; + } +}; +function createBaseClassParameterInfo() { + return { format: 0, schema: [] }; +} +var ClassParameterInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.format !== 0) { + writer.uint32(8).int32(message.format); + } + for (const v of message.schema) { + ClassParameterSpec.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.format = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.schema.push(ClassParameterSpec.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + format: isSet4(object.format) ? classParameterInfo_ParameterSerializationFormatFromJSON(object.format) : 0, + schema: globalThis.Array.isArray(object?.schema) ? object.schema.map((e) => ClassParameterSpec.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.format !== 0) { + obj.format = classParameterInfo_ParameterSerializationFormatToJSON(message.format); + } + if (message.schema?.length) { + obj.schema = message.schema.map((e) => ClassParameterSpec.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassParameterInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterInfo(); + message.format = object.format ?? 0; + message.schema = object.schema?.map((e) => ClassParameterSpec.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassParameterSet() { + return { parameters: [] }; +} +var ClassParameterSet = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.parameters) { + ClassParameterValue.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.parameters.push(ClassParameterValue.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + parameters: globalThis.Array.isArray(object?.parameters) ? object.parameters.map((e) => ClassParameterValue.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.parameters?.length) { + obj.parameters = message.parameters.map((e) => ClassParameterValue.toJSON(e)); + } + return obj; + }, + create(base) { + return ClassParameterSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterSet(); + message.parameters = object.parameters?.map((e) => ClassParameterValue.fromPartial(e)) || []; + return message; + } +}; +function createBaseClassParameterSpec() { + return { + name: "", + type: 0, + hasDefault: false, + stringDefault: void 0, + intDefault: void 0, + pickleDefault: void 0, + bytesDefault: void 0, + boolDefault: void 0, + fullType: void 0 + }; +} +var ClassParameterSpec = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.hasDefault !== false) { + writer.uint32(24).bool(message.hasDefault); + } + if (message.stringDefault !== void 0) { + writer.uint32(34).string(message.stringDefault); + } + if (message.intDefault !== void 0) { + writer.uint32(40).int64(message.intDefault); + } + if (message.pickleDefault !== void 0) { + writer.uint32(50).bytes(message.pickleDefault); + } + if (message.bytesDefault !== void 0) { + writer.uint32(58).bytes(message.bytesDefault); + } + if (message.boolDefault !== void 0) { + writer.uint32(72).bool(message.boolDefault); + } + if (message.fullType !== void 0) { + GenericPayloadType.encode(message.fullType, writer.uint32(66).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.hasDefault = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.stringDefault = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.intDefault = longToNumber2(reader.int64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.pickleDefault = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.bytesDefault = reader.bytes(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.boolDefault = reader.bool(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.fullType = GenericPayloadType.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + type: isSet4(object.type) ? parameterTypeFromJSON(object.type) : 0, + hasDefault: isSet4(object.hasDefault) ? globalThis.Boolean(object.hasDefault) : false, + stringDefault: isSet4(object.stringDefault) ? globalThis.String(object.stringDefault) : void 0, + intDefault: isSet4(object.intDefault) ? globalThis.Number(object.intDefault) : void 0, + pickleDefault: isSet4(object.pickleDefault) ? bytesFromBase64(object.pickleDefault) : void 0, + bytesDefault: isSet4(object.bytesDefault) ? bytesFromBase64(object.bytesDefault) : void 0, + boolDefault: isSet4(object.boolDefault) ? globalThis.Boolean(object.boolDefault) : void 0, + fullType: isSet4(object.fullType) ? GenericPayloadType.fromJSON(object.fullType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== 0) { + obj.type = parameterTypeToJSON(message.type); + } + if (message.hasDefault !== false) { + obj.hasDefault = message.hasDefault; + } + if (message.stringDefault !== void 0) { + obj.stringDefault = message.stringDefault; + } + if (message.intDefault !== void 0) { + obj.intDefault = Math.round(message.intDefault); + } + if (message.pickleDefault !== void 0) { + obj.pickleDefault = base64FromBytes(message.pickleDefault); + } + if (message.bytesDefault !== void 0) { + obj.bytesDefault = base64FromBytes(message.bytesDefault); + } + if (message.boolDefault !== void 0) { + obj.boolDefault = message.boolDefault; + } + if (message.fullType !== void 0) { + obj.fullType = GenericPayloadType.toJSON(message.fullType); + } + return obj; + }, + create(base) { + return ClassParameterSpec.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterSpec(); + message.name = object.name ?? ""; + message.type = object.type ?? 0; + message.hasDefault = object.hasDefault ?? false; + message.stringDefault = object.stringDefault ?? void 0; + message.intDefault = object.intDefault ?? void 0; + message.pickleDefault = object.pickleDefault ?? void 0; + message.bytesDefault = object.bytesDefault ?? void 0; + message.boolDefault = object.boolDefault ?? void 0; + message.fullType = object.fullType !== void 0 && object.fullType !== null ? GenericPayloadType.fromPartial(object.fullType) : void 0; + return message; + } +}; +function createBaseClassParameterValue() { + return { + name: "", + type: 0, + stringValue: void 0, + intValue: void 0, + pickleValue: void 0, + bytesValue: void 0, + boolValue: void 0 + }; +} +var ClassParameterValue = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.stringValue !== void 0) { + writer.uint32(26).string(message.stringValue); + } + if (message.intValue !== void 0) { + writer.uint32(32).int64(message.intValue); + } + if (message.pickleValue !== void 0) { + writer.uint32(42).bytes(message.pickleValue); + } + if (message.bytesValue !== void 0) { + writer.uint32(50).bytes(message.bytesValue); + } + if (message.boolValue !== void 0) { + writer.uint32(56).bool(message.boolValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClassParameterValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stringValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.intValue = longToNumber2(reader.int64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pickleValue = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.bytesValue = reader.bytes(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.boolValue = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + type: isSet4(object.type) ? parameterTypeFromJSON(object.type) : 0, + stringValue: isSet4(object.stringValue) ? globalThis.String(object.stringValue) : void 0, + intValue: isSet4(object.intValue) ? globalThis.Number(object.intValue) : void 0, + pickleValue: isSet4(object.pickleValue) ? bytesFromBase64(object.pickleValue) : void 0, + bytesValue: isSet4(object.bytesValue) ? bytesFromBase64(object.bytesValue) : void 0, + boolValue: isSet4(object.boolValue) ? globalThis.Boolean(object.boolValue) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== 0) { + obj.type = parameterTypeToJSON(message.type); + } + if (message.stringValue !== void 0) { + obj.stringValue = message.stringValue; + } + if (message.intValue !== void 0) { + obj.intValue = Math.round(message.intValue); + } + if (message.pickleValue !== void 0) { + obj.pickleValue = base64FromBytes(message.pickleValue); + } + if (message.bytesValue !== void 0) { + obj.bytesValue = base64FromBytes(message.bytesValue); + } + if (message.boolValue !== void 0) { + obj.boolValue = message.boolValue; + } + return obj; + }, + create(base) { + return ClassParameterValue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassParameterValue(); + message.name = object.name ?? ""; + message.type = object.type ?? 0; + message.stringValue = object.stringValue ?? void 0; + message.intValue = object.intValue ?? void 0; + message.pickleValue = object.pickleValue ?? void 0; + message.bytesValue = object.bytesValue ?? void 0; + message.boolValue = object.boolValue ?? void 0; + return message; + } +}; +function createBaseClientHelloResponse() { + return { warning: "", imageBuilderVersion: "", serverWarnings: [] }; +} +var ClientHelloResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.warning !== "") { + writer.uint32(10).string(message.warning); + } + if (message.imageBuilderVersion !== "") { + writer.uint32(18).string(message.imageBuilderVersion); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClientHelloResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.warning = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + warning: isSet4(object.warning) ? globalThis.String(object.warning) : "", + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : "", + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.warning !== "") { + obj.warning = message.warning; + } + if (message.imageBuilderVersion !== "") { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return ClientHelloResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClientHelloResponse(); + message.warning = object.warning ?? ""; + message.imageBuilderVersion = object.imageBuilderVersion ?? ""; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseCloudBucketMount() { + return { + bucketName: "", + mountPath: "", + credentialsSecretId: "", + readOnly: false, + bucketType: 0, + requesterPays: false, + bucketEndpointUrl: void 0, + keyPrefix: void 0, + oidcAuthRoleArn: void 0 + }; +} +var CloudBucketMount = { + encode(message, writer = new BinaryWriter()) { + if (message.bucketName !== "") { + writer.uint32(10).string(message.bucketName); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.credentialsSecretId !== "") { + writer.uint32(26).string(message.credentialsSecretId); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + if (message.bucketType !== 0) { + writer.uint32(40).int32(message.bucketType); + } + if (message.requesterPays !== false) { + writer.uint32(48).bool(message.requesterPays); + } + if (message.bucketEndpointUrl !== void 0) { + writer.uint32(58).string(message.bucketEndpointUrl); + } + if (message.keyPrefix !== void 0) { + writer.uint32(66).string(message.keyPrefix); + } + if (message.oidcAuthRoleArn !== void 0) { + writer.uint32(74).string(message.oidcAuthRoleArn); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCloudBucketMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.bucketName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.credentialsSecretId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.bucketType = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.requesterPays = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.bucketEndpointUrl = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.keyPrefix = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.oidcAuthRoleArn = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + bucketName: isSet4(object.bucketName) ? globalThis.String(object.bucketName) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + credentialsSecretId: isSet4(object.credentialsSecretId) ? globalThis.String(object.credentialsSecretId) : "", + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false, + bucketType: isSet4(object.bucketType) ? cloudBucketMount_BucketTypeFromJSON(object.bucketType) : 0, + requesterPays: isSet4(object.requesterPays) ? globalThis.Boolean(object.requesterPays) : false, + bucketEndpointUrl: isSet4(object.bucketEndpointUrl) ? globalThis.String(object.bucketEndpointUrl) : void 0, + keyPrefix: isSet4(object.keyPrefix) ? globalThis.String(object.keyPrefix) : void 0, + oidcAuthRoleArn: isSet4(object.oidcAuthRoleArn) ? globalThis.String(object.oidcAuthRoleArn) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.bucketName !== "") { + obj.bucketName = message.bucketName; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.credentialsSecretId !== "") { + obj.credentialsSecretId = message.credentialsSecretId; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + if (message.bucketType !== 0) { + obj.bucketType = cloudBucketMount_BucketTypeToJSON(message.bucketType); + } + if (message.requesterPays !== false) { + obj.requesterPays = message.requesterPays; + } + if (message.bucketEndpointUrl !== void 0) { + obj.bucketEndpointUrl = message.bucketEndpointUrl; + } + if (message.keyPrefix !== void 0) { + obj.keyPrefix = message.keyPrefix; + } + if (message.oidcAuthRoleArn !== void 0) { + obj.oidcAuthRoleArn = message.oidcAuthRoleArn; + } + return obj; + }, + create(base) { + return CloudBucketMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCloudBucketMount(); + message.bucketName = object.bucketName ?? ""; + message.mountPath = object.mountPath ?? ""; + message.credentialsSecretId = object.credentialsSecretId ?? ""; + message.readOnly = object.readOnly ?? false; + message.bucketType = object.bucketType ?? 0; + message.requesterPays = object.requesterPays ?? false; + message.bucketEndpointUrl = object.bucketEndpointUrl ?? void 0; + message.keyPrefix = object.keyPrefix ?? void 0; + message.oidcAuthRoleArn = object.oidcAuthRoleArn ?? void 0; + return message; + } +}; +function createBaseClusterGetRequest() { + return { clusterId: "" }; +} +var ClusterGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.clusterId !== "") { + writer.uint32(10).string(message.clusterId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusterId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + return obj; + }, + create(base) { + return ClusterGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterGetRequest(); + message.clusterId = object.clusterId ?? ""; + return message; + } +}; +function createBaseClusterGetResponse() { + return { cluster: void 0 }; +} +var ClusterGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cluster !== void 0) { + ClusterStats.encode(message.cluster, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cluster = ClusterStats.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { cluster: isSet4(object.cluster) ? ClusterStats.fromJSON(object.cluster) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.cluster !== void 0) { + obj.cluster = ClusterStats.toJSON(message.cluster); + } + return obj; + }, + create(base) { + return ClusterGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterGetResponse(); + message.cluster = object.cluster !== void 0 && object.cluster !== null ? ClusterStats.fromPartial(object.cluster) : void 0; + return message; + } +}; +function createBaseClusterListRequest() { + return { environmentName: "" }; +} +var ClusterListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ClusterListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseClusterListResponse() { + return { clusters: [] }; +} +var ClusterListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.clusters) { + ClusterStats.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusters.push(ClusterStats.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clusters: globalThis.Array.isArray(object?.clusters) ? object.clusters.map((e) => ClusterStats.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.clusters?.length) { + obj.clusters = message.clusters.map((e) => ClusterStats.toJSON(e)); + } + return obj; + }, + create(base) { + return ClusterListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterListResponse(); + message.clusters = object.clusters?.map((e) => ClusterStats.fromPartial(e)) || []; + return message; + } +}; +function createBaseClusterStats() { + return { appId: "", taskIds: [], clusterId: "", startedAt: 0 }; +} +var ClusterStats = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + for (const v of message.taskIds) { + writer.uint32(18).string(v); + } + if (message.clusterId !== "") { + writer.uint32(26).string(message.clusterId); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseClusterStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.clusterId = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + taskIds: globalThis.Array.isArray(object?.taskIds) ? object.taskIds.map((e) => globalThis.String(e)) : [], + clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.taskIds?.length) { + obj.taskIds = message.taskIds; + } + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + return obj; + }, + create(base) { + return ClusterStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClusterStats(); + message.appId = object.appId ?? ""; + message.taskIds = object.taskIds?.map((e) => e) || []; + message.clusterId = object.clusterId ?? ""; + message.startedAt = object.startedAt ?? 0; + return message; + } +}; +function createBaseCommitInfo() { + return { + vcs: "", + branch: "", + commitHash: "", + commitTimestamp: 0, + dirty: false, + authorName: "", + authorEmail: "", + repoUrl: "" + }; +} +var CommitInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.vcs !== "") { + writer.uint32(10).string(message.vcs); + } + if (message.branch !== "") { + writer.uint32(18).string(message.branch); + } + if (message.commitHash !== "") { + writer.uint32(26).string(message.commitHash); + } + if (message.commitTimestamp !== 0) { + writer.uint32(32).int64(message.commitTimestamp); + } + if (message.dirty !== false) { + writer.uint32(40).bool(message.dirty); + } + if (message.authorName !== "") { + writer.uint32(50).string(message.authorName); + } + if (message.authorEmail !== "") { + writer.uint32(58).string(message.authorEmail); + } + if (message.repoUrl !== "") { + writer.uint32(66).string(message.repoUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.vcs = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.branch = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.commitHash = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.commitTimestamp = longToNumber2(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.dirty = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.authorName = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.authorEmail = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.repoUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + vcs: isSet4(object.vcs) ? globalThis.String(object.vcs) : "", + branch: isSet4(object.branch) ? globalThis.String(object.branch) : "", + commitHash: isSet4(object.commitHash) ? globalThis.String(object.commitHash) : "", + commitTimestamp: isSet4(object.commitTimestamp) ? globalThis.Number(object.commitTimestamp) : 0, + dirty: isSet4(object.dirty) ? globalThis.Boolean(object.dirty) : false, + authorName: isSet4(object.authorName) ? globalThis.String(object.authorName) : "", + authorEmail: isSet4(object.authorEmail) ? globalThis.String(object.authorEmail) : "", + repoUrl: isSet4(object.repoUrl) ? globalThis.String(object.repoUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.vcs !== "") { + obj.vcs = message.vcs; + } + if (message.branch !== "") { + obj.branch = message.branch; + } + if (message.commitHash !== "") { + obj.commitHash = message.commitHash; + } + if (message.commitTimestamp !== 0) { + obj.commitTimestamp = Math.round(message.commitTimestamp); + } + if (message.dirty !== false) { + obj.dirty = message.dirty; + } + if (message.authorName !== "") { + obj.authorName = message.authorName; + } + if (message.authorEmail !== "") { + obj.authorEmail = message.authorEmail; + } + if (message.repoUrl !== "") { + obj.repoUrl = message.repoUrl; + } + return obj; + }, + create(base) { + return CommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitInfo(); + message.vcs = object.vcs ?? ""; + message.branch = object.branch ?? ""; + message.commitHash = object.commitHash ?? ""; + message.commitTimestamp = object.commitTimestamp ?? 0; + message.dirty = object.dirty ?? false; + message.authorName = object.authorName ?? ""; + message.authorEmail = object.authorEmail ?? ""; + message.repoUrl = object.repoUrl ?? ""; + return message; + } +}; +function createBaseContainerCheckpointRequest() { + return { checkpointId: "" }; +} +var ContainerCheckpointRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.checkpointId !== "") { + writer.uint32(10).string(message.checkpointId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerCheckpointRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.checkpointId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { checkpointId: isSet4(object.checkpointId) ? globalThis.String(object.checkpointId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.checkpointId !== "") { + obj.checkpointId = message.checkpointId; + } + return obj; + }, + create(base) { + return ContainerCheckpointRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerCheckpointRequest(); + message.checkpointId = object.checkpointId ?? ""; + return message; + } +}; +function createBaseContainerExecGetOutputRequest() { + return { execId: "", timeout: 0, lastBatchIndex: 0, fileDescriptor: 0, getRawBytes: false }; +} +var ContainerExecGetOutputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastBatchIndex !== 0) { + writer.uint32(24).uint64(message.lastBatchIndex); + } + if (message.fileDescriptor !== 0) { + writer.uint32(32).int32(message.fileDescriptor); + } + if (message.getRawBytes !== false) { + writer.uint32(40).bool(message.getRawBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecGetOutputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.lastBatchIndex = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.getRawBytes = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastBatchIndex: isSet4(object.lastBatchIndex) ? globalThis.Number(object.lastBatchIndex) : 0, + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + getRawBytes: isSet4(object.getRawBytes) ? globalThis.Boolean(object.getRawBytes) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastBatchIndex !== 0) { + obj.lastBatchIndex = Math.round(message.lastBatchIndex); + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.getRawBytes !== false) { + obj.getRawBytes = message.getRawBytes; + } + return obj; + }, + create(base) { + return ContainerExecGetOutputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecGetOutputRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastBatchIndex = object.lastBatchIndex ?? 0; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.getRawBytes = object.getRawBytes ?? false; + return message; + } +}; +function createBaseContainerExecPutInputRequest() { + return { execId: "", input: void 0 }; +} +var ContainerExecPutInputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.input !== void 0) { + RuntimeInputMessage.encode(message.input, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecPutInputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = RuntimeInputMessage.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + input: isSet4(object.input) ? RuntimeInputMessage.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.input !== void 0) { + obj.input = RuntimeInputMessage.toJSON(message.input); + } + return obj; + }, + create(base) { + return ContainerExecPutInputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecPutInputRequest(); + message.execId = object.execId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? RuntimeInputMessage.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseContainerExecRequest() { + return { + taskId: "", + command: [], + ptyInfo: void 0, + terminateContainerOnExit: false, + runtimeDebug: false, + stdoutOutput: 0, + stderrOutput: 0, + timeoutSecs: 0, + workdir: void 0, + secretIds: [] + }; +} +var ContainerExecRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + for (const v of message.command) { + writer.uint32(18).string(v); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(26).fork()).join(); + } + if (message.terminateContainerOnExit !== false) { + writer.uint32(32).bool(message.terminateContainerOnExit); + } + if (message.runtimeDebug !== false) { + writer.uint32(40).bool(message.runtimeDebug); + } + if (message.stdoutOutput !== 0) { + writer.uint32(48).int32(message.stdoutOutput); + } + if (message.stderrOutput !== 0) { + writer.uint32(56).int32(message.stderrOutput); + } + if (message.timeoutSecs !== 0) { + writer.uint32(64).uint32(message.timeoutSecs); + } + if (message.workdir !== void 0) { + writer.uint32(74).string(message.workdir); + } + for (const v of message.secretIds) { + writer.uint32(82).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.command.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.terminateContainerOnExit = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.stdoutOutput = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.stderrOutput = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.workdir = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + command: globalThis.Array.isArray(object?.command) ? object.command.map((e) => globalThis.String(e)) : [], + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + terminateContainerOnExit: isSet4(object.terminateContainerOnExit) ? globalThis.Boolean(object.terminateContainerOnExit) : false, + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + stdoutOutput: isSet4(object.stdoutOutput) ? execOutputOptionFromJSON(object.stdoutOutput) : 0, + stderrOutput: isSet4(object.stderrOutput) ? execOutputOptionFromJSON(object.stderrOutput) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.command?.length) { + obj.command = message.command; + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.terminateContainerOnExit !== false) { + obj.terminateContainerOnExit = message.terminateContainerOnExit; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.stdoutOutput !== 0) { + obj.stdoutOutput = execOutputOptionToJSON(message.stdoutOutput); + } + if (message.stderrOutput !== 0) { + obj.stderrOutput = execOutputOptionToJSON(message.stderrOutput); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + return obj; + }, + create(base) { + return ContainerExecRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecRequest(); + message.taskId = object.taskId ?? ""; + message.command = object.command?.map((e) => e) || []; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.terminateContainerOnExit = object.terminateContainerOnExit ?? false; + message.runtimeDebug = object.runtimeDebug ?? false; + message.stdoutOutput = object.stdoutOutput ?? 0; + message.stderrOutput = object.stderrOutput ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.workdir = object.workdir ?? void 0; + message.secretIds = object.secretIds?.map((e) => e) || []; + return message; + } +}; +function createBaseContainerExecResponse() { + return { execId: "" }; +} +var ContainerExecResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { execId: isSet4(object.execId) ? globalThis.String(object.execId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + return obj; + }, + create(base) { + return ContainerExecResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecResponse(); + message.execId = object.execId ?? ""; + return message; + } +}; +function createBaseContainerExecWaitRequest() { + return { execId: "", timeout: 0 }; +} +var ContainerExecWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return ContainerExecWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecWaitRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseContainerExecWaitResponse() { + return { exitCode: void 0, completed: false }; +} +var ContainerExecWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exitCode !== void 0) { + writer.uint32(8).int32(message.exitCode); + } + if (message.completed !== false) { + writer.uint32(16).bool(message.completed); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerExecWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exitCode = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.completed = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + exitCode: isSet4(object.exitCode) ? globalThis.Number(object.exitCode) : void 0, + completed: isSet4(object.completed) ? globalThis.Boolean(object.completed) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.exitCode !== void 0) { + obj.exitCode = Math.round(message.exitCode); + } + if (message.completed !== false) { + obj.completed = message.completed; + } + return obj; + }, + create(base) { + return ContainerExecWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerExecWaitResponse(); + message.exitCode = object.exitCode ?? void 0; + message.completed = object.completed ?? false; + return message; + } +}; +function createBaseContainerFileCloseRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileCloseRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileCloseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileCloseRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileCloseRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileDeleteBytesRequest() { + return { fileDescriptor: "", startInclusive: void 0, endExclusive: void 0 }; +} +var ContainerFileDeleteBytesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.startInclusive !== void 0) { + writer.uint32(16).uint32(message.startInclusive); + } + if (message.endExclusive !== void 0) { + writer.uint32(24).uint32(message.endExclusive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileDeleteBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.startInclusive = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.endExclusive = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + startInclusive: isSet4(object.startInclusive) ? globalThis.Number(object.startInclusive) : void 0, + endExclusive: isSet4(object.endExclusive) ? globalThis.Number(object.endExclusive) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.startInclusive !== void 0) { + obj.startInclusive = Math.round(message.startInclusive); + } + if (message.endExclusive !== void 0) { + obj.endExclusive = Math.round(message.endExclusive); + } + return obj; + }, + create(base) { + return ContainerFileDeleteBytesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileDeleteBytesRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.startInclusive = object.startInclusive ?? void 0; + message.endExclusive = object.endExclusive ?? void 0; + return message; + } +}; +function createBaseContainerFileFlushRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileFlushRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileFlushRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileFlushRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileFlushRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileLsRequest() { + return { path: "" }; +} +var ContainerFileLsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileLsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { path: isSet4(object.path) ? globalThis.String(object.path) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return ContainerFileLsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileLsRequest(); + message.path = object.path ?? ""; + return message; + } +}; +function createBaseContainerFileMkdirRequest() { + return { path: "", makeParents: false }; +} +var ContainerFileMkdirRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.makeParents !== false) { + writer.uint32(16).bool(message.makeParents); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileMkdirRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.makeParents = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + makeParents: isSet4(object.makeParents) ? globalThis.Boolean(object.makeParents) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.makeParents !== false) { + obj.makeParents = message.makeParents; + } + return obj; + }, + create(base) { + return ContainerFileMkdirRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileMkdirRequest(); + message.path = object.path ?? ""; + message.makeParents = object.makeParents ?? false; + return message; + } +}; +function createBaseContainerFileOpenRequest() { + return { fileDescriptor: void 0, path: "", mode: "" }; +} +var ContainerFileOpenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== void 0) { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.mode !== "") { + writer.uint32(26).string(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileOpenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.mode = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : void 0, + path: isSet4(object.path) ? globalThis.String(object.path) : "", + mode: isSet4(object.mode) ? globalThis.String(object.mode) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== void 0) { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.mode !== "") { + obj.mode = message.mode; + } + return obj; + }, + create(base) { + return ContainerFileOpenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileOpenRequest(); + message.fileDescriptor = object.fileDescriptor ?? void 0; + message.path = object.path ?? ""; + message.mode = object.mode ?? ""; + return message; + } +}; +function createBaseContainerFileReadLineRequest() { + return { fileDescriptor: "" }; +} +var ContainerFileReadLineRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileReadLineRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFileReadLineRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileReadLineRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + return message; + } +}; +function createBaseContainerFileReadRequest() { + return { fileDescriptor: "", n: void 0 }; +} +var ContainerFileReadRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.n !== void 0) { + writer.uint32(16).uint32(message.n); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileReadRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.n = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + n: isSet4(object.n) ? globalThis.Number(object.n) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.n !== void 0) { + obj.n = Math.round(message.n); + } + return obj; + }, + create(base) { + return ContainerFileReadRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileReadRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.n = object.n ?? void 0; + return message; + } +}; +function createBaseContainerFileRmRequest() { + return { path: "", recursive: false }; +} +var ContainerFileRmRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(16).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileRmRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return ContainerFileRmRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileRmRequest(); + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseContainerFileSeekRequest() { + return { fileDescriptor: "", offset: 0, whence: 0 }; +} +var ContainerFileSeekRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.offset !== 0) { + writer.uint32(16).int32(message.offset); + } + if (message.whence !== 0) { + writer.uint32(24).int32(message.whence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileSeekRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.offset = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.whence = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + offset: isSet4(object.offset) ? globalThis.Number(object.offset) : 0, + whence: isSet4(object.whence) ? seekWhenceFromJSON(object.whence) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.whence !== 0) { + obj.whence = seekWhenceToJSON(message.whence); + } + return obj; + }, + create(base) { + return ContainerFileSeekRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileSeekRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.offset = object.offset ?? 0; + message.whence = object.whence ?? 0; + return message; + } +}; +function createBaseContainerFileWatchRequest() { + return { path: "", recursive: false, timeoutSecs: void 0 }; +} +var ContainerFileWatchRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(16).bool(message.recursive); + } + if (message.timeoutSecs !== void 0) { + writer.uint32(24).uint64(message.timeoutSecs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.timeoutSecs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.timeoutSecs !== void 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + return obj; + }, + create(base) { + return ContainerFileWatchRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWatchRequest(); + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.timeoutSecs = object.timeoutSecs ?? void 0; + return message; + } +}; +function createBaseContainerFileWriteReplaceBytesRequest() { + return { fileDescriptor: "", data: new Uint8Array(0), startInclusive: void 0, endExclusive: void 0 }; +} +var ContainerFileWriteReplaceBytesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.startInclusive !== void 0) { + writer.uint32(24).uint32(message.startInclusive); + } + if (message.endExclusive !== void 0) { + writer.uint32(32).uint32(message.endExclusive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWriteReplaceBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.startInclusive = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.endExclusive = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + startInclusive: isSet4(object.startInclusive) ? globalThis.Number(object.startInclusive) : void 0, + endExclusive: isSet4(object.endExclusive) ? globalThis.Number(object.endExclusive) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.startInclusive !== void 0) { + obj.startInclusive = Math.round(message.startInclusive); + } + if (message.endExclusive !== void 0) { + obj.endExclusive = Math.round(message.endExclusive); + } + return obj; + }, + create(base) { + return ContainerFileWriteReplaceBytesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWriteReplaceBytesRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.startInclusive = object.startInclusive ?? void 0; + message.endExclusive = object.endExclusive ?? void 0; + return message; + } +}; +function createBaseContainerFileWriteRequest() { + return { fileDescriptor: "", data: new Uint8Array(0) }; +} +var ContainerFileWriteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== "") { + writer.uint32(10).string(message.fileDescriptor); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFileWriteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== "") { + obj.fileDescriptor = message.fileDescriptor; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return ContainerFileWriteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFileWriteRequest(); + message.fileDescriptor = object.fileDescriptor ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + } +}; +function createBaseContainerFilesystemExecGetOutputRequest() { + return { execId: "", timeout: 0 }; +} +var ContainerFilesystemExecGetOutputRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecGetOutputRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecGetOutputRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecGetOutputRequest(); + message.execId = object.execId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseContainerFilesystemExecRequest() { + return { + fileOpenRequest: void 0, + fileWriteRequest: void 0, + fileReadRequest: void 0, + fileFlushRequest: void 0, + fileReadLineRequest: void 0, + fileSeekRequest: void 0, + fileDeleteBytesRequest: void 0, + fileWriteReplaceBytesRequest: void 0, + fileCloseRequest: void 0, + fileLsRequest: void 0, + fileMkdirRequest: void 0, + fileRmRequest: void 0, + fileWatchRequest: void 0, + taskId: "" + }; +} +var ContainerFilesystemExecRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.fileOpenRequest !== void 0) { + ContainerFileOpenRequest.encode(message.fileOpenRequest, writer.uint32(10).fork()).join(); + } + if (message.fileWriteRequest !== void 0) { + ContainerFileWriteRequest.encode(message.fileWriteRequest, writer.uint32(18).fork()).join(); + } + if (message.fileReadRequest !== void 0) { + ContainerFileReadRequest.encode(message.fileReadRequest, writer.uint32(26).fork()).join(); + } + if (message.fileFlushRequest !== void 0) { + ContainerFileFlushRequest.encode(message.fileFlushRequest, writer.uint32(34).fork()).join(); + } + if (message.fileReadLineRequest !== void 0) { + ContainerFileReadLineRequest.encode(message.fileReadLineRequest, writer.uint32(42).fork()).join(); + } + if (message.fileSeekRequest !== void 0) { + ContainerFileSeekRequest.encode(message.fileSeekRequest, writer.uint32(50).fork()).join(); + } + if (message.fileDeleteBytesRequest !== void 0) { + ContainerFileDeleteBytesRequest.encode(message.fileDeleteBytesRequest, writer.uint32(58).fork()).join(); + } + if (message.fileWriteReplaceBytesRequest !== void 0) { + ContainerFileWriteReplaceBytesRequest.encode(message.fileWriteReplaceBytesRequest, writer.uint32(66).fork()).join(); + } + if (message.fileCloseRequest !== void 0) { + ContainerFileCloseRequest.encode(message.fileCloseRequest, writer.uint32(74).fork()).join(); + } + if (message.fileLsRequest !== void 0) { + ContainerFileLsRequest.encode(message.fileLsRequest, writer.uint32(90).fork()).join(); + } + if (message.fileMkdirRequest !== void 0) { + ContainerFileMkdirRequest.encode(message.fileMkdirRequest, writer.uint32(98).fork()).join(); + } + if (message.fileRmRequest !== void 0) { + ContainerFileRmRequest.encode(message.fileRmRequest, writer.uint32(106).fork()).join(); + } + if (message.fileWatchRequest !== void 0) { + ContainerFileWatchRequest.encode(message.fileWatchRequest, writer.uint32(114).fork()).join(); + } + if (message.taskId !== "") { + writer.uint32(82).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.fileOpenRequest = ContainerFileOpenRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fileWriteRequest = ContainerFileWriteRequest.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.fileReadRequest = ContainerFileReadRequest.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.fileFlushRequest = ContainerFileFlushRequest.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.fileReadLineRequest = ContainerFileReadLineRequest.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.fileSeekRequest = ContainerFileSeekRequest.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.fileDeleteBytesRequest = ContainerFileDeleteBytesRequest.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.fileWriteReplaceBytesRequest = ContainerFileWriteReplaceBytesRequest.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.fileCloseRequest = ContainerFileCloseRequest.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.fileLsRequest = ContainerFileLsRequest.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.fileMkdirRequest = ContainerFileMkdirRequest.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.fileRmRequest = ContainerFileRmRequest.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.fileWatchRequest = ContainerFileWatchRequest.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileOpenRequest: isSet4(object.fileOpenRequest) ? ContainerFileOpenRequest.fromJSON(object.fileOpenRequest) : void 0, + fileWriteRequest: isSet4(object.fileWriteRequest) ? ContainerFileWriteRequest.fromJSON(object.fileWriteRequest) : void 0, + fileReadRequest: isSet4(object.fileReadRequest) ? ContainerFileReadRequest.fromJSON(object.fileReadRequest) : void 0, + fileFlushRequest: isSet4(object.fileFlushRequest) ? ContainerFileFlushRequest.fromJSON(object.fileFlushRequest) : void 0, + fileReadLineRequest: isSet4(object.fileReadLineRequest) ? ContainerFileReadLineRequest.fromJSON(object.fileReadLineRequest) : void 0, + fileSeekRequest: isSet4(object.fileSeekRequest) ? ContainerFileSeekRequest.fromJSON(object.fileSeekRequest) : void 0, + fileDeleteBytesRequest: isSet4(object.fileDeleteBytesRequest) ? ContainerFileDeleteBytesRequest.fromJSON(object.fileDeleteBytesRequest) : void 0, + fileWriteReplaceBytesRequest: isSet4(object.fileWriteReplaceBytesRequest) ? ContainerFileWriteReplaceBytesRequest.fromJSON(object.fileWriteReplaceBytesRequest) : void 0, + fileCloseRequest: isSet4(object.fileCloseRequest) ? ContainerFileCloseRequest.fromJSON(object.fileCloseRequest) : void 0, + fileLsRequest: isSet4(object.fileLsRequest) ? ContainerFileLsRequest.fromJSON(object.fileLsRequest) : void 0, + fileMkdirRequest: isSet4(object.fileMkdirRequest) ? ContainerFileMkdirRequest.fromJSON(object.fileMkdirRequest) : void 0, + fileRmRequest: isSet4(object.fileRmRequest) ? ContainerFileRmRequest.fromJSON(object.fileRmRequest) : void 0, + fileWatchRequest: isSet4(object.fileWatchRequest) ? ContainerFileWatchRequest.fromJSON(object.fileWatchRequest) : void 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileOpenRequest !== void 0) { + obj.fileOpenRequest = ContainerFileOpenRequest.toJSON(message.fileOpenRequest); + } + if (message.fileWriteRequest !== void 0) { + obj.fileWriteRequest = ContainerFileWriteRequest.toJSON(message.fileWriteRequest); + } + if (message.fileReadRequest !== void 0) { + obj.fileReadRequest = ContainerFileReadRequest.toJSON(message.fileReadRequest); + } + if (message.fileFlushRequest !== void 0) { + obj.fileFlushRequest = ContainerFileFlushRequest.toJSON(message.fileFlushRequest); + } + if (message.fileReadLineRequest !== void 0) { + obj.fileReadLineRequest = ContainerFileReadLineRequest.toJSON(message.fileReadLineRequest); + } + if (message.fileSeekRequest !== void 0) { + obj.fileSeekRequest = ContainerFileSeekRequest.toJSON(message.fileSeekRequest); + } + if (message.fileDeleteBytesRequest !== void 0) { + obj.fileDeleteBytesRequest = ContainerFileDeleteBytesRequest.toJSON(message.fileDeleteBytesRequest); + } + if (message.fileWriteReplaceBytesRequest !== void 0) { + obj.fileWriteReplaceBytesRequest = ContainerFileWriteReplaceBytesRequest.toJSON( + message.fileWriteReplaceBytesRequest + ); + } + if (message.fileCloseRequest !== void 0) { + obj.fileCloseRequest = ContainerFileCloseRequest.toJSON(message.fileCloseRequest); + } + if (message.fileLsRequest !== void 0) { + obj.fileLsRequest = ContainerFileLsRequest.toJSON(message.fileLsRequest); + } + if (message.fileMkdirRequest !== void 0) { + obj.fileMkdirRequest = ContainerFileMkdirRequest.toJSON(message.fileMkdirRequest); + } + if (message.fileRmRequest !== void 0) { + obj.fileRmRequest = ContainerFileRmRequest.toJSON(message.fileRmRequest); + } + if (message.fileWatchRequest !== void 0) { + obj.fileWatchRequest = ContainerFileWatchRequest.toJSON(message.fileWatchRequest); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecRequest(); + message.fileOpenRequest = object.fileOpenRequest !== void 0 && object.fileOpenRequest !== null ? ContainerFileOpenRequest.fromPartial(object.fileOpenRequest) : void 0; + message.fileWriteRequest = object.fileWriteRequest !== void 0 && object.fileWriteRequest !== null ? ContainerFileWriteRequest.fromPartial(object.fileWriteRequest) : void 0; + message.fileReadRequest = object.fileReadRequest !== void 0 && object.fileReadRequest !== null ? ContainerFileReadRequest.fromPartial(object.fileReadRequest) : void 0; + message.fileFlushRequest = object.fileFlushRequest !== void 0 && object.fileFlushRequest !== null ? ContainerFileFlushRequest.fromPartial(object.fileFlushRequest) : void 0; + message.fileReadLineRequest = object.fileReadLineRequest !== void 0 && object.fileReadLineRequest !== null ? ContainerFileReadLineRequest.fromPartial(object.fileReadLineRequest) : void 0; + message.fileSeekRequest = object.fileSeekRequest !== void 0 && object.fileSeekRequest !== null ? ContainerFileSeekRequest.fromPartial(object.fileSeekRequest) : void 0; + message.fileDeleteBytesRequest = object.fileDeleteBytesRequest !== void 0 && object.fileDeleteBytesRequest !== null ? ContainerFileDeleteBytesRequest.fromPartial(object.fileDeleteBytesRequest) : void 0; + message.fileWriteReplaceBytesRequest = object.fileWriteReplaceBytesRequest !== void 0 && object.fileWriteReplaceBytesRequest !== null ? ContainerFileWriteReplaceBytesRequest.fromPartial(object.fileWriteReplaceBytesRequest) : void 0; + message.fileCloseRequest = object.fileCloseRequest !== void 0 && object.fileCloseRequest !== null ? ContainerFileCloseRequest.fromPartial(object.fileCloseRequest) : void 0; + message.fileLsRequest = object.fileLsRequest !== void 0 && object.fileLsRequest !== null ? ContainerFileLsRequest.fromPartial(object.fileLsRequest) : void 0; + message.fileMkdirRequest = object.fileMkdirRequest !== void 0 && object.fileMkdirRequest !== null ? ContainerFileMkdirRequest.fromPartial(object.fileMkdirRequest) : void 0; + message.fileRmRequest = object.fileRmRequest !== void 0 && object.fileRmRequest !== null ? ContainerFileRmRequest.fromPartial(object.fileRmRequest) : void 0; + message.fileWatchRequest = object.fileWatchRequest !== void 0 && object.fileWatchRequest !== null ? ContainerFileWatchRequest.fromPartial(object.fileWatchRequest) : void 0; + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerFilesystemExecResponse() { + return { execId: "", fileDescriptor: void 0 }; +} +var ContainerFilesystemExecResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.execId !== "") { + writer.uint32(10).string(message.execId); + } + if (message.fileDescriptor !== void 0) { + writer.uint32(18).string(message.fileDescriptor); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerFilesystemExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.execId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fileDescriptor = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + execId: isSet4(object.execId) ? globalThis.String(object.execId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? globalThis.String(object.fileDescriptor) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.execId !== "") { + obj.execId = message.execId; + } + if (message.fileDescriptor !== void 0) { + obj.fileDescriptor = message.fileDescriptor; + } + return obj; + }, + create(base) { + return ContainerFilesystemExecResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerFilesystemExecResponse(); + message.execId = object.execId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? void 0; + return message; + } +}; +function createBaseContainerHeartbeatRequest() { + return { canceledInputsReturnOutputs: false, canceledInputsReturnOutputsV2: false }; +} +var ContainerHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.canceledInputsReturnOutputs !== false) { + writer.uint32(32).bool(message.canceledInputsReturnOutputs); + } + if (message.canceledInputsReturnOutputsV2 !== false) { + writer.uint32(40).bool(message.canceledInputsReturnOutputsV2); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 32) { + break; + } + message.canceledInputsReturnOutputs = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.canceledInputsReturnOutputsV2 = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + canceledInputsReturnOutputs: isSet4(object.canceledInputsReturnOutputs) ? globalThis.Boolean(object.canceledInputsReturnOutputs) : false, + canceledInputsReturnOutputsV2: isSet4(object.canceledInputsReturnOutputsV2) ? globalThis.Boolean(object.canceledInputsReturnOutputsV2) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.canceledInputsReturnOutputs !== false) { + obj.canceledInputsReturnOutputs = message.canceledInputsReturnOutputs; + } + if (message.canceledInputsReturnOutputsV2 !== false) { + obj.canceledInputsReturnOutputsV2 = message.canceledInputsReturnOutputsV2; + } + return obj; + }, + create(base) { + return ContainerHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerHeartbeatRequest(); + message.canceledInputsReturnOutputs = object.canceledInputsReturnOutputs ?? false; + message.canceledInputsReturnOutputsV2 = object.canceledInputsReturnOutputsV2 ?? false; + return message; + } +}; +function createBaseContainerHeartbeatResponse() { + return { cancelInputEvent: void 0 }; +} +var ContainerHeartbeatResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cancelInputEvent !== void 0) { + CancelInputEvent.encode(message.cancelInputEvent, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerHeartbeatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cancelInputEvent = CancelInputEvent.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cancelInputEvent: isSet4(object.cancelInputEvent) ? CancelInputEvent.fromJSON(object.cancelInputEvent) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cancelInputEvent !== void 0) { + obj.cancelInputEvent = CancelInputEvent.toJSON(message.cancelInputEvent); + } + return obj; + }, + create(base) { + return ContainerHeartbeatResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerHeartbeatResponse(); + message.cancelInputEvent = object.cancelInputEvent !== void 0 && object.cancelInputEvent !== null ? CancelInputEvent.fromPartial(object.cancelInputEvent) : void 0; + return message; + } +}; +function createBaseContainerLogRequest() { + return { logs: [] }; +} +var ContainerLogRequest = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.logs) { + TaskLogs.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerLogRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.logs.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e) => TaskLogs.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.logs?.length) { + obj.logs = message.logs.map((e) => TaskLogs.toJSON(e)); + } + return obj; + }, + create(base) { + return ContainerLogRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerLogRequest(); + message.logs = object.logs?.map((e) => TaskLogs.fromPartial(e)) || []; + return message; + } +}; +function createBaseContainerReloadVolumesRequest() { + return { taskId: "" }; +} +var ContainerReloadVolumesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerReloadVolumesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerReloadVolumesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerReloadVolumesRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerReloadVolumesResponse() { + return {}; +} +var ContainerReloadVolumesResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerReloadVolumesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return ContainerReloadVolumesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseContainerReloadVolumesResponse(); + return message; + } +}; +function createBaseContainerStopRequest() { + return { taskId: "" }; +} +var ContainerStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return ContainerStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContainerStopRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseContainerStopResponse() { + return {}; +} +var ContainerStopResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseContainerStopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return ContainerStopResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseContainerStopResponse(); + return message; + } +}; +function createBaseCreationInfo() { + return { createdAt: 0, createdBy: "" }; +} +var CreationInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.createdAt !== 0) { + writer.uint32(9).double(message.createdAt); + } + if (message.createdBy !== "") { + writer.uint32(18).string(message.createdBy); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCreationInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.createdBy = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + createdBy: isSet4(object.createdBy) ? globalThis.String(object.createdBy) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.createdBy !== "") { + obj.createdBy = message.createdBy; + } + return obj; + }, + create(base) { + return CreationInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCreationInfo(); + message.createdAt = object.createdAt ?? 0; + message.createdBy = object.createdBy ?? ""; + return message; + } +}; +function createBaseCustomDomainConfig() { + return { name: "" }; +} +var CustomDomainConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCustomDomainConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return CustomDomainConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomDomainConfig(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseCustomDomainInfo() { + return { url: "" }; +} +var CustomDomainInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseCustomDomainInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return CustomDomainInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomDomainInfo(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseDNSRecord() { + return { type: 0, name: "", value: "" }; +} +var DNSRecord = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDNSRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? dNSRecordTypeFromJSON(object.type) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = dNSRecordTypeToJSON(message.type); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return DNSRecord.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDNSRecord(); + message.type = object.type ?? 0; + message.name = object.name ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseDataChunk() { + return { dataFormat: 0, data: void 0, dataBlobId: void 0, index: 0 }; +} +var DataChunk = { + encode(message, writer = new BinaryWriter()) { + if (message.dataFormat !== 0) { + writer.uint32(8).int32(message.dataFormat); + } + if (message.data !== void 0) { + writer.uint32(18).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(26).string(message.dataBlobId); + } + if (message.index !== 0) { + writer.uint32(32).uint64(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDataChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.index = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + index: isSet4(object.index) ? globalThis.Number(object.index) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + create(base) { + return DataChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataChunk(); + message.dataFormat = object.dataFormat ?? 0; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.index = object.index ?? 0; + return message; + } +}; +function createBaseDictClearRequest() { + return { dictId: "" }; +} +var DictClearRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictClearRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictClearRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictClearRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictContainsRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictContainsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContainsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictContainsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContainsRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictContainsResponse() { + return { found: false }; +} +var DictContainsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContainsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { found: isSet4(object.found) ? globalThis.Boolean(object.found) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + return obj; + }, + create(base) { + return DictContainsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContainsResponse(); + message.found = object.found ?? false; + return message; + } +}; +function createBaseDictContentsRequest() { + return { dictId: "", keys: false, values: false }; +} +var DictContentsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.keys !== false) { + writer.uint32(16).bool(message.keys); + } + if (message.values !== false) { + writer.uint32(24).bool(message.values); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictContentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.keys = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.values = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + keys: isSet4(object.keys) ? globalThis.Boolean(object.keys) : false, + values: isSet4(object.values) ? globalThis.Boolean(object.values) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.keys !== false) { + obj.keys = message.keys; + } + if (message.values !== false) { + obj.values = message.values; + } + return obj; + }, + create(base) { + return DictContentsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictContentsRequest(); + message.dictId = object.dictId ?? ""; + message.keys = object.keys ?? false; + message.values = object.values ?? false; + return message; + } +}; +function createBaseDictDeleteRequest() { + return { dictId: "" }; +} +var DictDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictDeleteRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictEntry() { + return { key: new Uint8Array(0), value: new Uint8Array(0) }; +} +var DictEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet4(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictEntry(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, data: [] }; +} +var DictGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + for (const v of message.data) { + DictEntry.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.data.push(DictEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => DictEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.data?.length) { + obj.data = message.data.map((e) => DictEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return DictGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.data = object.data?.map((e) => DictEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseDictGetOrCreateResponse() { + return { dictId: "", metadata: void 0 }; +} +var DictGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.metadata !== void 0) { + DictMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = DictMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + metadata: isSet4(object.metadata) ? DictMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.metadata !== void 0) { + obj.metadata = DictMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return DictGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetOrCreateResponse(); + message.dictId = object.dictId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? DictMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseDictGetRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictGetResponse() { + return { found: false, value: void 0 }; +} +var DictGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + if (message.value !== void 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + found: isSet4(object.found) ? globalThis.Boolean(object.found) : false, + value: isSet4(object.value) ? bytesFromBase64(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + if (message.value !== void 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictGetResponse(); + message.found = object.found ?? false; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseDictHeartbeatRequest() { + return { dictId: "" }; +} +var DictHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictHeartbeatRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictLenRequest() { + return { dictId: "" }; +} +var DictLenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + return obj; + }, + create(base) { + return DictLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictLenRequest(); + message.dictId = object.dictId ?? ""; + return message; + } +}; +function createBaseDictLenResponse() { + return { len: 0 }; +} +var DictLenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).int32(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { len: isSet4(object.len) ? globalThis.Number(object.len) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return DictLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictLenResponse(); + message.len = object.len ?? 0; + return message; + } +}; +function createBaseDictListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var DictListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return DictListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseDictListResponse() { + return { dicts: [], environmentName: "" }; +} +var DictListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.dicts) { + DictListResponse_DictInfo.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dicts.push(DictListResponse_DictInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dicts: globalThis.Array.isArray(object?.dicts) ? object.dicts.map((e) => DictListResponse_DictInfo.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.dicts?.length) { + obj.dicts = message.dicts.map((e) => DictListResponse_DictInfo.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return DictListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListResponse(); + message.dicts = object.dicts?.map((e) => DictListResponse_DictInfo.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseDictListResponse_DictInfo() { + return { name: "", createdAt: 0, dictId: "", metadata: void 0 }; +} +var DictListResponse_DictInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.dictId !== "") { + writer.uint32(26).string(message.dictId); + } + if (message.metadata !== void 0) { + DictMetadata.encode(message.metadata, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictListResponse_DictInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dictId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.metadata = DictMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + metadata: isSet4(object.metadata) ? DictMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.metadata !== void 0) { + obj.metadata = DictMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return DictListResponse_DictInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictListResponse_DictInfo(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.dictId = object.dictId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? DictMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseDictMetadata() { + return { name: "", creationInfo: void 0 }; +} +var DictMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return DictMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseDictPopRequest() { + return { dictId: "", key: new Uint8Array(0) }; +} +var DictPopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictPopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + key: isSet4(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + create(base) { + return DictPopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictPopRequest(); + message.dictId = object.dictId ?? ""; + message.key = object.key ?? new Uint8Array(0); + return message; + } +}; +function createBaseDictPopResponse() { + return { found: false, value: void 0 }; +} +var DictPopResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.found !== false) { + writer.uint32(8).bool(message.found); + } + if (message.value !== void 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictPopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.found = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + found: isSet4(object.found) ? globalThis.Boolean(object.found) : false, + value: isSet4(object.value) ? bytesFromBase64(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.found !== false) { + obj.found = message.found; + } + if (message.value !== void 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return DictPopResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictPopResponse(); + message.found = object.found ?? false; + message.value = object.value ?? void 0; + return message; + } +}; +function createBaseDictUpdateRequest() { + return { dictId: "", updates: [], ifNotExists: false }; +} +var DictUpdateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.dictId !== "") { + writer.uint32(10).string(message.dictId); + } + for (const v of message.updates) { + DictEntry.encode(v, writer.uint32(18).fork()).join(); + } + if (message.ifNotExists !== false) { + writer.uint32(24).bool(message.ifNotExists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dictId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.updates.push(DictEntry.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ifNotExists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dictId: isSet4(object.dictId) ? globalThis.String(object.dictId) : "", + updates: globalThis.Array.isArray(object?.updates) ? object.updates.map((e) => DictEntry.fromJSON(e)) : [], + ifNotExists: isSet4(object.ifNotExists) ? globalThis.Boolean(object.ifNotExists) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.dictId !== "") { + obj.dictId = message.dictId; + } + if (message.updates?.length) { + obj.updates = message.updates.map((e) => DictEntry.toJSON(e)); + } + if (message.ifNotExists !== false) { + obj.ifNotExists = message.ifNotExists; + } + return obj; + }, + create(base) { + return DictUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictUpdateRequest(); + message.dictId = object.dictId ?? ""; + message.updates = object.updates?.map((e) => DictEntry.fromPartial(e)) || []; + message.ifNotExists = object.ifNotExists ?? false; + return message; + } +}; +function createBaseDictUpdateResponse() { + return { created: false }; +} +var DictUpdateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.created !== false) { + writer.uint32(8).bool(message.created); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDictUpdateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.created = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { created: isSet4(object.created) ? globalThis.Boolean(object.created) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.created !== false) { + obj.created = message.created; + } + return obj; + }, + create(base) { + return DictUpdateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDictUpdateResponse(); + message.created = object.created ?? false; + return message; + } +}; +function createBaseDomain() { + return { domainId: "", domainName: "", createdAt: 0, certificateStatus: 0, dnsRecords: [] }; +} +var Domain = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + if (message.domainName !== "") { + writer.uint32(18).string(message.domainName); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.certificateStatus !== 0) { + writer.uint32(32).int32(message.certificateStatus); + } + for (const v of message.dnsRecords) { + DNSRecord.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.domainName = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.certificateStatus = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dnsRecords.push(DNSRecord.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "", + domainName: isSet4(object.domainName) ? globalThis.String(object.domainName) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + certificateStatus: isSet4(object.certificateStatus) ? certificateStatusFromJSON(object.certificateStatus) : 0, + dnsRecords: globalThis.Array.isArray(object?.dnsRecords) ? object.dnsRecords.map((e) => DNSRecord.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + if (message.domainName !== "") { + obj.domainName = message.domainName; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.certificateStatus !== 0) { + obj.certificateStatus = certificateStatusToJSON(message.certificateStatus); + } + if (message.dnsRecords?.length) { + obj.dnsRecords = message.dnsRecords.map((e) => DNSRecord.toJSON(e)); + } + return obj; + }, + create(base) { + return Domain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomain(); + message.domainId = object.domainId ?? ""; + message.domainName = object.domainName ?? ""; + message.createdAt = object.createdAt ?? 0; + message.certificateStatus = object.certificateStatus ?? 0; + message.dnsRecords = object.dnsRecords?.map((e) => DNSRecord.fromPartial(e)) || []; + return message; + } +}; +function createBaseDomainCertificateVerifyRequest() { + return { domainId: "" }; +} +var DomainCertificateVerifyRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCertificateVerifyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + return obj; + }, + create(base) { + return DomainCertificateVerifyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCertificateVerifyRequest(); + message.domainId = object.domainId ?? ""; + return message; + } +}; +function createBaseDomainCertificateVerifyResponse() { + return { domain: void 0 }; +} +var DomainCertificateVerifyResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.domain !== void 0) { + Domain.encode(message.domain, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCertificateVerifyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domain = Domain.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domain: isSet4(object.domain) ? Domain.fromJSON(object.domain) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.domain !== void 0) { + obj.domain = Domain.toJSON(message.domain); + } + return obj; + }, + create(base) { + return DomainCertificateVerifyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCertificateVerifyResponse(); + message.domain = object.domain !== void 0 && object.domain !== null ? Domain.fromPartial(object.domain) : void 0; + return message; + } +}; +function createBaseDomainCreateRequest() { + return { domainName: "" }; +} +var DomainCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.domainName !== "") { + writer.uint32(10).string(message.domainName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { domainName: isSet4(object.domainName) ? globalThis.String(object.domainName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.domainName !== "") { + obj.domainName = message.domainName; + } + return obj; + }, + create(base) { + return DomainCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCreateRequest(); + message.domainName = object.domainName ?? ""; + return message; + } +}; +function createBaseDomainCreateResponse() { + return { domainId: "", dnsRecords: [] }; +} +var DomainCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.domainId !== "") { + writer.uint32(10).string(message.domainId); + } + for (const v of message.dnsRecords) { + DNSRecord.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domainId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dnsRecords.push(DNSRecord.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domainId: isSet4(object.domainId) ? globalThis.String(object.domainId) : "", + dnsRecords: globalThis.Array.isArray(object?.dnsRecords) ? object.dnsRecords.map((e) => DNSRecord.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domainId !== "") { + obj.domainId = message.domainId; + } + if (message.dnsRecords?.length) { + obj.dnsRecords = message.dnsRecords.map((e) => DNSRecord.toJSON(e)); + } + return obj; + }, + create(base) { + return DomainCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainCreateResponse(); + message.domainId = object.domainId ?? ""; + message.dnsRecords = object.dnsRecords?.map((e) => DNSRecord.fromPartial(e)) || []; + return message; + } +}; +function createBaseDomainListRequest() { + return {}; +} +var DomainListRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return DomainListRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseDomainListRequest(); + return message; + } +}; +function createBaseDomainListResponse() { + return { domains: [] }; +} +var DomainListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.domains) { + Domain.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseDomainListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.domains.push(Domain.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + domains: globalThis.Array.isArray(object?.domains) ? object.domains.map((e) => Domain.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.domains?.length) { + obj.domains = message.domains.map((e) => Domain.toJSON(e)); + } + return obj; + }, + create(base) { + return DomainListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDomainListResponse(); + message.domains = object.domains?.map((e) => Domain.fromPartial(e)) || []; + return message; + } +}; +function createBaseEnvironmentCreateRequest() { + return { name: "" }; +} +var EnvironmentCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return EnvironmentCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentCreateRequest(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseEnvironmentDeleteRequest() { + return { name: "" }; +} +var EnvironmentDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { name: isSet4(object.name) ? globalThis.String(object.name) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return EnvironmentDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentDeleteRequest(); + message.name = object.name ?? ""; + return message; + } +}; +function createBaseEnvironmentGetOrCreateRequest() { + return { deploymentName: "", objectCreationType: 0 }; +} +var EnvironmentGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(16).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return EnvironmentGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseEnvironmentGetOrCreateResponse() { + return { environmentId: "", metadata: void 0 }; +} +var EnvironmentGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentId !== "") { + writer.uint32(10).string(message.environmentId); + } + if (message.metadata !== void 0) { + EnvironmentMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = EnvironmentMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentId: isSet4(object.environmentId) ? globalThis.String(object.environmentId) : "", + metadata: isSet4(object.metadata) ? EnvironmentMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentId !== "") { + obj.environmentId = message.environmentId; + } + if (message.metadata !== void 0) { + obj.metadata = EnvironmentMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return EnvironmentGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentGetOrCreateResponse(); + message.environmentId = object.environmentId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? EnvironmentMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseEnvironmentListItem() { + return { name: "", webhookSuffix: "", createdAt: 0, default: false, isManaged: false, environmentId: "" }; +} +var EnvironmentListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.webhookSuffix !== "") { + writer.uint32(18).string(message.webhookSuffix); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.default !== false) { + writer.uint32(32).bool(message.default); + } + if (message.isManaged !== false) { + writer.uint32(40).bool(message.isManaged); + } + if (message.environmentId !== "") { + writer.uint32(50).string(message.environmentId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webhookSuffix = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.default = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.isManaged = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.environmentId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + webhookSuffix: isSet4(object.webhookSuffix) ? globalThis.String(object.webhookSuffix) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + default: isSet4(object.default) ? globalThis.Boolean(object.default) : false, + isManaged: isSet4(object.isManaged) ? globalThis.Boolean(object.isManaged) : false, + environmentId: isSet4(object.environmentId) ? globalThis.String(object.environmentId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.webhookSuffix !== "") { + obj.webhookSuffix = message.webhookSuffix; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.default !== false) { + obj.default = message.default; + } + if (message.isManaged !== false) { + obj.isManaged = message.isManaged; + } + if (message.environmentId !== "") { + obj.environmentId = message.environmentId; + } + return obj; + }, + create(base) { + return EnvironmentListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentListItem(); + message.name = object.name ?? ""; + message.webhookSuffix = object.webhookSuffix ?? ""; + message.createdAt = object.createdAt ?? 0; + message.default = object.default ?? false; + message.isManaged = object.isManaged ?? false; + message.environmentId = object.environmentId ?? ""; + return message; + } +}; +function createBaseEnvironmentListResponse() { + return { items: [] }; +} +var EnvironmentListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + EnvironmentListItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.items.push(EnvironmentListItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => EnvironmentListItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => EnvironmentListItem.toJSON(e)); + } + return obj; + }, + create(base) { + return EnvironmentListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentListResponse(); + message.items = object.items?.map((e) => EnvironmentListItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseEnvironmentMetadata() { + return { name: "", settings: void 0 }; +} +var EnvironmentMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.settings !== void 0) { + EnvironmentSettings.encode(message.settings, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.settings = EnvironmentSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + settings: isSet4(object.settings) ? EnvironmentSettings.fromJSON(object.settings) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.settings !== void 0) { + obj.settings = EnvironmentSettings.toJSON(message.settings); + } + return obj; + }, + create(base) { + return EnvironmentMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentMetadata(); + message.name = object.name ?? ""; + message.settings = object.settings !== void 0 && object.settings !== null ? EnvironmentSettings.fromPartial(object.settings) : void 0; + return message; + } +}; +function createBaseEnvironmentSettings() { + return { imageBuilderVersion: "", webhookSuffix: "" }; +} +var EnvironmentSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.imageBuilderVersion !== "") { + writer.uint32(10).string(message.imageBuilderVersion); + } + if (message.webhookSuffix !== "") { + writer.uint32(18).string(message.webhookSuffix); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webhookSuffix = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : "", + webhookSuffix: isSet4(object.webhookSuffix) ? globalThis.String(object.webhookSuffix) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageBuilderVersion !== "") { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + if (message.webhookSuffix !== "") { + obj.webhookSuffix = message.webhookSuffix; + } + return obj; + }, + create(base) { + return EnvironmentSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentSettings(); + message.imageBuilderVersion = object.imageBuilderVersion ?? ""; + message.webhookSuffix = object.webhookSuffix ?? ""; + return message; + } +}; +function createBaseEnvironmentUpdateRequest() { + return { currentName: "", name: void 0, webSuffix: void 0 }; +} +var EnvironmentUpdateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.currentName !== "") { + writer.uint32(10).string(message.currentName); + } + if (message.name !== void 0) { + StringValue.encode({ value: message.name }, writer.uint32(18).fork()).join(); + } + if (message.webSuffix !== void 0) { + StringValue.encode({ value: message.webSuffix }, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseEnvironmentUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.currentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = StringValue.decode(reader, reader.uint32()).value; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.webSuffix = StringValue.decode(reader, reader.uint32()).value; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + currentName: isSet4(object.currentName) ? globalThis.String(object.currentName) : "", + name: isSet4(object.name) ? String(object.name) : void 0, + webSuffix: isSet4(object.webSuffix) ? String(object.webSuffix) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.currentName !== "") { + obj.currentName = message.currentName; + } + if (message.name !== void 0) { + obj.name = message.name; + } + if (message.webSuffix !== void 0) { + obj.webSuffix = message.webSuffix; + } + return obj; + }, + create(base) { + return EnvironmentUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnvironmentUpdateRequest(); + message.currentName = object.currentName ?? ""; + message.name = object.name ?? void 0; + message.webSuffix = object.webSuffix ?? void 0; + return message; + } +}; +function createBaseFileEntry() { + return { path: "", type: 0, mtime: 0, size: 0 }; +} +var FileEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.mtime !== 0) { + writer.uint32(24).uint64(message.mtime); + } + if (message.size !== 0) { + writer.uint32(32).uint64(message.size); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFileEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.mtime = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + type: isSet4(object.type) ? fileEntry_FileTypeFromJSON(object.type) : 0, + mtime: isSet4(object.mtime) ? globalThis.Number(object.mtime) : 0, + size: isSet4(object.size) ? globalThis.Number(object.size) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.type !== 0) { + obj.type = fileEntry_FileTypeToJSON(message.type); + } + if (message.mtime !== 0) { + obj.mtime = Math.round(message.mtime); + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + return obj; + }, + create(base) { + return FileEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileEntry(); + message.path = object.path ?? ""; + message.type = object.type ?? 0; + message.mtime = object.mtime ?? 0; + message.size = object.size ?? 0; + return message; + } +}; +function createBaseFilesystemRuntimeOutputBatch() { + return { output: [], error: void 0, batchIndex: 0, eof: false }; +} +var FilesystemRuntimeOutputBatch = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.output) { + writer.uint32(10).bytes(v); + } + if (message.error !== void 0) { + SystemErrorMessage.encode(message.error, writer.uint32(18).fork()).join(); + } + if (message.batchIndex !== 0) { + writer.uint32(24).uint64(message.batchIndex); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFilesystemRuntimeOutputBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.output.push(reader.bytes()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.error = SystemErrorMessage.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.batchIndex = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + output: globalThis.Array.isArray(object?.output) ? object.output.map((e) => bytesFromBase64(e)) : [], + error: isSet4(object.error) ? SystemErrorMessage.fromJSON(object.error) : void 0, + batchIndex: isSet4(object.batchIndex) ? globalThis.Number(object.batchIndex) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.output?.length) { + obj.output = message.output.map((e) => base64FromBytes(e)); + } + if (message.error !== void 0) { + obj.error = SystemErrorMessage.toJSON(message.error); + } + if (message.batchIndex !== 0) { + obj.batchIndex = Math.round(message.batchIndex); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return FilesystemRuntimeOutputBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFilesystemRuntimeOutputBatch(); + message.output = object.output?.map((e) => e) || []; + message.error = object.error !== void 0 && object.error !== null ? SystemErrorMessage.fromPartial(object.error) : void 0; + message.batchIndex = object.batchIndex ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseFlashContainerDeregisterRequest() { + return { serviceName: "" }; +} +var FlashContainerDeregisterRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.serviceName !== "") { + writer.uint32(10).string(message.serviceName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerDeregisterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.serviceName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { serviceName: isSet4(object.serviceName) ? globalThis.String(object.serviceName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.serviceName !== "") { + obj.serviceName = message.serviceName; + } + return obj; + }, + create(base) { + return FlashContainerDeregisterRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerDeregisterRequest(); + message.serviceName = object.serviceName ?? ""; + return message; + } +}; +function createBaseFlashContainerListRequest() { + return { functionId: "" }; +} +var FlashContainerListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FlashContainerListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFlashContainerListResponse() { + return { containers: [] }; +} +var FlashContainerListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.containers) { + FlashContainerListResponse_Container.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.containers.push(FlashContainerListResponse_Container.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + containers: globalThis.Array.isArray(object?.containers) ? object.containers.map((e) => FlashContainerListResponse_Container.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.containers?.length) { + obj.containers = message.containers.map((e) => FlashContainerListResponse_Container.toJSON(e)); + } + return obj; + }, + create(base) { + return FlashContainerListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListResponse(); + message.containers = object.containers?.map((e) => FlashContainerListResponse_Container.fromPartial(e)) || []; + return message; + } +}; +function createBaseFlashContainerListResponse_Container() { + return { taskId: "", host: "", port: 0 }; +} +var FlashContainerListResponse_Container = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.host !== "") { + writer.uint32(18).string(message.host); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerListResponse_Container(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.host = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return FlashContainerListResponse_Container.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerListResponse_Container(); + message.taskId = object.taskId ?? ""; + message.host = object.host ?? ""; + message.port = object.port ?? 0; + return message; + } +}; +function createBaseFlashContainerRegisterRequest() { + return { serviceName: "", priority: 0, weight: 0, host: "", port: 0 }; +} +var FlashContainerRegisterRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.serviceName !== "") { + writer.uint32(10).string(message.serviceName); + } + if (message.priority !== 0) { + writer.uint32(16).uint32(message.priority); + } + if (message.weight !== 0) { + writer.uint32(24).uint32(message.weight); + } + if (message.host !== "") { + writer.uint32(34).string(message.host); + } + if (message.port !== 0) { + writer.uint32(40).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerRegisterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.serviceName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.priority = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.weight = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.host = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + serviceName: isSet4(object.serviceName) ? globalThis.String(object.serviceName) : "", + priority: isSet4(object.priority) ? globalThis.Number(object.priority) : 0, + weight: isSet4(object.weight) ? globalThis.Number(object.weight) : 0, + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.serviceName !== "") { + obj.serviceName = message.serviceName; + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.weight !== 0) { + obj.weight = Math.round(message.weight); + } + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return FlashContainerRegisterRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerRegisterRequest(); + message.serviceName = object.serviceName ?? ""; + message.priority = object.priority ?? 0; + message.weight = object.weight ?? 0; + message.host = object.host ?? ""; + message.port = object.port ?? 0; + return message; + } +}; +function createBaseFlashContainerRegisterResponse() { + return { url: "" }; +} +var FlashContainerRegisterResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashContainerRegisterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { url: isSet4(object.url) ? globalThis.String(object.url) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return FlashContainerRegisterResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashContainerRegisterResponse(); + message.url = object.url ?? ""; + return message; + } +}; +function createBaseFlashSetTargetSlotsMetricsRequest() { + return { functionId: "", targetSlots: 0 }; +} +var FlashSetTargetSlotsMetricsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.targetSlots !== 0) { + writer.uint32(16).uint32(message.targetSlots); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashSetTargetSlotsMetricsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.targetSlots = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + targetSlots: isSet4(object.targetSlots) ? globalThis.Number(object.targetSlots) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.targetSlots !== 0) { + obj.targetSlots = Math.round(message.targetSlots); + } + return obj; + }, + create(base) { + return FlashSetTargetSlotsMetricsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFlashSetTargetSlotsMetricsRequest(); + message.functionId = object.functionId ?? ""; + message.targetSlots = object.targetSlots ?? 0; + return message; + } +}; +function createBaseFlashSetTargetSlotsMetricsResponse() { + return {}; +} +var FlashSetTargetSlotsMetricsResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFlashSetTargetSlotsMetricsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return FlashSetTargetSlotsMetricsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFlashSetTargetSlotsMetricsResponse(); + return message; + } +}; +function createBaseFunctionMessage() { + return { + moduleName: "", + functionName: "", + mountIds: [], + imageId: "", + functionSerialized: new Uint8Array(0), + definitionType: 0, + functionType: 0, + resources: void 0, + secretIds: [], + rateLimit: void 0, + webhookConfig: void 0, + sharedVolumeMounts: [], + proxyId: void 0, + retryPolicy: void 0, + concurrencyLimit: 0, + timeoutSecs: 0, + ptyInfo: void 0, + classSerialized: new Uint8Array(0), + taskIdleTimeoutSecs: 0, + cloudProvider: void 0, + warmPoolSize: 0, + webUrl: "", + webUrlInfo: void 0, + runtime: "", + appName: "", + volumeMounts: [], + maxConcurrentInputs: 0, + customDomainInfo: [], + workerId: "", + runtimeDebug: false, + isBuilderFunction: false, + isAutoSnapshot: false, + isMethod: false, + isCheckpointingFunction: false, + checkpointingEnabled: false, + checkpoint: void 0, + objectDependencies: [], + blockNetwork: false, + maxInputs: 0, + s3Mounts: [], + cloudBucketMounts: [], + schedulerPlacement: void 0, + isClass: false, + useFunctionId: "", + useMethodName: "", + classParameterInfo: void 0, + batchMaxSize: 0, + batchLingerMs: 0, + i6pnEnabled: false, + ExperimentalConcurrentCancellations: false, + targetConcurrentInputs: 0, + ExperimentalTaskTemplatesEnabled: false, + ExperimentalTaskTemplates: [], + ExperimentalGroupSize: 0, + untrusted: false, + ExperimentalBufferContainers: 0, + ExperimentalProxyIp: void 0, + runtimePerfRecord: false, + schedule: void 0, + snapshotDebug: false, + methodDefinitions: {}, + methodDefinitionsSet: false, + ExperimentalCustomScaling: false, + cloudProviderStr: "", + ExperimentalEnableGpuSnapshot: false, + autoscalerSettings: void 0, + functionSchema: void 0, + experimentalOptions: {}, + mountClientDependencies: false, + flashServiceUrls: [], + flashServiceLabel: "", + enableGpuSnapshot: false, + startupTimeoutSecs: 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + for (const v of message.mountIds) { + writer.uint32(26).string(v); + } + if (message.imageId !== "") { + writer.uint32(34).string(message.imageId); + } + if (message.functionSerialized.length !== 0) { + writer.uint32(50).bytes(message.functionSerialized); + } + if (message.definitionType !== 0) { + writer.uint32(56).int32(message.definitionType); + } + if (message.functionType !== 0) { + writer.uint32(64).int32(message.functionType); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(74).fork()).join(); + } + for (const v of message.secretIds) { + writer.uint32(82).string(v); + } + if (message.rateLimit !== void 0) { + RateLimit.encode(message.rateLimit, writer.uint32(90).fork()).join(); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(122).fork()).join(); + } + for (const v of message.sharedVolumeMounts) { + SharedVolumeMount.encode(v, writer.uint32(130).fork()).join(); + } + if (message.proxyId !== void 0) { + writer.uint32(138).string(message.proxyId); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(146).fork()).join(); + } + if (message.concurrencyLimit !== 0) { + writer.uint32(152).uint32(message.concurrencyLimit); + } + if (message.timeoutSecs !== 0) { + writer.uint32(168).uint32(message.timeoutSecs); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(178).fork()).join(); + } + if (message.classSerialized.length !== 0) { + writer.uint32(186).bytes(message.classSerialized); + } + if (message.taskIdleTimeoutSecs !== 0) { + writer.uint32(200).uint32(message.taskIdleTimeoutSecs); + } + if (message.cloudProvider !== void 0) { + writer.uint32(208).int32(message.cloudProvider); + } + if (message.warmPoolSize !== 0) { + writer.uint32(216).uint32(message.warmPoolSize); + } + if (message.webUrl !== "") { + writer.uint32(226).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(234).fork()).join(); + } + if (message.runtime !== "") { + writer.uint32(242).string(message.runtime); + } + if (message.appName !== "") { + writer.uint32(250).string(message.appName); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(266).fork()).join(); + } + if (message.maxConcurrentInputs !== 0) { + writer.uint32(272).uint32(message.maxConcurrentInputs); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(282).fork()).join(); + } + if (message.workerId !== "") { + writer.uint32(290).string(message.workerId); + } + if (message.runtimeDebug !== false) { + writer.uint32(296).bool(message.runtimeDebug); + } + if (message.isBuilderFunction !== false) { + writer.uint32(256).bool(message.isBuilderFunction); + } + if (message.isAutoSnapshot !== false) { + writer.uint32(304).bool(message.isAutoSnapshot); + } + if (message.isMethod !== false) { + writer.uint32(312).bool(message.isMethod); + } + if (message.isCheckpointingFunction !== false) { + writer.uint32(320).bool(message.isCheckpointingFunction); + } + if (message.checkpointingEnabled !== false) { + writer.uint32(328).bool(message.checkpointingEnabled); + } + if (message.checkpoint !== void 0) { + CheckpointInfo.encode(message.checkpoint, writer.uint32(338).fork()).join(); + } + for (const v of message.objectDependencies) { + ObjectDependency.encode(v, writer.uint32(346).fork()).join(); + } + if (message.blockNetwork !== false) { + writer.uint32(352).bool(message.blockNetwork); + } + if (message.maxInputs !== 0) { + writer.uint32(368).uint32(message.maxInputs); + } + for (const v of message.s3Mounts) { + S3Mount.encode(v, writer.uint32(378).fork()).join(); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(410).fork()).join(); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(402).fork()).join(); + } + if (message.isClass !== false) { + writer.uint32(424).bool(message.isClass); + } + if (message.useFunctionId !== "") { + writer.uint32(434).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(442).string(message.useMethodName); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(450).fork()).join(); + } + if (message.batchMaxSize !== 0) { + writer.uint32(480).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + writer.uint32(488).uint64(message.batchLingerMs); + } + if (message.i6pnEnabled !== false) { + writer.uint32(496).bool(message.i6pnEnabled); + } + if (message.ExperimentalConcurrentCancellations !== false) { + writer.uint32(504).bool(message.ExperimentalConcurrentCancellations); + } + if (message.targetConcurrentInputs !== 0) { + writer.uint32(512).uint32(message.targetConcurrentInputs); + } + if (message.ExperimentalTaskTemplatesEnabled !== false) { + writer.uint32(520).bool(message.ExperimentalTaskTemplatesEnabled); + } + for (const v of message.ExperimentalTaskTemplates) { + TaskTemplate.encode(v, writer.uint32(530).fork()).join(); + } + if (message.ExperimentalGroupSize !== 0) { + writer.uint32(536).uint32(message.ExperimentalGroupSize); + } + if (message.untrusted !== false) { + writer.uint32(544).bool(message.untrusted); + } + if (message.ExperimentalBufferContainers !== 0) { + writer.uint32(552).uint32(message.ExperimentalBufferContainers); + } + if (message.ExperimentalProxyIp !== void 0) { + writer.uint32(562).string(message.ExperimentalProxyIp); + } + if (message.runtimePerfRecord !== false) { + writer.uint32(568).bool(message.runtimePerfRecord); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(578).fork()).join(); + } + if (message.snapshotDebug !== false) { + writer.uint32(584).bool(message.snapshotDebug); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + Function_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(594).fork()).join(); + }); + if (message.methodDefinitionsSet !== false) { + writer.uint32(600).bool(message.methodDefinitionsSet); + } + if (message.ExperimentalCustomScaling !== false) { + writer.uint32(608).bool(message.ExperimentalCustomScaling); + } + if (message.cloudProviderStr !== "") { + writer.uint32(618).string(message.cloudProviderStr); + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + writer.uint32(624).bool(message.ExperimentalEnableGpuSnapshot); + } + if (message.autoscalerSettings !== void 0) { + AutoscalerSettings.encode(message.autoscalerSettings, writer.uint32(634).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(642).fork()).join(); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + Function_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(650).fork()).join(); + }); + if (message.mountClientDependencies !== false) { + writer.uint32(656).bool(message.mountClientDependencies); + } + for (const v of message.flashServiceUrls) { + writer.uint32(666).string(v); + } + if (message.flashServiceLabel !== "") { + writer.uint32(674).string(message.flashServiceLabel); + } + if (message.enableGpuSnapshot !== false) { + writer.uint32(680).bool(message.enableGpuSnapshot); + } + if (message.startupTimeoutSecs !== 0) { + writer.uint32(688).uint32(message.startupTimeoutSecs); + } + writer.uint32(698).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(706).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.moduleName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.imageId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.functionSerialized = reader.bytes(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.definitionType = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.rateLimit = RateLimit.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.sharedVolumeMounts.push(SharedVolumeMount.decode(reader, reader.uint32())); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.classSerialized = reader.bytes(); + continue; + } + case 25: { + if (tag !== 200) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 26: { + if (tag !== 208) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 29: { + if (tag !== 234) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + message.runtime = reader.string(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + message.appName = reader.string(); + continue; + } + case 33: { + if (tag !== 266) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + message.workerId = reader.string(); + continue; + } + case 37: { + if (tag !== 296) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 32: { + if (tag !== 256) { + break; + } + message.isBuilderFunction = reader.bool(); + continue; + } + case 38: { + if (tag !== 304) { + break; + } + message.isAutoSnapshot = reader.bool(); + continue; + } + case 39: { + if (tag !== 312) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 40: { + if (tag !== 320) { + break; + } + message.isCheckpointingFunction = reader.bool(); + continue; + } + case 41: { + if (tag !== 328) { + break; + } + message.checkpointingEnabled = reader.bool(); + continue; + } + case 42: { + if (tag !== 338) { + break; + } + message.checkpoint = CheckpointInfo.decode(reader, reader.uint32()); + continue; + } + case 43: { + if (tag !== 346) { + break; + } + message.objectDependencies.push(ObjectDependency.decode(reader, reader.uint32())); + continue; + } + case 44: { + if (tag !== 352) { + break; + } + message.blockNetwork = reader.bool(); + continue; + } + case 46: { + if (tag !== 368) { + break; + } + message.maxInputs = reader.uint32(); + continue; + } + case 47: { + if (tag !== 378) { + break; + } + message.s3Mounts.push(S3Mount.decode(reader, reader.uint32())); + continue; + } + case 51: { + if (tag !== 410) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 53: { + if (tag !== 424) { + break; + } + message.isClass = reader.bool(); + continue; + } + case 54: { + if (tag !== 434) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 55: { + if (tag !== 442) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 56: { + if (tag !== 450) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 60: { + if (tag !== 480) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 61: { + if (tag !== 488) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + case 62: { + if (tag !== 496) { + break; + } + message.i6pnEnabled = reader.bool(); + continue; + } + case 63: { + if (tag !== 504) { + break; + } + message.ExperimentalConcurrentCancellations = reader.bool(); + continue; + } + case 64: { + if (tag !== 512) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 65: { + if (tag !== 520) { + break; + } + message.ExperimentalTaskTemplatesEnabled = reader.bool(); + continue; + } + case 66: { + if (tag !== 530) { + break; + } + message.ExperimentalTaskTemplates.push(TaskTemplate.decode(reader, reader.uint32())); + continue; + } + case 67: { + if (tag !== 536) { + break; + } + message.ExperimentalGroupSize = reader.uint32(); + continue; + } + case 68: { + if (tag !== 544) { + break; + } + message.untrusted = reader.bool(); + continue; + } + case 69: { + if (tag !== 552) { + break; + } + message.ExperimentalBufferContainers = reader.uint32(); + continue; + } + case 70: { + if (tag !== 562) { + break; + } + message.ExperimentalProxyIp = reader.string(); + continue; + } + case 71: { + if (tag !== 568) { + break; + } + message.runtimePerfRecord = reader.bool(); + continue; + } + case 72: { + if (tag !== 578) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 73: { + if (tag !== 584) { + break; + } + message.snapshotDebug = reader.bool(); + continue; + } + case 74: { + if (tag !== 594) { + break; + } + const entry74 = Function_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry74.value !== void 0) { + message.methodDefinitions[entry74.key] = entry74.value; + } + continue; + } + case 75: { + if (tag !== 600) { + break; + } + message.methodDefinitionsSet = reader.bool(); + continue; + } + case 76: { + if (tag !== 608) { + break; + } + message.ExperimentalCustomScaling = reader.bool(); + continue; + } + case 77: { + if (tag !== 618) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 78: { + if (tag !== 624) { + break; + } + message.ExperimentalEnableGpuSnapshot = reader.bool(); + continue; + } + case 79: { + if (tag !== 634) { + break; + } + message.autoscalerSettings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + case 80: { + if (tag !== 642) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 81: { + if (tag !== 650) { + break; + } + const entry81 = Function_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry81.value !== void 0) { + message.experimentalOptions[entry81.key] = entry81.value; + } + continue; + } + case 82: { + if (tag !== 656) { + break; + } + message.mountClientDependencies = reader.bool(); + continue; + } + case 83: { + if (tag !== 666) { + break; + } + message.flashServiceUrls.push(reader.string()); + continue; + } + case 84: { + if (tag !== 674) { + break; + } + message.flashServiceLabel = reader.string(); + continue; + } + case 85: { + if (tag !== 680) { + break; + } + message.enableGpuSnapshot = reader.bool(); + continue; + } + case 86: { + if (tag !== 688) { + break; + } + message.startupTimeoutSecs = reader.uint32(); + continue; + } + case 87: { + if (tag === 696) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 698) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 88: { + if (tag === 704) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 706) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + functionSerialized: isSet4(object.functionSerialized) ? bytesFromBase64(object.functionSerialized) : new Uint8Array(0), + definitionType: isSet4(object.definitionType) ? function_DefinitionTypeFromJSON(object.definitionType) : 0, + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + rateLimit: isSet4(object.rateLimit) ? RateLimit.fromJSON(object.rateLimit) : void 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + sharedVolumeMounts: globalThis.Array.isArray(object?.sharedVolumeMounts) ? object.sharedVolumeMounts.map((e) => SharedVolumeMount.fromJSON(e)) : [], + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : void 0, + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + classSerialized: isSet4(object.classSerialized) ? bytesFromBase64(object.classSerialized) : new Uint8Array(0), + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : void 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : "", + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + isBuilderFunction: isSet4(object.isBuilderFunction) ? globalThis.Boolean(object.isBuilderFunction) : false, + isAutoSnapshot: isSet4(object.isAutoSnapshot) ? globalThis.Boolean(object.isAutoSnapshot) : false, + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + isCheckpointingFunction: isSet4(object.isCheckpointingFunction) ? globalThis.Boolean(object.isCheckpointingFunction) : false, + checkpointingEnabled: isSet4(object.checkpointingEnabled) ? globalThis.Boolean(object.checkpointingEnabled) : false, + checkpoint: isSet4(object.checkpoint) ? CheckpointInfo.fromJSON(object.checkpoint) : void 0, + objectDependencies: globalThis.Array.isArray(object?.objectDependencies) ? object.objectDependencies.map((e) => ObjectDependency.fromJSON(e)) : [], + blockNetwork: isSet4(object.blockNetwork) ? globalThis.Boolean(object.blockNetwork) : false, + maxInputs: isSet4(object.maxInputs) ? globalThis.Number(object.maxInputs) : 0, + s3Mounts: globalThis.Array.isArray(object?.s3Mounts) ? object.s3Mounts.map((e) => S3Mount.fromJSON(e)) : [], + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [], + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + isClass: isSet4(object.isClass) ? globalThis.Boolean(object.isClass) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : 0, + i6pnEnabled: isSet4(object.i6pnEnabled) ? globalThis.Boolean(object.i6pnEnabled) : false, + ExperimentalConcurrentCancellations: isSet4(object.ExperimentalConcurrentCancellations) ? globalThis.Boolean(object.ExperimentalConcurrentCancellations) : false, + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : 0, + ExperimentalTaskTemplatesEnabled: isSet4(object.ExperimentalTaskTemplatesEnabled) ? globalThis.Boolean(object.ExperimentalTaskTemplatesEnabled) : false, + ExperimentalTaskTemplates: globalThis.Array.isArray(object?.ExperimentalTaskTemplates) ? object.ExperimentalTaskTemplates.map((e) => TaskTemplate.fromJSON(e)) : [], + ExperimentalGroupSize: isSet4(object.ExperimentalGroupSize) ? globalThis.Number(object.ExperimentalGroupSize) : 0, + untrusted: isSet4(object.untrusted) ? globalThis.Boolean(object.untrusted) : false, + ExperimentalBufferContainers: isSet4(object.ExperimentalBufferContainers) ? globalThis.Number(object.ExperimentalBufferContainers) : 0, + ExperimentalProxyIp: isSet4(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0, + runtimePerfRecord: isSet4(object.runtimePerfRecord) ? globalThis.Boolean(object.runtimePerfRecord) : false, + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + snapshotDebug: isSet4(object.snapshotDebug) ? globalThis.Boolean(object.snapshotDebug) : false, + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + methodDefinitionsSet: isSet4(object.methodDefinitionsSet) ? globalThis.Boolean(object.methodDefinitionsSet) : false, + ExperimentalCustomScaling: isSet4(object.ExperimentalCustomScaling) ? globalThis.Boolean(object.ExperimentalCustomScaling) : false, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : "", + ExperimentalEnableGpuSnapshot: isSet4(object.ExperimentalEnableGpuSnapshot) ? globalThis.Boolean(object.ExperimentalEnableGpuSnapshot) : false, + autoscalerSettings: isSet4(object.autoscalerSettings) ? AutoscalerSettings.fromJSON(object.autoscalerSettings) : void 0, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + mountClientDependencies: isSet4(object.mountClientDependencies) ? globalThis.Boolean(object.mountClientDependencies) : false, + flashServiceUrls: globalThis.Array.isArray(object?.flashServiceUrls) ? object.flashServiceUrls.map((e) => globalThis.String(e)) : [], + flashServiceLabel: isSet4(object.flashServiceLabel) ? globalThis.String(object.flashServiceLabel) : "", + enableGpuSnapshot: isSet4(object.enableGpuSnapshot) ? globalThis.Boolean(object.enableGpuSnapshot) : false, + startupTimeoutSecs: isSet4(object.startupTimeoutSecs) ? globalThis.Number(object.startupTimeoutSecs) : 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.functionSerialized.length !== 0) { + obj.functionSerialized = base64FromBytes(message.functionSerialized); + } + if (message.definitionType !== 0) { + obj.definitionType = function_DefinitionTypeToJSON(message.definitionType); + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.rateLimit !== void 0) { + obj.rateLimit = RateLimit.toJSON(message.rateLimit); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.sharedVolumeMounts?.length) { + obj.sharedVolumeMounts = message.sharedVolumeMounts.map((e) => SharedVolumeMount.toJSON(e)); + } + if (message.proxyId !== void 0) { + obj.proxyId = message.proxyId; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.concurrencyLimit !== 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.classSerialized.length !== 0) { + obj.classSerialized = base64FromBytes(message.classSerialized); + } + if (message.taskIdleTimeoutSecs !== 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.cloudProvider !== void 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + if (message.warmPoolSize !== 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.maxConcurrentInputs !== 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.isBuilderFunction !== false) { + obj.isBuilderFunction = message.isBuilderFunction; + } + if (message.isAutoSnapshot !== false) { + obj.isAutoSnapshot = message.isAutoSnapshot; + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.isCheckpointingFunction !== false) { + obj.isCheckpointingFunction = message.isCheckpointingFunction; + } + if (message.checkpointingEnabled !== false) { + obj.checkpointingEnabled = message.checkpointingEnabled; + } + if (message.checkpoint !== void 0) { + obj.checkpoint = CheckpointInfo.toJSON(message.checkpoint); + } + if (message.objectDependencies?.length) { + obj.objectDependencies = message.objectDependencies.map((e) => ObjectDependency.toJSON(e)); + } + if (message.blockNetwork !== false) { + obj.blockNetwork = message.blockNetwork; + } + if (message.maxInputs !== 0) { + obj.maxInputs = Math.round(message.maxInputs); + } + if (message.s3Mounts?.length) { + obj.s3Mounts = message.s3Mounts.map((e) => S3Mount.toJSON(e)); + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.isClass !== false) { + obj.isClass = message.isClass; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.batchMaxSize !== 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + if (message.i6pnEnabled !== false) { + obj.i6pnEnabled = message.i6pnEnabled; + } + if (message.ExperimentalConcurrentCancellations !== false) { + obj.ExperimentalConcurrentCancellations = message.ExperimentalConcurrentCancellations; + } + if (message.targetConcurrentInputs !== 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.ExperimentalTaskTemplatesEnabled !== false) { + obj.ExperimentalTaskTemplatesEnabled = message.ExperimentalTaskTemplatesEnabled; + } + if (message.ExperimentalTaskTemplates?.length) { + obj.ExperimentalTaskTemplates = message.ExperimentalTaskTemplates.map((e) => TaskTemplate.toJSON(e)); + } + if (message.ExperimentalGroupSize !== 0) { + obj.ExperimentalGroupSize = Math.round(message.ExperimentalGroupSize); + } + if (message.untrusted !== false) { + obj.untrusted = message.untrusted; + } + if (message.ExperimentalBufferContainers !== 0) { + obj.ExperimentalBufferContainers = Math.round(message.ExperimentalBufferContainers); + } + if (message.ExperimentalProxyIp !== void 0) { + obj.ExperimentalProxyIp = message.ExperimentalProxyIp; + } + if (message.runtimePerfRecord !== false) { + obj.runtimePerfRecord = message.runtimePerfRecord; + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.snapshotDebug !== false) { + obj.snapshotDebug = message.snapshotDebug; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.methodDefinitionsSet !== false) { + obj.methodDefinitionsSet = message.methodDefinitionsSet; + } + if (message.ExperimentalCustomScaling !== false) { + obj.ExperimentalCustomScaling = message.ExperimentalCustomScaling; + } + if (message.cloudProviderStr !== "") { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + obj.ExperimentalEnableGpuSnapshot = message.ExperimentalEnableGpuSnapshot; + } + if (message.autoscalerSettings !== void 0) { + obj.autoscalerSettings = AutoscalerSettings.toJSON(message.autoscalerSettings); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.mountClientDependencies !== false) { + obj.mountClientDependencies = message.mountClientDependencies; + } + if (message.flashServiceUrls?.length) { + obj.flashServiceUrls = message.flashServiceUrls; + } + if (message.flashServiceLabel !== "") { + obj.flashServiceLabel = message.flashServiceLabel; + } + if (message.enableGpuSnapshot !== false) { + obj.enableGpuSnapshot = message.enableGpuSnapshot; + } + if (message.startupTimeoutSecs !== 0) { + obj.startupTimeoutSecs = Math.round(message.startupTimeoutSecs); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMessage(); + message.moduleName = object.moduleName ?? ""; + message.functionName = object.functionName ?? ""; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.imageId = object.imageId ?? ""; + message.functionSerialized = object.functionSerialized ?? new Uint8Array(0); + message.definitionType = object.definitionType ?? 0; + message.functionType = object.functionType ?? 0; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.rateLimit = object.rateLimit !== void 0 && object.rateLimit !== null ? RateLimit.fromPartial(object.rateLimit) : void 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.sharedVolumeMounts = object.sharedVolumeMounts?.map((e) => SharedVolumeMount.fromPartial(e)) || []; + message.proxyId = object.proxyId ?? void 0; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.concurrencyLimit = object.concurrencyLimit ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.classSerialized = object.classSerialized ?? new Uint8Array(0); + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? 0; + message.cloudProvider = object.cloudProvider ?? void 0; + message.warmPoolSize = object.warmPoolSize ?? 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.runtime = object.runtime ?? ""; + message.appName = object.appName ?? ""; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.workerId = object.workerId ?? ""; + message.runtimeDebug = object.runtimeDebug ?? false; + message.isBuilderFunction = object.isBuilderFunction ?? false; + message.isAutoSnapshot = object.isAutoSnapshot ?? false; + message.isMethod = object.isMethod ?? false; + message.isCheckpointingFunction = object.isCheckpointingFunction ?? false; + message.checkpointingEnabled = object.checkpointingEnabled ?? false; + message.checkpoint = object.checkpoint !== void 0 && object.checkpoint !== null ? CheckpointInfo.fromPartial(object.checkpoint) : void 0; + message.objectDependencies = object.objectDependencies?.map((e) => ObjectDependency.fromPartial(e)) || []; + message.blockNetwork = object.blockNetwork ?? false; + message.maxInputs = object.maxInputs ?? 0; + message.s3Mounts = object.s3Mounts?.map((e) => S3Mount.fromPartial(e)) || []; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.isClass = object.isClass ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.batchMaxSize = object.batchMaxSize ?? 0; + message.batchLingerMs = object.batchLingerMs ?? 0; + message.i6pnEnabled = object.i6pnEnabled ?? false; + message.ExperimentalConcurrentCancellations = object.ExperimentalConcurrentCancellations ?? false; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? 0; + message.ExperimentalTaskTemplatesEnabled = object.ExperimentalTaskTemplatesEnabled ?? false; + message.ExperimentalTaskTemplates = object.ExperimentalTaskTemplates?.map((e) => TaskTemplate.fromPartial(e)) || []; + message.ExperimentalGroupSize = object.ExperimentalGroupSize ?? 0; + message.untrusted = object.untrusted ?? false; + message.ExperimentalBufferContainers = object.ExperimentalBufferContainers ?? 0; + message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0; + message.runtimePerfRecord = object.runtimePerfRecord ?? false; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.snapshotDebug = object.snapshotDebug ?? false; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.methodDefinitionsSet = object.methodDefinitionsSet ?? false; + message.ExperimentalCustomScaling = object.ExperimentalCustomScaling ?? false; + message.cloudProviderStr = object.cloudProviderStr ?? ""; + message.ExperimentalEnableGpuSnapshot = object.ExperimentalEnableGpuSnapshot ?? false; + message.autoscalerSettings = object.autoscalerSettings !== void 0 && object.autoscalerSettings !== null ? AutoscalerSettings.fromPartial(object.autoscalerSettings) : void 0; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.mountClientDependencies = object.mountClientDependencies ?? false; + message.flashServiceUrls = object.flashServiceUrls?.map((e) => e) || []; + message.flashServiceLabel = object.flashServiceLabel ?? ""; + message.enableGpuSnapshot = object.enableGpuSnapshot ?? false; + message.startupTimeoutSecs = object.startupTimeoutSecs ?? 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunction_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var Function_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunction_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return Function_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunction_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunction_ExperimentalOptionsEntry() { + return { key: "", value: "" }; +} +var Function_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunction_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Function_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunction_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseFunctionAsyncInvokeRequest() { + return { functionId: "", parentInputId: "", input: void 0 }; +} +var FunctionAsyncInvokeRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionAsyncInvokeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + return obj; + }, + create(base) { + return FunctionAsyncInvokeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionAsyncInvokeRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + return message; + } +}; +function createBaseFunctionAsyncInvokeResponse() { + return { retryWithBlobUpload: false, functionCallId: "" }; +} +var FunctionAsyncInvokeResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.retryWithBlobUpload !== false) { + writer.uint32(8).bool(message.retryWithBlobUpload); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionAsyncInvokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.retryWithBlobUpload = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + retryWithBlobUpload: isSet4(object.retryWithBlobUpload) ? globalThis.Boolean(object.retryWithBlobUpload) : false, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.retryWithBlobUpload !== false) { + obj.retryWithBlobUpload = message.retryWithBlobUpload; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionAsyncInvokeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionAsyncInvokeResponse(); + message.retryWithBlobUpload = object.retryWithBlobUpload ?? false; + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionBindParamsRequest() { + return { + functionId: "", + serializedParams: new Uint8Array(0), + functionOptions: void 0, + environmentName: "", + authSecret: "" + }; +} +var FunctionBindParamsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.serializedParams.length !== 0) { + writer.uint32(18).bytes(message.serializedParams); + } + if (message.functionOptions !== void 0) { + FunctionOptions.encode(message.functionOptions, writer.uint32(26).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.authSecret !== "") { + writer.uint32(42).string(message.authSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionBindParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.serializedParams = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionOptions = FunctionOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.authSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + serializedParams: isSet4(object.serializedParams) ? bytesFromBase64(object.serializedParams) : new Uint8Array(0), + functionOptions: isSet4(object.functionOptions) ? FunctionOptions.fromJSON(object.functionOptions) : void 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + authSecret: isSet4(object.authSecret) ? globalThis.String(object.authSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.serializedParams.length !== 0) { + obj.serializedParams = base64FromBytes(message.serializedParams); + } + if (message.functionOptions !== void 0) { + obj.functionOptions = FunctionOptions.toJSON(message.functionOptions); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.authSecret !== "") { + obj.authSecret = message.authSecret; + } + return obj; + }, + create(base) { + return FunctionBindParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionBindParamsRequest(); + message.functionId = object.functionId ?? ""; + message.serializedParams = object.serializedParams ?? new Uint8Array(0); + message.functionOptions = object.functionOptions !== void 0 && object.functionOptions !== null ? FunctionOptions.fromPartial(object.functionOptions) : void 0; + message.environmentName = object.environmentName ?? ""; + message.authSecret = object.authSecret ?? ""; + return message; + } +}; +function createBaseFunctionBindParamsResponse() { + return { boundFunctionId: "", handleMetadata: void 0 }; +} +var FunctionBindParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.boundFunctionId !== "") { + writer.uint32(10).string(message.boundFunctionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionBindParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.boundFunctionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + boundFunctionId: isSet4(object.boundFunctionId) ? globalThis.String(object.boundFunctionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.boundFunctionId !== "") { + obj.boundFunctionId = message.boundFunctionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return FunctionBindParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionBindParamsResponse(); + message.boundFunctionId = object.boundFunctionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseFunctionCallCallGraphInfo() { + return { functionCallId: "", parentInputId: "", functionName: "", moduleName: "" }; +} +var FunctionCallCallGraphInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.functionName !== "") { + writer.uint32(26).string(message.functionName); + } + if (message.moduleName !== "") { + writer.uint32(34).string(message.moduleName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallCallGraphInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.moduleName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + return obj; + }, + create(base) { + return FunctionCallCallGraphInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallCallGraphInfo(); + message.functionCallId = object.functionCallId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.functionName = object.functionName ?? ""; + message.moduleName = object.moduleName ?? ""; + return message; + } +}; +function createBaseFunctionCallCancelRequest() { + return { functionCallId: "", terminateContainers: false, functionId: void 0 }; +} +var FunctionCallCancelRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.terminateContainers !== false) { + writer.uint32(16).bool(message.terminateContainers); + } + if (message.functionId !== void 0) { + writer.uint32(26).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallCancelRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.terminateContainers = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + terminateContainers: isSet4(object.terminateContainers) ? globalThis.Boolean(object.terminateContainers) : false, + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.terminateContainers !== false) { + obj.terminateContainers = message.terminateContainers; + } + if (message.functionId !== void 0) { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionCallCancelRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallCancelRequest(); + message.functionCallId = object.functionCallId ?? ""; + message.terminateContainers = object.terminateContainers ?? false; + message.functionId = object.functionId ?? void 0; + return message; + } +}; +function createBaseFunctionCallFromIdRequest() { + return { functionCallId: "" }; +} +var FunctionCallFromIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallFromIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionCallFromIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallFromIdRequest(); + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionCallFromIdResponse() { + return { functionCallId: "", numInputs: 0 }; +} +var FunctionCallFromIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.numInputs !== 0) { + writer.uint32(16).int32(message.numInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallFromIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.numInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + numInputs: isSet4(object.numInputs) ? globalThis.Number(object.numInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.numInputs !== 0) { + obj.numInputs = Math.round(message.numInputs); + } + return obj; + }, + create(base) { + return FunctionCallFromIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallFromIdResponse(); + message.functionCallId = object.functionCallId ?? ""; + message.numInputs = object.numInputs ?? 0; + return message; + } +}; +function createBaseFunctionCallGetDataRequest() { + return { functionCallId: void 0, attemptToken: void 0, lastIndex: 0 }; +} +var FunctionCallGetDataRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.attemptToken !== void 0) { + writer.uint32(26).string(message.attemptToken); + } + if (message.lastIndex !== 0) { + writer.uint32(16).uint64(message.lastIndex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallGetDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.lastIndex = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0, + lastIndex: isSet4(object.lastIndex) ? globalThis.Number(object.lastIndex) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + if (message.lastIndex !== 0) { + obj.lastIndex = Math.round(message.lastIndex); + } + return obj; + }, + create(base) { + return FunctionCallGetDataRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallGetDataRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.attemptToken = object.attemptToken ?? void 0; + message.lastIndex = object.lastIndex ?? 0; + return message; + } +}; +function createBaseFunctionCallInfo() { + return { + functionCallId: "", + idx: 0, + createdAt: 0, + scheduledAt: 0, + pendingInputs: void 0, + failedInputs: void 0, + succeededInputs: void 0, + timeoutInputs: void 0, + cancelledInputs: void 0, + totalInputs: 0 + }; +} +var FunctionCallInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.createdAt !== 0) { + writer.uint32(49).double(message.createdAt); + } + if (message.scheduledAt !== 0) { + writer.uint32(57).double(message.scheduledAt); + } + if (message.pendingInputs !== void 0) { + InputCategoryInfo.encode(message.pendingInputs, writer.uint32(98).fork()).join(); + } + if (message.failedInputs !== void 0) { + InputCategoryInfo.encode(message.failedInputs, writer.uint32(106).fork()).join(); + } + if (message.succeededInputs !== void 0) { + InputCategoryInfo.encode(message.succeededInputs, writer.uint32(114).fork()).join(); + } + if (message.timeoutInputs !== void 0) { + InputCategoryInfo.encode(message.timeoutInputs, writer.uint32(122).fork()).join(); + } + if (message.cancelledInputs !== void 0) { + InputCategoryInfo.encode(message.cancelledInputs, writer.uint32(130).fork()).join(); + } + if (message.totalInputs !== 0) { + writer.uint32(136).int32(message.totalInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.scheduledAt = reader.double(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.pendingInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.failedInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.succeededInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.timeoutInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.cancelledInputs = InputCategoryInfo.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.totalInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + scheduledAt: isSet4(object.scheduledAt) ? globalThis.Number(object.scheduledAt) : 0, + pendingInputs: isSet4(object.pendingInputs) ? InputCategoryInfo.fromJSON(object.pendingInputs) : void 0, + failedInputs: isSet4(object.failedInputs) ? InputCategoryInfo.fromJSON(object.failedInputs) : void 0, + succeededInputs: isSet4(object.succeededInputs) ? InputCategoryInfo.fromJSON(object.succeededInputs) : void 0, + timeoutInputs: isSet4(object.timeoutInputs) ? InputCategoryInfo.fromJSON(object.timeoutInputs) : void 0, + cancelledInputs: isSet4(object.cancelledInputs) ? InputCategoryInfo.fromJSON(object.cancelledInputs) : void 0, + totalInputs: isSet4(object.totalInputs) ? globalThis.Number(object.totalInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.scheduledAt !== 0) { + obj.scheduledAt = message.scheduledAt; + } + if (message.pendingInputs !== void 0) { + obj.pendingInputs = InputCategoryInfo.toJSON(message.pendingInputs); + } + if (message.failedInputs !== void 0) { + obj.failedInputs = InputCategoryInfo.toJSON(message.failedInputs); + } + if (message.succeededInputs !== void 0) { + obj.succeededInputs = InputCategoryInfo.toJSON(message.succeededInputs); + } + if (message.timeoutInputs !== void 0) { + obj.timeoutInputs = InputCategoryInfo.toJSON(message.timeoutInputs); + } + if (message.cancelledInputs !== void 0) { + obj.cancelledInputs = InputCategoryInfo.toJSON(message.cancelledInputs); + } + if (message.totalInputs !== 0) { + obj.totalInputs = Math.round(message.totalInputs); + } + return obj; + }, + create(base) { + return FunctionCallInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallInfo(); + message.functionCallId = object.functionCallId ?? ""; + message.idx = object.idx ?? 0; + message.createdAt = object.createdAt ?? 0; + message.scheduledAt = object.scheduledAt ?? 0; + message.pendingInputs = object.pendingInputs !== void 0 && object.pendingInputs !== null ? InputCategoryInfo.fromPartial(object.pendingInputs) : void 0; + message.failedInputs = object.failedInputs !== void 0 && object.failedInputs !== null ? InputCategoryInfo.fromPartial(object.failedInputs) : void 0; + message.succeededInputs = object.succeededInputs !== void 0 && object.succeededInputs !== null ? InputCategoryInfo.fromPartial(object.succeededInputs) : void 0; + message.timeoutInputs = object.timeoutInputs !== void 0 && object.timeoutInputs !== null ? InputCategoryInfo.fromPartial(object.timeoutInputs) : void 0; + message.cancelledInputs = object.cancelledInputs !== void 0 && object.cancelledInputs !== null ? InputCategoryInfo.fromPartial(object.cancelledInputs) : void 0; + message.totalInputs = object.totalInputs ?? 0; + return message; + } +}; +function createBaseFunctionCallListRequest() { + return { functionId: "" }; +} +var FunctionCallListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionCallListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallListRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionCallListResponse() { + return { functionCalls: [] }; +} +var FunctionCallListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.functionCalls) { + FunctionCallInfo.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCalls.push(FunctionCallInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCalls: globalThis.Array.isArray(object?.functionCalls) ? object.functionCalls.map((e) => FunctionCallInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCalls?.length) { + obj.functionCalls = message.functionCalls.map((e) => FunctionCallInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCallListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallListResponse(); + message.functionCalls = object.functionCalls?.map((e) => FunctionCallInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionCallPutDataRequest() { + return { functionCallId: void 0, attemptToken: void 0, dataChunks: [] }; +} +var FunctionCallPutDataRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.attemptToken !== void 0) { + writer.uint32(26).string(message.attemptToken); + } + for (const v of message.dataChunks) { + DataChunk.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCallPutDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataChunks.push(DataChunk.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0, + dataChunks: globalThis.Array.isArray(object?.dataChunks) ? object.dataChunks.map((e) => DataChunk.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + if (message.dataChunks?.length) { + obj.dataChunks = message.dataChunks.map((e) => DataChunk.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCallPutDataRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCallPutDataRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.attemptToken = object.attemptToken ?? void 0; + message.dataChunks = object.dataChunks?.map((e) => DataChunk.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionCreateRequest() { + return { function: void 0, appId: "", schedule: void 0, existingFunctionId: "", functionData: void 0 }; +} +var FunctionCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(10).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(18).string(message.appId); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(50).fork()).join(); + } + if (message.existingFunctionId !== "") { + writer.uint32(58).string(message.existingFunctionId); + } + if (message.functionData !== void 0) { + FunctionData.encode(message.functionData, writer.uint32(74).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.existingFunctionId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionData = FunctionData.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + existingFunctionId: isSet4(object.existingFunctionId) ? globalThis.String(object.existingFunctionId) : "", + functionData: isSet4(object.functionData) ? FunctionData.fromJSON(object.functionData) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.existingFunctionId !== "") { + obj.existingFunctionId = message.existingFunctionId; + } + if (message.functionData !== void 0) { + obj.functionData = FunctionData.toJSON(message.functionData); + } + return obj; + }, + create(base) { + return FunctionCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCreateRequest(); + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + message.appId = object.appId ?? ""; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.existingFunctionId = object.existingFunctionId ?? ""; + message.functionData = object.functionData !== void 0 && object.functionData !== null ? FunctionData.fromPartial(object.functionData) : void 0; + return message; + } +}; +function createBaseFunctionCreateResponse() { + return { functionId: "", DeprecatedWebUrl: "", function: void 0, handleMetadata: void 0, serverWarnings: [] }; +} +var FunctionCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.DeprecatedWebUrl !== "") { + writer.uint32(18).string(message.DeprecatedWebUrl); + } + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(34).fork()).join(); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(42).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.DeprecatedWebUrl = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + DeprecatedWebUrl: isSet4(object.DeprecatedWebUrl) ? globalThis.String(object.DeprecatedWebUrl) : "", + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0, + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.DeprecatedWebUrl !== "") { + obj.DeprecatedWebUrl = message.DeprecatedWebUrl; + } + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionCreateResponse(); + message.functionId = object.functionId ?? ""; + message.DeprecatedWebUrl = object.DeprecatedWebUrl ?? ""; + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionData() { + return { + moduleName: "", + functionName: "", + functionType: 0, + warmPoolSize: 0, + concurrencyLimit: 0, + taskIdleTimeoutSecs: 0, + ExperimentalGroupSize: 0, + ExperimentalBufferContainers: 0, + ExperimentalCustomScaling: false, + ExperimentalEnableGpuSnapshot: false, + workerId: "", + timeoutSecs: 0, + webUrl: "", + webUrlInfo: void 0, + webhookConfig: void 0, + customDomainInfo: [], + ExperimentalProxyIp: void 0, + methodDefinitions: {}, + methodDefinitionsSet: false, + isClass: false, + classParameterInfo: void 0, + isMethod: false, + useFunctionId: "", + useMethodName: "", + rankedFunctions: [], + schedule: void 0, + untrusted: false, + snapshotDebug: false, + runtimePerfRecord: false, + autoscalerSettings: void 0, + functionSchema: void 0, + experimentalOptions: {}, + flashServiceUrls: [], + flashServiceLabel: "", + startupTimeoutSecs: 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionData = { + encode(message, writer = new BinaryWriter()) { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(24).int32(message.functionType); + } + if (message.warmPoolSize !== 0) { + writer.uint32(32).uint32(message.warmPoolSize); + } + if (message.concurrencyLimit !== 0) { + writer.uint32(40).uint32(message.concurrencyLimit); + } + if (message.taskIdleTimeoutSecs !== 0) { + writer.uint32(48).uint32(message.taskIdleTimeoutSecs); + } + if (message.ExperimentalGroupSize !== 0) { + writer.uint32(152).uint32(message.ExperimentalGroupSize); + } + if (message.ExperimentalBufferContainers !== 0) { + writer.uint32(176).uint32(message.ExperimentalBufferContainers); + } + if (message.ExperimentalCustomScaling !== false) { + writer.uint32(184).bool(message.ExperimentalCustomScaling); + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + writer.uint32(240).bool(message.ExperimentalEnableGpuSnapshot); + } + if (message.workerId !== "") { + writer.uint32(58).string(message.workerId); + } + if (message.timeoutSecs !== 0) { + writer.uint32(64).uint32(message.timeoutSecs); + } + if (message.webUrl !== "") { + writer.uint32(74).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(82).fork()).join(); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(90).fork()).join(); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(98).fork()).join(); + } + if (message.ExperimentalProxyIp !== void 0) { + writer.uint32(194).string(message.ExperimentalProxyIp); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + FunctionData_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(202).fork()).join(); + }); + if (message.methodDefinitionsSet !== false) { + writer.uint32(208).bool(message.methodDefinitionsSet); + } + if (message.isClass !== false) { + writer.uint32(104).bool(message.isClass); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(114).fork()).join(); + } + if (message.isMethod !== false) { + writer.uint32(120).bool(message.isMethod); + } + if (message.useFunctionId !== "") { + writer.uint32(130).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(138).string(message.useMethodName); + } + for (const v of message.rankedFunctions) { + FunctionData_RankedFunction.encode(v, writer.uint32(146).fork()).join(); + } + if (message.schedule !== void 0) { + Schedule.encode(message.schedule, writer.uint32(162).fork()).join(); + } + if (message.untrusted !== false) { + writer.uint32(216).bool(message.untrusted); + } + if (message.snapshotDebug !== false) { + writer.uint32(224).bool(message.snapshotDebug); + } + if (message.runtimePerfRecord !== false) { + writer.uint32(232).bool(message.runtimePerfRecord); + } + if (message.autoscalerSettings !== void 0) { + AutoscalerSettings.encode(message.autoscalerSettings, writer.uint32(250).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(258).fork()).join(); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + FunctionData_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(266).fork()).join(); + }); + for (const v of message.flashServiceUrls) { + writer.uint32(274).string(v); + } + if (message.flashServiceLabel !== "") { + writer.uint32(282).string(message.flashServiceLabel); + } + if (message.startupTimeoutSecs !== 0) { + writer.uint32(288).uint32(message.startupTimeoutSecs); + } + writer.uint32(298).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(306).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.moduleName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.ExperimentalGroupSize = reader.uint32(); + continue; + } + case 22: { + if (tag !== 176) { + break; + } + message.ExperimentalBufferContainers = reader.uint32(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + message.ExperimentalCustomScaling = reader.bool(); + continue; + } + case 30: { + if (tag !== 240) { + break; + } + message.ExperimentalEnableGpuSnapshot = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.workerId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + message.ExperimentalProxyIp = reader.string(); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + const entry25 = FunctionData_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry25.value !== void 0) { + message.methodDefinitions[entry25.key] = entry25.value; + } + continue; + } + case 26: { + if (tag !== 208) { + break; + } + message.methodDefinitionsSet = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.isClass = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.rankedFunctions.push(FunctionData_RankedFunction.decode(reader, reader.uint32())); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.schedule = Schedule.decode(reader, reader.uint32()); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.untrusted = reader.bool(); + continue; + } + case 28: { + if (tag !== 224) { + break; + } + message.snapshotDebug = reader.bool(); + continue; + } + case 29: { + if (tag !== 232) { + break; + } + message.runtimePerfRecord = reader.bool(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + message.autoscalerSettings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + case 32: { + if (tag !== 258) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 266) { + break; + } + const entry33 = FunctionData_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry33.value !== void 0) { + message.experimentalOptions[entry33.key] = entry33.value; + } + continue; + } + case 34: { + if (tag !== 274) { + break; + } + message.flashServiceUrls.push(reader.string()); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.flashServiceLabel = reader.string(); + continue; + } + case 36: { + if (tag !== 288) { + break; + } + message.startupTimeoutSecs = reader.uint32(); + continue; + } + case 37: { + if (tag === 296) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 298) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 38: { + if (tag === 304) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 306) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + moduleName: isSet4(object.moduleName) ? globalThis.String(object.moduleName) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : 0, + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : 0, + ExperimentalGroupSize: isSet4(object.ExperimentalGroupSize) ? globalThis.Number(object.ExperimentalGroupSize) : 0, + ExperimentalBufferContainers: isSet4(object.ExperimentalBufferContainers) ? globalThis.Number(object.ExperimentalBufferContainers) : 0, + ExperimentalCustomScaling: isSet4(object.ExperimentalCustomScaling) ? globalThis.Boolean(object.ExperimentalCustomScaling) : false, + ExperimentalEnableGpuSnapshot: isSet4(object.ExperimentalEnableGpuSnapshot) ? globalThis.Boolean(object.ExperimentalEnableGpuSnapshot) : false, + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + ExperimentalProxyIp: isSet4(object.ExperimentalProxyIp) ? globalThis.String(object.ExperimentalProxyIp) : void 0, + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + methodDefinitionsSet: isSet4(object.methodDefinitionsSet) ? globalThis.Boolean(object.methodDefinitionsSet) : false, + isClass: isSet4(object.isClass) ? globalThis.Boolean(object.isClass) : false, + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + rankedFunctions: globalThis.Array.isArray(object?.rankedFunctions) ? object.rankedFunctions.map((e) => FunctionData_RankedFunction.fromJSON(e)) : [], + schedule: isSet4(object.schedule) ? Schedule.fromJSON(object.schedule) : void 0, + untrusted: isSet4(object.untrusted) ? globalThis.Boolean(object.untrusted) : false, + snapshotDebug: isSet4(object.snapshotDebug) ? globalThis.Boolean(object.snapshotDebug) : false, + runtimePerfRecord: isSet4(object.runtimePerfRecord) ? globalThis.Boolean(object.runtimePerfRecord) : false, + autoscalerSettings: isSet4(object.autoscalerSettings) ? AutoscalerSettings.fromJSON(object.autoscalerSettings) : void 0, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + flashServiceUrls: globalThis.Array.isArray(object?.flashServiceUrls) ? object.flashServiceUrls.map((e) => globalThis.String(e)) : [], + flashServiceLabel: isSet4(object.flashServiceLabel) ? globalThis.String(object.flashServiceLabel) : "", + startupTimeoutSecs: isSet4(object.startupTimeoutSecs) ? globalThis.Number(object.startupTimeoutSecs) : 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.moduleName !== "") { + obj.moduleName = message.moduleName; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.warmPoolSize !== 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.concurrencyLimit !== 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.taskIdleTimeoutSecs !== 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.ExperimentalGroupSize !== 0) { + obj.ExperimentalGroupSize = Math.round(message.ExperimentalGroupSize); + } + if (message.ExperimentalBufferContainers !== 0) { + obj.ExperimentalBufferContainers = Math.round(message.ExperimentalBufferContainers); + } + if (message.ExperimentalCustomScaling !== false) { + obj.ExperimentalCustomScaling = message.ExperimentalCustomScaling; + } + if (message.ExperimentalEnableGpuSnapshot !== false) { + obj.ExperimentalEnableGpuSnapshot = message.ExperimentalEnableGpuSnapshot; + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.ExperimentalProxyIp !== void 0) { + obj.ExperimentalProxyIp = message.ExperimentalProxyIp; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.methodDefinitionsSet !== false) { + obj.methodDefinitionsSet = message.methodDefinitionsSet; + } + if (message.isClass !== false) { + obj.isClass = message.isClass; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.rankedFunctions?.length) { + obj.rankedFunctions = message.rankedFunctions.map((e) => FunctionData_RankedFunction.toJSON(e)); + } + if (message.schedule !== void 0) { + obj.schedule = Schedule.toJSON(message.schedule); + } + if (message.untrusted !== false) { + obj.untrusted = message.untrusted; + } + if (message.snapshotDebug !== false) { + obj.snapshotDebug = message.snapshotDebug; + } + if (message.runtimePerfRecord !== false) { + obj.runtimePerfRecord = message.runtimePerfRecord; + } + if (message.autoscalerSettings !== void 0) { + obj.autoscalerSettings = AutoscalerSettings.toJSON(message.autoscalerSettings); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.flashServiceUrls?.length) { + obj.flashServiceUrls = message.flashServiceUrls; + } + if (message.flashServiceLabel !== "") { + obj.flashServiceLabel = message.flashServiceLabel; + } + if (message.startupTimeoutSecs !== 0) { + obj.startupTimeoutSecs = Math.round(message.startupTimeoutSecs); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData(); + message.moduleName = object.moduleName ?? ""; + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.warmPoolSize = object.warmPoolSize ?? 0; + message.concurrencyLimit = object.concurrencyLimit ?? 0; + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? 0; + message.ExperimentalGroupSize = object.ExperimentalGroupSize ?? 0; + message.ExperimentalBufferContainers = object.ExperimentalBufferContainers ?? 0; + message.ExperimentalCustomScaling = object.ExperimentalCustomScaling ?? false; + message.ExperimentalEnableGpuSnapshot = object.ExperimentalEnableGpuSnapshot ?? false; + message.workerId = object.workerId ?? ""; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.ExperimentalProxyIp = object.ExperimentalProxyIp ?? void 0; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.methodDefinitionsSet = object.methodDefinitionsSet ?? false; + message.isClass = object.isClass ?? false; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.isMethod = object.isMethod ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.rankedFunctions = object.rankedFunctions?.map((e) => FunctionData_RankedFunction.fromPartial(e)) || []; + message.schedule = object.schedule !== void 0 && object.schedule !== null ? Schedule.fromPartial(object.schedule) : void 0; + message.untrusted = object.untrusted ?? false; + message.snapshotDebug = object.snapshotDebug ?? false; + message.runtimePerfRecord = object.runtimePerfRecord ?? false; + message.autoscalerSettings = object.autoscalerSettings !== void 0 && object.autoscalerSettings !== null ? AutoscalerSettings.fromPartial(object.autoscalerSettings) : void 0; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.flashServiceUrls = object.flashServiceUrls?.map((e) => e) || []; + message.flashServiceLabel = object.flashServiceLabel ?? ""; + message.startupTimeoutSecs = object.startupTimeoutSecs ?? 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionData_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var FunctionData_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionData_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionData_RankedFunction() { + return { rank: 0, function: void 0 }; +} +var FunctionData_RankedFunction = { + encode(message, writer = new BinaryWriter()) { + if (message.rank !== 0) { + writer.uint32(8).uint32(message.rank); + } + if (message.function !== void 0) { + FunctionMessage.encode(message.function, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_RankedFunction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.rank = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.function = FunctionMessage.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rank: isSet4(object.rank) ? globalThis.Number(object.rank) : 0, + function: isSet4(object.function) ? FunctionMessage.fromJSON(object.function) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.rank !== 0) { + obj.rank = Math.round(message.rank); + } + if (message.function !== void 0) { + obj.function = FunctionMessage.toJSON(message.function); + } + return obj; + }, + create(base) { + return FunctionData_RankedFunction.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_RankedFunction(); + message.rank = object.rank ?? 0; + message.function = object.function !== void 0 && object.function !== null ? FunctionMessage.fromPartial(object.function) : void 0; + return message; + } +}; +function createBaseFunctionData_ExperimentalOptionsEntry() { + return { key: "", value: "" }; +} +var FunctionData_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionData_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return FunctionData_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionData_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseFunctionFinishInputsRequest() { + return { functionId: "", functionCallId: "", numInputs: 0 }; +} +var FunctionFinishInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + if (message.numInputs !== 0) { + writer.uint32(24).uint32(message.numInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionFinishInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numInputs = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + numInputs: isSet4(object.numInputs) ? globalThis.Number(object.numInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.numInputs !== 0) { + obj.numInputs = Math.round(message.numInputs); + } + return obj; + }, + create(base) { + return FunctionFinishInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionFinishInputsRequest(); + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.numInputs = object.numInputs ?? 0; + return message; + } +}; +function createBaseFunctionGetCallGraphRequest() { + return { functionCallId: "" }; +} +var FunctionGetCallGraphRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCallGraphRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + return obj; + }, + create(base) { + return FunctionGetCallGraphRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCallGraphRequest(); + message.functionCallId = object.functionCallId ?? ""; + return message; + } +}; +function createBaseFunctionGetCallGraphResponse() { + return { inputs: [], functionCalls: [] }; +} +var FunctionGetCallGraphResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + InputCallGraphInfo.encode(v, writer.uint32(10).fork()).join(); + } + for (const v of message.functionCalls) { + FunctionCallCallGraphInfo.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCallGraphResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputs.push(InputCallGraphInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCalls.push(FunctionCallCallGraphInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => InputCallGraphInfo.fromJSON(e)) : [], + functionCalls: globalThis.Array.isArray(object?.functionCalls) ? object.functionCalls.map((e) => FunctionCallCallGraphInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => InputCallGraphInfo.toJSON(e)); + } + if (message.functionCalls?.length) { + obj.functionCalls = message.functionCalls.map((e) => FunctionCallCallGraphInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionGetCallGraphResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCallGraphResponse(); + message.inputs = object.inputs?.map((e) => InputCallGraphInfo.fromPartial(e)) || []; + message.functionCalls = object.functionCalls?.map((e) => FunctionCallCallGraphInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionGetCurrentStatsRequest() { + return { functionId: "" }; +} +var FunctionGetCurrentStatsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetCurrentStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionGetCurrentStatsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetCurrentStatsRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionGetDynamicConcurrencyRequest() { + return { functionId: "", targetConcurrency: 0, maxConcurrency: 0 }; +} +var FunctionGetDynamicConcurrencyRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.targetConcurrency !== 0) { + writer.uint32(16).uint32(message.targetConcurrency); + } + if (message.maxConcurrency !== 0) { + writer.uint32(24).uint32(message.maxConcurrency); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetDynamicConcurrencyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.targetConcurrency = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxConcurrency = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + targetConcurrency: isSet4(object.targetConcurrency) ? globalThis.Number(object.targetConcurrency) : 0, + maxConcurrency: isSet4(object.maxConcurrency) ? globalThis.Number(object.maxConcurrency) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.targetConcurrency !== 0) { + obj.targetConcurrency = Math.round(message.targetConcurrency); + } + if (message.maxConcurrency !== 0) { + obj.maxConcurrency = Math.round(message.maxConcurrency); + } + return obj; + }, + create(base) { + return FunctionGetDynamicConcurrencyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetDynamicConcurrencyRequest(); + message.functionId = object.functionId ?? ""; + message.targetConcurrency = object.targetConcurrency ?? 0; + message.maxConcurrency = object.maxConcurrency ?? 0; + return message; + } +}; +function createBaseFunctionGetDynamicConcurrencyResponse() { + return { concurrency: 0 }; +} +var FunctionGetDynamicConcurrencyResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.concurrency !== 0) { + writer.uint32(8).uint32(message.concurrency); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetDynamicConcurrencyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.concurrency = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { concurrency: isSet4(object.concurrency) ? globalThis.Number(object.concurrency) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.concurrency !== 0) { + obj.concurrency = Math.round(message.concurrency); + } + return obj; + }, + create(base) { + return FunctionGetDynamicConcurrencyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetDynamicConcurrencyResponse(); + message.concurrency = object.concurrency ?? 0; + return message; + } +}; +function createBaseFunctionGetInputsItem() { + return { + inputId: "", + input: void 0, + killSwitch: false, + functionCallId: "", + functionCallInvocationType: 0, + retryCount: 0, + functionMapIdx: void 0, + attemptToken: "" + }; +} +var FunctionGetInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.killSwitch !== false) { + writer.uint32(24).bool(message.killSwitch); + } + if (message.functionCallId !== "") { + writer.uint32(42).string(message.functionCallId); + } + if (message.functionCallInvocationType !== 0) { + writer.uint32(48).int32(message.functionCallInvocationType); + } + if (message.retryCount !== 0) { + writer.uint32(56).uint32(message.retryCount); + } + if (message.functionMapIdx !== void 0) { + writer.uint32(64).int32(message.functionMapIdx); + } + if (message.attemptToken !== "") { + writer.uint32(74).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.killSwitch = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.functionCallInvocationType = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionMapIdx = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + killSwitch: isSet4(object.killSwitch) ? globalThis.Boolean(object.killSwitch) : false, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + functionCallInvocationType: isSet4(object.functionCallInvocationType) ? functionCallInvocationTypeFromJSON(object.functionCallInvocationType) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + functionMapIdx: isSet4(object.functionMapIdx) ? globalThis.Number(object.functionMapIdx) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.killSwitch !== false) { + obj.killSwitch = message.killSwitch; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.functionCallInvocationType !== 0) { + obj.functionCallInvocationType = functionCallInvocationTypeToJSON(message.functionCallInvocationType); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.functionMapIdx !== void 0) { + obj.functionMapIdx = Math.round(message.functionMapIdx); + } + if (message.attemptToken !== "") { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return FunctionGetInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsItem(); + message.inputId = object.inputId ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.killSwitch = object.killSwitch ?? false; + message.functionCallId = object.functionCallId ?? ""; + message.functionCallInvocationType = object.functionCallInvocationType ?? 0; + message.retryCount = object.retryCount ?? 0; + message.functionMapIdx = object.functionMapIdx ?? void 0; + message.attemptToken = object.attemptToken ?? ""; + return message; + } +}; +function createBaseFunctionGetInputsRequest() { + return { functionId: "", maxValues: 0, averageCallTime: 0, inputConcurrency: 0, batchMaxSize: 0, batchLingerMs: 0 }; +} +var FunctionGetInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.maxValues !== 0) { + writer.uint32(24).int32(message.maxValues); + } + if (message.averageCallTime !== 0) { + writer.uint32(45).float(message.averageCallTime); + } + if (message.inputConcurrency !== 0) { + writer.uint32(48).int32(message.inputConcurrency); + } + if (message.batchMaxSize !== 0) { + writer.uint32(88).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + writer.uint32(96).uint64(message.batchLingerMs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxValues = reader.int32(); + continue; + } + case 5: { + if (tag !== 45) { + break; + } + message.averageCallTime = reader.float(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.inputConcurrency = reader.int32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + maxValues: isSet4(object.maxValues) ? globalThis.Number(object.maxValues) : 0, + averageCallTime: isSet4(object.averageCallTime) ? globalThis.Number(object.averageCallTime) : 0, + inputConcurrency: isSet4(object.inputConcurrency) ? globalThis.Number(object.inputConcurrency) : 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.maxValues !== 0) { + obj.maxValues = Math.round(message.maxValues); + } + if (message.averageCallTime !== 0) { + obj.averageCallTime = message.averageCallTime; + } + if (message.inputConcurrency !== 0) { + obj.inputConcurrency = Math.round(message.inputConcurrency); + } + if (message.batchMaxSize !== 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + return obj; + }, + create(base) { + return FunctionGetInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsRequest(); + message.functionId = object.functionId ?? ""; + message.maxValues = object.maxValues ?? 0; + message.averageCallTime = object.averageCallTime ?? 0; + message.inputConcurrency = object.inputConcurrency ?? 0; + message.batchMaxSize = object.batchMaxSize ?? 0; + message.batchLingerMs = object.batchLingerMs ?? 0; + return message; + } +}; +function createBaseFunctionGetInputsResponse() { + return { inputs: [], rateLimitSleepDuration: 0 }; +} +var FunctionGetInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + FunctionGetInputsItem.encode(v, writer.uint32(26).fork()).join(); + } + if (message.rateLimitSleepDuration !== 0) { + writer.uint32(37).float(message.rateLimitSleepDuration); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.inputs.push(FunctionGetInputsItem.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.rateLimitSleepDuration = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionGetInputsItem.fromJSON(e)) : [], + rateLimitSleepDuration: isSet4(object.rateLimitSleepDuration) ? globalThis.Number(object.rateLimitSleepDuration) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionGetInputsItem.toJSON(e)); + } + if (message.rateLimitSleepDuration !== 0) { + obj.rateLimitSleepDuration = message.rateLimitSleepDuration; + } + return obj; + }, + create(base) { + return FunctionGetInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetInputsResponse(); + message.inputs = object.inputs?.map((e) => FunctionGetInputsItem.fromPartial(e)) || []; + message.rateLimitSleepDuration = object.rateLimitSleepDuration ?? 0; + return message; + } +}; +function createBaseFunctionGetOutputsItem() { + return { + result: void 0, + idx: 0, + inputId: "", + dataFormat: 0, + taskId: "", + inputStartedAt: 0, + outputCreatedAt: 0, + retryCount: 0, + fcTraceTag: "" + }; +} +var FunctionGetOutputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.inputId !== "") { + writer.uint32(26).string(message.inputId); + } + if (message.dataFormat !== 0) { + writer.uint32(40).int32(message.dataFormat); + } + if (message.taskId !== "") { + writer.uint32(50).string(message.taskId); + } + if (message.inputStartedAt !== 0) { + writer.uint32(57).double(message.inputStartedAt); + } + if (message.outputCreatedAt !== 0) { + writer.uint32(65).double(message.outputCreatedAt); + } + if (message.retryCount !== 0) { + writer.uint32(72).uint32(message.retryCount); + } + if (message.fcTraceTag !== "") { + writer.uint32(82).string(message.fcTraceTag); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.inputId = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.taskId = reader.string(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.inputStartedAt = reader.double(); + continue; + } + case 8: { + if (tag !== 65) { + break; + } + message.outputCreatedAt = reader.double(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.fcTraceTag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + inputStartedAt: isSet4(object.inputStartedAt) ? globalThis.Number(object.inputStartedAt) : 0, + outputCreatedAt: isSet4(object.outputCreatedAt) ? globalThis.Number(object.outputCreatedAt) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + fcTraceTag: isSet4(object.fcTraceTag) ? globalThis.String(object.fcTraceTag) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.inputStartedAt !== 0) { + obj.inputStartedAt = message.inputStartedAt; + } + if (message.outputCreatedAt !== 0) { + obj.outputCreatedAt = message.outputCreatedAt; + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.fcTraceTag !== "") { + obj.fcTraceTag = message.fcTraceTag; + } + return obj; + }, + create(base) { + return FunctionGetOutputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsItem(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.idx = object.idx ?? 0; + message.inputId = object.inputId ?? ""; + message.dataFormat = object.dataFormat ?? 0; + message.taskId = object.taskId ?? ""; + message.inputStartedAt = object.inputStartedAt ?? 0; + message.outputCreatedAt = object.outputCreatedAt ?? 0; + message.retryCount = object.retryCount ?? 0; + message.fcTraceTag = object.fcTraceTag ?? ""; + return message; + } +}; +function createBaseFunctionGetOutputsRequest() { + return { + functionCallId: "", + maxValues: 0, + timeout: 0, + lastEntryId: "", + clearOnSuccess: false, + requestedAt: 0, + inputJwts: [], + startIdx: void 0, + endIdx: void 0 + }; +} +var FunctionGetOutputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + if (message.maxValues !== 0) { + writer.uint32(16).int32(message.maxValues); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(50).string(message.lastEntryId); + } + if (message.clearOnSuccess !== false) { + writer.uint32(56).bool(message.clearOnSuccess); + } + if (message.requestedAt !== 0) { + writer.uint32(65).double(message.requestedAt); + } + for (const v of message.inputJwts) { + writer.uint32(74).string(v); + } + if (message.startIdx !== void 0) { + writer.uint32(80).int32(message.startIdx); + } + if (message.endIdx !== void 0) { + writer.uint32(88).int32(message.endIdx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.maxValues = reader.int32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.clearOnSuccess = reader.bool(); + continue; + } + case 8: { + if (tag !== 65) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.inputJwts.push(reader.string()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.startIdx = reader.int32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.endIdx = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + maxValues: isSet4(object.maxValues) ? globalThis.Number(object.maxValues) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + clearOnSuccess: isSet4(object.clearOnSuccess) ? globalThis.Boolean(object.clearOnSuccess) : false, + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + inputJwts: globalThis.Array.isArray(object?.inputJwts) ? object.inputJwts.map((e) => globalThis.String(e)) : [], + startIdx: isSet4(object.startIdx) ? globalThis.Number(object.startIdx) : void 0, + endIdx: isSet4(object.endIdx) ? globalThis.Number(object.endIdx) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.maxValues !== 0) { + obj.maxValues = Math.round(message.maxValues); + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.clearOnSuccess !== false) { + obj.clearOnSuccess = message.clearOnSuccess; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.inputJwts?.length) { + obj.inputJwts = message.inputJwts; + } + if (message.startIdx !== void 0) { + obj.startIdx = Math.round(message.startIdx); + } + if (message.endIdx !== void 0) { + obj.endIdx = Math.round(message.endIdx); + } + return obj; + }, + create(base) { + return FunctionGetOutputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsRequest(); + message.functionCallId = object.functionCallId ?? ""; + message.maxValues = object.maxValues ?? 0; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.clearOnSuccess = object.clearOnSuccess ?? false; + message.requestedAt = object.requestedAt ?? 0; + message.inputJwts = object.inputJwts?.map((e) => e) || []; + message.startIdx = object.startIdx ?? void 0; + message.endIdx = object.endIdx ?? void 0; + return message; + } +}; +function createBaseFunctionGetOutputsResponse() { + return { idxs: [], outputs: [], lastEntryId: "", numUnfinishedInputs: 0 }; +} +var FunctionGetOutputsResponse = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(26).fork(); + for (const v of message.idxs) { + writer.int32(v); + } + writer.join(); + for (const v of message.outputs) { + FunctionGetOutputsItem.encode(v, writer.uint32(34).fork()).join(); + } + if (message.lastEntryId !== "") { + writer.uint32(42).string(message.lastEntryId); + } + if (message.numUnfinishedInputs !== 0) { + writer.uint32(48).int32(message.numUnfinishedInputs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetOutputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag === 24) { + message.idxs.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.idxs.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.outputs.push(FunctionGetOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.numUnfinishedInputs = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idxs: globalThis.Array.isArray(object?.idxs) ? object.idxs.map((e) => globalThis.Number(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionGetOutputsItem.fromJSON(e)) : [], + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + numUnfinishedInputs: isSet4(object.numUnfinishedInputs) ? globalThis.Number(object.numUnfinishedInputs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.idxs?.length) { + obj.idxs = message.idxs.map((e) => Math.round(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionGetOutputsItem.toJSON(e)); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.numUnfinishedInputs !== 0) { + obj.numUnfinishedInputs = Math.round(message.numUnfinishedInputs); + } + return obj; + }, + create(base) { + return FunctionGetOutputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetOutputsResponse(); + message.idxs = object.idxs?.map((e) => e) || []; + message.outputs = object.outputs?.map((e) => FunctionGetOutputsItem.fromPartial(e)) || []; + message.lastEntryId = object.lastEntryId ?? ""; + message.numUnfinishedInputs = object.numUnfinishedInputs ?? 0; + return message; + } +}; +function createBaseFunctionGetRequest() { + return { appName: "", objectTag: "", environmentName: "" }; +} +var FunctionGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + if (message.objectTag !== "") { + writer.uint32(18).string(message.objectTag); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.objectTag = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "", + objectTag: isSet4(object.objectTag) ? globalThis.String(object.objectTag) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appName !== "") { + obj.appName = message.appName; + } + if (message.objectTag !== "") { + obj.objectTag = message.objectTag; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return FunctionGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetRequest(); + message.appName = object.appName ?? ""; + message.objectTag = object.objectTag ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseFunctionGetResponse() { + return { functionId: "", handleMetadata: void 0, serverWarnings: [] }; +} +var FunctionGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + for (const v of message.serverWarnings) { + Warning.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.serverWarnings.push(Warning.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0, + serverWarnings: globalThis.Array.isArray(object?.serverWarnings) ? object.serverWarnings.map((e) => Warning.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + if (message.serverWarnings?.length) { + obj.serverWarnings = message.serverWarnings.map((e) => Warning.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetResponse(); + message.functionId = object.functionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + message.serverWarnings = object.serverWarnings?.map((e) => Warning.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionGetSerializedRequest() { + return { functionId: "" }; +} +var FunctionGetSerializedRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetSerializedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + return obj; + }, + create(base) { + return FunctionGetSerializedRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetSerializedRequest(); + message.functionId = object.functionId ?? ""; + return message; + } +}; +function createBaseFunctionGetSerializedResponse() { + return { functionSerialized: new Uint8Array(0), classSerialized: new Uint8Array(0) }; +} +var FunctionGetSerializedResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionSerialized.length !== 0) { + writer.uint32(10).bytes(message.functionSerialized); + } + if (message.classSerialized.length !== 0) { + writer.uint32(18).bytes(message.classSerialized); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionGetSerializedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionSerialized = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classSerialized = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionSerialized: isSet4(object.functionSerialized) ? bytesFromBase64(object.functionSerialized) : new Uint8Array(0), + classSerialized: isSet4(object.classSerialized) ? bytesFromBase64(object.classSerialized) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionSerialized.length !== 0) { + obj.functionSerialized = base64FromBytes(message.functionSerialized); + } + if (message.classSerialized.length !== 0) { + obj.classSerialized = base64FromBytes(message.classSerialized); + } + return obj; + }, + create(base) { + return FunctionGetSerializedResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionGetSerializedResponse(); + message.functionSerialized = object.functionSerialized ?? new Uint8Array(0); + message.classSerialized = object.classSerialized ?? new Uint8Array(0); + return message; + } +}; +function createBaseFunctionHandleMetadata() { + return { + functionName: "", + functionType: 0, + webUrl: "", + isMethod: false, + useFunctionId: "", + useMethodName: "", + definitionId: "", + classParameterInfo: void 0, + methodHandleMetadata: {}, + functionSchema: void 0, + inputPlaneUrl: void 0, + inputPlaneRegion: void 0, + maxObjectSizeBytes: void 0, + ExperimentalFlashUrls: [], + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(64).int32(message.functionType); + } + if (message.webUrl !== "") { + writer.uint32(226).string(message.webUrl); + } + if (message.isMethod !== false) { + writer.uint32(312).bool(message.isMethod); + } + if (message.useFunctionId !== "") { + writer.uint32(322).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(330).string(message.useMethodName); + } + if (message.definitionId !== "") { + writer.uint32(338).string(message.definitionId); + } + if (message.classParameterInfo !== void 0) { + ClassParameterInfo.encode(message.classParameterInfo, writer.uint32(346).fork()).join(); + } + Object.entries(message.methodHandleMetadata).forEach(([key, value]) => { + FunctionHandleMetadata_MethodHandleMetadataEntry.encode({ key, value }, writer.uint32(354).fork()).join(); + }); + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(362).fork()).join(); + } + if (message.inputPlaneUrl !== void 0) { + writer.uint32(370).string(message.inputPlaneUrl); + } + if (message.inputPlaneRegion !== void 0) { + writer.uint32(378).string(message.inputPlaneRegion); + } + if (message.maxObjectSizeBytes !== void 0) { + writer.uint32(384).uint64(message.maxObjectSizeBytes); + } + for (const v of message.ExperimentalFlashUrls) { + writer.uint32(394).string(v); + } + writer.uint32(402).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(410).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 39: { + if (tag !== 312) { + break; + } + message.isMethod = reader.bool(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 42: { + if (tag !== 338) { + break; + } + message.definitionId = reader.string(); + continue; + } + case 43: { + if (tag !== 346) { + break; + } + message.classParameterInfo = ClassParameterInfo.decode(reader, reader.uint32()); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + const entry44 = FunctionHandleMetadata_MethodHandleMetadataEntry.decode(reader, reader.uint32()); + if (entry44.value !== void 0) { + message.methodHandleMetadata[entry44.key] = entry44.value; + } + continue; + } + case 45: { + if (tag !== 362) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 46: { + if (tag !== 370) { + break; + } + message.inputPlaneUrl = reader.string(); + continue; + } + case 47: { + if (tag !== 378) { + break; + } + message.inputPlaneRegion = reader.string(); + continue; + } + case 48: { + if (tag !== 384) { + break; + } + message.maxObjectSizeBytes = longToNumber2(reader.uint64()); + continue; + } + case 49: { + if (tag !== 394) { + break; + } + message.ExperimentalFlashUrls.push(reader.string()); + continue; + } + case 50: { + if (tag === 400) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 402) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 51: { + if (tag === 408) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 410) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + isMethod: isSet4(object.isMethod) ? globalThis.Boolean(object.isMethod) : false, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + definitionId: isSet4(object.definitionId) ? globalThis.String(object.definitionId) : "", + classParameterInfo: isSet4(object.classParameterInfo) ? ClassParameterInfo.fromJSON(object.classParameterInfo) : void 0, + methodHandleMetadata: isObject2(object.methodHandleMetadata) ? Object.entries(object.methodHandleMetadata).reduce( + (acc, [key, value]) => { + acc[key] = FunctionHandleMetadata.fromJSON(value); + return acc; + }, + {} + ) : {}, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + inputPlaneUrl: isSet4(object.inputPlaneUrl) ? globalThis.String(object.inputPlaneUrl) : void 0, + inputPlaneRegion: isSet4(object.inputPlaneRegion) ? globalThis.String(object.inputPlaneRegion) : void 0, + maxObjectSizeBytes: isSet4(object.maxObjectSizeBytes) ? globalThis.Number(object.maxObjectSizeBytes) : void 0, + ExperimentalFlashUrls: globalThis.Array.isArray(object?.ExperimentalFlashUrls) ? object.ExperimentalFlashUrls.map((e) => globalThis.String(e)) : [], + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.isMethod !== false) { + obj.isMethod = message.isMethod; + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.definitionId !== "") { + obj.definitionId = message.definitionId; + } + if (message.classParameterInfo !== void 0) { + obj.classParameterInfo = ClassParameterInfo.toJSON(message.classParameterInfo); + } + if (message.methodHandleMetadata) { + const entries = Object.entries(message.methodHandleMetadata); + if (entries.length > 0) { + obj.methodHandleMetadata = {}; + entries.forEach(([k, v]) => { + obj.methodHandleMetadata[k] = FunctionHandleMetadata.toJSON(v); + }); + } + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.inputPlaneUrl !== void 0) { + obj.inputPlaneUrl = message.inputPlaneUrl; + } + if (message.inputPlaneRegion !== void 0) { + obj.inputPlaneRegion = message.inputPlaneRegion; + } + if (message.maxObjectSizeBytes !== void 0) { + obj.maxObjectSizeBytes = Math.round(message.maxObjectSizeBytes); + } + if (message.ExperimentalFlashUrls?.length) { + obj.ExperimentalFlashUrls = message.ExperimentalFlashUrls; + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionHandleMetadata(); + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.webUrl = object.webUrl ?? ""; + message.isMethod = object.isMethod ?? false; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.definitionId = object.definitionId ?? ""; + message.classParameterInfo = object.classParameterInfo !== void 0 && object.classParameterInfo !== null ? ClassParameterInfo.fromPartial(object.classParameterInfo) : void 0; + message.methodHandleMetadata = Object.entries(object.methodHandleMetadata ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = FunctionHandleMetadata.fromPartial(value); + } + return acc; + }, {}); + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.inputPlaneUrl = object.inputPlaneUrl ?? void 0; + message.inputPlaneRegion = object.inputPlaneRegion ?? void 0; + message.maxObjectSizeBytes = object.maxObjectSizeBytes ?? void 0; + message.ExperimentalFlashUrls = object.ExperimentalFlashUrls?.map((e) => e) || []; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionHandleMetadata_MethodHandleMetadataEntry() { + return { key: "", value: void 0 }; +} +var FunctionHandleMetadata_MethodHandleMetadataEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + FunctionHandleMetadata.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionHandleMetadata_MethodHandleMetadataEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? FunctionHandleMetadata.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = FunctionHandleMetadata.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionHandleMetadata_MethodHandleMetadataEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionHandleMetadata_MethodHandleMetadataEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? FunctionHandleMetadata.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionInput() { + return { args: void 0, argsBlobId: void 0, finalInput: false, dataFormat: 0, methodName: void 0 }; +} +var FunctionInput = { + encode(message, writer = new BinaryWriter()) { + if (message.args !== void 0) { + writer.uint32(10).bytes(message.args); + } + if (message.argsBlobId !== void 0) { + writer.uint32(58).string(message.argsBlobId); + } + if (message.finalInput !== false) { + writer.uint32(72).bool(message.finalInput); + } + if (message.dataFormat !== 0) { + writer.uint32(80).int32(message.dataFormat); + } + if (message.methodName !== void 0) { + writer.uint32(90).string(message.methodName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.args = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.argsBlobId = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.finalInput = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.methodName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + args: isSet4(object.args) ? bytesFromBase64(object.args) : void 0, + argsBlobId: isSet4(object.argsBlobId) ? globalThis.String(object.argsBlobId) : void 0, + finalInput: isSet4(object.finalInput) ? globalThis.Boolean(object.finalInput) : false, + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + methodName: isSet4(object.methodName) ? globalThis.String(object.methodName) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.args !== void 0) { + obj.args = base64FromBytes(message.args); + } + if (message.argsBlobId !== void 0) { + obj.argsBlobId = message.argsBlobId; + } + if (message.finalInput !== false) { + obj.finalInput = message.finalInput; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.methodName !== void 0) { + obj.methodName = message.methodName; + } + return obj; + }, + create(base) { + return FunctionInput.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionInput(); + message.args = object.args ?? void 0; + message.argsBlobId = object.argsBlobId ?? void 0; + message.finalInput = object.finalInput ?? false; + message.dataFormat = object.dataFormat ?? 0; + message.methodName = object.methodName ?? void 0; + return message; + } +}; +function createBaseFunctionMapRequest() { + return { + functionId: "", + parentInputId: "", + returnExceptions: false, + functionCallType: 0, + pipelinedInputs: [], + functionCallInvocationType: 0, + fromSpawnMap: false + }; +} +var FunctionMapRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.returnExceptions !== false) { + writer.uint32(24).bool(message.returnExceptions); + } + if (message.functionCallType !== 0) { + writer.uint32(32).int32(message.functionCallType); + } + for (const v of message.pipelinedInputs) { + FunctionPutInputsItem.encode(v, writer.uint32(42).fork()).join(); + } + if (message.functionCallInvocationType !== 0) { + writer.uint32(48).int32(message.functionCallInvocationType); + } + if (message.fromSpawnMap !== false) { + writer.uint32(56).bool(message.fromSpawnMap); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMapRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.returnExceptions = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.functionCallType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pipelinedInputs.push(FunctionPutInputsItem.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.functionCallInvocationType = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.fromSpawnMap = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + returnExceptions: isSet4(object.returnExceptions) ? globalThis.Boolean(object.returnExceptions) : false, + functionCallType: isSet4(object.functionCallType) ? functionCallTypeFromJSON(object.functionCallType) : 0, + pipelinedInputs: globalThis.Array.isArray(object?.pipelinedInputs) ? object.pipelinedInputs.map((e) => FunctionPutInputsItem.fromJSON(e)) : [], + functionCallInvocationType: isSet4(object.functionCallInvocationType) ? functionCallInvocationTypeFromJSON(object.functionCallInvocationType) : 0, + fromSpawnMap: isSet4(object.fromSpawnMap) ? globalThis.Boolean(object.fromSpawnMap) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.returnExceptions !== false) { + obj.returnExceptions = message.returnExceptions; + } + if (message.functionCallType !== 0) { + obj.functionCallType = functionCallTypeToJSON(message.functionCallType); + } + if (message.pipelinedInputs?.length) { + obj.pipelinedInputs = message.pipelinedInputs.map((e) => FunctionPutInputsItem.toJSON(e)); + } + if (message.functionCallInvocationType !== 0) { + obj.functionCallInvocationType = functionCallInvocationTypeToJSON(message.functionCallInvocationType); + } + if (message.fromSpawnMap !== false) { + obj.fromSpawnMap = message.fromSpawnMap; + } + return obj; + }, + create(base) { + return FunctionMapRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMapRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.returnExceptions = object.returnExceptions ?? false; + message.functionCallType = object.functionCallType ?? 0; + message.pipelinedInputs = object.pipelinedInputs?.map((e) => FunctionPutInputsItem.fromPartial(e)) || []; + message.functionCallInvocationType = object.functionCallInvocationType ?? 0; + message.fromSpawnMap = object.fromSpawnMap ?? false; + return message; + } +}; +function createBaseFunctionMapResponse() { + return { + functionCallId: "", + pipelinedInputs: [], + retryPolicy: void 0, + functionCallJwt: "", + syncClientRetriesEnabled: false, + maxInputsOutstanding: 0 + }; +} +var FunctionMapResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== "") { + writer.uint32(10).string(message.functionCallId); + } + for (const v of message.pipelinedInputs) { + FunctionPutInputsResponseItem.encode(v, writer.uint32(18).fork()).join(); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(26).fork()).join(); + } + if (message.functionCallJwt !== "") { + writer.uint32(34).string(message.functionCallJwt); + } + if (message.syncClientRetriesEnabled !== false) { + writer.uint32(40).bool(message.syncClientRetriesEnabled); + } + if (message.maxInputsOutstanding !== 0) { + writer.uint32(48).uint32(message.maxInputsOutstanding); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionMapResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pipelinedInputs.push(FunctionPutInputsResponseItem.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.functionCallJwt = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.syncClientRetriesEnabled = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.maxInputsOutstanding = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + pipelinedInputs: globalThis.Array.isArray(object?.pipelinedInputs) ? object.pipelinedInputs.map((e) => FunctionPutInputsResponseItem.fromJSON(e)) : [], + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + functionCallJwt: isSet4(object.functionCallJwt) ? globalThis.String(object.functionCallJwt) : "", + syncClientRetriesEnabled: isSet4(object.syncClientRetriesEnabled) ? globalThis.Boolean(object.syncClientRetriesEnabled) : false, + maxInputsOutstanding: isSet4(object.maxInputsOutstanding) ? globalThis.Number(object.maxInputsOutstanding) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.pipelinedInputs?.length) { + obj.pipelinedInputs = message.pipelinedInputs.map((e) => FunctionPutInputsResponseItem.toJSON(e)); + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.functionCallJwt !== "") { + obj.functionCallJwt = message.functionCallJwt; + } + if (message.syncClientRetriesEnabled !== false) { + obj.syncClientRetriesEnabled = message.syncClientRetriesEnabled; + } + if (message.maxInputsOutstanding !== 0) { + obj.maxInputsOutstanding = Math.round(message.maxInputsOutstanding); + } + return obj; + }, + create(base) { + return FunctionMapResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionMapResponse(); + message.functionCallId = object.functionCallId ?? ""; + message.pipelinedInputs = object.pipelinedInputs?.map((e) => FunctionPutInputsResponseItem.fromPartial(e)) || []; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.functionCallJwt = object.functionCallJwt ?? ""; + message.syncClientRetriesEnabled = object.syncClientRetriesEnabled ?? false; + message.maxInputsOutstanding = object.maxInputsOutstanding ?? 0; + return message; + } +}; +function createBaseFunctionOptions() { + return { + secretIds: [], + mountIds: [], + resources: void 0, + retryPolicy: void 0, + concurrencyLimit: void 0, + timeoutSecs: void 0, + taskIdleTimeoutSecs: void 0, + warmPoolSize: void 0, + volumeMounts: [], + targetConcurrentInputs: void 0, + replaceVolumeMounts: false, + replaceSecretIds: false, + bufferContainers: void 0, + maxConcurrentInputs: void 0, + batchMaxSize: void 0, + batchLingerMs: void 0, + schedulerPlacement: void 0, + cloudProviderStr: void 0, + replaceCloudBucketMounts: false, + cloudBucketMounts: [] + }; +} +var FunctionOptions = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.secretIds) { + writer.uint32(10).string(v); + } + for (const v of message.mountIds) { + writer.uint32(18).string(v); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(26).fork()).join(); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(34).fork()).join(); + } + if (message.concurrencyLimit !== void 0) { + writer.uint32(40).uint32(message.concurrencyLimit); + } + if (message.timeoutSecs !== void 0) { + writer.uint32(48).uint32(message.timeoutSecs); + } + if (message.taskIdleTimeoutSecs !== void 0) { + writer.uint32(56).uint32(message.taskIdleTimeoutSecs); + } + if (message.warmPoolSize !== void 0) { + writer.uint32(64).uint32(message.warmPoolSize); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(74).fork()).join(); + } + if (message.targetConcurrentInputs !== void 0) { + writer.uint32(80).uint32(message.targetConcurrentInputs); + } + if (message.replaceVolumeMounts !== false) { + writer.uint32(88).bool(message.replaceVolumeMounts); + } + if (message.replaceSecretIds !== false) { + writer.uint32(96).bool(message.replaceSecretIds); + } + if (message.bufferContainers !== void 0) { + writer.uint32(104).uint32(message.bufferContainers); + } + if (message.maxConcurrentInputs !== void 0) { + writer.uint32(112).uint32(message.maxConcurrentInputs); + } + if (message.batchMaxSize !== void 0) { + writer.uint32(120).uint32(message.batchMaxSize); + } + if (message.batchLingerMs !== void 0) { + writer.uint32(128).uint64(message.batchLingerMs); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(138).fork()).join(); + } + if (message.cloudProviderStr !== void 0) { + writer.uint32(146).string(message.cloudProviderStr); + } + if (message.replaceCloudBucketMounts !== false) { + writer.uint32(152).bool(message.replaceCloudBucketMounts); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(162).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.concurrencyLimit = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.taskIdleTimeoutSecs = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.warmPoolSize = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.replaceVolumeMounts = reader.bool(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.replaceSecretIds = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.bufferContainers = reader.uint32(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.batchMaxSize = reader.uint32(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.batchLingerMs = longToNumber2(reader.uint64()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + message.replaceCloudBucketMounts = reader.bool(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0, + concurrencyLimit: isSet4(object.concurrencyLimit) ? globalThis.Number(object.concurrencyLimit) : void 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : void 0, + taskIdleTimeoutSecs: isSet4(object.taskIdleTimeoutSecs) ? globalThis.Number(object.taskIdleTimeoutSecs) : void 0, + warmPoolSize: isSet4(object.warmPoolSize) ? globalThis.Number(object.warmPoolSize) : void 0, + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : void 0, + replaceVolumeMounts: isSet4(object.replaceVolumeMounts) ? globalThis.Boolean(object.replaceVolumeMounts) : false, + replaceSecretIds: isSet4(object.replaceSecretIds) ? globalThis.Boolean(object.replaceSecretIds) : false, + bufferContainers: isSet4(object.bufferContainers) ? globalThis.Number(object.bufferContainers) : void 0, + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : void 0, + batchMaxSize: isSet4(object.batchMaxSize) ? globalThis.Number(object.batchMaxSize) : void 0, + batchLingerMs: isSet4(object.batchLingerMs) ? globalThis.Number(object.batchLingerMs) : void 0, + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : void 0, + replaceCloudBucketMounts: isSet4(object.replaceCloudBucketMounts) ? globalThis.Boolean(object.replaceCloudBucketMounts) : false, + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + if (message.concurrencyLimit !== void 0) { + obj.concurrencyLimit = Math.round(message.concurrencyLimit); + } + if (message.timeoutSecs !== void 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.taskIdleTimeoutSecs !== void 0) { + obj.taskIdleTimeoutSecs = Math.round(message.taskIdleTimeoutSecs); + } + if (message.warmPoolSize !== void 0) { + obj.warmPoolSize = Math.round(message.warmPoolSize); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.targetConcurrentInputs !== void 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.replaceVolumeMounts !== false) { + obj.replaceVolumeMounts = message.replaceVolumeMounts; + } + if (message.replaceSecretIds !== false) { + obj.replaceSecretIds = message.replaceSecretIds; + } + if (message.bufferContainers !== void 0) { + obj.bufferContainers = Math.round(message.bufferContainers); + } + if (message.maxConcurrentInputs !== void 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.batchMaxSize !== void 0) { + obj.batchMaxSize = Math.round(message.batchMaxSize); + } + if (message.batchLingerMs !== void 0) { + obj.batchLingerMs = Math.round(message.batchLingerMs); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.cloudProviderStr !== void 0) { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.replaceCloudBucketMounts !== false) { + obj.replaceCloudBucketMounts = message.replaceCloudBucketMounts; + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionOptions(); + message.secretIds = object.secretIds?.map((e) => e) || []; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + message.concurrencyLimit = object.concurrencyLimit ?? void 0; + message.timeoutSecs = object.timeoutSecs ?? void 0; + message.taskIdleTimeoutSecs = object.taskIdleTimeoutSecs ?? void 0; + message.warmPoolSize = object.warmPoolSize ?? void 0; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? void 0; + message.replaceVolumeMounts = object.replaceVolumeMounts ?? false; + message.replaceSecretIds = object.replaceSecretIds ?? false; + message.bufferContainers = object.bufferContainers ?? void 0; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? void 0; + message.batchMaxSize = object.batchMaxSize ?? void 0; + message.batchLingerMs = object.batchLingerMs ?? void 0; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.cloudProviderStr = object.cloudProviderStr ?? void 0; + message.replaceCloudBucketMounts = object.replaceCloudBucketMounts ?? false; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPrecreateRequest() { + return { + appId: "", + functionName: "", + existingFunctionId: "", + functionType: 0, + webhookConfig: void 0, + useFunctionId: "", + useMethodName: "", + methodDefinitions: {}, + functionSchema: void 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var FunctionPrecreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.functionName !== "") { + writer.uint32(18).string(message.functionName); + } + if (message.existingFunctionId !== "") { + writer.uint32(26).string(message.existingFunctionId); + } + if (message.functionType !== 0) { + writer.uint32(32).int32(message.functionType); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(42).fork()).join(); + } + if (message.useFunctionId !== "") { + writer.uint32(50).string(message.useFunctionId); + } + if (message.useMethodName !== "") { + writer.uint32(58).string(message.useMethodName); + } + Object.entries(message.methodDefinitions).forEach(([key, value]) => { + FunctionPrecreateRequest_MethodDefinitionsEntry.encode({ key, value }, writer.uint32(66).fork()).join(); + }); + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(74).fork()).join(); + } + writer.uint32(82).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.existingFunctionId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.useFunctionId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.useMethodName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + const entry8 = FunctionPrecreateRequest_MethodDefinitionsEntry.decode(reader, reader.uint32()); + if (entry8.value !== void 0) { + message.methodDefinitions[entry8.key] = entry8.value; + } + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag === 80) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 11: { + if (tag === 88) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + existingFunctionId: isSet4(object.existingFunctionId) ? globalThis.String(object.existingFunctionId) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + useFunctionId: isSet4(object.useFunctionId) ? globalThis.String(object.useFunctionId) : "", + useMethodName: isSet4(object.useMethodName) ? globalThis.String(object.useMethodName) : "", + methodDefinitions: isObject2(object.methodDefinitions) ? Object.entries(object.methodDefinitions).reduce((acc, [key, value]) => { + acc[key] = MethodDefinition.fromJSON(value); + return acc; + }, {}) : {}, + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.existingFunctionId !== "") { + obj.existingFunctionId = message.existingFunctionId; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.useFunctionId !== "") { + obj.useFunctionId = message.useFunctionId; + } + if (message.useMethodName !== "") { + obj.useMethodName = message.useMethodName; + } + if (message.methodDefinitions) { + const entries = Object.entries(message.methodDefinitions); + if (entries.length > 0) { + obj.methodDefinitions = {}; + entries.forEach(([k, v]) => { + obj.methodDefinitions[k] = MethodDefinition.toJSON(v); + }); + } + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPrecreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateRequest(); + message.appId = object.appId ?? ""; + message.functionName = object.functionName ?? ""; + message.existingFunctionId = object.existingFunctionId ?? ""; + message.functionType = object.functionType ?? 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.useFunctionId = object.useFunctionId ?? ""; + message.useMethodName = object.useMethodName ?? ""; + message.methodDefinitions = Object.entries(object.methodDefinitions ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = MethodDefinition.fromPartial(value); + } + return acc; + }, {}); + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionPrecreateRequest_MethodDefinitionsEntry() { + return { key: "", value: void 0 }; +} +var FunctionPrecreateRequest_MethodDefinitionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== void 0) { + MethodDefinition.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateRequest_MethodDefinitionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = MethodDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? MethodDefinition.fromJSON(object.value) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== void 0) { + obj.value = MethodDefinition.toJSON(message.value); + } + return obj; + }, + create(base) { + return FunctionPrecreateRequest_MethodDefinitionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateRequest_MethodDefinitionsEntry(); + message.key = object.key ?? ""; + message.value = object.value !== void 0 && object.value !== null ? MethodDefinition.fromPartial(object.value) : void 0; + return message; + } +}; +function createBaseFunctionPrecreateResponse() { + return { functionId: "", handleMetadata: void 0 }; +} +var FunctionPrecreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.handleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPrecreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + handleMetadata: isSet4(object.handleMetadata) ? FunctionHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = FunctionHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return FunctionPrecreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPrecreateResponse(); + message.functionId = object.functionId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseFunctionPutInputsItem() { + return { idx: 0, input: void 0, r2Failed: false, r2ThroughputBytesS: 0 }; +} +var FunctionPutInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.idx !== 0) { + writer.uint32(8).int32(message.idx); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.r2Failed !== false) { + writer.uint32(24).bool(message.r2Failed); + } + if (message.r2ThroughputBytesS !== 0) { + writer.uint32(40).uint64(message.r2ThroughputBytesS); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.idx = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.r2Failed = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.r2ThroughputBytesS = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + r2Failed: isSet4(object.r2Failed) ? globalThis.Boolean(object.r2Failed) : false, + r2ThroughputBytesS: isSet4(object.r2ThroughputBytesS) ? globalThis.Number(object.r2ThroughputBytesS) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.r2Failed !== false) { + obj.r2Failed = message.r2Failed; + } + if (message.r2ThroughputBytesS !== 0) { + obj.r2ThroughputBytesS = Math.round(message.r2ThroughputBytesS); + } + return obj; + }, + create(base) { + return FunctionPutInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsItem(); + message.idx = object.idx ?? 0; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.r2Failed = object.r2Failed ?? false; + message.r2ThroughputBytesS = object.r2ThroughputBytesS ?? 0; + return message; + } +}; +function createBaseFunctionPutInputsRequest() { + return { functionId: "", functionCallId: "", inputs: [] }; +} +var FunctionPutInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(26).string(message.functionCallId); + } + for (const v of message.inputs) { + FunctionPutInputsItem.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.inputs.push(FunctionPutInputsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionPutInputsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionPutInputsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPutInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsRequest(); + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.inputs = object.inputs?.map((e) => FunctionPutInputsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPutInputsResponse() { + return { inputs: [] }; +} +var FunctionPutInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputs) { + FunctionPutInputsResponseItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputs.push(FunctionPutInputsResponseItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionPutInputsResponseItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionPutInputsResponseItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionPutInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsResponse(); + message.inputs = object.inputs?.map((e) => FunctionPutInputsResponseItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionPutInputsResponseItem() { + return { idx: 0, inputId: "", inputJwt: "" }; +} +var FunctionPutInputsResponseItem = { + encode(message, writer = new BinaryWriter()) { + if (message.idx !== 0) { + writer.uint32(8).int32(message.idx); + } + if (message.inputId !== "") { + writer.uint32(18).string(message.inputId); + } + if (message.inputJwt !== "") { + writer.uint32(26).string(message.inputJwt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutInputsResponseItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.idx = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.inputJwt = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + inputJwt: isSet4(object.inputJwt) ? globalThis.String(object.inputJwt) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.inputJwt !== "") { + obj.inputJwt = message.inputJwt; + } + return obj; + }, + create(base) { + return FunctionPutInputsResponseItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutInputsResponseItem(); + message.idx = object.idx ?? 0; + message.inputId = object.inputId ?? ""; + message.inputJwt = object.inputJwt ?? ""; + return message; + } +}; +function createBaseFunctionPutOutputsItem() { + return { + inputId: "", + result: void 0, + inputStartedAt: 0, + outputCreatedAt: 0, + dataFormat: 0, + retryCount: 0, + functionCallId: "", + functionMapIdx: void 0 + }; +} +var FunctionPutOutputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.inputStartedAt !== 0) { + writer.uint32(25).double(message.inputStartedAt); + } + if (message.outputCreatedAt !== 0) { + writer.uint32(33).double(message.outputCreatedAt); + } + if (message.dataFormat !== 0) { + writer.uint32(56).int32(message.dataFormat); + } + if (message.retryCount !== 0) { + writer.uint32(64).uint32(message.retryCount); + } + if (message.functionCallId !== "") { + writer.uint32(74).string(message.functionCallId); + } + if (message.functionMapIdx !== void 0) { + writer.uint32(80).int32(message.functionMapIdx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutOutputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.inputStartedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.outputCreatedAt = reader.double(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.dataFormat = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.functionMapIdx = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + inputStartedAt: isSet4(object.inputStartedAt) ? globalThis.Number(object.inputStartedAt) : 0, + outputCreatedAt: isSet4(object.outputCreatedAt) ? globalThis.Number(object.outputCreatedAt) : 0, + dataFormat: isSet4(object.dataFormat) ? dataFormatFromJSON(object.dataFormat) : 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + functionMapIdx: isSet4(object.functionMapIdx) ? globalThis.Number(object.functionMapIdx) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.inputStartedAt !== 0) { + obj.inputStartedAt = message.inputStartedAt; + } + if (message.outputCreatedAt !== 0) { + obj.outputCreatedAt = message.outputCreatedAt; + } + if (message.dataFormat !== 0) { + obj.dataFormat = dataFormatToJSON(message.dataFormat); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.functionMapIdx !== void 0) { + obj.functionMapIdx = Math.round(message.functionMapIdx); + } + return obj; + }, + create(base) { + return FunctionPutOutputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutOutputsItem(); + message.inputId = object.inputId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.inputStartedAt = object.inputStartedAt ?? 0; + message.outputCreatedAt = object.outputCreatedAt ?? 0; + message.dataFormat = object.dataFormat ?? 0; + message.retryCount = object.retryCount ?? 0; + message.functionCallId = object.functionCallId ?? ""; + message.functionMapIdx = object.functionMapIdx ?? void 0; + return message; + } +}; +function createBaseFunctionPutOutputsRequest() { + return { outputs: [], requestedAt: 0 }; +} +var FunctionPutOutputsRequest = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.outputs) { + FunctionPutOutputsItem.encode(v, writer.uint32(34).fork()).join(); + } + if (message.requestedAt !== 0) { + writer.uint32(41).double(message.requestedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionPutOutputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + message.outputs.push(FunctionPutOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.requestedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionPutOutputsItem.fromJSON(e)) : [], + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionPutOutputsItem.toJSON(e)); + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + return obj; + }, + create(base) { + return FunctionPutOutputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionPutOutputsRequest(); + message.outputs = object.outputs?.map((e) => FunctionPutOutputsItem.fromPartial(e)) || []; + message.requestedAt = object.requestedAt ?? 0; + return message; + } +}; +function createBaseFunctionRetryInputsItem() { + return { inputJwt: "", input: void 0, retryCount: 0 }; +} +var FunctionRetryInputsItem = { + encode(message, writer = new BinaryWriter()) { + if (message.inputJwt !== "") { + writer.uint32(10).string(message.inputJwt); + } + if (message.input !== void 0) { + FunctionInput.encode(message.input, writer.uint32(18).fork()).join(); + } + if (message.retryCount !== 0) { + writer.uint32(24).uint32(message.retryCount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputJwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = FunctionInput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.retryCount = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputJwt: isSet4(object.inputJwt) ? globalThis.String(object.inputJwt) : "", + input: isSet4(object.input) ? FunctionInput.fromJSON(object.input) : void 0, + retryCount: isSet4(object.retryCount) ? globalThis.Number(object.retryCount) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputJwt !== "") { + obj.inputJwt = message.inputJwt; + } + if (message.input !== void 0) { + obj.input = FunctionInput.toJSON(message.input); + } + if (message.retryCount !== 0) { + obj.retryCount = Math.round(message.retryCount); + } + return obj; + }, + create(base) { + return FunctionRetryInputsItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsItem(); + message.inputJwt = object.inputJwt ?? ""; + message.input = object.input !== void 0 && object.input !== null ? FunctionInput.fromPartial(object.input) : void 0; + message.retryCount = object.retryCount ?? 0; + return message; + } +}; +function createBaseFunctionRetryInputsRequest() { + return { functionCallJwt: "", inputs: [] }; +} +var FunctionRetryInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallJwt !== "") { + writer.uint32(10).string(message.functionCallJwt); + } + for (const v of message.inputs) { + FunctionRetryInputsItem.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallJwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputs.push(FunctionRetryInputsItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallJwt: isSet4(object.functionCallJwt) ? globalThis.String(object.functionCallJwt) : "", + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => FunctionRetryInputsItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallJwt !== "") { + obj.functionCallJwt = message.functionCallJwt; + } + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => FunctionRetryInputsItem.toJSON(e)); + } + return obj; + }, + create(base) { + return FunctionRetryInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsRequest(); + message.functionCallJwt = object.functionCallJwt ?? ""; + message.inputs = object.inputs?.map((e) => FunctionRetryInputsItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseFunctionRetryInputsResponse() { + return { inputJwts: [] }; +} +var FunctionRetryInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputJwts) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputJwts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputJwts: globalThis.Array.isArray(object?.inputJwts) ? object.inputJwts.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputJwts?.length) { + obj.inputJwts = message.inputJwts; + } + return obj; + }, + create(base) { + return FunctionRetryInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryInputsResponse(); + message.inputJwts = object.inputJwts?.map((e) => e) || []; + return message; + } +}; +function createBaseFunctionRetryPolicy() { + return { backoffCoefficient: 0, initialDelayMs: 0, maxDelayMs: 0, retries: 0 }; +} +var FunctionRetryPolicy = { + encode(message, writer = new BinaryWriter()) { + if (message.backoffCoefficient !== 0) { + writer.uint32(13).float(message.backoffCoefficient); + } + if (message.initialDelayMs !== 0) { + writer.uint32(16).uint32(message.initialDelayMs); + } + if (message.maxDelayMs !== 0) { + writer.uint32(24).uint32(message.maxDelayMs); + } + if (message.retries !== 0) { + writer.uint32(144).uint32(message.retries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionRetryPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + message.backoffCoefficient = reader.float(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.initialDelayMs = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxDelayMs = reader.uint32(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + message.retries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + backoffCoefficient: isSet4(object.backoffCoefficient) ? globalThis.Number(object.backoffCoefficient) : 0, + initialDelayMs: isSet4(object.initialDelayMs) ? globalThis.Number(object.initialDelayMs) : 0, + maxDelayMs: isSet4(object.maxDelayMs) ? globalThis.Number(object.maxDelayMs) : 0, + retries: isSet4(object.retries) ? globalThis.Number(object.retries) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.backoffCoefficient !== 0) { + obj.backoffCoefficient = message.backoffCoefficient; + } + if (message.initialDelayMs !== 0) { + obj.initialDelayMs = Math.round(message.initialDelayMs); + } + if (message.maxDelayMs !== 0) { + obj.maxDelayMs = Math.round(message.maxDelayMs); + } + if (message.retries !== 0) { + obj.retries = Math.round(message.retries); + } + return obj; + }, + create(base) { + return FunctionRetryPolicy.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionRetryPolicy(); + message.backoffCoefficient = object.backoffCoefficient ?? 0; + message.initialDelayMs = object.initialDelayMs ?? 0; + message.maxDelayMs = object.maxDelayMs ?? 0; + message.retries = object.retries ?? 0; + return message; + } +}; +function createBaseFunctionSchema() { + return { schemaType: 0, arguments: [], returnType: void 0 }; +} +var FunctionSchema = { + encode(message, writer = new BinaryWriter()) { + if (message.schemaType !== 0) { + writer.uint32(8).int32(message.schemaType); + } + for (const v of message.arguments) { + ClassParameterSpec.encode(v, writer.uint32(18).fork()).join(); + } + if (message.returnType !== void 0) { + GenericPayloadType.encode(message.returnType, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.schemaType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.arguments.push(ClassParameterSpec.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.returnType = GenericPayloadType.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + schemaType: isSet4(object.schemaType) ? functionSchema_FunctionSchemaTypeFromJSON(object.schemaType) : 0, + arguments: globalThis.Array.isArray(object?.arguments) ? object.arguments.map((e) => ClassParameterSpec.fromJSON(e)) : [], + returnType: isSet4(object.returnType) ? GenericPayloadType.fromJSON(object.returnType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.schemaType !== 0) { + obj.schemaType = functionSchema_FunctionSchemaTypeToJSON(message.schemaType); + } + if (message.arguments?.length) { + obj.arguments = message.arguments.map((e) => ClassParameterSpec.toJSON(e)); + } + if (message.returnType !== void 0) { + obj.returnType = GenericPayloadType.toJSON(message.returnType); + } + return obj; + }, + create(base) { + return FunctionSchema.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionSchema(); + message.schemaType = object.schemaType ?? 0; + message.arguments = object.arguments?.map((e) => ClassParameterSpec.fromPartial(e)) || []; + message.returnType = object.returnType !== void 0 && object.returnType !== null ? GenericPayloadType.fromPartial(object.returnType) : void 0; + return message; + } +}; +function createBaseFunctionStats() { + return { backlog: 0, numTotalTasks: 0 }; +} +var FunctionStats = { + encode(message, writer = new BinaryWriter()) { + if (message.backlog !== 0) { + writer.uint32(8).uint32(message.backlog); + } + if (message.numTotalTasks !== 0) { + writer.uint32(24).uint32(message.numTotalTasks); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.backlog = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numTotalTasks = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + backlog: isSet4(object.backlog) ? globalThis.Number(object.backlog) : 0, + numTotalTasks: isSet4(object.numTotalTasks) ? globalThis.Number(object.numTotalTasks) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.backlog !== 0) { + obj.backlog = Math.round(message.backlog); + } + if (message.numTotalTasks !== 0) { + obj.numTotalTasks = Math.round(message.numTotalTasks); + } + return obj; + }, + create(base) { + return FunctionStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionStats(); + message.backlog = object.backlog ?? 0; + message.numTotalTasks = object.numTotalTasks ?? 0; + return message; + } +}; +function createBaseFunctionUpdateSchedulingParamsRequest() { + return { functionId: "", warmPoolSizeOverride: 0, settings: void 0 }; +} +var FunctionUpdateSchedulingParamsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.warmPoolSizeOverride !== 0) { + writer.uint32(16).uint32(message.warmPoolSizeOverride); + } + if (message.settings !== void 0) { + AutoscalerSettings.encode(message.settings, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionUpdateSchedulingParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.warmPoolSizeOverride = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.settings = AutoscalerSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + warmPoolSizeOverride: isSet4(object.warmPoolSizeOverride) ? globalThis.Number(object.warmPoolSizeOverride) : 0, + settings: isSet4(object.settings) ? AutoscalerSettings.fromJSON(object.settings) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.warmPoolSizeOverride !== 0) { + obj.warmPoolSizeOverride = Math.round(message.warmPoolSizeOverride); + } + if (message.settings !== void 0) { + obj.settings = AutoscalerSettings.toJSON(message.settings); + } + return obj; + }, + create(base) { + return FunctionUpdateSchedulingParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFunctionUpdateSchedulingParamsRequest(); + message.functionId = object.functionId ?? ""; + message.warmPoolSizeOverride = object.warmPoolSizeOverride ?? 0; + message.settings = object.settings !== void 0 && object.settings !== null ? AutoscalerSettings.fromPartial(object.settings) : void 0; + return message; + } +}; +function createBaseFunctionUpdateSchedulingParamsResponse() { + return {}; +} +var FunctionUpdateSchedulingParamsResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseFunctionUpdateSchedulingParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return FunctionUpdateSchedulingParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFunctionUpdateSchedulingParamsResponse(); + return message; + } +}; +function createBaseGPUConfig() { + return { type: 0, count: 0, gpuType: "" }; +} +var GPUConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.count !== 0) { + writer.uint32(16).uint32(message.count); + } + if (message.gpuType !== "") { + writer.uint32(34).string(message.gpuType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGPUConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.count = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? gPUTypeFromJSON(object.type) : 0, + count: isSet4(object.count) ? globalThis.Number(object.count) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = gPUTypeToJSON(message.type); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.gpuType !== "") { + obj.gpuType = message.gpuType; + } + return obj; + }, + create(base) { + return GPUConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGPUConfig(); + message.type = object.type ?? 0; + message.count = object.count ?? 0; + message.gpuType = object.gpuType ?? ""; + return message; + } +}; +function createBaseGeneratorDone() { + return { itemsTotal: 0 }; +} +var GeneratorDone = { + encode(message, writer = new BinaryWriter()) { + if (message.itemsTotal !== 0) { + writer.uint32(8).uint64(message.itemsTotal); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGeneratorDone(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.itemsTotal = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { itemsTotal: isSet4(object.itemsTotal) ? globalThis.Number(object.itemsTotal) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.itemsTotal !== 0) { + obj.itemsTotal = Math.round(message.itemsTotal); + } + return obj; + }, + create(base) { + return GeneratorDone.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratorDone(); + message.itemsTotal = object.itemsTotal ?? 0; + return message; + } +}; +function createBaseGenericPayloadType() { + return { baseType: 0, subTypes: [] }; +} +var GenericPayloadType = { + encode(message, writer = new BinaryWriter()) { + if (message.baseType !== 0) { + writer.uint32(8).int32(message.baseType); + } + for (const v of message.subTypes) { + GenericPayloadType.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGenericPayloadType(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.baseType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.subTypes.push(GenericPayloadType.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseType: isSet4(object.baseType) ? parameterTypeFromJSON(object.baseType) : 0, + subTypes: globalThis.Array.isArray(object?.subTypes) ? object.subTypes.map((e) => GenericPayloadType.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseType !== 0) { + obj.baseType = parameterTypeToJSON(message.baseType); + } + if (message.subTypes?.length) { + obj.subTypes = message.subTypes.map((e) => GenericPayloadType.toJSON(e)); + } + return obj; + }, + create(base) { + return GenericPayloadType.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenericPayloadType(); + message.baseType = object.baseType ?? 0; + message.subTypes = object.subTypes?.map((e) => GenericPayloadType.fromPartial(e)) || []; + return message; + } +}; +function createBaseGenericResult() { + return { + status: 0, + exception: "", + exitcode: 0, + traceback: "", + serializedTb: new Uint8Array(0), + tbLineCache: new Uint8Array(0), + data: void 0, + dataBlobId: void 0, + propagationReason: "" + }; +} +var GenericResult = { + encode(message, writer = new BinaryWriter()) { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + if (message.exception !== "") { + writer.uint32(18).string(message.exception); + } + if (message.exitcode !== 0) { + writer.uint32(24).int32(message.exitcode); + } + if (message.traceback !== "") { + writer.uint32(34).string(message.traceback); + } + if (message.serializedTb.length !== 0) { + writer.uint32(90).bytes(message.serializedTb); + } + if (message.tbLineCache.length !== 0) { + writer.uint32(98).bytes(message.tbLineCache); + } + if (message.data !== void 0) { + writer.uint32(42).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(82).string(message.dataBlobId); + } + if (message.propagationReason !== "") { + writer.uint32(106).string(message.propagationReason); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseGenericResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.status = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.exception = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.exitcode = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.traceback = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.serializedTb = reader.bytes(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.tbLineCache = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.data = reader.bytes(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.propagationReason = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet4(object.status) ? genericResult_GenericStatusFromJSON(object.status) : 0, + exception: isSet4(object.exception) ? globalThis.String(object.exception) : "", + exitcode: isSet4(object.exitcode) ? globalThis.Number(object.exitcode) : 0, + traceback: isSet4(object.traceback) ? globalThis.String(object.traceback) : "", + serializedTb: isSet4(object.serializedTb) ? bytesFromBase64(object.serializedTb) : new Uint8Array(0), + tbLineCache: isSet4(object.tbLineCache) ? bytesFromBase64(object.tbLineCache) : new Uint8Array(0), + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + propagationReason: isSet4(object.propagationReason) ? globalThis.String(object.propagationReason) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.status !== 0) { + obj.status = genericResult_GenericStatusToJSON(message.status); + } + if (message.exception !== "") { + obj.exception = message.exception; + } + if (message.exitcode !== 0) { + obj.exitcode = Math.round(message.exitcode); + } + if (message.traceback !== "") { + obj.traceback = message.traceback; + } + if (message.serializedTb.length !== 0) { + obj.serializedTb = base64FromBytes(message.serializedTb); + } + if (message.tbLineCache.length !== 0) { + obj.tbLineCache = base64FromBytes(message.tbLineCache); + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.propagationReason !== "") { + obj.propagationReason = message.propagationReason; + } + return obj; + }, + create(base) { + return GenericResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenericResult(); + message.status = object.status ?? 0; + message.exception = object.exception ?? ""; + message.exitcode = object.exitcode ?? 0; + message.traceback = object.traceback ?? ""; + message.serializedTb = object.serializedTb ?? new Uint8Array(0); + message.tbLineCache = object.tbLineCache ?? new Uint8Array(0); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.propagationReason = object.propagationReason ?? ""; + return message; + } +}; +function createBaseImage() { + return { + baseImages: [], + dockerfileCommands: [], + contextFiles: [], + version: "", + secretIds: [], + contextMountId: "", + gpuConfig: void 0, + imageRegistryConfig: void 0, + buildFunctionDef: "", + buildFunctionGlobals: new Uint8Array(0), + runtime: "", + runtimeDebug: false, + buildFunction: void 0, + buildArgs: {}, + volumeMounts: [] + }; +} +var Image = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.baseImages) { + BaseImage.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.dockerfileCommands) { + writer.uint32(50).string(v); + } + for (const v of message.contextFiles) { + ImageContextFile.encode(v, writer.uint32(58).fork()).join(); + } + if (message.version !== "") { + writer.uint32(90).string(message.version); + } + for (const v of message.secretIds) { + writer.uint32(98).string(v); + } + if (message.contextMountId !== "") { + writer.uint32(122).string(message.contextMountId); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(130).fork()).join(); + } + if (message.imageRegistryConfig !== void 0) { + ImageRegistryConfig.encode(message.imageRegistryConfig, writer.uint32(138).fork()).join(); + } + if (message.buildFunctionDef !== "") { + writer.uint32(114).string(message.buildFunctionDef); + } + if (message.buildFunctionGlobals.length !== 0) { + writer.uint32(146).bytes(message.buildFunctionGlobals); + } + if (message.runtime !== "") { + writer.uint32(154).string(message.runtime); + } + if (message.runtimeDebug !== false) { + writer.uint32(160).bool(message.runtimeDebug); + } + if (message.buildFunction !== void 0) { + BuildFunction.encode(message.buildFunction, writer.uint32(170).fork()).join(); + } + Object.entries(message.buildArgs).forEach(([key, value]) => { + Image_BuildArgsEntry.encode({ key, value }, writer.uint32(178).fork()).join(); + }); + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(186).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + if (tag !== 42) { + break; + } + message.baseImages.push(BaseImage.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.dockerfileCommands.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.contextFiles.push(ImageContextFile.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.version = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.contextMountId = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.imageRegistryConfig = ImageRegistryConfig.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.buildFunctionDef = reader.string(); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + message.buildFunctionGlobals = reader.bytes(); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + message.runtime = reader.string(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + message.buildFunction = BuildFunction.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + const entry22 = Image_BuildArgsEntry.decode(reader, reader.uint32()); + if (entry22.value !== void 0) { + message.buildArgs[entry22.key] = entry22.value; + } + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseImages: globalThis.Array.isArray(object?.baseImages) ? object.baseImages.map((e) => BaseImage.fromJSON(e)) : [], + dockerfileCommands: globalThis.Array.isArray(object?.dockerfileCommands) ? object.dockerfileCommands.map((e) => globalThis.String(e)) : [], + contextFiles: globalThis.Array.isArray(object?.contextFiles) ? object.contextFiles.map((e) => ImageContextFile.fromJSON(e)) : [], + version: isSet4(object.version) ? globalThis.String(object.version) : "", + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + contextMountId: isSet4(object.contextMountId) ? globalThis.String(object.contextMountId) : "", + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0, + imageRegistryConfig: isSet4(object.imageRegistryConfig) ? ImageRegistryConfig.fromJSON(object.imageRegistryConfig) : void 0, + buildFunctionDef: isSet4(object.buildFunctionDef) ? globalThis.String(object.buildFunctionDef) : "", + buildFunctionGlobals: isSet4(object.buildFunctionGlobals) ? bytesFromBase64(object.buildFunctionGlobals) : new Uint8Array(0), + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : "", + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + buildFunction: isSet4(object.buildFunction) ? BuildFunction.fromJSON(object.buildFunction) : void 0, + buildArgs: isObject2(object.buildArgs) ? Object.entries(object.buildArgs).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseImages?.length) { + obj.baseImages = message.baseImages.map((e) => BaseImage.toJSON(e)); + } + if (message.dockerfileCommands?.length) { + obj.dockerfileCommands = message.dockerfileCommands; + } + if (message.contextFiles?.length) { + obj.contextFiles = message.contextFiles.map((e) => ImageContextFile.toJSON(e)); + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.contextMountId !== "") { + obj.contextMountId = message.contextMountId; + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + if (message.imageRegistryConfig !== void 0) { + obj.imageRegistryConfig = ImageRegistryConfig.toJSON(message.imageRegistryConfig); + } + if (message.buildFunctionDef !== "") { + obj.buildFunctionDef = message.buildFunctionDef; + } + if (message.buildFunctionGlobals.length !== 0) { + obj.buildFunctionGlobals = base64FromBytes(message.buildFunctionGlobals); + } + if (message.runtime !== "") { + obj.runtime = message.runtime; + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.buildFunction !== void 0) { + obj.buildFunction = BuildFunction.toJSON(message.buildFunction); + } + if (message.buildArgs) { + const entries = Object.entries(message.buildArgs); + if (entries.length > 0) { + obj.buildArgs = {}; + entries.forEach(([k, v]) => { + obj.buildArgs[k] = v; + }); + } + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + return obj; + }, + create(base) { + return Image.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImage(); + message.baseImages = object.baseImages?.map((e) => BaseImage.fromPartial(e)) || []; + message.dockerfileCommands = object.dockerfileCommands?.map((e) => e) || []; + message.contextFiles = object.contextFiles?.map((e) => ImageContextFile.fromPartial(e)) || []; + message.version = object.version ?? ""; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.contextMountId = object.contextMountId ?? ""; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + message.imageRegistryConfig = object.imageRegistryConfig !== void 0 && object.imageRegistryConfig !== null ? ImageRegistryConfig.fromPartial(object.imageRegistryConfig) : void 0; + message.buildFunctionDef = object.buildFunctionDef ?? ""; + message.buildFunctionGlobals = object.buildFunctionGlobals ?? new Uint8Array(0); + message.runtime = object.runtime ?? ""; + message.runtimeDebug = object.runtimeDebug ?? false; + message.buildFunction = object.buildFunction !== void 0 && object.buildFunction !== null ? BuildFunction.fromPartial(object.buildFunction) : void 0; + message.buildArgs = Object.entries(object.buildArgs ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + return message; + } +}; +function createBaseImage_BuildArgsEntry() { + return { key: "", value: "" }; +} +var Image_BuildArgsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImage_BuildArgsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Image_BuildArgsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImage_BuildArgsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseImageContextFile() { + return { filename: "", data: new Uint8Array(0) }; +} +var ImageContextFile = { + encode(message, writer = new BinaryWriter()) { + if (message.filename !== "") { + writer.uint32(10).string(message.filename); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageContextFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.filename = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + filename: isSet4(object.filename) ? globalThis.String(object.filename) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.filename !== "") { + obj.filename = message.filename; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return ImageContextFile.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageContextFile(); + message.filename = object.filename ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + } +}; +function createBaseImageDeleteRequest() { + return { imageId: "" }; +} +var ImageDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return ImageDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageDeleteRequest(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseImageFromIdRequest() { + return { imageId: "" }; +} +var ImageFromIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageFromIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return ImageFromIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageFromIdRequest(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseImageFromIdResponse() { + return { imageId: "", metadata: void 0 }; +} +var ImageFromIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageFromIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageFromIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageFromIdResponse(); + message.imageId = object.imageId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageGetOrCreateRequest() { + return { + image: void 0, + appId: "", + existingImageId: "", + buildFunctionId: "", + forceBuild: false, + namespace: 0, + builderVersion: "", + allowGlobalDeployment: false, + ignoreCache: false + }; +} +var ImageGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.image !== void 0) { + Image.encode(message.image, writer.uint32(18).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(34).string(message.appId); + } + if (message.existingImageId !== "") { + writer.uint32(42).string(message.existingImageId); + } + if (message.buildFunctionId !== "") { + writer.uint32(50).string(message.buildFunctionId); + } + if (message.forceBuild !== false) { + writer.uint32(56).bool(message.forceBuild); + } + if (message.namespace !== 0) { + writer.uint32(64).int32(message.namespace); + } + if (message.builderVersion !== "") { + writer.uint32(74).string(message.builderVersion); + } + if (message.allowGlobalDeployment !== false) { + writer.uint32(80).bool(message.allowGlobalDeployment); + } + if (message.ignoreCache !== false) { + writer.uint32(88).bool(message.ignoreCache); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.image = Image.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.appId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.existingImageId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.buildFunctionId = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.forceBuild = reader.bool(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.namespace = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.builderVersion = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.allowGlobalDeployment = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.ignoreCache = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + image: isSet4(object.image) ? Image.fromJSON(object.image) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + existingImageId: isSet4(object.existingImageId) ? globalThis.String(object.existingImageId) : "", + buildFunctionId: isSet4(object.buildFunctionId) ? globalThis.String(object.buildFunctionId) : "", + forceBuild: isSet4(object.forceBuild) ? globalThis.Boolean(object.forceBuild) : false, + namespace: isSet4(object.namespace) ? deploymentNamespaceFromJSON(object.namespace) : 0, + builderVersion: isSet4(object.builderVersion) ? globalThis.String(object.builderVersion) : "", + allowGlobalDeployment: isSet4(object.allowGlobalDeployment) ? globalThis.Boolean(object.allowGlobalDeployment) : false, + ignoreCache: isSet4(object.ignoreCache) ? globalThis.Boolean(object.ignoreCache) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.image !== void 0) { + obj.image = Image.toJSON(message.image); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.existingImageId !== "") { + obj.existingImageId = message.existingImageId; + } + if (message.buildFunctionId !== "") { + obj.buildFunctionId = message.buildFunctionId; + } + if (message.forceBuild !== false) { + obj.forceBuild = message.forceBuild; + } + if (message.namespace !== 0) { + obj.namespace = deploymentNamespaceToJSON(message.namespace); + } + if (message.builderVersion !== "") { + obj.builderVersion = message.builderVersion; + } + if (message.allowGlobalDeployment !== false) { + obj.allowGlobalDeployment = message.allowGlobalDeployment; + } + if (message.ignoreCache !== false) { + obj.ignoreCache = message.ignoreCache; + } + return obj; + }, + create(base) { + return ImageGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageGetOrCreateRequest(); + message.image = object.image !== void 0 && object.image !== null ? Image.fromPartial(object.image) : void 0; + message.appId = object.appId ?? ""; + message.existingImageId = object.existingImageId ?? ""; + message.buildFunctionId = object.buildFunctionId ?? ""; + message.forceBuild = object.forceBuild ?? false; + message.namespace = object.namespace ?? 0; + message.builderVersion = object.builderVersion ?? ""; + message.allowGlobalDeployment = object.allowGlobalDeployment ?? false; + message.ignoreCache = object.ignoreCache ?? false; + return message; + } +}; +function createBaseImageGetOrCreateResponse() { + return { imageId: "", result: void 0, metadata: void 0 }; +} +var ImageGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageGetOrCreateResponse(); + message.imageId = object.imageId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageJoinStreamingRequest() { + return { imageId: "", timeout: 0, lastEntryId: "", includeLogsForFinished: false }; +} +var ImageJoinStreamingRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(26).string(message.lastEntryId); + } + if (message.includeLogsForFinished !== false) { + writer.uint32(32).bool(message.includeLogsForFinished); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageJoinStreamingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.includeLogsForFinished = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + includeLogsForFinished: isSet4(object.includeLogsForFinished) ? globalThis.Boolean(object.includeLogsForFinished) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.includeLogsForFinished !== false) { + obj.includeLogsForFinished = message.includeLogsForFinished; + } + return obj; + }, + create(base) { + return ImageJoinStreamingRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageJoinStreamingRequest(); + message.imageId = object.imageId ?? ""; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.includeLogsForFinished = object.includeLogsForFinished ?? false; + return message; + } +}; +function createBaseImageJoinStreamingResponse() { + return { result: void 0, taskLogs: [], entryId: "", eof: false, metadata: void 0 }; +} +var ImageJoinStreamingResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + for (const v of message.taskLogs) { + TaskLogs.encode(v, writer.uint32(18).fork()).join(); + } + if (message.entryId !== "") { + writer.uint32(26).string(message.entryId); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + if (message.metadata !== void 0) { + ImageMetadata.encode(message.metadata, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageJoinStreamingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskLogs.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.entryId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.metadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + taskLogs: globalThis.Array.isArray(object?.taskLogs) ? object.taskLogs.map((e) => TaskLogs.fromJSON(e)) : [], + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "", + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false, + metadata: isSet4(object.metadata) ? ImageMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.taskLogs?.length) { + obj.taskLogs = message.taskLogs.map((e) => TaskLogs.toJSON(e)); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + if (message.eof !== false) { + obj.eof = message.eof; + } + if (message.metadata !== void 0) { + obj.metadata = ImageMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return ImageJoinStreamingResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageJoinStreamingResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.taskLogs = object.taskLogs?.map((e) => TaskLogs.fromPartial(e)) || []; + message.entryId = object.entryId ?? ""; + message.eof = object.eof ?? false; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? ImageMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseImageMetadata() { + return { + pythonVersionInfo: void 0, + pythonPackages: {}, + workdir: void 0, + libcVersionInfo: void 0, + imageBuilderVersion: void 0 + }; +} +var ImageMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.pythonVersionInfo !== void 0) { + writer.uint32(10).string(message.pythonVersionInfo); + } + Object.entries(message.pythonPackages).forEach(([key, value]) => { + ImageMetadata_PythonPackagesEntry.encode({ key, value }, writer.uint32(18).fork()).join(); + }); + if (message.workdir !== void 0) { + writer.uint32(26).string(message.workdir); + } + if (message.libcVersionInfo !== void 0) { + writer.uint32(34).string(message.libcVersionInfo); + } + if (message.imageBuilderVersion !== void 0) { + writer.uint32(42).string(message.imageBuilderVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pythonVersionInfo = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + const entry2 = ImageMetadata_PythonPackagesEntry.decode(reader, reader.uint32()); + if (entry2.value !== void 0) { + message.pythonPackages[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.workdir = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.libcVersionInfo = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.imageBuilderVersion = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pythonVersionInfo: isSet4(object.pythonVersionInfo) ? globalThis.String(object.pythonVersionInfo) : void 0, + pythonPackages: isObject2(object.pythonPackages) ? Object.entries(object.pythonPackages).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + libcVersionInfo: isSet4(object.libcVersionInfo) ? globalThis.String(object.libcVersionInfo) : void 0, + imageBuilderVersion: isSet4(object.imageBuilderVersion) ? globalThis.String(object.imageBuilderVersion) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.pythonVersionInfo !== void 0) { + obj.pythonVersionInfo = message.pythonVersionInfo; + } + if (message.pythonPackages) { + const entries = Object.entries(message.pythonPackages); + if (entries.length > 0) { + obj.pythonPackages = {}; + entries.forEach(([k, v]) => { + obj.pythonPackages[k] = v; + }); + } + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.libcVersionInfo !== void 0) { + obj.libcVersionInfo = message.libcVersionInfo; + } + if (message.imageBuilderVersion !== void 0) { + obj.imageBuilderVersion = message.imageBuilderVersion; + } + return obj; + }, + create(base) { + return ImageMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageMetadata(); + message.pythonVersionInfo = object.pythonVersionInfo ?? void 0; + message.pythonPackages = Object.entries(object.pythonPackages ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {} + ); + message.workdir = object.workdir ?? void 0; + message.libcVersionInfo = object.libcVersionInfo ?? void 0; + message.imageBuilderVersion = object.imageBuilderVersion ?? void 0; + return message; + } +}; +function createBaseImageMetadata_PythonPackagesEntry() { + return { key: "", value: "" }; +} +var ImageMetadata_PythonPackagesEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageMetadata_PythonPackagesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return ImageMetadata_PythonPackagesEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageMetadata_PythonPackagesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseImageRegistryConfig() { + return { registryAuthType: 0, secretId: "" }; +} +var ImageRegistryConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.registryAuthType !== 0) { + writer.uint32(8).int32(message.registryAuthType); + } + if (message.secretId !== "") { + writer.uint32(18).string(message.secretId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseImageRegistryConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.registryAuthType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.secretId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + registryAuthType: isSet4(object.registryAuthType) ? registryAuthTypeFromJSON(object.registryAuthType) : 0, + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.registryAuthType !== 0) { + obj.registryAuthType = registryAuthTypeToJSON(message.registryAuthType); + } + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + return obj; + }, + create(base) { + return ImageRegistryConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseImageRegistryConfig(); + message.registryAuthType = object.registryAuthType ?? 0; + message.secretId = object.secretId ?? ""; + return message; + } +}; +function createBaseInputCallGraphInfo() { + return { inputId: "", status: 0, functionCallId: "", taskId: "" }; +} +var InputCallGraphInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.functionCallId !== "") { + writer.uint32(26).string(message.functionCallId); + } + if (message.taskId !== "") { + writer.uint32(34).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputCallGraphInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + status: isSet4(object.status) ? genericResult_GenericStatusFromJSON(object.status) : 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.status !== 0) { + obj.status = genericResult_GenericStatusToJSON(message.status); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return InputCallGraphInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputCallGraphInfo(); + message.inputId = object.inputId ?? ""; + message.status = object.status ?? 0; + message.functionCallId = object.functionCallId ?? ""; + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseInputCategoryInfo() { + return { total: 0, latest: [] }; +} +var InputCategoryInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.total !== 0) { + writer.uint32(8).int32(message.total); + } + for (const v of message.latest) { + InputInfo.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputCategoryInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.total = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.latest.push(InputInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet4(object.total) ? globalThis.Number(object.total) : 0, + latest: globalThis.Array.isArray(object?.latest) ? object.latest.map((e) => InputInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.latest?.length) { + obj.latest = message.latest.map((e) => InputInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return InputCategoryInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputCategoryInfo(); + message.total = object.total ?? 0; + message.latest = object.latest?.map((e) => InputInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseInputInfo() { + return { inputId: "", idx: 0, taskId: "", startedAt: 0, finishedAt: 0, taskStartupTime: 0, taskFirstInput: false }; +} +var InputInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.inputId !== "") { + writer.uint32(10).string(message.inputId); + } + if (message.idx !== 0) { + writer.uint32(16).int32(message.idx); + } + if (message.taskId !== "") { + writer.uint32(26).string(message.taskId); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + if (message.finishedAt !== 0) { + writer.uint32(41).double(message.finishedAt); + } + if (message.taskStartupTime !== 0) { + writer.uint32(49).double(message.taskStartupTime); + } + if (message.taskFirstInput !== false) { + writer.uint32(56).bool(message.taskFirstInput); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseInputInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.idx = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.taskId = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.finishedAt = reader.double(); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.taskStartupTime = reader.double(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.taskFirstInput = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + idx: isSet4(object.idx) ? globalThis.Number(object.idx) : 0, + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0, + finishedAt: isSet4(object.finishedAt) ? globalThis.Number(object.finishedAt) : 0, + taskStartupTime: isSet4(object.taskStartupTime) ? globalThis.Number(object.taskStartupTime) : 0, + taskFirstInput: isSet4(object.taskFirstInput) ? globalThis.Boolean(object.taskFirstInput) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.idx !== 0) { + obj.idx = Math.round(message.idx); + } + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + if (message.finishedAt !== 0) { + obj.finishedAt = message.finishedAt; + } + if (message.taskStartupTime !== 0) { + obj.taskStartupTime = message.taskStartupTime; + } + if (message.taskFirstInput !== false) { + obj.taskFirstInput = message.taskFirstInput; + } + return obj; + }, + create(base) { + return InputInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInputInfo(); + message.inputId = object.inputId ?? ""; + message.idx = object.idx ?? 0; + message.taskId = object.taskId ?? ""; + message.startedAt = object.startedAt ?? 0; + message.finishedAt = object.finishedAt ?? 0; + message.taskStartupTime = object.taskStartupTime ?? 0; + message.taskFirstInput = object.taskFirstInput ?? false; + return message; + } +}; +function createBaseListPagination() { + return { maxObjects: 0, createdBefore: 0 }; +} +var ListPagination = { + encode(message, writer = new BinaryWriter()) { + if (message.maxObjects !== 0) { + writer.uint32(8).int32(message.maxObjects); + } + if (message.createdBefore !== 0) { + writer.uint32(17).double(message.createdBefore); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseListPagination(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.maxObjects = reader.int32(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdBefore = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxObjects: isSet4(object.maxObjects) ? globalThis.Number(object.maxObjects) : 0, + createdBefore: isSet4(object.createdBefore) ? globalThis.Number(object.createdBefore) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.maxObjects !== 0) { + obj.maxObjects = Math.round(message.maxObjects); + } + if (message.createdBefore !== 0) { + obj.createdBefore = message.createdBefore; + } + return obj; + }, + create(base) { + return ListPagination.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseListPagination(); + message.maxObjects = object.maxObjects ?? 0; + message.createdBefore = object.createdBefore ?? 0; + return message; + } +}; +function createBaseMapAwaitRequest() { + return { functionCallId: void 0, mapToken: void 0, lastEntryId: "", requestedAt: 0, timeout: 0 }; +} +var MapAwaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionCallId !== void 0) { + writer.uint32(10).string(message.functionCallId); + } + if (message.mapToken !== void 0) { + writer.uint32(42).string(message.mapToken); + } + if (message.lastEntryId !== "") { + writer.uint32(18).string(message.lastEntryId); + } + if (message.requestedAt !== 0) { + writer.uint32(25).double(message.requestedAt); + } + if (message.timeout !== 0) { + writer.uint32(37).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapAwaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.requestedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : void 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + requestedAt: isSet4(object.requestedAt) ? globalThis.Number(object.requestedAt) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.mapToken !== void 0) { + obj.mapToken = message.mapToken; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.requestedAt !== 0) { + obj.requestedAt = message.requestedAt; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return MapAwaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapAwaitRequest(); + message.functionCallId = object.functionCallId ?? void 0; + message.mapToken = object.mapToken ?? void 0; + message.lastEntryId = object.lastEntryId ?? ""; + message.requestedAt = object.requestedAt ?? 0; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseMapAwaitResponse() { + return { outputs: [], lastEntryId: "" }; +} +var MapAwaitResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.outputs) { + FunctionGetOutputsItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.lastEntryId !== "") { + writer.uint32(18).string(message.lastEntryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapAwaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.outputs.push(FunctionGetOutputsItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => FunctionGetOutputsItem.fromJSON(e)) : [], + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => FunctionGetOutputsItem.toJSON(e)); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + return obj; + }, + create(base) { + return MapAwaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapAwaitResponse(); + message.outputs = object.outputs?.map((e) => FunctionGetOutputsItem.fromPartial(e)) || []; + message.lastEntryId = object.lastEntryId ?? ""; + return message; + } +}; +function createBaseMapCheckInputsRequest() { + return { lastEntryId: "", timeout: 0, attemptTokens: [] }; +} +var MapCheckInputsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.lastEntryId !== "") { + writer.uint32(10).string(message.lastEntryId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + for (const v of message.attemptTokens) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapCheckInputsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.attemptTokens.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + attemptTokens: globalThis.Array.isArray(object?.attemptTokens) ? object.attemptTokens.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.attemptTokens?.length) { + obj.attemptTokens = message.attemptTokens; + } + return obj; + }, + create(base) { + return MapCheckInputsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapCheckInputsRequest(); + message.lastEntryId = object.lastEntryId ?? ""; + message.timeout = object.timeout ?? 0; + message.attemptTokens = object.attemptTokens?.map((e) => e) || []; + return message; + } +}; +function createBaseMapCheckInputsResponse() { + return { lost: [] }; +} +var MapCheckInputsResponse = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.lost) { + writer.bool(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapCheckInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.lost.push(reader.bool()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.lost.push(reader.bool()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { lost: globalThis.Array.isArray(object?.lost) ? object.lost.map((e) => globalThis.Boolean(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.lost?.length) { + obj.lost = message.lost; + } + return obj; + }, + create(base) { + return MapCheckInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapCheckInputsResponse(); + message.lost = object.lost?.map((e) => e) || []; + return message; + } +}; +function createBaseMapStartOrContinueItem() { + return { input: void 0, attemptToken: void 0 }; +} +var MapStartOrContinueItem = { + encode(message, writer = new BinaryWriter()) { + if (message.input !== void 0) { + FunctionPutInputsItem.encode(message.input, writer.uint32(10).fork()).join(); + } + if (message.attemptToken !== void 0) { + writer.uint32(18).string(message.attemptToken); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.input = FunctionPutInputsItem.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.attemptToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + input: isSet4(object.input) ? FunctionPutInputsItem.fromJSON(object.input) : void 0, + attemptToken: isSet4(object.attemptToken) ? globalThis.String(object.attemptToken) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.input !== void 0) { + obj.input = FunctionPutInputsItem.toJSON(message.input); + } + if (message.attemptToken !== void 0) { + obj.attemptToken = message.attemptToken; + } + return obj; + }, + create(base) { + return MapStartOrContinueItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueItem(); + message.input = object.input !== void 0 && object.input !== null ? FunctionPutInputsItem.fromPartial(object.input) : void 0; + message.attemptToken = object.attemptToken ?? void 0; + return message; + } +}; +function createBaseMapStartOrContinueRequest() { + return { functionId: "", parentInputId: "", functionCallId: void 0, mapToken: void 0, items: [] }; +} +var MapStartOrContinueRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.parentInputId !== "") { + writer.uint32(18).string(message.parentInputId); + } + if (message.functionCallId !== void 0) { + writer.uint32(26).string(message.functionCallId); + } + if (message.mapToken !== void 0) { + writer.uint32(42).string(message.mapToken); + } + for (const v of message.items) { + MapStartOrContinueItem.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.parentInputId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.items.push(MapStartOrContinueItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + parentInputId: isSet4(object.parentInputId) ? globalThis.String(object.parentInputId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : void 0, + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : void 0, + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => MapStartOrContinueItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.parentInputId !== "") { + obj.parentInputId = message.parentInputId; + } + if (message.functionCallId !== void 0) { + obj.functionCallId = message.functionCallId; + } + if (message.mapToken !== void 0) { + obj.mapToken = message.mapToken; + } + if (message.items?.length) { + obj.items = message.items.map((e) => MapStartOrContinueItem.toJSON(e)); + } + return obj; + }, + create(base) { + return MapStartOrContinueRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueRequest(); + message.functionId = object.functionId ?? ""; + message.parentInputId = object.parentInputId ?? ""; + message.functionCallId = object.functionCallId ?? void 0; + message.mapToken = object.mapToken ?? void 0; + message.items = object.items?.map((e) => MapStartOrContinueItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseMapStartOrContinueResponse() { + return { + mapToken: "", + functionId: "", + functionCallId: "", + maxInputsOutstanding: 0, + attemptTokens: [], + retryPolicy: void 0 + }; +} +var MapStartOrContinueResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.mapToken !== "") { + writer.uint32(50).string(message.mapToken); + } + if (message.functionId !== "") { + writer.uint32(10).string(message.functionId); + } + if (message.functionCallId !== "") { + writer.uint32(18).string(message.functionCallId); + } + if (message.maxInputsOutstanding !== 0) { + writer.uint32(24).uint32(message.maxInputsOutstanding); + } + for (const v of message.attemptTokens) { + writer.uint32(34).string(v); + } + if (message.retryPolicy !== void 0) { + FunctionRetryPolicy.encode(message.retryPolicy, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMapStartOrContinueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: { + if (tag !== 50) { + break; + } + message.mapToken = reader.string(); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + message.functionId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxInputsOutstanding = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.attemptTokens.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.retryPolicy = FunctionRetryPolicy.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mapToken: isSet4(object.mapToken) ? globalThis.String(object.mapToken) : "", + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + maxInputsOutstanding: isSet4(object.maxInputsOutstanding) ? globalThis.Number(object.maxInputsOutstanding) : 0, + attemptTokens: globalThis.Array.isArray(object?.attemptTokens) ? object.attemptTokens.map((e) => globalThis.String(e)) : [], + retryPolicy: isSet4(object.retryPolicy) ? FunctionRetryPolicy.fromJSON(object.retryPolicy) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mapToken !== "") { + obj.mapToken = message.mapToken; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.maxInputsOutstanding !== 0) { + obj.maxInputsOutstanding = Math.round(message.maxInputsOutstanding); + } + if (message.attemptTokens?.length) { + obj.attemptTokens = message.attemptTokens; + } + if (message.retryPolicy !== void 0) { + obj.retryPolicy = FunctionRetryPolicy.toJSON(message.retryPolicy); + } + return obj; + }, + create(base) { + return MapStartOrContinueResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMapStartOrContinueResponse(); + message.mapToken = object.mapToken ?? ""; + message.functionId = object.functionId ?? ""; + message.functionCallId = object.functionCallId ?? ""; + message.maxInputsOutstanding = object.maxInputsOutstanding ?? 0; + message.attemptTokens = object.attemptTokens?.map((e) => e) || []; + message.retryPolicy = object.retryPolicy !== void 0 && object.retryPolicy !== null ? FunctionRetryPolicy.fromPartial(object.retryPolicy) : void 0; + return message; + } +}; +function createBaseMethodDefinition() { + return { + functionName: "", + functionType: 0, + webhookConfig: void 0, + webUrl: "", + webUrlInfo: void 0, + customDomainInfo: [], + functionSchema: void 0, + supportedInputFormats: [], + supportedOutputFormats: [] + }; +} +var MethodDefinition = { + encode(message, writer = new BinaryWriter()) { + if (message.functionName !== "") { + writer.uint32(10).string(message.functionName); + } + if (message.functionType !== 0) { + writer.uint32(16).int32(message.functionType); + } + if (message.webhookConfig !== void 0) { + WebhookConfig.encode(message.webhookConfig, writer.uint32(26).fork()).join(); + } + if (message.webUrl !== "") { + writer.uint32(34).string(message.webUrl); + } + if (message.webUrlInfo !== void 0) { + WebUrlInfo.encode(message.webUrlInfo, writer.uint32(42).fork()).join(); + } + for (const v of message.customDomainInfo) { + CustomDomainInfo.encode(v, writer.uint32(50).fork()).join(); + } + if (message.functionSchema !== void 0) { + FunctionSchema.encode(message.functionSchema, writer.uint32(58).fork()).join(); + } + writer.uint32(66).fork(); + for (const v of message.supportedInputFormats) { + writer.int32(v); + } + writer.join(); + writer.uint32(74).fork(); + for (const v of message.supportedOutputFormats) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMethodDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.functionName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.functionType = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.webhookConfig = WebhookConfig.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.webUrlInfo = WebUrlInfo.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.customDomainInfo.push(CustomDomainInfo.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.functionSchema = FunctionSchema.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag === 64) { + message.supportedInputFormats.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedInputFormats.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag === 72) { + message.supportedOutputFormats.push(reader.int32()); + continue; + } + if (tag === 74) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.supportedOutputFormats.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + functionName: isSet4(object.functionName) ? globalThis.String(object.functionName) : "", + functionType: isSet4(object.functionType) ? function_FunctionTypeFromJSON(object.functionType) : 0, + webhookConfig: isSet4(object.webhookConfig) ? WebhookConfig.fromJSON(object.webhookConfig) : void 0, + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + webUrlInfo: isSet4(object.webUrlInfo) ? WebUrlInfo.fromJSON(object.webUrlInfo) : void 0, + customDomainInfo: globalThis.Array.isArray(object?.customDomainInfo) ? object.customDomainInfo.map((e) => CustomDomainInfo.fromJSON(e)) : [], + functionSchema: isSet4(object.functionSchema) ? FunctionSchema.fromJSON(object.functionSchema) : void 0, + supportedInputFormats: globalThis.Array.isArray(object?.supportedInputFormats) ? object.supportedInputFormats.map((e) => dataFormatFromJSON(e)) : [], + supportedOutputFormats: globalThis.Array.isArray(object?.supportedOutputFormats) ? object.supportedOutputFormats.map((e) => dataFormatFromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.functionName !== "") { + obj.functionName = message.functionName; + } + if (message.functionType !== 0) { + obj.functionType = function_FunctionTypeToJSON(message.functionType); + } + if (message.webhookConfig !== void 0) { + obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig); + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.webUrlInfo !== void 0) { + obj.webUrlInfo = WebUrlInfo.toJSON(message.webUrlInfo); + } + if (message.customDomainInfo?.length) { + obj.customDomainInfo = message.customDomainInfo.map((e) => CustomDomainInfo.toJSON(e)); + } + if (message.functionSchema !== void 0) { + obj.functionSchema = FunctionSchema.toJSON(message.functionSchema); + } + if (message.supportedInputFormats?.length) { + obj.supportedInputFormats = message.supportedInputFormats.map((e) => dataFormatToJSON(e)); + } + if (message.supportedOutputFormats?.length) { + obj.supportedOutputFormats = message.supportedOutputFormats.map((e) => dataFormatToJSON(e)); + } + return obj; + }, + create(base) { + return MethodDefinition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodDefinition(); + message.functionName = object.functionName ?? ""; + message.functionType = object.functionType ?? 0; + message.webhookConfig = object.webhookConfig !== void 0 && object.webhookConfig !== null ? WebhookConfig.fromPartial(object.webhookConfig) : void 0; + message.webUrl = object.webUrl ?? ""; + message.webUrlInfo = object.webUrlInfo !== void 0 && object.webUrlInfo !== null ? WebUrlInfo.fromPartial(object.webUrlInfo) : void 0; + message.customDomainInfo = object.customDomainInfo?.map((e) => CustomDomainInfo.fromPartial(e)) || []; + message.functionSchema = object.functionSchema !== void 0 && object.functionSchema !== null ? FunctionSchema.fromPartial(object.functionSchema) : void 0; + message.supportedInputFormats = object.supportedInputFormats?.map((e) => e) || []; + message.supportedOutputFormats = object.supportedOutputFormats?.map((e) => e) || []; + return message; + } +}; +function createBaseMountFile() { + return { filename: "", sha256Hex: "", size: void 0, mode: void 0 }; +} +var MountFile = { + encode(message, writer = new BinaryWriter()) { + if (message.filename !== "") { + writer.uint32(10).string(message.filename); + } + if (message.sha256Hex !== "") { + writer.uint32(26).string(message.sha256Hex); + } + if (message.size !== void 0) { + writer.uint32(32).uint64(message.size); + } + if (message.mode !== void 0) { + writer.uint32(40).uint32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.filename = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.mode = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + filename: isSet4(object.filename) ? globalThis.String(object.filename) : "", + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : void 0, + mode: isSet4(object.mode) ? globalThis.Number(object.mode) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.filename !== "") { + obj.filename = message.filename; + } + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.size !== void 0) { + obj.size = Math.round(message.size); + } + if (message.mode !== void 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + create(base) { + return MountFile.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountFile(); + message.filename = object.filename ?? ""; + message.sha256Hex = object.sha256Hex ?? ""; + message.size = object.size ?? void 0; + message.mode = object.mode ?? void 0; + return message; + } +}; +function createBaseMountGetOrCreateRequest() { + return { deploymentName: "", namespace: 0, environmentName: "", objectCreationType: 0, files: [], appId: "" }; +} +var MountGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.namespace !== 0) { + writer.uint32(16).int32(message.namespace); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + for (const v of message.files) { + MountFile.encode(v, writer.uint32(42).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(50).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.namespace = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.files.push(MountFile.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + namespace: isSet4(object.namespace) ? deploymentNamespaceFromJSON(object.namespace) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => MountFile.fromJSON(e)) : [], + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.namespace !== 0) { + obj.namespace = deploymentNamespaceToJSON(message.namespace); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.files?.length) { + obj.files = message.files.map((e) => MountFile.toJSON(e)); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return MountGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.namespace = object.namespace ?? 0; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.files = object.files?.map((e) => MountFile.fromPartial(e)) || []; + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseMountGetOrCreateResponse() { + return { mountId: "", handleMetadata: void 0 }; +} +var MountGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.mountId !== "") { + writer.uint32(10).string(message.mountId); + } + if (message.handleMetadata !== void 0) { + MountHandleMetadata.encode(message.handleMetadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mountId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.handleMetadata = MountHandleMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mountId: isSet4(object.mountId) ? globalThis.String(object.mountId) : "", + handleMetadata: isSet4(object.handleMetadata) ? MountHandleMetadata.fromJSON(object.handleMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mountId !== "") { + obj.mountId = message.mountId; + } + if (message.handleMetadata !== void 0) { + obj.handleMetadata = MountHandleMetadata.toJSON(message.handleMetadata); + } + return obj; + }, + create(base) { + return MountGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountGetOrCreateResponse(); + message.mountId = object.mountId ?? ""; + message.handleMetadata = object.handleMetadata !== void 0 && object.handleMetadata !== null ? MountHandleMetadata.fromPartial(object.handleMetadata) : void 0; + return message; + } +}; +function createBaseMountHandleMetadata() { + return { contentChecksumSha256Hex: "" }; +} +var MountHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.contentChecksumSha256Hex !== "") { + writer.uint32(10).string(message.contentChecksumSha256Hex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentChecksumSha256Hex = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentChecksumSha256Hex: isSet4(object.contentChecksumSha256Hex) ? globalThis.String(object.contentChecksumSha256Hex) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentChecksumSha256Hex !== "") { + obj.contentChecksumSha256Hex = message.contentChecksumSha256Hex; + } + return obj; + }, + create(base) { + return MountHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountHandleMetadata(); + message.contentChecksumSha256Hex = object.contentChecksumSha256Hex ?? ""; + return message; + } +}; +function createBaseMountPutFileRequest() { + return { sha256Hex: "", data: void 0, dataBlobId: void 0 }; +} +var MountPutFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sha256Hex !== "") { + writer.uint32(18).string(message.sha256Hex); + } + if (message.data !== void 0) { + writer.uint32(26).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(42).string(message.dataBlobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountPutFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.data = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + return obj; + }, + create(base) { + return MountPutFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountPutFileRequest(); + message.sha256Hex = object.sha256Hex ?? ""; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + return message; + } +}; +function createBaseMountPutFileResponse() { + return { exists: false }; +} +var MountPutFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(16).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMountPutFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return MountPutFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMountPutFileResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseMultiPartUpload() { + return { partLength: 0, uploadUrls: [], completionUrl: "" }; +} +var MultiPartUpload = { + encode(message, writer = new BinaryWriter()) { + if (message.partLength !== 0) { + writer.uint32(8).int64(message.partLength); + } + for (const v of message.uploadUrls) { + writer.uint32(18).string(v); + } + if (message.completionUrl !== "") { + writer.uint32(26).string(message.completionUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMultiPartUpload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.partLength = longToNumber2(reader.int64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.uploadUrls.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.completionUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + partLength: isSet4(object.partLength) ? globalThis.Number(object.partLength) : 0, + uploadUrls: globalThis.Array.isArray(object?.uploadUrls) ? object.uploadUrls.map((e) => globalThis.String(e)) : [], + completionUrl: isSet4(object.completionUrl) ? globalThis.String(object.completionUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.partLength !== 0) { + obj.partLength = Math.round(message.partLength); + } + if (message.uploadUrls?.length) { + obj.uploadUrls = message.uploadUrls; + } + if (message.completionUrl !== "") { + obj.completionUrl = message.completionUrl; + } + return obj; + }, + create(base) { + return MultiPartUpload.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMultiPartUpload(); + message.partLength = object.partLength ?? 0; + message.uploadUrls = object.uploadUrls?.map((e) => e) || []; + message.completionUrl = object.completionUrl ?? ""; + return message; + } +}; +function createBaseMultiPartUploadList() { + return { items: [] }; +} +var MultiPartUploadList = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + MultiPartUpload.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseMultiPartUploadList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(MultiPartUpload.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => MultiPartUpload.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => MultiPartUpload.toJSON(e)); + } + return obj; + }, + create(base) { + return MultiPartUploadList.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMultiPartUploadList(); + message.items = object.items?.map((e) => MultiPartUpload.fromPartial(e)) || []; + return message; + } +}; +function createBaseNetworkAccess() { + return { networkAccessType: 0, allowedCidrs: [] }; +} +var NetworkAccess = { + encode(message, writer = new BinaryWriter()) { + if (message.networkAccessType !== 0) { + writer.uint32(8).int32(message.networkAccessType); + } + for (const v of message.allowedCidrs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNetworkAccess(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.networkAccessType = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.allowedCidrs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + networkAccessType: isSet4(object.networkAccessType) ? networkAccess_NetworkAccessTypeFromJSON(object.networkAccessType) : 0, + allowedCidrs: globalThis.Array.isArray(object?.allowedCidrs) ? object.allowedCidrs.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.networkAccessType !== 0) { + obj.networkAccessType = networkAccess_NetworkAccessTypeToJSON(message.networkAccessType); + } + if (message.allowedCidrs?.length) { + obj.allowedCidrs = message.allowedCidrs; + } + return obj; + }, + create(base) { + return NetworkAccess.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNetworkAccess(); + message.networkAccessType = object.networkAccessType ?? 0; + message.allowedCidrs = object.allowedCidrs?.map((e) => e) || []; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest() { + return { notebookId: "", results: [] }; +} +var NotebookKernelPublishResultsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.notebookId !== "") { + writer.uint32(10).string(message.notebookId); + } + for (const v of message.results) { + NotebookKernelPublishResultsRequest_CellResult.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.notebookId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.results.push(NotebookKernelPublishResultsRequest_CellResult.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + notebookId: isSet4(object.notebookId) ? globalThis.String(object.notebookId) : "", + results: globalThis.Array.isArray(object?.results) ? object.results.map((e) => NotebookKernelPublishResultsRequest_CellResult.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.notebookId !== "") { + obj.notebookId = message.notebookId; + } + if (message.results?.length) { + obj.results = message.results.map((e) => NotebookKernelPublishResultsRequest_CellResult.toJSON(e)); + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest(); + message.notebookId = object.notebookId ?? ""; + message.results = object.results?.map((e) => NotebookKernelPublishResultsRequest_CellResult.fromPartial(e)) || []; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest_ExecuteReply() { + return { status: "", executionCount: 0, duration: 0 }; +} +var NotebookKernelPublishResultsRequest_ExecuteReply = { + encode(message, writer = new BinaryWriter()) { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.executionCount !== 0) { + writer.uint32(16).uint32(message.executionCount); + } + if (message.duration !== 0) { + writer.uint32(25).double(message.duration); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest_ExecuteReply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.status = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.executionCount = reader.uint32(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.duration = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet4(object.status) ? globalThis.String(object.status) : "", + executionCount: isSet4(object.executionCount) ? globalThis.Number(object.executionCount) : 0, + duration: isSet4(object.duration) ? globalThis.Number(object.duration) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.executionCount !== 0) { + obj.executionCount = Math.round(message.executionCount); + } + if (message.duration !== 0) { + obj.duration = message.duration; + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest_ExecuteReply(); + message.status = object.status ?? ""; + message.executionCount = object.executionCount ?? 0; + message.duration = object.duration ?? 0; + return message; + } +}; +function createBaseNotebookKernelPublishResultsRequest_CellResult() { + return { cellId: "", output: void 0, clearOutput: void 0, executeReply: void 0 }; +} +var NotebookKernelPublishResultsRequest_CellResult = { + encode(message, writer = new BinaryWriter()) { + if (message.cellId !== "") { + writer.uint32(10).string(message.cellId); + } + if (message.output !== void 0) { + NotebookOutput.encode(message.output, writer.uint32(18).fork()).join(); + } + if (message.clearOutput !== void 0) { + writer.uint32(24).bool(message.clearOutput); + } + if (message.executeReply !== void 0) { + NotebookKernelPublishResultsRequest_ExecuteReply.encode(message.executeReply, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookKernelPublishResultsRequest_CellResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cellId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.output = NotebookOutput.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.clearOutput = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.executeReply = NotebookKernelPublishResultsRequest_ExecuteReply.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cellId: isSet4(object.cellId) ? globalThis.String(object.cellId) : "", + output: isSet4(object.output) ? NotebookOutput.fromJSON(object.output) : void 0, + clearOutput: isSet4(object.clearOutput) ? globalThis.Boolean(object.clearOutput) : void 0, + executeReply: isSet4(object.executeReply) ? NotebookKernelPublishResultsRequest_ExecuteReply.fromJSON(object.executeReply) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cellId !== "") { + obj.cellId = message.cellId; + } + if (message.output !== void 0) { + obj.output = NotebookOutput.toJSON(message.output); + } + if (message.clearOutput !== void 0) { + obj.clearOutput = message.clearOutput; + } + if (message.executeReply !== void 0) { + obj.executeReply = NotebookKernelPublishResultsRequest_ExecuteReply.toJSON(message.executeReply); + } + return obj; + }, + create(base) { + return NotebookKernelPublishResultsRequest_CellResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookKernelPublishResultsRequest_CellResult(); + message.cellId = object.cellId ?? ""; + message.output = object.output !== void 0 && object.output !== null ? NotebookOutput.fromPartial(object.output) : void 0; + message.clearOutput = object.clearOutput ?? void 0; + message.executeReply = object.executeReply !== void 0 && object.executeReply !== null ? NotebookKernelPublishResultsRequest_ExecuteReply.fromPartial(object.executeReply) : void 0; + return message; + } +}; +function createBaseNotebookOutput() { + return { executeResult: void 0, displayData: void 0, stream: void 0, error: void 0 }; +} +var NotebookOutput = { + encode(message, writer = new BinaryWriter()) { + if (message.executeResult !== void 0) { + NotebookOutput_ExecuteResult.encode(message.executeResult, writer.uint32(10).fork()).join(); + } + if (message.displayData !== void 0) { + NotebookOutput_DisplayData.encode(message.displayData, writer.uint32(18).fork()).join(); + } + if (message.stream !== void 0) { + NotebookOutput_Stream.encode(message.stream, writer.uint32(26).fork()).join(); + } + if (message.error !== void 0) { + NotebookOutput_Error.encode(message.error, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.executeResult = NotebookOutput_ExecuteResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.displayData = NotebookOutput_DisplayData.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.stream = NotebookOutput_Stream.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.error = NotebookOutput_Error.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + executeResult: isSet4(object.executeResult) ? NotebookOutput_ExecuteResult.fromJSON(object.executeResult) : void 0, + displayData: isSet4(object.displayData) ? NotebookOutput_DisplayData.fromJSON(object.displayData) : void 0, + stream: isSet4(object.stream) ? NotebookOutput_Stream.fromJSON(object.stream) : void 0, + error: isSet4(object.error) ? NotebookOutput_Error.fromJSON(object.error) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.executeResult !== void 0) { + obj.executeResult = NotebookOutput_ExecuteResult.toJSON(message.executeResult); + } + if (message.displayData !== void 0) { + obj.displayData = NotebookOutput_DisplayData.toJSON(message.displayData); + } + if (message.stream !== void 0) { + obj.stream = NotebookOutput_Stream.toJSON(message.stream); + } + if (message.error !== void 0) { + obj.error = NotebookOutput_Error.toJSON(message.error); + } + return obj; + }, + create(base) { + return NotebookOutput.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput(); + message.executeResult = object.executeResult !== void 0 && object.executeResult !== null ? NotebookOutput_ExecuteResult.fromPartial(object.executeResult) : void 0; + message.displayData = object.displayData !== void 0 && object.displayData !== null ? NotebookOutput_DisplayData.fromPartial(object.displayData) : void 0; + message.stream = object.stream !== void 0 && object.stream !== null ? NotebookOutput_Stream.fromPartial(object.stream) : void 0; + message.error = object.error !== void 0 && object.error !== null ? NotebookOutput_Error.fromPartial(object.error) : void 0; + return message; + } +}; +function createBaseNotebookOutput_ExecuteResult() { + return { executionCount: 0, data: void 0, metadata: void 0 }; +} +var NotebookOutput_ExecuteResult = { + encode(message, writer = new BinaryWriter()) { + if (message.executionCount !== 0) { + writer.uint32(8).uint32(message.executionCount); + } + if (message.data !== void 0) { + Struct.encode(Struct.wrap(message.data), writer.uint32(18).fork()).join(); + } + if (message.metadata !== void 0) { + Struct.encode(Struct.wrap(message.metadata), writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_ExecuteResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.executionCount = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + executionCount: isSet4(object.executionCount) ? globalThis.Number(object.executionCount) : 0, + data: isObject2(object.data) ? object.data : void 0, + metadata: isObject2(object.metadata) ? object.metadata : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.executionCount !== 0) { + obj.executionCount = Math.round(message.executionCount); + } + if (message.data !== void 0) { + obj.data = message.data; + } + if (message.metadata !== void 0) { + obj.metadata = message.metadata; + } + return obj; + }, + create(base) { + return NotebookOutput_ExecuteResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_ExecuteResult(); + message.executionCount = object.executionCount ?? 0; + message.data = object.data ?? void 0; + message.metadata = object.metadata ?? void 0; + return message; + } +}; +function createBaseNotebookOutput_DisplayData() { + return { data: void 0, metadata: void 0, transientDisplayId: void 0 }; +} +var NotebookOutput_DisplayData = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + Struct.encode(Struct.wrap(message.data), writer.uint32(10).fork()).join(); + } + if (message.metadata !== void 0) { + Struct.encode(Struct.wrap(message.metadata), writer.uint32(18).fork()).join(); + } + if (message.transientDisplayId !== void 0) { + writer.uint32(26).string(message.transientDisplayId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_DisplayData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.transientDisplayId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isObject2(object.data) ? object.data : void 0, + metadata: isObject2(object.metadata) ? object.metadata : void 0, + transientDisplayId: isSet4(object.transientDisplayId) ? globalThis.String(object.transientDisplayId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = message.data; + } + if (message.metadata !== void 0) { + obj.metadata = message.metadata; + } + if (message.transientDisplayId !== void 0) { + obj.transientDisplayId = message.transientDisplayId; + } + return obj; + }, + create(base) { + return NotebookOutput_DisplayData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_DisplayData(); + message.data = object.data ?? void 0; + message.metadata = object.metadata ?? void 0; + message.transientDisplayId = object.transientDisplayId ?? void 0; + return message; + } +}; +function createBaseNotebookOutput_Stream() { + return { name: "", text: "" }; +} +var NotebookOutput_Stream = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.text !== "") { + writer.uint32(18).string(message.text); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_Stream(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.text = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + text: isSet4(object.text) ? globalThis.String(object.text) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.text !== "") { + obj.text = message.text; + } + return obj; + }, + create(base) { + return NotebookOutput_Stream.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_Stream(); + message.name = object.name ?? ""; + message.text = object.text ?? ""; + return message; + } +}; +function createBaseNotebookOutput_Error() { + return { ename: "", evalue: "", traceback: [] }; +} +var NotebookOutput_Error = { + encode(message, writer = new BinaryWriter()) { + if (message.ename !== "") { + writer.uint32(10).string(message.ename); + } + if (message.evalue !== "") { + writer.uint32(18).string(message.evalue); + } + for (const v of message.traceback) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseNotebookOutput_Error(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.ename = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.evalue = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.traceback.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ename: isSet4(object.ename) ? globalThis.String(object.ename) : "", + evalue: isSet4(object.evalue) ? globalThis.String(object.evalue) : "", + traceback: globalThis.Array.isArray(object?.traceback) ? object.traceback.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.ename !== "") { + obj.ename = message.ename; + } + if (message.evalue !== "") { + obj.evalue = message.evalue; + } + if (message.traceback?.length) { + obj.traceback = message.traceback; + } + return obj; + }, + create(base) { + return NotebookOutput_Error.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNotebookOutput_Error(); + message.ename = object.ename ?? ""; + message.evalue = object.evalue ?? ""; + message.traceback = object.traceback?.map((e) => e) || []; + return message; + } +}; +function createBaseObject() { + return { + objectId: "", + functionHandleMetadata: void 0, + mountHandleMetadata: void 0, + classHandleMetadata: void 0, + sandboxHandleMetadata: void 0, + volumeMetadata: void 0 + }; +} +var Object_ = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + if (message.functionHandleMetadata !== void 0) { + FunctionHandleMetadata.encode(message.functionHandleMetadata, writer.uint32(26).fork()).join(); + } + if (message.mountHandleMetadata !== void 0) { + MountHandleMetadata.encode(message.mountHandleMetadata, writer.uint32(34).fork()).join(); + } + if (message.classHandleMetadata !== void 0) { + ClassHandleMetadata.encode(message.classHandleMetadata, writer.uint32(42).fork()).join(); + } + if (message.sandboxHandleMetadata !== void 0) { + SandboxHandleMetadata.encode(message.sandboxHandleMetadata, writer.uint32(50).fork()).join(); + } + if (message.volumeMetadata !== void 0) { + VolumeMetadata.encode(message.volumeMetadata, writer.uint32(58).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseObject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.functionHandleMetadata = FunctionHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.mountHandleMetadata = MountHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.classHandleMetadata = ClassHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.sandboxHandleMetadata = SandboxHandleMetadata.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.volumeMetadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "", + functionHandleMetadata: isSet4(object.functionHandleMetadata) ? FunctionHandleMetadata.fromJSON(object.functionHandleMetadata) : void 0, + mountHandleMetadata: isSet4(object.mountHandleMetadata) ? MountHandleMetadata.fromJSON(object.mountHandleMetadata) : void 0, + classHandleMetadata: isSet4(object.classHandleMetadata) ? ClassHandleMetadata.fromJSON(object.classHandleMetadata) : void 0, + sandboxHandleMetadata: isSet4(object.sandboxHandleMetadata) ? SandboxHandleMetadata.fromJSON(object.sandboxHandleMetadata) : void 0, + volumeMetadata: isSet4(object.volumeMetadata) ? VolumeMetadata.fromJSON(object.volumeMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.functionHandleMetadata !== void 0) { + obj.functionHandleMetadata = FunctionHandleMetadata.toJSON(message.functionHandleMetadata); + } + if (message.mountHandleMetadata !== void 0) { + obj.mountHandleMetadata = MountHandleMetadata.toJSON(message.mountHandleMetadata); + } + if (message.classHandleMetadata !== void 0) { + obj.classHandleMetadata = ClassHandleMetadata.toJSON(message.classHandleMetadata); + } + if (message.sandboxHandleMetadata !== void 0) { + obj.sandboxHandleMetadata = SandboxHandleMetadata.toJSON(message.sandboxHandleMetadata); + } + if (message.volumeMetadata !== void 0) { + obj.volumeMetadata = VolumeMetadata.toJSON(message.volumeMetadata); + } + return obj; + }, + create(base) { + return Object_.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseObject(); + message.objectId = object.objectId ?? ""; + message.functionHandleMetadata = object.functionHandleMetadata !== void 0 && object.functionHandleMetadata !== null ? FunctionHandleMetadata.fromPartial(object.functionHandleMetadata) : void 0; + message.mountHandleMetadata = object.mountHandleMetadata !== void 0 && object.mountHandleMetadata !== null ? MountHandleMetadata.fromPartial(object.mountHandleMetadata) : void 0; + message.classHandleMetadata = object.classHandleMetadata !== void 0 && object.classHandleMetadata !== null ? ClassHandleMetadata.fromPartial(object.classHandleMetadata) : void 0; + message.sandboxHandleMetadata = object.sandboxHandleMetadata !== void 0 && object.sandboxHandleMetadata !== null ? SandboxHandleMetadata.fromPartial(object.sandboxHandleMetadata) : void 0; + message.volumeMetadata = object.volumeMetadata !== void 0 && object.volumeMetadata !== null ? VolumeMetadata.fromPartial(object.volumeMetadata) : void 0; + return message; + } +}; +function createBaseObjectDependency() { + return { objectId: "" }; +} +var ObjectDependency = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseObjectDependency(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + return obj; + }, + create(base) { + return ObjectDependency.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseObjectDependency(); + message.objectId = object.objectId ?? ""; + return message; + } +}; +function createBasePTYInfo() { + return { + enabled: false, + winszRows: 0, + winszCols: 0, + envTerm: "", + envColorterm: "", + envTermProgram: "", + ptyType: 0, + noTerminateOnIdleStdin: false + }; +} +var PTYInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.enabled !== false) { + writer.uint32(8).bool(message.enabled); + } + if (message.winszRows !== 0) { + writer.uint32(16).uint32(message.winszRows); + } + if (message.winszCols !== 0) { + writer.uint32(24).uint32(message.winszCols); + } + if (message.envTerm !== "") { + writer.uint32(34).string(message.envTerm); + } + if (message.envColorterm !== "") { + writer.uint32(42).string(message.envColorterm); + } + if (message.envTermProgram !== "") { + writer.uint32(50).string(message.envTermProgram); + } + if (message.ptyType !== 0) { + writer.uint32(56).int32(message.ptyType); + } + if (message.noTerminateOnIdleStdin !== false) { + writer.uint32(64).bool(message.noTerminateOnIdleStdin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePTYInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.enabled = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.winszRows = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.winszCols = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.envTerm = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.envColorterm = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.envTermProgram = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.ptyType = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.noTerminateOnIdleStdin = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + enabled: isSet4(object.enabled) ? globalThis.Boolean(object.enabled) : false, + winszRows: isSet4(object.winszRows) ? globalThis.Number(object.winszRows) : 0, + winszCols: isSet4(object.winszCols) ? globalThis.Number(object.winszCols) : 0, + envTerm: isSet4(object.envTerm) ? globalThis.String(object.envTerm) : "", + envColorterm: isSet4(object.envColorterm) ? globalThis.String(object.envColorterm) : "", + envTermProgram: isSet4(object.envTermProgram) ? globalThis.String(object.envTermProgram) : "", + ptyType: isSet4(object.ptyType) ? pTYInfo_PTYTypeFromJSON(object.ptyType) : 0, + noTerminateOnIdleStdin: isSet4(object.noTerminateOnIdleStdin) ? globalThis.Boolean(object.noTerminateOnIdleStdin) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + if (message.winszRows !== 0) { + obj.winszRows = Math.round(message.winszRows); + } + if (message.winszCols !== 0) { + obj.winszCols = Math.round(message.winszCols); + } + if (message.envTerm !== "") { + obj.envTerm = message.envTerm; + } + if (message.envColorterm !== "") { + obj.envColorterm = message.envColorterm; + } + if (message.envTermProgram !== "") { + obj.envTermProgram = message.envTermProgram; + } + if (message.ptyType !== 0) { + obj.ptyType = pTYInfo_PTYTypeToJSON(message.ptyType); + } + if (message.noTerminateOnIdleStdin !== false) { + obj.noTerminateOnIdleStdin = message.noTerminateOnIdleStdin; + } + return obj; + }, + create(base) { + return PTYInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePTYInfo(); + message.enabled = object.enabled ?? false; + message.winszRows = object.winszRows ?? 0; + message.winszCols = object.winszCols ?? 0; + message.envTerm = object.envTerm ?? ""; + message.envColorterm = object.envColorterm ?? ""; + message.envTermProgram = object.envTermProgram ?? ""; + message.ptyType = object.ptyType ?? 0; + message.noTerminateOnIdleStdin = object.noTerminateOnIdleStdin ?? false; + return message; + } +}; +function createBasePortSpec() { + return { port: 0, unencrypted: false, tunnelType: void 0 }; +} +var PortSpec = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + if (message.unencrypted !== false) { + writer.uint32(16).bool(message.unencrypted); + } + if (message.tunnelType !== void 0) { + writer.uint32(24).int32(message.tunnelType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePortSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.unencrypted = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.tunnelType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencrypted: isSet4(object.unencrypted) ? globalThis.Boolean(object.unencrypted) : false, + tunnelType: isSet4(object.tunnelType) ? tunnelTypeFromJSON(object.tunnelType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencrypted !== false) { + obj.unencrypted = message.unencrypted; + } + if (message.tunnelType !== void 0) { + obj.tunnelType = tunnelTypeToJSON(message.tunnelType); + } + return obj; + }, + create(base) { + return PortSpec.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePortSpec(); + message.port = object.port ?? 0; + message.unencrypted = object.unencrypted ?? false; + message.tunnelType = object.tunnelType ?? void 0; + return message; + } +}; +function createBasePortSpecs() { + return { ports: [] }; +} +var PortSpecs = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.ports) { + PortSpec.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBasePortSpecs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.ports.push(PortSpec.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { ports: globalThis.Array.isArray(object?.ports) ? object.ports.map((e) => PortSpec.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.ports?.length) { + obj.ports = message.ports.map((e) => PortSpec.toJSON(e)); + } + return obj; + }, + create(base) { + return PortSpecs.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePortSpecs(); + message.ports = object.ports?.map((e) => PortSpec.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxy() { + return { name: "", createdAt: 0, environmentName: "", proxyId: "", proxyIps: [] }; +} +var Proxy2 = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.proxyId !== "") { + writer.uint32(42).string(message.proxyId); + } + for (const v of message.proxyIps) { + ProxyIp.encode(v, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.proxyIps.push(ProxyIp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "", + proxyIps: globalThis.Array.isArray(object?.proxyIps) ? object.proxyIps.map((e) => ProxyIp.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + if (message.proxyIps?.length) { + obj.proxyIps = message.proxyIps.map((e) => ProxyIp.toJSON(e)); + } + return obj; + }, + create(base) { + return Proxy2.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxy(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.environmentName = object.environmentName ?? ""; + message.proxyId = object.proxyId ?? ""; + message.proxyIps = object.proxyIps?.map((e) => ProxyIp.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxyAddIpRequest() { + return { proxyId: "" }; +} +var ProxyAddIpRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyAddIpRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyAddIpRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyAddIpRequest(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyAddIpResponse() { + return { proxyIp: void 0 }; +} +var ProxyAddIpResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== void 0) { + ProxyIp.encode(message.proxyIp, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyAddIpResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = ProxyIp.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyIp: isSet4(object.proxyIp) ? ProxyIp.fromJSON(object.proxyIp) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== void 0) { + obj.proxyIp = ProxyIp.toJSON(message.proxyIp); + } + return obj; + }, + create(base) { + return ProxyAddIpResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyAddIpResponse(); + message.proxyIp = object.proxyIp !== void 0 && object.proxyIp !== null ? ProxyIp.fromPartial(object.proxyIp) : void 0; + return message; + } +}; +function createBaseProxyCreateRequest() { + return { name: "", environmentName: "" }; +} +var ProxyCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyCreateRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyCreateResponse() { + return { proxy: void 0 }; +} +var ProxyCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxy !== void 0) { + Proxy2.encode(message.proxy, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxy = Proxy2.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxy: isSet4(object.proxy) ? Proxy2.fromJSON(object.proxy) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxy !== void 0) { + obj.proxy = Proxy2.toJSON(message.proxy); + } + return obj; + }, + create(base) { + return ProxyCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyCreateResponse(); + message.proxy = object.proxy !== void 0 && object.proxy !== null ? Proxy2.fromPartial(object.proxy) : void 0; + return message; + } +}; +function createBaseProxyDeleteRequest() { + return { proxyId: "" }; +} +var ProxyDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyDeleteRequest(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0 }; +} +var ProxyGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return ProxyGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseProxyGetOrCreateResponse() { + return { proxyId: "" }; +} +var ProxyGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyId !== "") { + writer.uint32(10).string(message.proxyId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyId !== "") { + obj.proxyId = message.proxyId; + } + return obj; + }, + create(base) { + return ProxyGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetOrCreateResponse(); + message.proxyId = object.proxyId ?? ""; + return message; + } +}; +function createBaseProxyGetRequest() { + return { name: "", environmentName: "" }; +} +var ProxyGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetRequest(); + message.name = object.name ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyGetResponse() { + return { proxy: void 0 }; +} +var ProxyGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.proxy !== void 0) { + Proxy2.encode(message.proxy, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxy = Proxy2.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxy: isSet4(object.proxy) ? Proxy2.fromJSON(object.proxy) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.proxy !== void 0) { + obj.proxy = Proxy2.toJSON(message.proxy); + } + return obj; + }, + create(base) { + return ProxyGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyGetResponse(); + message.proxy = object.proxy !== void 0 && object.proxy !== null ? Proxy2.fromPartial(object.proxy) : void 0; + return message; + } +}; +function createBaseProxyIp() { + return { proxyIp: "", status: 0, createdAt: 0, environmentName: "" }; +} +var ProxyIp = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== "") { + writer.uint32(10).string(message.proxyIp); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyIp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.status = reader.int32(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + proxyIp: isSet4(object.proxyIp) ? globalThis.String(object.proxyIp) : "", + status: isSet4(object.status) ? proxyIpStatusFromJSON(object.status) : 0, + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== "") { + obj.proxyIp = message.proxyIp; + } + if (message.status !== 0) { + obj.status = proxyIpStatusToJSON(message.status); + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return ProxyIp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyIp(); + message.proxyIp = object.proxyIp ?? ""; + message.status = object.status ?? 0; + message.createdAt = object.createdAt ?? 0; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseProxyListResponse() { + return { proxies: [] }; +} +var ProxyListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.proxies) { + Proxy2.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxies.push(Proxy2.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + proxies: globalThis.Array.isArray(object?.proxies) ? object.proxies.map((e) => Proxy2.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.proxies?.length) { + obj.proxies = message.proxies.map((e) => Proxy2.toJSON(e)); + } + return obj; + }, + create(base) { + return ProxyListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyListResponse(); + message.proxies = object.proxies?.map((e) => Proxy2.fromPartial(e)) || []; + return message; + } +}; +function createBaseProxyRemoveIpRequest() { + return { proxyIp: "" }; +} +var ProxyRemoveIpRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.proxyIp !== "") { + writer.uint32(10).string(message.proxyIp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseProxyRemoveIpRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.proxyIp = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { proxyIp: isSet4(object.proxyIp) ? globalThis.String(object.proxyIp) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.proxyIp !== "") { + obj.proxyIp = message.proxyIp; + } + return obj; + }, + create(base) { + return ProxyRemoveIpRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProxyRemoveIpRequest(); + message.proxyIp = object.proxyIp ?? ""; + return message; + } +}; +function createBaseQueueClearRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), allPartitions: false }; +} +var QueueClearRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.allPartitions !== false) { + writer.uint32(24).bool(message.allPartitions); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueClearRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.allPartitions = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + allPartitions: isSet4(object.allPartitions) ? globalThis.Boolean(object.allPartitions) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.allPartitions !== false) { + obj.allPartitions = message.allPartitions; + } + return obj; + }, + create(base) { + return QueueClearRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueClearRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.allPartitions = object.allPartitions ?? false; + return message; + } +}; +function createBaseQueueDeleteRequest() { + return { queueId: "" }; +} +var QueueDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + return obj; + }, + create(base) { + return QueueDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueDeleteRequest(); + message.queueId = object.queueId ?? ""; + return message; + } +}; +function createBaseQueueGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0 }; +} +var QueueGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + return obj; + }, + create(base) { + return QueueGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + return message; + } +}; +function createBaseQueueGetOrCreateResponse() { + return { queueId: "", metadata: void 0 }; +} +var QueueGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.metadata !== void 0) { + QueueMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = QueueMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + metadata: isSet4(object.metadata) ? QueueMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.metadata !== void 0) { + obj.metadata = QueueMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return QueueGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetOrCreateResponse(); + message.queueId = object.queueId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? QueueMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseQueueGetRequest() { + return { queueId: "", timeout: 0, nValues: 0, partitionKey: new Uint8Array(0) }; +} +var QueueGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.nValues !== 0) { + writer.uint32(32).int32(message.nValues); + } + if (message.partitionKey.length !== 0) { + writer.uint32(42).bytes(message.partitionKey); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.nValues = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + nValues: isSet4(object.nValues) ? globalThis.Number(object.nValues) : 0, + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.nValues !== 0) { + obj.nValues = Math.round(message.nValues); + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + return obj; + }, + create(base) { + return QueueGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetRequest(); + message.queueId = object.queueId ?? ""; + message.timeout = object.timeout ?? 0; + message.nValues = object.nValues ?? 0; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + return message; + } +}; +function createBaseQueueGetResponse() { + return { values: [] }; +} +var QueueGetResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.values) { + writer.uint32(18).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.values.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + values: globalThis.Array.isArray(object?.values) ? object.values.map((e) => bytesFromBase64(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return QueueGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueGetResponse(); + message.values = object.values?.map((e) => e) || []; + return message; + } +}; +function createBaseQueueHeartbeatRequest() { + return { queueId: "" }; +} +var QueueHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + return obj; + }, + create(base) { + return QueueHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueHeartbeatRequest(); + message.queueId = object.queueId ?? ""; + return message; + } +}; +function createBaseQueueItem() { + return { value: new Uint8Array(0), entryId: "" }; +} +var QueueItem = { + encode(message, writer = new BinaryWriter()) { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.entryId !== "") { + writer.uint32(18).string(message.entryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.value = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.entryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + value: isSet4(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + return obj; + }, + create(base) { + return QueueItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueItem(); + message.value = object.value ?? new Uint8Array(0); + message.entryId = object.entryId ?? ""; + return message; + } +}; +function createBaseQueueLenRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), total: false }; +} +var QueueLenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.total !== false) { + writer.uint32(24).bool(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.total = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + total: isSet4(object.total) ? globalThis.Boolean(object.total) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.total !== false) { + obj.total = message.total; + } + return obj; + }, + create(base) { + return QueueLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueLenRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.total = object.total ?? false; + return message; + } +}; +function createBaseQueueLenResponse() { + return { len: 0 }; +} +var QueueLenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).int32(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { len: isSet4(object.len) ? globalThis.Number(object.len) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return QueueLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueLenResponse(); + message.len = object.len ?? 0; + return message; + } +}; +function createBaseQueueListRequest() { + return { environmentName: "", totalSizeLimit: 0, pagination: void 0 }; +} +var QueueListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.totalSizeLimit !== 0) { + writer.uint32(16).int32(message.totalSizeLimit); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.totalSizeLimit = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + totalSizeLimit: isSet4(object.totalSizeLimit) ? globalThis.Number(object.totalSizeLimit) : 0, + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.totalSizeLimit !== 0) { + obj.totalSizeLimit = Math.round(message.totalSizeLimit); + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueueListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListRequest(); + message.environmentName = object.environmentName ?? ""; + message.totalSizeLimit = object.totalSizeLimit ?? 0; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseQueueListResponse() { + return { queues: [], environmentName: "" }; +} +var QueueListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.queues) { + QueueListResponse_QueueInfo.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queues.push(QueueListResponse_QueueInfo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queues: globalThis.Array.isArray(object?.queues) ? object.queues.map((e) => QueueListResponse_QueueInfo.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.queues?.length) { + obj.queues = message.queues.map((e) => QueueListResponse_QueueInfo.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return QueueListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListResponse(); + message.queues = object.queues?.map((e) => QueueListResponse_QueueInfo.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseQueueListResponse_QueueInfo() { + return { name: "", createdAt: 0, numPartitions: 0, totalSize: 0, queueId: "", metadata: void 0 }; +} +var QueueListResponse_QueueInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.numPartitions !== 0) { + writer.uint32(24).int32(message.numPartitions); + } + if (message.totalSize !== 0) { + writer.uint32(32).int32(message.totalSize); + } + if (message.queueId !== "") { + writer.uint32(42).string(message.queueId); + } + if (message.metadata !== void 0) { + QueueMetadata.encode(message.metadata, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueListResponse_QueueInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.numPartitions = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.totalSize = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.queueId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.metadata = QueueMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + numPartitions: isSet4(object.numPartitions) ? globalThis.Number(object.numPartitions) : 0, + totalSize: isSet4(object.totalSize) ? globalThis.Number(object.totalSize) : 0, + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + metadata: isSet4(object.metadata) ? QueueMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.numPartitions !== 0) { + obj.numPartitions = Math.round(message.numPartitions); + } + if (message.totalSize !== 0) { + obj.totalSize = Math.round(message.totalSize); + } + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.metadata !== void 0) { + obj.metadata = QueueMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return QueueListResponse_QueueInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueListResponse_QueueInfo(); + message.name = object.name ?? ""; + message.createdAt = object.createdAt ?? 0; + message.numPartitions = object.numPartitions ?? 0; + message.totalSize = object.totalSize ?? 0; + message.queueId = object.queueId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? QueueMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseQueueMetadata() { + return { name: "", creationInfo: void 0 }; +} +var QueueMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return QueueMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseQueueNextItemsRequest() { + return { queueId: "", partitionKey: new Uint8Array(0), lastEntryId: "", itemPollTimeout: 0 }; +} +var QueueNextItemsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + if (message.partitionKey.length !== 0) { + writer.uint32(18).bytes(message.partitionKey); + } + if (message.lastEntryId !== "") { + writer.uint32(26).string(message.lastEntryId); + } + if (message.itemPollTimeout !== 0) { + writer.uint32(37).float(message.itemPollTimeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueNextItemsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + message.itemPollTimeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "", + itemPollTimeout: isSet4(object.itemPollTimeout) ? globalThis.Number(object.itemPollTimeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + if (message.itemPollTimeout !== 0) { + obj.itemPollTimeout = message.itemPollTimeout; + } + return obj; + }, + create(base) { + return QueueNextItemsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueNextItemsRequest(); + message.queueId = object.queueId ?? ""; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.lastEntryId = object.lastEntryId ?? ""; + message.itemPollTimeout = object.itemPollTimeout ?? 0; + return message; + } +}; +function createBaseQueueNextItemsResponse() { + return { items: [] }; +} +var QueueNextItemsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + QueueItem.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueueNextItemsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(QueueItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => QueueItem.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => QueueItem.toJSON(e)); + } + return obj; + }, + create(base) { + return QueueNextItemsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueueNextItemsResponse(); + message.items = object.items?.map((e) => QueueItem.fromPartial(e)) || []; + return message; + } +}; +function createBaseQueuePutRequest() { + return { queueId: "", values: [], partitionKey: new Uint8Array(0), partitionTtlSeconds: 0 }; +} +var QueuePutRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.queueId !== "") { + writer.uint32(10).string(message.queueId); + } + for (const v of message.values) { + writer.uint32(34).bytes(v); + } + if (message.partitionKey.length !== 0) { + writer.uint32(42).bytes(message.partitionKey); + } + if (message.partitionTtlSeconds !== 0) { + writer.uint32(48).int32(message.partitionTtlSeconds); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseQueuePutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.queueId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.values.push(reader.bytes()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.partitionKey = reader.bytes(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.partitionTtlSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + queueId: isSet4(object.queueId) ? globalThis.String(object.queueId) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e) => bytesFromBase64(e)) : [], + partitionKey: isSet4(object.partitionKey) ? bytesFromBase64(object.partitionKey) : new Uint8Array(0), + partitionTtlSeconds: isSet4(object.partitionTtlSeconds) ? globalThis.Number(object.partitionTtlSeconds) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.queueId !== "") { + obj.queueId = message.queueId; + } + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + if (message.partitionKey.length !== 0) { + obj.partitionKey = base64FromBytes(message.partitionKey); + } + if (message.partitionTtlSeconds !== 0) { + obj.partitionTtlSeconds = Math.round(message.partitionTtlSeconds); + } + return obj; + }, + create(base) { + return QueuePutRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueuePutRequest(); + message.queueId = object.queueId ?? ""; + message.values = object.values?.map((e) => e) || []; + message.partitionKey = object.partitionKey ?? new Uint8Array(0); + message.partitionTtlSeconds = object.partitionTtlSeconds ?? 0; + return message; + } +}; +function createBaseRateLimit() { + return { limit: 0, interval: 0 }; +} +var RateLimit = { + encode(message, writer = new BinaryWriter()) { + if (message.limit !== 0) { + writer.uint32(8).int32(message.limit); + } + if (message.interval !== 0) { + writer.uint32(16).int32(message.interval); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRateLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.limit = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.interval = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + limit: isSet4(object.limit) ? globalThis.Number(object.limit) : 0, + interval: isSet4(object.interval) ? rateLimitIntervalFromJSON(object.interval) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.interval !== 0) { + obj.interval = rateLimitIntervalToJSON(message.interval); + } + return obj; + }, + create(base) { + return RateLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRateLimit(); + message.limit = object.limit ?? 0; + message.interval = object.interval ?? 0; + return message; + } +}; +function createBaseResources() { + return { + memoryMb: 0, + milliCpu: 0, + gpuConfig: void 0, + memoryMbMax: 0, + ephemeralDiskMb: 0, + milliCpuMax: 0, + rdma: false + }; +} +var Resources = { + encode(message, writer = new BinaryWriter()) { + if (message.memoryMb !== 0) { + writer.uint32(16).uint32(message.memoryMb); + } + if (message.milliCpu !== 0) { + writer.uint32(24).uint32(message.milliCpu); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(34).fork()).join(); + } + if (message.memoryMbMax !== 0) { + writer.uint32(40).uint32(message.memoryMbMax); + } + if (message.ephemeralDiskMb !== 0) { + writer.uint32(48).uint32(message.ephemeralDiskMb); + } + if (message.milliCpuMax !== 0) { + writer.uint32(56).uint32(message.milliCpuMax); + } + if (message.rdma !== false) { + writer.uint32(64).bool(message.rdma); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseResources(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.memoryMb = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.milliCpu = reader.uint32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.memoryMbMax = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.ephemeralDiskMb = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.milliCpuMax = reader.uint32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.rdma = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + memoryMb: isSet4(object.memoryMb) ? globalThis.Number(object.memoryMb) : 0, + milliCpu: isSet4(object.milliCpu) ? globalThis.Number(object.milliCpu) : 0, + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0, + memoryMbMax: isSet4(object.memoryMbMax) ? globalThis.Number(object.memoryMbMax) : 0, + ephemeralDiskMb: isSet4(object.ephemeralDiskMb) ? globalThis.Number(object.ephemeralDiskMb) : 0, + milliCpuMax: isSet4(object.milliCpuMax) ? globalThis.Number(object.milliCpuMax) : 0, + rdma: isSet4(object.rdma) ? globalThis.Boolean(object.rdma) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.memoryMb !== 0) { + obj.memoryMb = Math.round(message.memoryMb); + } + if (message.milliCpu !== 0) { + obj.milliCpu = Math.round(message.milliCpu); + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + if (message.memoryMbMax !== 0) { + obj.memoryMbMax = Math.round(message.memoryMbMax); + } + if (message.ephemeralDiskMb !== 0) { + obj.ephemeralDiskMb = Math.round(message.ephemeralDiskMb); + } + if (message.milliCpuMax !== 0) { + obj.milliCpuMax = Math.round(message.milliCpuMax); + } + if (message.rdma !== false) { + obj.rdma = message.rdma; + } + return obj; + }, + create(base) { + return Resources.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResources(); + message.memoryMb = object.memoryMb ?? 0; + message.milliCpu = object.milliCpu ?? 0; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + message.memoryMbMax = object.memoryMbMax ?? 0; + message.ephemeralDiskMb = object.ephemeralDiskMb ?? 0; + message.milliCpuMax = object.milliCpuMax ?? 0; + message.rdma = object.rdma ?? false; + return message; + } +}; +function createBaseRuntimeInputMessage() { + return { message: new Uint8Array(0), messageIndex: 0, eof: false }; +} +var RuntimeInputMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.message.length !== 0) { + writer.uint32(10).bytes(message.message); + } + if (message.messageIndex !== 0) { + writer.uint32(16).uint64(message.messageIndex); + } + if (message.eof !== false) { + writer.uint32(24).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeInputMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.message = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.messageIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + message: isSet4(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0), + messageIndex: isSet4(object.messageIndex) ? globalThis.Number(object.messageIndex) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.message.length !== 0) { + obj.message = base64FromBytes(message.message); + } + if (message.messageIndex !== 0) { + obj.messageIndex = Math.round(message.messageIndex); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return RuntimeInputMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeInputMessage(); + message.message = object.message ?? new Uint8Array(0); + message.messageIndex = object.messageIndex ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseRuntimeOutputBatch() { + return { items: [], batchIndex: 0, exitCode: void 0, stdout: [], stderr: [], info: [] }; +} +var RuntimeOutputBatch = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + RuntimeOutputMessage.encode(v, writer.uint32(10).fork()).join(); + } + if (message.batchIndex !== 0) { + writer.uint32(16).uint64(message.batchIndex); + } + if (message.exitCode !== void 0) { + writer.uint32(24).int32(message.exitCode); + } + for (const v of message.stdout) { + RuntimeOutputMessage.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.stderr) { + RuntimeOutputMessage.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.info) { + RuntimeOutputMessage.encode(v, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeOutputBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.batchIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.exitCode = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.stdout.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.stderr.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.info.push(RuntimeOutputMessage.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + batchIndex: isSet4(object.batchIndex) ? globalThis.Number(object.batchIndex) : 0, + exitCode: isSet4(object.exitCode) ? globalThis.Number(object.exitCode) : void 0, + stdout: globalThis.Array.isArray(object?.stdout) ? object.stdout.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + stderr: globalThis.Array.isArray(object?.stderr) ? object.stderr.map((e) => RuntimeOutputMessage.fromJSON(e)) : [], + info: globalThis.Array.isArray(object?.info) ? object.info.map((e) => RuntimeOutputMessage.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.batchIndex !== 0) { + obj.batchIndex = Math.round(message.batchIndex); + } + if (message.exitCode !== void 0) { + obj.exitCode = Math.round(message.exitCode); + } + if (message.stdout?.length) { + obj.stdout = message.stdout.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.stderr?.length) { + obj.stderr = message.stderr.map((e) => RuntimeOutputMessage.toJSON(e)); + } + if (message.info?.length) { + obj.info = message.info.map((e) => RuntimeOutputMessage.toJSON(e)); + } + return obj; + }, + create(base) { + return RuntimeOutputBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeOutputBatch(); + message.items = object.items?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.batchIndex = object.batchIndex ?? 0; + message.exitCode = object.exitCode ?? void 0; + message.stdout = object.stdout?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.stderr = object.stderr?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + message.info = object.info?.map((e) => RuntimeOutputMessage.fromPartial(e)) || []; + return message; + } +}; +function createBaseRuntimeOutputMessage() { + return { fileDescriptor: 0, message: "", messageBytes: new Uint8Array(0) }; +} +var RuntimeOutputMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.fileDescriptor !== 0) { + writer.uint32(8).int32(message.fileDescriptor); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.messageBytes.length !== 0) { + writer.uint32(26).bytes(message.messageBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseRuntimeOutputMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.message = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.messageBytes = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + message: isSet4(object.message) ? globalThis.String(object.message) : "", + messageBytes: isSet4(object.messageBytes) ? bytesFromBase64(object.messageBytes) : new Uint8Array(0) + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.messageBytes.length !== 0) { + obj.messageBytes = base64FromBytes(message.messageBytes); + } + return obj; + }, + create(base) { + return RuntimeOutputMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRuntimeOutputMessage(); + message.fileDescriptor = object.fileDescriptor ?? 0; + message.message = object.message ?? ""; + message.messageBytes = object.messageBytes ?? new Uint8Array(0); + return message; + } +}; +function createBaseS3Mount() { + return { bucketName: "", mountPath: "", credentialsSecretId: "", readOnly: false }; +} +var S3Mount = { + encode(message, writer = new BinaryWriter()) { + if (message.bucketName !== "") { + writer.uint32(10).string(message.bucketName); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.credentialsSecretId !== "") { + writer.uint32(26).string(message.credentialsSecretId); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseS3Mount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.bucketName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.credentialsSecretId = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + bucketName: isSet4(object.bucketName) ? globalThis.String(object.bucketName) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + credentialsSecretId: isSet4(object.credentialsSecretId) ? globalThis.String(object.credentialsSecretId) : "", + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.bucketName !== "") { + obj.bucketName = message.bucketName; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.credentialsSecretId !== "") { + obj.credentialsSecretId = message.credentialsSecretId; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + create(base) { + return S3Mount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseS3Mount(); + message.bucketName = object.bucketName ?? ""; + message.mountPath = object.mountPath ?? ""; + message.credentialsSecretId = object.credentialsSecretId ?? ""; + message.readOnly = object.readOnly ?? false; + return message; + } +}; +function createBaseSandbox() { + return { + entrypointArgs: [], + mountIds: [], + imageId: "", + secretIds: [], + resources: void 0, + cloudProvider: 0, + timeoutSecs: 0, + workdir: void 0, + nfsMounts: [], + runtimeDebug: false, + blockNetwork: false, + s3Mounts: [], + cloudBucketMounts: [], + volumeMounts: [], + ptyInfo: void 0, + schedulerPlacement: void 0, + workerId: "", + openPorts: void 0, + i6pnEnabled: false, + networkAccess: void 0, + proxyId: void 0, + enableSnapshot: false, + snapshotVersion: void 0, + cloudProviderStr: "", + runscRuntimeVersion: void 0, + runtime: void 0, + verbose: false, + name: void 0, + experimentalOptions: {}, + preloadPathPrefixes: [], + idleTimeoutSecs: void 0, + directSandboxCommandsEnabled: false + }; +} +var Sandbox = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entrypointArgs) { + writer.uint32(10).string(v); + } + for (const v of message.mountIds) { + writer.uint32(18).string(v); + } + if (message.imageId !== "") { + writer.uint32(26).string(message.imageId); + } + for (const v of message.secretIds) { + writer.uint32(34).string(v); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(42).fork()).join(); + } + if (message.cloudProvider !== 0) { + writer.uint32(48).int32(message.cloudProvider); + } + if (message.timeoutSecs !== 0) { + writer.uint32(56).uint32(message.timeoutSecs); + } + if (message.workdir !== void 0) { + writer.uint32(66).string(message.workdir); + } + for (const v of message.nfsMounts) { + SharedVolumeMount.encode(v, writer.uint32(74).fork()).join(); + } + if (message.runtimeDebug !== false) { + writer.uint32(80).bool(message.runtimeDebug); + } + if (message.blockNetwork !== false) { + writer.uint32(88).bool(message.blockNetwork); + } + for (const v of message.s3Mounts) { + S3Mount.encode(v, writer.uint32(98).fork()).join(); + } + for (const v of message.cloudBucketMounts) { + CloudBucketMount.encode(v, writer.uint32(114).fork()).join(); + } + for (const v of message.volumeMounts) { + VolumeMount.encode(v, writer.uint32(106).fork()).join(); + } + if (message.ptyInfo !== void 0) { + PTYInfo.encode(message.ptyInfo, writer.uint32(122).fork()).join(); + } + if (message.schedulerPlacement !== void 0) { + SchedulerPlacement.encode(message.schedulerPlacement, writer.uint32(138).fork()).join(); + } + if (message.workerId !== "") { + writer.uint32(154).string(message.workerId); + } + if (message.openPorts !== void 0) { + PortSpecs.encode(message.openPorts, writer.uint32(162).fork()).join(); + } + if (message.i6pnEnabled !== false) { + writer.uint32(168).bool(message.i6pnEnabled); + } + if (message.networkAccess !== void 0) { + NetworkAccess.encode(message.networkAccess, writer.uint32(178).fork()).join(); + } + if (message.proxyId !== void 0) { + writer.uint32(186).string(message.proxyId); + } + if (message.enableSnapshot !== false) { + writer.uint32(192).bool(message.enableSnapshot); + } + if (message.snapshotVersion !== void 0) { + writer.uint32(200).uint32(message.snapshotVersion); + } + if (message.cloudProviderStr !== "") { + writer.uint32(210).string(message.cloudProviderStr); + } + if (message.runscRuntimeVersion !== void 0) { + writer.uint32(218).string(message.runscRuntimeVersion); + } + if (message.runtime !== void 0) { + writer.uint32(226).string(message.runtime); + } + if (message.verbose !== false) { + writer.uint32(232).bool(message.verbose); + } + if (message.name !== void 0) { + writer.uint32(242).string(message.name); + } + Object.entries(message.experimentalOptions).forEach(([key, value]) => { + Sandbox_ExperimentalOptionsEntry.encode({ key, value }, writer.uint32(250).fork()).join(); + }); + for (const v of message.preloadPathPrefixes) { + writer.uint32(258).string(v); + } + if (message.idleTimeoutSecs !== void 0) { + writer.uint32(264).uint32(message.idleTimeoutSecs); + } + if (message.directSandboxCommandsEnabled !== false) { + writer.uint32(272).bool(message.directSandboxCommandsEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandbox(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entrypointArgs.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountIds.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.imageId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.secretIds.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.timeoutSecs = reader.uint32(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.workdir = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.nfsMounts.push(SharedVolumeMount.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.runtimeDebug = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.blockNetwork = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.s3Mounts.push(S3Mount.decode(reader, reader.uint32())); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.cloudBucketMounts.push(CloudBucketMount.decode(reader, reader.uint32())); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.volumeMounts.push(VolumeMount.decode(reader, reader.uint32())); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.ptyInfo = PTYInfo.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + message.schedulerPlacement = SchedulerPlacement.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + message.workerId = reader.string(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + message.openPorts = PortSpecs.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + message.i6pnEnabled = reader.bool(); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.networkAccess = NetworkAccess.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + message.proxyId = reader.string(); + continue; + } + case 24: { + if (tag !== 192) { + break; + } + message.enableSnapshot = reader.bool(); + continue; + } + case 25: { + if (tag !== 200) { + break; + } + message.snapshotVersion = reader.uint32(); + continue; + } + case 26: { + if (tag !== 210) { + break; + } + message.cloudProviderStr = reader.string(); + continue; + } + case 27: { + if (tag !== 218) { + break; + } + message.runscRuntimeVersion = reader.string(); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + message.runtime = reader.string(); + continue; + } + case 29: { + if (tag !== 232) { + break; + } + message.verbose = reader.bool(); + continue; + } + case 30: { + if (tag !== 242) { + break; + } + message.name = reader.string(); + continue; + } + case 31: { + if (tag !== 250) { + break; + } + const entry31 = Sandbox_ExperimentalOptionsEntry.decode(reader, reader.uint32()); + if (entry31.value !== void 0) { + message.experimentalOptions[entry31.key] = entry31.value; + } + continue; + } + case 32: { + if (tag !== 258) { + break; + } + message.preloadPathPrefixes.push(reader.string()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + message.idleTimeoutSecs = reader.uint32(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.directSandboxCommandsEnabled = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entrypointArgs: globalThis.Array.isArray(object?.entrypointArgs) ? object.entrypointArgs.map((e) => globalThis.String(e)) : [], + mountIds: globalThis.Array.isArray(object?.mountIds) ? object.mountIds.map((e) => globalThis.String(e)) : [], + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + secretIds: globalThis.Array.isArray(object?.secretIds) ? object.secretIds.map((e) => globalThis.String(e)) : [], + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0, + timeoutSecs: isSet4(object.timeoutSecs) ? globalThis.Number(object.timeoutSecs) : 0, + workdir: isSet4(object.workdir) ? globalThis.String(object.workdir) : void 0, + nfsMounts: globalThis.Array.isArray(object?.nfsMounts) ? object.nfsMounts.map((e) => SharedVolumeMount.fromJSON(e)) : [], + runtimeDebug: isSet4(object.runtimeDebug) ? globalThis.Boolean(object.runtimeDebug) : false, + blockNetwork: isSet4(object.blockNetwork) ? globalThis.Boolean(object.blockNetwork) : false, + s3Mounts: globalThis.Array.isArray(object?.s3Mounts) ? object.s3Mounts.map((e) => S3Mount.fromJSON(e)) : [], + cloudBucketMounts: globalThis.Array.isArray(object?.cloudBucketMounts) ? object.cloudBucketMounts.map((e) => CloudBucketMount.fromJSON(e)) : [], + volumeMounts: globalThis.Array.isArray(object?.volumeMounts) ? object.volumeMounts.map((e) => VolumeMount.fromJSON(e)) : [], + ptyInfo: isSet4(object.ptyInfo) ? PTYInfo.fromJSON(object.ptyInfo) : void 0, + schedulerPlacement: isSet4(object.schedulerPlacement) ? SchedulerPlacement.fromJSON(object.schedulerPlacement) : void 0, + workerId: isSet4(object.workerId) ? globalThis.String(object.workerId) : "", + openPorts: isSet4(object.openPorts) ? PortSpecs.fromJSON(object.openPorts) : void 0, + i6pnEnabled: isSet4(object.i6pnEnabled) ? globalThis.Boolean(object.i6pnEnabled) : false, + networkAccess: isSet4(object.networkAccess) ? NetworkAccess.fromJSON(object.networkAccess) : void 0, + proxyId: isSet4(object.proxyId) ? globalThis.String(object.proxyId) : void 0, + enableSnapshot: isSet4(object.enableSnapshot) ? globalThis.Boolean(object.enableSnapshot) : false, + snapshotVersion: isSet4(object.snapshotVersion) ? globalThis.Number(object.snapshotVersion) : void 0, + cloudProviderStr: isSet4(object.cloudProviderStr) ? globalThis.String(object.cloudProviderStr) : "", + runscRuntimeVersion: isSet4(object.runscRuntimeVersion) ? globalThis.String(object.runscRuntimeVersion) : void 0, + runtime: isSet4(object.runtime) ? globalThis.String(object.runtime) : void 0, + verbose: isSet4(object.verbose) ? globalThis.Boolean(object.verbose) : false, + name: isSet4(object.name) ? globalThis.String(object.name) : void 0, + experimentalOptions: isObject2(object.experimentalOptions) ? Object.entries(object.experimentalOptions).reduce((acc, [key, value]) => { + acc[key] = Boolean(value); + return acc; + }, {}) : {}, + preloadPathPrefixes: globalThis.Array.isArray(object?.preloadPathPrefixes) ? object.preloadPathPrefixes.map((e) => globalThis.String(e)) : [], + idleTimeoutSecs: isSet4(object.idleTimeoutSecs) ? globalThis.Number(object.idleTimeoutSecs) : void 0, + directSandboxCommandsEnabled: isSet4(object.directSandboxCommandsEnabled) ? globalThis.Boolean(object.directSandboxCommandsEnabled) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.entrypointArgs?.length) { + obj.entrypointArgs = message.entrypointArgs; + } + if (message.mountIds?.length) { + obj.mountIds = message.mountIds; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.secretIds?.length) { + obj.secretIds = message.secretIds; + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + if (message.timeoutSecs !== 0) { + obj.timeoutSecs = Math.round(message.timeoutSecs); + } + if (message.workdir !== void 0) { + obj.workdir = message.workdir; + } + if (message.nfsMounts?.length) { + obj.nfsMounts = message.nfsMounts.map((e) => SharedVolumeMount.toJSON(e)); + } + if (message.runtimeDebug !== false) { + obj.runtimeDebug = message.runtimeDebug; + } + if (message.blockNetwork !== false) { + obj.blockNetwork = message.blockNetwork; + } + if (message.s3Mounts?.length) { + obj.s3Mounts = message.s3Mounts.map((e) => S3Mount.toJSON(e)); + } + if (message.cloudBucketMounts?.length) { + obj.cloudBucketMounts = message.cloudBucketMounts.map((e) => CloudBucketMount.toJSON(e)); + } + if (message.volumeMounts?.length) { + obj.volumeMounts = message.volumeMounts.map((e) => VolumeMount.toJSON(e)); + } + if (message.ptyInfo !== void 0) { + obj.ptyInfo = PTYInfo.toJSON(message.ptyInfo); + } + if (message.schedulerPlacement !== void 0) { + obj.schedulerPlacement = SchedulerPlacement.toJSON(message.schedulerPlacement); + } + if (message.workerId !== "") { + obj.workerId = message.workerId; + } + if (message.openPorts !== void 0) { + obj.openPorts = PortSpecs.toJSON(message.openPorts); + } + if (message.i6pnEnabled !== false) { + obj.i6pnEnabled = message.i6pnEnabled; + } + if (message.networkAccess !== void 0) { + obj.networkAccess = NetworkAccess.toJSON(message.networkAccess); + } + if (message.proxyId !== void 0) { + obj.proxyId = message.proxyId; + } + if (message.enableSnapshot !== false) { + obj.enableSnapshot = message.enableSnapshot; + } + if (message.snapshotVersion !== void 0) { + obj.snapshotVersion = Math.round(message.snapshotVersion); + } + if (message.cloudProviderStr !== "") { + obj.cloudProviderStr = message.cloudProviderStr; + } + if (message.runscRuntimeVersion !== void 0) { + obj.runscRuntimeVersion = message.runscRuntimeVersion; + } + if (message.runtime !== void 0) { + obj.runtime = message.runtime; + } + if (message.verbose !== false) { + obj.verbose = message.verbose; + } + if (message.name !== void 0) { + obj.name = message.name; + } + if (message.experimentalOptions) { + const entries = Object.entries(message.experimentalOptions); + if (entries.length > 0) { + obj.experimentalOptions = {}; + entries.forEach(([k, v]) => { + obj.experimentalOptions[k] = v; + }); + } + } + if (message.preloadPathPrefixes?.length) { + obj.preloadPathPrefixes = message.preloadPathPrefixes; + } + if (message.idleTimeoutSecs !== void 0) { + obj.idleTimeoutSecs = Math.round(message.idleTimeoutSecs); + } + if (message.directSandboxCommandsEnabled !== false) { + obj.directSandboxCommandsEnabled = message.directSandboxCommandsEnabled; + } + return obj; + }, + create(base) { + return Sandbox.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandbox(); + message.entrypointArgs = object.entrypointArgs?.map((e) => e) || []; + message.mountIds = object.mountIds?.map((e) => e) || []; + message.imageId = object.imageId ?? ""; + message.secretIds = object.secretIds?.map((e) => e) || []; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.cloudProvider = object.cloudProvider ?? 0; + message.timeoutSecs = object.timeoutSecs ?? 0; + message.workdir = object.workdir ?? void 0; + message.nfsMounts = object.nfsMounts?.map((e) => SharedVolumeMount.fromPartial(e)) || []; + message.runtimeDebug = object.runtimeDebug ?? false; + message.blockNetwork = object.blockNetwork ?? false; + message.s3Mounts = object.s3Mounts?.map((e) => S3Mount.fromPartial(e)) || []; + message.cloudBucketMounts = object.cloudBucketMounts?.map((e) => CloudBucketMount.fromPartial(e)) || []; + message.volumeMounts = object.volumeMounts?.map((e) => VolumeMount.fromPartial(e)) || []; + message.ptyInfo = object.ptyInfo !== void 0 && object.ptyInfo !== null ? PTYInfo.fromPartial(object.ptyInfo) : void 0; + message.schedulerPlacement = object.schedulerPlacement !== void 0 && object.schedulerPlacement !== null ? SchedulerPlacement.fromPartial(object.schedulerPlacement) : void 0; + message.workerId = object.workerId ?? ""; + message.openPorts = object.openPorts !== void 0 && object.openPorts !== null ? PortSpecs.fromPartial(object.openPorts) : void 0; + message.i6pnEnabled = object.i6pnEnabled ?? false; + message.networkAccess = object.networkAccess !== void 0 && object.networkAccess !== null ? NetworkAccess.fromPartial(object.networkAccess) : void 0; + message.proxyId = object.proxyId ?? void 0; + message.enableSnapshot = object.enableSnapshot ?? false; + message.snapshotVersion = object.snapshotVersion ?? void 0; + message.cloudProviderStr = object.cloudProviderStr ?? ""; + message.runscRuntimeVersion = object.runscRuntimeVersion ?? void 0; + message.runtime = object.runtime ?? void 0; + message.verbose = object.verbose ?? false; + message.name = object.name ?? void 0; + message.experimentalOptions = Object.entries(object.experimentalOptions ?? {}).reduce( + (acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.Boolean(value); + } + return acc; + }, + {} + ); + message.preloadPathPrefixes = object.preloadPathPrefixes?.map((e) => e) || []; + message.idleTimeoutSecs = object.idleTimeoutSecs ?? void 0; + message.directSandboxCommandsEnabled = object.directSandboxCommandsEnabled ?? false; + return message; + } +}; +function createBaseSandbox_ExperimentalOptionsEntry() { + return { key: "", value: false }; +} +var Sandbox_ExperimentalOptionsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== false) { + writer.uint32(16).bool(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandbox_ExperimentalOptionsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.value = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.Boolean(object.value) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== false) { + obj.value = message.value; + } + return obj; + }, + create(base) { + return Sandbox_ExperimentalOptionsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandbox_ExperimentalOptionsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? false; + return message; + } +}; +function createBaseSandboxCreateConnectTokenRequest() { + return { sandboxId: "", userMetadata: "" }; +} +var SandboxCreateConnectTokenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.userMetadata !== "") { + writer.uint32(18).string(message.userMetadata); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateConnectTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.userMetadata = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + userMetadata: isSet4(object.userMetadata) ? globalThis.String(object.userMetadata) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.userMetadata !== "") { + obj.userMetadata = message.userMetadata; + } + return obj; + }, + create(base) { + return SandboxCreateConnectTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateConnectTokenRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.userMetadata = object.userMetadata ?? ""; + return message; + } +}; +function createBaseSandboxCreateConnectTokenResponse() { + return { url: "", token: "" }; +} +var SandboxCreateConnectTokenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + if (message.token !== "") { + writer.uint32(18).string(message.token); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateConnectTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.url = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + url: isSet4(object.url) ? globalThis.String(object.url) : "", + token: isSet4(object.token) ? globalThis.String(object.token) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.url !== "") { + obj.url = message.url; + } + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + create(base) { + return SandboxCreateConnectTokenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateConnectTokenResponse(); + message.url = object.url ?? ""; + message.token = object.token ?? ""; + return message; + } +}; +function createBaseSandboxCreateRequest() { + return { appId: "", definition: void 0, environmentName: "" }; +} +var SandboxCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.definition !== void 0) { + Sandbox.encode(message.definition, writer.uint32(18).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.definition = Sandbox.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + definition: isSet4(object.definition) ? Sandbox.fromJSON(object.definition) : void 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.definition !== void 0) { + obj.definition = Sandbox.toJSON(message.definition); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SandboxCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateRequest(); + message.appId = object.appId ?? ""; + message.definition = object.definition !== void 0 && object.definition !== null ? Sandbox.fromPartial(object.definition) : void 0; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSandboxCreateResponse() { + return { sandboxId: "" }; +} +var SandboxCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxCreateResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetCommandRouterAccessRequest() { + return { sandboxId: "" }; +} +var SandboxGetCommandRouterAccessRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetCommandRouterAccessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetCommandRouterAccessRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetCommandRouterAccessRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetCommandRouterAccessResponse() { + return { jwt: "", url: "" }; +} +var SandboxGetCommandRouterAccessResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.jwt !== "") { + writer.uint32(10).string(message.jwt); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetCommandRouterAccessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.jwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + jwt: isSet4(object.jwt) ? globalThis.String(object.jwt) : "", + url: isSet4(object.url) ? globalThis.String(object.url) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.jwt !== "") { + obj.jwt = message.jwt; + } + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return SandboxGetCommandRouterAccessResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetCommandRouterAccessResponse(); + message.jwt = object.jwt ?? ""; + message.url = object.url ?? ""; + return message; + } +}; +function createBaseSandboxGetFromNameRequest() { + return { sandboxName: "", environmentName: "", appName: "" }; +} +var SandboxGetFromNameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxName !== "") { + writer.uint32(10).string(message.sandboxName); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + if (message.appName !== "") { + writer.uint32(26).string(message.appName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetFromNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxName: isSet4(object.sandboxName) ? globalThis.String(object.sandboxName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + appName: isSet4(object.appName) ? globalThis.String(object.appName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxName !== "") { + obj.sandboxName = message.sandboxName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.appName !== "") { + obj.appName = message.appName; + } + return obj; + }, + create(base) { + return SandboxGetFromNameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetFromNameRequest(); + message.sandboxName = object.sandboxName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.appName = object.appName ?? ""; + return message; + } +}; +function createBaseSandboxGetFromNameResponse() { + return { sandboxId: "" }; +} +var SandboxGetFromNameResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetFromNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetFromNameResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetFromNameResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetLogsRequest() { + return { sandboxId: "", fileDescriptor: 0, timeout: 0, lastEntryId: "" }; +} +var SandboxGetLogsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.fileDescriptor !== 0) { + writer.uint32(16).int32(message.fileDescriptor); + } + if (message.timeout !== 0) { + writer.uint32(29).float(message.timeout); + } + if (message.lastEntryId !== "") { + writer.uint32(34).string(message.lastEntryId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetLogsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + message.timeout = reader.float(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.lastEntryId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + lastEntryId: isSet4(object.lastEntryId) ? globalThis.String(object.lastEntryId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.lastEntryId !== "") { + obj.lastEntryId = message.lastEntryId; + } + return obj; + }, + create(base) { + return SandboxGetLogsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetLogsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.timeout = object.timeout ?? 0; + message.lastEntryId = object.lastEntryId ?? ""; + return message; + } +}; +function createBaseSandboxGetResourceUsageRequest() { + return { sandboxId: "" }; +} +var SandboxGetResourceUsageRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetResourceUsageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxGetResourceUsageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetResourceUsageRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxGetResourceUsageResponse() { + return { cpuCoreNanosecs: 0, memGibNanosecs: 0, gpuNanosecs: 0, gpuType: void 0 }; +} +var SandboxGetResourceUsageResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.cpuCoreNanosecs !== 0) { + writer.uint32(8).uint64(message.cpuCoreNanosecs); + } + if (message.memGibNanosecs !== 0) { + writer.uint32(16).uint64(message.memGibNanosecs); + } + if (message.gpuNanosecs !== 0) { + writer.uint32(24).uint64(message.gpuNanosecs); + } + if (message.gpuType !== void 0) { + writer.uint32(34).string(message.gpuType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetResourceUsageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.cpuCoreNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.memGibNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.gpuNanosecs = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.gpuType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cpuCoreNanosecs: isSet4(object.cpuCoreNanosecs) ? globalThis.Number(object.cpuCoreNanosecs) : 0, + memGibNanosecs: isSet4(object.memGibNanosecs) ? globalThis.Number(object.memGibNanosecs) : 0, + gpuNanosecs: isSet4(object.gpuNanosecs) ? globalThis.Number(object.gpuNanosecs) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cpuCoreNanosecs !== 0) { + obj.cpuCoreNanosecs = Math.round(message.cpuCoreNanosecs); + } + if (message.memGibNanosecs !== 0) { + obj.memGibNanosecs = Math.round(message.memGibNanosecs); + } + if (message.gpuNanosecs !== 0) { + obj.gpuNanosecs = Math.round(message.gpuNanosecs); + } + if (message.gpuType !== void 0) { + obj.gpuType = message.gpuType; + } + return obj; + }, + create(base) { + return SandboxGetResourceUsageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetResourceUsageResponse(); + message.cpuCoreNanosecs = object.cpuCoreNanosecs ?? 0; + message.memGibNanosecs = object.memGibNanosecs ?? 0; + message.gpuNanosecs = object.gpuNanosecs ?? 0; + message.gpuType = object.gpuType ?? void 0; + return message; + } +}; +function createBaseSandboxGetTaskIdRequest() { + return { sandboxId: "", timeout: void 0, waitUntilReady: false }; +} +var SandboxGetTaskIdRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== void 0) { + writer.uint32(21).float(message.timeout); + } + if (message.waitUntilReady !== false) { + writer.uint32(24).bool(message.waitUntilReady); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTaskIdRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.waitUntilReady = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : void 0, + waitUntilReady: isSet4(object.waitUntilReady) ? globalThis.Boolean(object.waitUntilReady) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== void 0) { + obj.timeout = message.timeout; + } + if (message.waitUntilReady !== false) { + obj.waitUntilReady = message.waitUntilReady; + } + return obj; + }, + create(base) { + return SandboxGetTaskIdRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTaskIdRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? void 0; + message.waitUntilReady = object.waitUntilReady ?? false; + return message; + } +}; +function createBaseSandboxGetTaskIdResponse() { + return { taskId: void 0, taskResult: void 0 }; +} +var SandboxGetTaskIdResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== void 0) { + writer.uint32(10).string(message.taskId); + } + if (message.taskResult !== void 0) { + GenericResult.encode(message.taskResult, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTaskIdResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.taskResult = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : void 0, + taskResult: isSet4(object.taskResult) ? GenericResult.fromJSON(object.taskResult) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== void 0) { + obj.taskId = message.taskId; + } + if (message.taskResult !== void 0) { + obj.taskResult = GenericResult.toJSON(message.taskResult); + } + return obj; + }, + create(base) { + return SandboxGetTaskIdResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTaskIdResponse(); + message.taskId = object.taskId ?? void 0; + message.taskResult = object.taskResult !== void 0 && object.taskResult !== null ? GenericResult.fromPartial(object.taskResult) : void 0; + return message; + } +}; +function createBaseSandboxGetTunnelsRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxGetTunnelsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTunnelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxGetTunnelsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTunnelsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxGetTunnelsResponse() { + return { result: void 0, tunnels: [] }; +} +var SandboxGetTunnelsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + for (const v of message.tunnels) { + TunnelData.encode(v, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxGetTunnelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tunnels.push(TunnelData.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + tunnels: globalThis.Array.isArray(object?.tunnels) ? object.tunnels.map((e) => TunnelData.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.tunnels?.length) { + obj.tunnels = message.tunnels.map((e) => TunnelData.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxGetTunnelsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxGetTunnelsResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.tunnels = object.tunnels?.map((e) => TunnelData.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxHandleMetadata() { + return { result: void 0 }; +} +var SandboxHandleMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxHandleMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxHandleMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxHandleMetadata(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSandboxInfo() { + return { id: "", createdAt: 0, taskInfo: void 0, appId: "", tags: [], name: "" }; +} +var SandboxInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.taskInfo !== void 0) { + TaskInfo.encode(message.taskInfo, writer.uint32(34).fork()).join(); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(50).fork()).join(); + } + if (message.name !== "") { + writer.uint32(58).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.taskInfo = TaskInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet4(object.id) ? globalThis.String(object.id) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + taskInfo: isSet4(object.taskInfo) ? TaskInfo.fromJSON(object.taskInfo) : void 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [], + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.taskInfo !== void 0) { + obj.taskInfo = TaskInfo.toJSON(message.taskInfo); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return SandboxInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxInfo(); + message.id = object.id ?? ""; + message.createdAt = object.createdAt ?? 0; + message.taskInfo = object.taskInfo !== void 0 && object.taskInfo !== null ? TaskInfo.fromPartial(object.taskInfo) : void 0; + message.appId = object.appId ?? ""; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseSandboxListRequest() { + return { appId: "", beforeTimestamp: 0, environmentName: "", includeFinished: false, tags: [] }; +} +var SandboxListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.appId !== "") { + writer.uint32(10).string(message.appId); + } + if (message.beforeTimestamp !== 0) { + writer.uint32(17).double(message.beforeTimestamp); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.includeFinished !== false) { + writer.uint32(32).bool(message.includeFinished); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.appId = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.beforeTimestamp = reader.double(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.includeFinished = reader.bool(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + beforeTimestamp: isSet4(object.beforeTimestamp) ? globalThis.Number(object.beforeTimestamp) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + includeFinished: isSet4(object.includeFinished) ? globalThis.Boolean(object.includeFinished) : false, + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.beforeTimestamp !== 0) { + obj.beforeTimestamp = message.beforeTimestamp; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.includeFinished !== false) { + obj.includeFinished = message.includeFinished; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxListRequest(); + message.appId = object.appId ?? ""; + message.beforeTimestamp = object.beforeTimestamp ?? 0; + message.environmentName = object.environmentName ?? ""; + message.includeFinished = object.includeFinished ?? false; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxListResponse() { + return { sandboxes: [] }; +} +var SandboxListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.sandboxes) { + SandboxInfo.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxes.push(SandboxInfo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxes: globalThis.Array.isArray(object?.sandboxes) ? object.sandboxes.map((e) => SandboxInfo.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxes?.length) { + obj.sandboxes = message.sandboxes.map((e) => SandboxInfo.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxListResponse(); + message.sandboxes = object.sandboxes?.map((e) => SandboxInfo.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxRestoreRequest() { + return { snapshotId: "", sandboxNameOverride: "", sandboxNameOverrideType: 0 }; +} +var SandboxRestoreRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + if (message.sandboxNameOverride !== "") { + writer.uint32(18).string(message.sandboxNameOverride); + } + if (message.sandboxNameOverrideType !== 0) { + writer.uint32(24).int32(message.sandboxNameOverrideType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxRestoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sandboxNameOverride = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sandboxNameOverrideType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "", + sandboxNameOverride: isSet4(object.sandboxNameOverride) ? globalThis.String(object.sandboxNameOverride) : "", + sandboxNameOverrideType: isSet4(object.sandboxNameOverrideType) ? sandboxRestoreRequest_SandboxNameOverrideTypeFromJSON(object.sandboxNameOverrideType) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + if (message.sandboxNameOverride !== "") { + obj.sandboxNameOverride = message.sandboxNameOverride; + } + if (message.sandboxNameOverrideType !== 0) { + obj.sandboxNameOverrideType = sandboxRestoreRequest_SandboxNameOverrideTypeToJSON( + message.sandboxNameOverrideType + ); + } + return obj; + }, + create(base) { + return SandboxRestoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxRestoreRequest(); + message.snapshotId = object.snapshotId ?? ""; + message.sandboxNameOverride = object.sandboxNameOverride ?? ""; + message.sandboxNameOverrideType = object.sandboxNameOverrideType ?? 0; + return message; + } +}; +function createBaseSandboxRestoreResponse() { + return { sandboxId: "" }; +} +var SandboxRestoreResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxRestoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxRestoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxRestoreResponse(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncGetRequest() { + return { imageId: "", timeout: 0 }; +} +var SandboxSnapshotFsAsyncGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncGetRequest(); + message.imageId = object.imageId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncRequest() { + return { sandboxId: "" }; +} +var SandboxSnapshotFsAsyncRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsAsyncResponse() { + return { imageId: "" }; +} +var SandboxSnapshotFsAsyncResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsAsyncResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsAsyncResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsAsyncResponse(); + message.imageId = object.imageId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotFsRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxSnapshotFsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotFsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotFsResponse() { + return { imageId: "", result: void 0, imageMetadata: void 0 }; +} +var SandboxSnapshotFsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.imageId !== "") { + writer.uint32(10).string(message.imageId); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + if (message.imageMetadata !== void 0) { + ImageMetadata.encode(message.imageMetadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotFsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.imageId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.imageMetadata = ImageMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + imageMetadata: isSet4(object.imageMetadata) ? ImageMetadata.fromJSON(object.imageMetadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.imageMetadata !== void 0) { + obj.imageMetadata = ImageMetadata.toJSON(message.imageMetadata); + } + return obj; + }, + create(base) { + return SandboxSnapshotFsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotFsResponse(); + message.imageId = object.imageId ?? ""; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.imageMetadata = object.imageMetadata !== void 0 && object.imageMetadata !== null ? ImageMetadata.fromPartial(object.imageMetadata) : void 0; + return message; + } +}; +function createBaseSandboxSnapshotGetRequest() { + return { snapshotId: "" }; +} +var SandboxSnapshotGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotGetRequest(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotGetResponse() { + return { snapshotId: "" }; +} +var SandboxSnapshotGetResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotGetResponse(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotRequest() { + return { sandboxId: "" }; +} +var SandboxSnapshotRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxSnapshotRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotResponse() { + return { snapshotId: "" }; +} +var SandboxSnapshotResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + return obj; + }, + create(base) { + return SandboxSnapshotResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotResponse(); + message.snapshotId = object.snapshotId ?? ""; + return message; + } +}; +function createBaseSandboxSnapshotWaitRequest() { + return { snapshotId: "", timeout: 0 }; +} +var SandboxSnapshotWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.snapshotId !== "") { + writer.uint32(10).string(message.snapshotId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.snapshotId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshotId: isSet4(object.snapshotId) ? globalThis.String(object.snapshotId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshotId !== "") { + obj.snapshotId = message.snapshotId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxSnapshotWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotWaitRequest(); + message.snapshotId = object.snapshotId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxSnapshotWaitResponse() { + return { result: void 0 }; +} +var SandboxSnapshotWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxSnapshotWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxSnapshotWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxSnapshotWaitResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSandboxStdinWriteRequest() { + return { sandboxId: "", input: new Uint8Array(0), index: 0, eof: false }; +} +var SandboxStdinWriteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.input.length !== 0) { + writer.uint32(18).bytes(message.input); + } + if (message.index !== 0) { + writer.uint32(24).uint32(message.index); + } + if (message.eof !== false) { + writer.uint32(32).bool(message.eof); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxStdinWriteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.input = reader.bytes(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.index = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.eof = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + input: isSet4(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0), + index: isSet4(object.index) ? globalThis.Number(object.index) : 0, + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.input.length !== 0) { + obj.input = base64FromBytes(message.input); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.eof !== false) { + obj.eof = message.eof; + } + return obj; + }, + create(base) { + return SandboxStdinWriteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxStdinWriteRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.input = object.input ?? new Uint8Array(0); + message.index = object.index ?? 0; + message.eof = object.eof ?? false; + return message; + } +}; +function createBaseSandboxStdinWriteResponse() { + return {}; +} +var SandboxStdinWriteResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxStdinWriteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return SandboxStdinWriteResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseSandboxStdinWriteResponse(); + return message; + } +}; +function createBaseSandboxTag() { + return { tagName: "", tagValue: "" }; +} +var SandboxTag = { + encode(message, writer = new BinaryWriter()) { + if (message.tagName !== "") { + writer.uint32(10).string(message.tagName); + } + if (message.tagValue !== "") { + writer.uint32(18).string(message.tagValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTag(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tagName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tagValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tagName: isSet4(object.tagName) ? globalThis.String(object.tagName) : "", + tagValue: isSet4(object.tagValue) ? globalThis.String(object.tagValue) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tagName !== "") { + obj.tagName = message.tagName; + } + if (message.tagValue !== "") { + obj.tagValue = message.tagValue; + } + return obj; + }, + create(base) { + return SandboxTag.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTag(); + message.tagName = object.tagName ?? ""; + message.tagValue = object.tagValue ?? ""; + return message; + } +}; +function createBaseSandboxTagsGetRequest() { + return { sandboxId: "" }; +} +var SandboxTagsGetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxTagsGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsGetRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxTagsGetResponse() { + return { tags: [] }; +} +var SandboxTagsGetResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxTagsGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsGetResponse(); + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxTagsSetRequest() { + return { environmentName: "", sandboxId: "", tags: [] }; +} +var SandboxTagsSetRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.sandboxId !== "") { + writer.uint32(18).string(message.sandboxId); + } + for (const v of message.tags) { + SandboxTag.encode(v, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTagsSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.tags.push(SandboxTag.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => SandboxTag.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.tags?.length) { + obj.tags = message.tags.map((e) => SandboxTag.toJSON(e)); + } + return obj; + }, + create(base) { + return SandboxTagsSetRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTagsSetRequest(); + message.environmentName = object.environmentName ?? ""; + message.sandboxId = object.sandboxId ?? ""; + message.tags = object.tags?.map((e) => SandboxTag.fromPartial(e)) || []; + return message; + } +}; +function createBaseSandboxTerminateRequest() { + return { sandboxId: "" }; +} +var SandboxTerminateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTerminateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + return obj; + }, + create(base) { + return SandboxTerminateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTerminateRequest(); + message.sandboxId = object.sandboxId ?? ""; + return message; + } +}; +function createBaseSandboxTerminateResponse() { + return { existingResult: void 0 }; +} +var SandboxTerminateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.existingResult !== void 0) { + GenericResult.encode(message.existingResult, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxTerminateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.existingResult = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { existingResult: isSet4(object.existingResult) ? GenericResult.fromJSON(object.existingResult) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.existingResult !== void 0) { + obj.existingResult = GenericResult.toJSON(message.existingResult); + } + return obj; + }, + create(base) { + return SandboxTerminateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxTerminateResponse(); + message.existingResult = object.existingResult !== void 0 && object.existingResult !== null ? GenericResult.fromPartial(object.existingResult) : void 0; + return message; + } +}; +function createBaseSandboxWaitRequest() { + return { sandboxId: "", timeout: 0 }; +} +var SandboxWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sandboxId !== "") { + writer.uint32(10).string(message.sandboxId); + } + if (message.timeout !== 0) { + writer.uint32(21).float(message.timeout); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + message.timeout = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + return obj; + }, + create(base) { + return SandboxWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxWaitRequest(); + message.sandboxId = object.sandboxId ?? ""; + message.timeout = object.timeout ?? 0; + return message; + } +}; +function createBaseSandboxWaitResponse() { + return { result: void 0 }; +} +var SandboxWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSandboxWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return SandboxWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSandboxWaitResponse(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseSchedule() { + return { cron: void 0, period: void 0 }; +} +var Schedule = { + encode(message, writer = new BinaryWriter()) { + if (message.cron !== void 0) { + Schedule_Cron.encode(message.cron, writer.uint32(10).fork()).join(); + } + if (message.period !== void 0) { + Schedule_Period.encode(message.period, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cron = Schedule_Cron.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.period = Schedule_Period.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cron: isSet4(object.cron) ? Schedule_Cron.fromJSON(object.cron) : void 0, + period: isSet4(object.period) ? Schedule_Period.fromJSON(object.period) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.cron !== void 0) { + obj.cron = Schedule_Cron.toJSON(message.cron); + } + if (message.period !== void 0) { + obj.period = Schedule_Period.toJSON(message.period); + } + return obj; + }, + create(base) { + return Schedule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule(); + message.cron = object.cron !== void 0 && object.cron !== null ? Schedule_Cron.fromPartial(object.cron) : void 0; + message.period = object.period !== void 0 && object.period !== null ? Schedule_Period.fromPartial(object.period) : void 0; + return message; + } +}; +function createBaseSchedule_Cron() { + return { cronString: "", timezone: "" }; +} +var Schedule_Cron = { + encode(message, writer = new BinaryWriter()) { + if (message.cronString !== "") { + writer.uint32(10).string(message.cronString); + } + if (message.timezone !== "") { + writer.uint32(18).string(message.timezone); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule_Cron(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.cronString = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.timezone = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + cronString: isSet4(object.cronString) ? globalThis.String(object.cronString) : "", + timezone: isSet4(object.timezone) ? globalThis.String(object.timezone) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.cronString !== "") { + obj.cronString = message.cronString; + } + if (message.timezone !== "") { + obj.timezone = message.timezone; + } + return obj; + }, + create(base) { + return Schedule_Cron.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule_Cron(); + message.cronString = object.cronString ?? ""; + message.timezone = object.timezone ?? ""; + return message; + } +}; +function createBaseSchedule_Period() { + return { years: 0, months: 0, weeks: 0, days: 0, hours: 0, minutes: 0, seconds: 0 }; +} +var Schedule_Period = { + encode(message, writer = new BinaryWriter()) { + if (message.years !== 0) { + writer.uint32(8).int32(message.years); + } + if (message.months !== 0) { + writer.uint32(16).int32(message.months); + } + if (message.weeks !== 0) { + writer.uint32(24).int32(message.weeks); + } + if (message.days !== 0) { + writer.uint32(32).int32(message.days); + } + if (message.hours !== 0) { + writer.uint32(40).int32(message.hours); + } + if (message.minutes !== 0) { + writer.uint32(48).int32(message.minutes); + } + if (message.seconds !== 0) { + writer.uint32(61).float(message.seconds); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedule_Period(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.years = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.months = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.weeks = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.days = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.hours = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.minutes = reader.int32(); + continue; + } + case 7: { + if (tag !== 61) { + break; + } + message.seconds = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + years: isSet4(object.years) ? globalThis.Number(object.years) : 0, + months: isSet4(object.months) ? globalThis.Number(object.months) : 0, + weeks: isSet4(object.weeks) ? globalThis.Number(object.weeks) : 0, + days: isSet4(object.days) ? globalThis.Number(object.days) : 0, + hours: isSet4(object.hours) ? globalThis.Number(object.hours) : 0, + minutes: isSet4(object.minutes) ? globalThis.Number(object.minutes) : 0, + seconds: isSet4(object.seconds) ? globalThis.Number(object.seconds) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.years !== 0) { + obj.years = Math.round(message.years); + } + if (message.months !== 0) { + obj.months = Math.round(message.months); + } + if (message.weeks !== 0) { + obj.weeks = Math.round(message.weeks); + } + if (message.days !== 0) { + obj.days = Math.round(message.days); + } + if (message.hours !== 0) { + obj.hours = Math.round(message.hours); + } + if (message.minutes !== 0) { + obj.minutes = Math.round(message.minutes); + } + if (message.seconds !== 0) { + obj.seconds = message.seconds; + } + return obj; + }, + create(base) { + return Schedule_Period.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedule_Period(); + message.years = object.years ?? 0; + message.months = object.months ?? 0; + message.weeks = object.weeks ?? 0; + message.days = object.days ?? 0; + message.hours = object.hours ?? 0; + message.minutes = object.minutes ?? 0; + message.seconds = object.seconds ?? 0; + return message; + } +}; +function createBaseSchedulerPlacement() { + return { regions: [], Zone: void 0, Lifecycle: void 0, InstanceTypes: [] }; +} +var SchedulerPlacement = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.regions) { + writer.uint32(34).string(v); + } + if (message.Zone !== void 0) { + writer.uint32(18).string(message.Zone); + } + if (message.Lifecycle !== void 0) { + writer.uint32(26).string(message.Lifecycle); + } + for (const v of message.InstanceTypes) { + writer.uint32(42).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSchedulerPlacement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + if (tag !== 34) { + break; + } + message.regions.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.Zone = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.Lifecycle = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.InstanceTypes.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + regions: globalThis.Array.isArray(object?.regions) ? object.regions.map((e) => globalThis.String(e)) : [], + Zone: isSet4(object.Zone) ? globalThis.String(object.Zone) : void 0, + Lifecycle: isSet4(object.Lifecycle) ? globalThis.String(object.Lifecycle) : void 0, + InstanceTypes: globalThis.Array.isArray(object?.InstanceTypes) ? object.InstanceTypes.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.regions?.length) { + obj.regions = message.regions; + } + if (message.Zone !== void 0) { + obj.Zone = message.Zone; + } + if (message.Lifecycle !== void 0) { + obj.Lifecycle = message.Lifecycle; + } + if (message.InstanceTypes?.length) { + obj.InstanceTypes = message.InstanceTypes; + } + return obj; + }, + create(base) { + return SchedulerPlacement.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSchedulerPlacement(); + message.regions = object.regions?.map((e) => e) || []; + message.Zone = object.Zone ?? void 0; + message.Lifecycle = object.Lifecycle ?? void 0; + message.InstanceTypes = object.InstanceTypes?.map((e) => e) || []; + return message; + } +}; +function createBaseSecretDeleteRequest() { + return { secretId: "" }; +} +var SecretDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.secretId !== "") { + writer.uint32(10).string(message.secretId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + return obj; + }, + create(base) { + return SecretDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretDeleteRequest(); + message.secretId = object.secretId ?? ""; + return message; + } +}; +function createBaseSecretGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, envDict: {}, appId: "", requiredKeys: [] }; +} +var SecretGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + Object.entries(message.envDict).forEach(([key, value]) => { + SecretGetOrCreateRequest_EnvDictEntry.encode({ key, value }, writer.uint32(42).fork()).join(); + }); + if (message.appId !== "") { + writer.uint32(50).string(message.appId); + } + for (const v of message.requiredKeys) { + writer.uint32(58).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + const entry5 = SecretGetOrCreateRequest_EnvDictEntry.decode(reader, reader.uint32()); + if (entry5.value !== void 0) { + message.envDict[entry5.key] = entry5.value; + } + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.appId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.requiredKeys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + envDict: isObject2(object.envDict) ? Object.entries(object.envDict).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {}, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + requiredKeys: globalThis.Array.isArray(object?.requiredKeys) ? object.requiredKeys.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.envDict) { + const entries = Object.entries(message.envDict); + if (entries.length > 0) { + obj.envDict = {}; + entries.forEach(([k, v]) => { + obj.envDict[k] = v; + }); + } + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.requiredKeys?.length) { + obj.requiredKeys = message.requiredKeys; + } + return obj; + }, + create(base) { + return SecretGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.envDict = Object.entries(object.envDict ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + message.appId = object.appId ?? ""; + message.requiredKeys = object.requiredKeys?.map((e) => e) || []; + return message; + } +}; +function createBaseSecretGetOrCreateRequest_EnvDictEntry() { + return { key: "", value: "" }; +} +var SecretGetOrCreateRequest_EnvDictEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateRequest_EnvDictEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return SecretGetOrCreateRequest_EnvDictEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateRequest_EnvDictEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseSecretGetOrCreateResponse() { + return { secretId: "", metadata: void 0 }; +} +var SecretGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.secretId !== "") { + writer.uint32(10).string(message.secretId); + } + if (message.metadata !== void 0) { + SecretMetadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.secretId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.metadata = SecretMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "", + metadata: isSet4(object.metadata) ? SecretMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + if (message.metadata !== void 0) { + obj.metadata = SecretMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return SecretGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretGetOrCreateResponse(); + message.secretId = object.secretId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? SecretMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseSecretListItem() { + return { label: "", createdAt: 0, lastUsedAt: 0, environmentName: "", secretId: "", metadata: void 0 }; +} +var SecretListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.createdAt !== 0) { + writer.uint32(17).double(message.createdAt); + } + if (message.lastUsedAt !== 0) { + writer.uint32(25).double(message.lastUsedAt); + } + if (message.environmentName !== "") { + writer.uint32(34).string(message.environmentName); + } + if (message.secretId !== "") { + writer.uint32(42).string(message.secretId); + } + if (message.metadata !== void 0) { + SecretMetadata.encode(message.metadata, writer.uint32(50).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.lastUsedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.secretId = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.metadata = SecretMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + lastUsedAt: isSet4(object.lastUsedAt) ? globalThis.Number(object.lastUsedAt) : 0, + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + secretId: isSet4(object.secretId) ? globalThis.String(object.secretId) : "", + metadata: isSet4(object.metadata) ? SecretMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.lastUsedAt !== 0) { + obj.lastUsedAt = message.lastUsedAt; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.secretId !== "") { + obj.secretId = message.secretId; + } + if (message.metadata !== void 0) { + obj.metadata = SecretMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return SecretListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListItem(); + message.label = object.label ?? ""; + message.createdAt = object.createdAt ?? 0; + message.lastUsedAt = object.lastUsedAt ?? 0; + message.environmentName = object.environmentName ?? ""; + message.secretId = object.secretId ?? ""; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? SecretMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseSecretListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var SecretListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return SecretListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseSecretListResponse() { + return { items: [], environmentName: "" }; +} +var SecretListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + SecretListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(SecretListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => SecretListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => SecretListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SecretListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretListResponse(); + message.items = object.items?.map((e) => SecretListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSecretMetadata() { + return { name: "", creationInfo: void 0 }; +} +var SecretMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSecretMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return SecretMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSecretMetadata(); + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseSharedVolumeDeleteRequest() { + return { sharedVolumeId: "" }; +} +var SharedVolumeDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeDeleteRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetFileRequest() { + return { sharedVolumeId: "", path: "" }; +} +var SharedVolumeGetFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return SharedVolumeGetFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetFileResponse() { + return { data: void 0, dataBlobId: void 0 }; +} +var SharedVolumeGetFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + writer.uint32(10).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(18).string(message.dataBlobId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + return obj; + }, + create(base) { + return SharedVolumeGetFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetFileResponse(); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + return message; + } +}; +function createBaseSharedVolumeGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, appId: "" }; +} +var SharedVolumeGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + return obj; + }, + create(base) { + return SharedVolumeGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.appId = object.appId ?? ""; + return message; + } +}; +function createBaseSharedVolumeGetOrCreateResponse() { + return { sharedVolumeId: "" }; +} +var SharedVolumeGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeGetOrCreateResponse(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeHeartbeatRequest() { + return { sharedVolumeId: "" }; +} +var SharedVolumeHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + return obj; + }, + create(base) { + return SharedVolumeHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeHeartbeatRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + return message; + } +}; +function createBaseSharedVolumeListFilesRequest() { + return { sharedVolumeId: "", path: "" }; +} +var SharedVolumeListFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return SharedVolumeListFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListFilesRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + return message; + } +}; +function createBaseSharedVolumeListFilesResponse() { + return { entries: [] }; +} +var SharedVolumeListFilesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return SharedVolumeListFilesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListFilesResponse(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseSharedVolumeListItem() { + return { label: "", sharedVolumeId: "", createdAt: 0, cloudProvider: 0 }; +} +var SharedVolumeListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.sharedVolumeId !== "") { + writer.uint32(18).string(message.sharedVolumeId); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.cloudProvider !== 0) { + writer.uint32(32).int32(message.cloudProvider); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + return obj; + }, + create(base) { + return SharedVolumeListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListItem(); + message.label = object.label ?? ""; + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.createdAt = object.createdAt ?? 0; + message.cloudProvider = object.cloudProvider ?? 0; + return message; + } +}; +function createBaseSharedVolumeListRequest() { + return { environmentName: "" }; +} +var SharedVolumeListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SharedVolumeListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSharedVolumeListResponse() { + return { items: [], environmentName: "" }; +} +var SharedVolumeListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + SharedVolumeListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(SharedVolumeListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => SharedVolumeListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => SharedVolumeListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return SharedVolumeListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeListResponse(); + message.items = object.items?.map((e) => SharedVolumeListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseSharedVolumeMount() { + return { mountPath: "", sharedVolumeId: "", cloudProvider: 0 }; +} +var SharedVolumeMount = { + encode(message, writer = new BinaryWriter()) { + if (message.mountPath !== "") { + writer.uint32(10).string(message.mountPath); + } + if (message.sharedVolumeId !== "") { + writer.uint32(18).string(message.sharedVolumeId); + } + if (message.cloudProvider !== 0) { + writer.uint32(24).int32(message.cloudProvider); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.cloudProvider = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + cloudProvider: isSet4(object.cloudProvider) ? cloudProviderFromJSON(object.cloudProvider) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.cloudProvider !== 0) { + obj.cloudProvider = cloudProviderToJSON(message.cloudProvider); + } + return obj; + }, + create(base) { + return SharedVolumeMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeMount(); + message.mountPath = object.mountPath ?? ""; + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.cloudProvider = object.cloudProvider ?? 0; + return message; + } +}; +function createBaseSharedVolumePutFileRequest() { + return { sharedVolumeId: "", path: "", sha256Hex: "", data: void 0, dataBlobId: void 0, resumable: false }; +} +var SharedVolumePutFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.sha256Hex !== "") { + writer.uint32(26).string(message.sha256Hex); + } + if (message.data !== void 0) { + writer.uint32(34).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(42).string(message.dataBlobId); + } + if (message.resumable !== false) { + writer.uint32(48).bool(message.resumable); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumePutFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sha256Hex = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.data = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.resumable = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + sha256Hex: isSet4(object.sha256Hex) ? globalThis.String(object.sha256Hex) : "", + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + resumable: isSet4(object.resumable) ? globalThis.Boolean(object.resumable) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.sha256Hex !== "") { + obj.sha256Hex = message.sha256Hex; + } + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.resumable !== false) { + obj.resumable = message.resumable; + } + return obj; + }, + create(base) { + return SharedVolumePutFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumePutFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + message.sha256Hex = object.sha256Hex ?? ""; + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.resumable = object.resumable ?? false; + return message; + } +}; +function createBaseSharedVolumePutFileResponse() { + return { exists: false }; +} +var SharedVolumePutFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(8).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumePutFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return SharedVolumePutFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumePutFileResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseSharedVolumeRemoveFileRequest() { + return { sharedVolumeId: "", path: "", recursive: false }; +} +var SharedVolumeRemoveFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.sharedVolumeId !== "") { + writer.uint32(10).string(message.sharedVolumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSharedVolumeRemoveFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sharedVolumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sharedVolumeId: isSet4(object.sharedVolumeId) ? globalThis.String(object.sharedVolumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.sharedVolumeId !== "") { + obj.sharedVolumeId = message.sharedVolumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return SharedVolumeRemoveFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSharedVolumeRemoveFileRequest(); + message.sharedVolumeId = object.sharedVolumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseSystemErrorMessage() { + return { errorCode: 0, errorMessage: "" }; +} +var SystemErrorMessage = { + encode(message, writer = new BinaryWriter()) { + if (message.errorCode !== 0) { + writer.uint32(8).int32(message.errorCode); + } + if (message.errorMessage !== "") { + writer.uint32(18).string(message.errorMessage); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseSystemErrorMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.errorCode = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.errorMessage = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + errorCode: isSet4(object.errorCode) ? systemErrorCodeFromJSON(object.errorCode) : 0, + errorMessage: isSet4(object.errorMessage) ? globalThis.String(object.errorMessage) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.errorCode !== 0) { + obj.errorCode = systemErrorCodeToJSON(message.errorCode); + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + create(base) { + return SystemErrorMessage.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSystemErrorMessage(); + message.errorCode = object.errorCode ?? 0; + message.errorMessage = object.errorMessage ?? ""; + return message; + } +}; +function createBaseTaskClusterHelloRequest() { + return { taskId: "", containerIp: "" }; +} +var TaskClusterHelloRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.containerIp !== "") { + writer.uint32(18).string(message.containerIp); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskClusterHelloRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.containerIp = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + containerIp: isSet4(object.containerIp) ? globalThis.String(object.containerIp) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.containerIp !== "") { + obj.containerIp = message.containerIp; + } + return obj; + }, + create(base) { + return TaskClusterHelloRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskClusterHelloRequest(); + message.taskId = object.taskId ?? ""; + message.containerIp = object.containerIp ?? ""; + return message; + } +}; +function createBaseTaskClusterHelloResponse() { + return { clusterId: "", clusterRank: 0, containerIps: [], containerIpv4Ips: [] }; +} +var TaskClusterHelloResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.clusterId !== "") { + writer.uint32(10).string(message.clusterId); + } + if (message.clusterRank !== 0) { + writer.uint32(16).uint32(message.clusterRank); + } + for (const v of message.containerIps) { + writer.uint32(26).string(v); + } + for (const v of message.containerIpv4Ips) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskClusterHelloResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.clusterId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.clusterRank = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.containerIps.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.containerIpv4Ips.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + clusterId: isSet4(object.clusterId) ? globalThis.String(object.clusterId) : "", + clusterRank: isSet4(object.clusterRank) ? globalThis.Number(object.clusterRank) : 0, + containerIps: globalThis.Array.isArray(object?.containerIps) ? object.containerIps.map((e) => globalThis.String(e)) : [], + containerIpv4Ips: globalThis.Array.isArray(object?.containerIpv4Ips) ? object.containerIpv4Ips.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.clusterId !== "") { + obj.clusterId = message.clusterId; + } + if (message.clusterRank !== 0) { + obj.clusterRank = Math.round(message.clusterRank); + } + if (message.containerIps?.length) { + obj.containerIps = message.containerIps; + } + if (message.containerIpv4Ips?.length) { + obj.containerIpv4Ips = message.containerIpv4Ips; + } + return obj; + }, + create(base) { + return TaskClusterHelloResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskClusterHelloResponse(); + message.clusterId = object.clusterId ?? ""; + message.clusterRank = object.clusterRank ?? 0; + message.containerIps = object.containerIps?.map((e) => e) || []; + message.containerIpv4Ips = object.containerIpv4Ips?.map((e) => e) || []; + return message; + } +}; +function createBaseTaskCurrentInputsResponse() { + return { inputIds: [] }; +} +var TaskCurrentInputsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.inputIds) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskCurrentInputsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.inputIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + inputIds: globalThis.Array.isArray(object?.inputIds) ? object.inputIds.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.inputIds?.length) { + obj.inputIds = message.inputIds; + } + return obj; + }, + create(base) { + return TaskCurrentInputsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskCurrentInputsResponse(); + message.inputIds = object.inputIds?.map((e) => e) || []; + return message; + } +}; +function createBaseTaskGetAutoscalingMetricsRequest() { + return { taskId: "" }; +} +var TaskGetAutoscalingMetricsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetAutoscalingMetricsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return TaskGetAutoscalingMetricsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetAutoscalingMetricsRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseTaskGetAutoscalingMetricsResponse() { + return { metrics: void 0 }; +} +var TaskGetAutoscalingMetricsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.metrics !== void 0) { + AutoscalingMetrics.encode(message.metrics, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetAutoscalingMetricsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.metrics = AutoscalingMetrics.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { metrics: isSet4(object.metrics) ? AutoscalingMetrics.fromJSON(object.metrics) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.metrics !== void 0) { + obj.metrics = AutoscalingMetrics.toJSON(message.metrics); + } + return obj; + }, + create(base) { + return TaskGetAutoscalingMetricsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetAutoscalingMetricsResponse(); + message.metrics = object.metrics !== void 0 && object.metrics !== null ? AutoscalingMetrics.fromPartial(object.metrics) : void 0; + return message; + } +}; +function createBaseTaskGetCommandRouterAccessRequest() { + return { taskId: "" }; +} +var TaskGetCommandRouterAccessRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetCommandRouterAccessRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + return obj; + }, + create(base) { + return TaskGetCommandRouterAccessRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetCommandRouterAccessRequest(); + message.taskId = object.taskId ?? ""; + return message; + } +}; +function createBaseTaskGetCommandRouterAccessResponse() { + return { jwt: "", url: "" }; +} +var TaskGetCommandRouterAccessResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.jwt !== "") { + writer.uint32(10).string(message.jwt); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskGetCommandRouterAccessResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.jwt = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + jwt: isSet4(object.jwt) ? globalThis.String(object.jwt) : "", + url: isSet4(object.url) ? globalThis.String(object.url) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.jwt !== "") { + obj.jwt = message.jwt; + } + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + create(base) { + return TaskGetCommandRouterAccessResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskGetCommandRouterAccessResponse(); + message.jwt = object.jwt ?? ""; + message.url = object.url ?? ""; + return message; + } +}; +function createBaseTaskInfo() { + return { + id: "", + startedAt: 0, + finishedAt: 0, + result: void 0, + enqueuedAt: 0, + gpuType: "", + sandboxId: "", + snapshotBehavior: 0, + gpuConfig: void 0 + }; +} +var TaskInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.startedAt !== 0) { + writer.uint32(17).double(message.startedAt); + } + if (message.finishedAt !== 0) { + writer.uint32(25).double(message.finishedAt); + } + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(34).fork()).join(); + } + if (message.enqueuedAt !== 0) { + writer.uint32(41).double(message.enqueuedAt); + } + if (message.gpuType !== "") { + writer.uint32(50).string(message.gpuType); + } + if (message.sandboxId !== "") { + writer.uint32(58).string(message.sandboxId); + } + if (message.snapshotBehavior !== 0) { + writer.uint32(64).int32(message.snapshotBehavior); + } + if (message.gpuConfig !== void 0) { + GPUConfig.encode(message.gpuConfig, writer.uint32(74).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + message.startedAt = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.finishedAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + message.enqueuedAt = reader.double(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.gpuType = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.sandboxId = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.snapshotBehavior = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.gpuConfig = GPUConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet4(object.id) ? globalThis.String(object.id) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0, + finishedAt: isSet4(object.finishedAt) ? globalThis.Number(object.finishedAt) : 0, + result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0, + enqueuedAt: isSet4(object.enqueuedAt) ? globalThis.Number(object.enqueuedAt) : 0, + gpuType: isSet4(object.gpuType) ? globalThis.String(object.gpuType) : "", + sandboxId: isSet4(object.sandboxId) ? globalThis.String(object.sandboxId) : "", + snapshotBehavior: isSet4(object.snapshotBehavior) ? taskSnapshotBehaviorFromJSON(object.snapshotBehavior) : 0, + gpuConfig: isSet4(object.gpuConfig) ? GPUConfig.fromJSON(object.gpuConfig) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + if (message.finishedAt !== 0) { + obj.finishedAt = message.finishedAt; + } + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + if (message.enqueuedAt !== 0) { + obj.enqueuedAt = message.enqueuedAt; + } + if (message.gpuType !== "") { + obj.gpuType = message.gpuType; + } + if (message.sandboxId !== "") { + obj.sandboxId = message.sandboxId; + } + if (message.snapshotBehavior !== 0) { + obj.snapshotBehavior = taskSnapshotBehaviorToJSON(message.snapshotBehavior); + } + if (message.gpuConfig !== void 0) { + obj.gpuConfig = GPUConfig.toJSON(message.gpuConfig); + } + return obj; + }, + create(base) { + return TaskInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskInfo(); + message.id = object.id ?? ""; + message.startedAt = object.startedAt ?? 0; + message.finishedAt = object.finishedAt ?? 0; + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + message.enqueuedAt = object.enqueuedAt ?? 0; + message.gpuType = object.gpuType ?? ""; + message.sandboxId = object.sandboxId ?? ""; + message.snapshotBehavior = object.snapshotBehavior ?? 0; + message.gpuConfig = object.gpuConfig !== void 0 && object.gpuConfig !== null ? GPUConfig.fromPartial(object.gpuConfig) : void 0; + return message; + } +}; +function createBaseTaskListRequest() { + return { environmentName: "" }; +} +var TaskListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return TaskListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskListRequest(); + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseTaskListResponse() { + return { tasks: [] }; +} +var TaskListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.tasks) { + TaskStats.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tasks.push(TaskStats.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tasks: globalThis.Array.isArray(object?.tasks) ? object.tasks.map((e) => TaskStats.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.tasks?.length) { + obj.tasks = message.tasks.map((e) => TaskStats.toJSON(e)); + } + return obj; + }, + create(base) { + return TaskListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskListResponse(); + message.tasks = object.tasks?.map((e) => TaskStats.fromPartial(e)) || []; + return message; + } +}; +function createBaseTaskLogs() { + return { + data: "", + taskState: 0, + timestamp: 0, + fileDescriptor: 0, + taskProgress: void 0, + functionCallId: "", + inputId: "", + timestampNs: 0 + }; +} +var TaskLogs = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.taskState !== 0) { + writer.uint32(48).int32(message.taskState); + } + if (message.timestamp !== 0) { + writer.uint32(57).double(message.timestamp); + } + if (message.fileDescriptor !== 0) { + writer.uint32(64).int32(message.fileDescriptor); + } + if (message.taskProgress !== void 0) { + TaskProgress.encode(message.taskProgress, writer.uint32(74).fork()).join(); + } + if (message.functionCallId !== "") { + writer.uint32(82).string(message.functionCallId); + } + if (message.inputId !== "") { + writer.uint32(90).string(message.inputId); + } + if (message.timestampNs !== 0) { + writer.uint32(96).uint64(message.timestampNs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskLogs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.taskState = reader.int32(); + continue; + } + case 7: { + if (tag !== 57) { + break; + } + message.timestamp = reader.double(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fileDescriptor = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.taskProgress = TaskProgress.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.functionCallId = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.inputId = reader.string(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + message.timestampNs = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? globalThis.String(object.data) : "", + taskState: isSet4(object.taskState) ? taskStateFromJSON(object.taskState) : 0, + timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0, + fileDescriptor: isSet4(object.fileDescriptor) ? fileDescriptorFromJSON(object.fileDescriptor) : 0, + taskProgress: isSet4(object.taskProgress) ? TaskProgress.fromJSON(object.taskProgress) : void 0, + functionCallId: isSet4(object.functionCallId) ? globalThis.String(object.functionCallId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + timestampNs: isSet4(object.timestampNs) ? globalThis.Number(object.timestampNs) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.taskState !== 0) { + obj.taskState = taskStateToJSON(message.taskState); + } + if (message.timestamp !== 0) { + obj.timestamp = message.timestamp; + } + if (message.fileDescriptor !== 0) { + obj.fileDescriptor = fileDescriptorToJSON(message.fileDescriptor); + } + if (message.taskProgress !== void 0) { + obj.taskProgress = TaskProgress.toJSON(message.taskProgress); + } + if (message.functionCallId !== "") { + obj.functionCallId = message.functionCallId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.timestampNs !== 0) { + obj.timestampNs = Math.round(message.timestampNs); + } + return obj; + }, + create(base) { + return TaskLogs.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskLogs(); + message.data = object.data ?? ""; + message.taskState = object.taskState ?? 0; + message.timestamp = object.timestamp ?? 0; + message.fileDescriptor = object.fileDescriptor ?? 0; + message.taskProgress = object.taskProgress !== void 0 && object.taskProgress !== null ? TaskProgress.fromPartial(object.taskProgress) : void 0; + message.functionCallId = object.functionCallId ?? ""; + message.inputId = object.inputId ?? ""; + message.timestampNs = object.timestampNs ?? 0; + return message; + } +}; +function createBaseTaskLogsBatch() { + return { + taskId: "", + items: [], + entryId: "", + appDone: false, + functionId: "", + inputId: "", + imageId: "", + eof: false, + ptyExecId: "", + rootFunctionId: "", + ttlDays: 0 + }; +} +var TaskLogsBatch = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + for (const v of message.items) { + TaskLogs.encode(v, writer.uint32(18).fork()).join(); + } + if (message.entryId !== "") { + writer.uint32(42).string(message.entryId); + } + if (message.appDone !== false) { + writer.uint32(80).bool(message.appDone); + } + if (message.functionId !== "") { + writer.uint32(90).string(message.functionId); + } + if (message.inputId !== "") { + writer.uint32(98).string(message.inputId); + } + if (message.imageId !== "") { + writer.uint32(106).string(message.imageId); + } + if (message.eof !== false) { + writer.uint32(112).bool(message.eof); + } + if (message.ptyExecId !== "") { + writer.uint32(122).string(message.ptyExecId); + } + if (message.rootFunctionId !== "") { + writer.uint32(130).string(message.rootFunctionId); + } + if (message.ttlDays !== 0) { + writer.uint32(136).uint32(message.ttlDays); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskLogsBatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.items.push(TaskLogs.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.entryId = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.appDone = reader.bool(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.functionId = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.inputId = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.imageId = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.eof = reader.bool(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.ptyExecId = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.rootFunctionId = reader.string(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.ttlDays = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => TaskLogs.fromJSON(e)) : [], + entryId: isSet4(object.entryId) ? globalThis.String(object.entryId) : "", + appDone: isSet4(object.appDone) ? globalThis.Boolean(object.appDone) : false, + functionId: isSet4(object.functionId) ? globalThis.String(object.functionId) : "", + inputId: isSet4(object.inputId) ? globalThis.String(object.inputId) : "", + imageId: isSet4(object.imageId) ? globalThis.String(object.imageId) : "", + eof: isSet4(object.eof) ? globalThis.Boolean(object.eof) : false, + ptyExecId: isSet4(object.ptyExecId) ? globalThis.String(object.ptyExecId) : "", + rootFunctionId: isSet4(object.rootFunctionId) ? globalThis.String(object.rootFunctionId) : "", + ttlDays: isSet4(object.ttlDays) ? globalThis.Number(object.ttlDays) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.items?.length) { + obj.items = message.items.map((e) => TaskLogs.toJSON(e)); + } + if (message.entryId !== "") { + obj.entryId = message.entryId; + } + if (message.appDone !== false) { + obj.appDone = message.appDone; + } + if (message.functionId !== "") { + obj.functionId = message.functionId; + } + if (message.inputId !== "") { + obj.inputId = message.inputId; + } + if (message.imageId !== "") { + obj.imageId = message.imageId; + } + if (message.eof !== false) { + obj.eof = message.eof; + } + if (message.ptyExecId !== "") { + obj.ptyExecId = message.ptyExecId; + } + if (message.rootFunctionId !== "") { + obj.rootFunctionId = message.rootFunctionId; + } + if (message.ttlDays !== 0) { + obj.ttlDays = Math.round(message.ttlDays); + } + return obj; + }, + create(base) { + return TaskLogsBatch.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskLogsBatch(); + message.taskId = object.taskId ?? ""; + message.items = object.items?.map((e) => TaskLogs.fromPartial(e)) || []; + message.entryId = object.entryId ?? ""; + message.appDone = object.appDone ?? false; + message.functionId = object.functionId ?? ""; + message.inputId = object.inputId ?? ""; + message.imageId = object.imageId ?? ""; + message.eof = object.eof ?? false; + message.ptyExecId = object.ptyExecId ?? ""; + message.rootFunctionId = object.rootFunctionId ?? ""; + message.ttlDays = object.ttlDays ?? 0; + return message; + } +}; +function createBaseTaskProgress() { + return { len: 0, pos: 0, progressType: 0, description: "" }; +} +var TaskProgress = { + encode(message, writer = new BinaryWriter()) { + if (message.len !== 0) { + writer.uint32(8).uint64(message.len); + } + if (message.pos !== 0) { + writer.uint32(16).uint64(message.pos); + } + if (message.progressType !== 0) { + writer.uint32(24).int32(message.progressType); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.pos = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.progressType = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + len: isSet4(object.len) ? globalThis.Number(object.len) : 0, + pos: isSet4(object.pos) ? globalThis.Number(object.pos) : 0, + progressType: isSet4(object.progressType) ? progressTypeFromJSON(object.progressType) : 0, + description: isSet4(object.description) ? globalThis.String(object.description) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + if (message.pos !== 0) { + obj.pos = Math.round(message.pos); + } + if (message.progressType !== 0) { + obj.progressType = progressTypeToJSON(message.progressType); + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + create(base) { + return TaskProgress.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskProgress(); + message.len = object.len ?? 0; + message.pos = object.pos ?? 0; + message.progressType = object.progressType ?? 0; + message.description = object.description ?? ""; + return message; + } +}; +function createBaseTaskResultRequest() { + return { result: void 0 }; +} +var TaskResultRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.result !== void 0) { + GenericResult.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.result = GenericResult.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { result: isSet4(object.result) ? GenericResult.fromJSON(object.result) : void 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.result !== void 0) { + obj.result = GenericResult.toJSON(message.result); + } + return obj; + }, + create(base) { + return TaskResultRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskResultRequest(); + message.result = object.result !== void 0 && object.result !== null ? GenericResult.fromPartial(object.result) : void 0; + return message; + } +}; +function createBaseTaskStats() { + return { taskId: "", appId: "", appDescription: "", startedAt: 0 }; +} +var TaskStats = { + encode(message, writer = new BinaryWriter()) { + if (message.taskId !== "") { + writer.uint32(10).string(message.taskId); + } + if (message.appId !== "") { + writer.uint32(18).string(message.appId); + } + if (message.appDescription !== "") { + writer.uint32(26).string(message.appDescription); + } + if (message.startedAt !== 0) { + writer.uint32(33).double(message.startedAt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.taskId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.appId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.appDescription = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + message.startedAt = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + taskId: isSet4(object.taskId) ? globalThis.String(object.taskId) : "", + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + appDescription: isSet4(object.appDescription) ? globalThis.String(object.appDescription) : "", + startedAt: isSet4(object.startedAt) ? globalThis.Number(object.startedAt) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.taskId !== "") { + obj.taskId = message.taskId; + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.appDescription !== "") { + obj.appDescription = message.appDescription; + } + if (message.startedAt !== 0) { + obj.startedAt = message.startedAt; + } + return obj; + }, + create(base) { + return TaskStats.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskStats(); + message.taskId = object.taskId ?? ""; + message.appId = object.appId ?? ""; + message.appDescription = object.appDescription ?? ""; + message.startedAt = object.startedAt ?? 0; + return message; + } +}; +function createBaseTaskTemplate() { + return { rank: 0, resources: void 0, targetConcurrentInputs: 0, maxConcurrentInputs: 0, index: 0 }; +} +var TaskTemplate = { + encode(message, writer = new BinaryWriter()) { + if (message.rank !== 0) { + writer.uint32(8).uint32(message.rank); + } + if (message.resources !== void 0) { + Resources.encode(message.resources, writer.uint32(18).fork()).join(); + } + if (message.targetConcurrentInputs !== 0) { + writer.uint32(24).uint32(message.targetConcurrentInputs); + } + if (message.maxConcurrentInputs !== 0) { + writer.uint32(32).uint32(message.maxConcurrentInputs); + } + if (message.index !== 0) { + writer.uint32(40).uint32(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTaskTemplate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.rank = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.resources = Resources.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.targetConcurrentInputs = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.maxConcurrentInputs = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.index = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rank: isSet4(object.rank) ? globalThis.Number(object.rank) : 0, + resources: isSet4(object.resources) ? Resources.fromJSON(object.resources) : void 0, + targetConcurrentInputs: isSet4(object.targetConcurrentInputs) ? globalThis.Number(object.targetConcurrentInputs) : 0, + maxConcurrentInputs: isSet4(object.maxConcurrentInputs) ? globalThis.Number(object.maxConcurrentInputs) : 0, + index: isSet4(object.index) ? globalThis.Number(object.index) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.rank !== 0) { + obj.rank = Math.round(message.rank); + } + if (message.resources !== void 0) { + obj.resources = Resources.toJSON(message.resources); + } + if (message.targetConcurrentInputs !== 0) { + obj.targetConcurrentInputs = Math.round(message.targetConcurrentInputs); + } + if (message.maxConcurrentInputs !== 0) { + obj.maxConcurrentInputs = Math.round(message.maxConcurrentInputs); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + create(base) { + return TaskTemplate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTaskTemplate(); + message.rank = object.rank ?? 0; + message.resources = object.resources !== void 0 && object.resources !== null ? Resources.fromPartial(object.resources) : void 0; + message.targetConcurrentInputs = object.targetConcurrentInputs ?? 0; + message.maxConcurrentInputs = object.maxConcurrentInputs ?? 0; + message.index = object.index ?? 0; + return message; + } +}; +function createBaseTokenFlowCreateRequest() { + return { utmSource: "", localhostPort: 0, nextUrl: "" }; +} +var TokenFlowCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.utmSource !== "") { + writer.uint32(26).string(message.utmSource); + } + if (message.localhostPort !== 0) { + writer.uint32(32).int32(message.localhostPort); + } + if (message.nextUrl !== "") { + writer.uint32(42).string(message.nextUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 26) { + break; + } + message.utmSource = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.localhostPort = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.nextUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + utmSource: isSet4(object.utmSource) ? globalThis.String(object.utmSource) : "", + localhostPort: isSet4(object.localhostPort) ? globalThis.Number(object.localhostPort) : 0, + nextUrl: isSet4(object.nextUrl) ? globalThis.String(object.nextUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.utmSource !== "") { + obj.utmSource = message.utmSource; + } + if (message.localhostPort !== 0) { + obj.localhostPort = Math.round(message.localhostPort); + } + if (message.nextUrl !== "") { + obj.nextUrl = message.nextUrl; + } + return obj; + }, + create(base) { + return TokenFlowCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowCreateRequest(); + message.utmSource = object.utmSource ?? ""; + message.localhostPort = object.localhostPort ?? 0; + message.nextUrl = object.nextUrl ?? ""; + return message; + } +}; +function createBaseTokenFlowCreateResponse() { + return { tokenFlowId: "", webUrl: "", code: "", waitSecret: "" }; +} +var TokenFlowCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.tokenFlowId !== "") { + writer.uint32(10).string(message.tokenFlowId); + } + if (message.webUrl !== "") { + writer.uint32(18).string(message.webUrl); + } + if (message.code !== "") { + writer.uint32(26).string(message.code); + } + if (message.waitSecret !== "") { + writer.uint32(34).string(message.waitSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tokenFlowId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.webUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.code = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.waitSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tokenFlowId: isSet4(object.tokenFlowId) ? globalThis.String(object.tokenFlowId) : "", + webUrl: isSet4(object.webUrl) ? globalThis.String(object.webUrl) : "", + code: isSet4(object.code) ? globalThis.String(object.code) : "", + waitSecret: isSet4(object.waitSecret) ? globalThis.String(object.waitSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tokenFlowId !== "") { + obj.tokenFlowId = message.tokenFlowId; + } + if (message.webUrl !== "") { + obj.webUrl = message.webUrl; + } + if (message.code !== "") { + obj.code = message.code; + } + if (message.waitSecret !== "") { + obj.waitSecret = message.waitSecret; + } + return obj; + }, + create(base) { + return TokenFlowCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowCreateResponse(); + message.tokenFlowId = object.tokenFlowId ?? ""; + message.webUrl = object.webUrl ?? ""; + message.code = object.code ?? ""; + message.waitSecret = object.waitSecret ?? ""; + return message; + } +}; +function createBaseTokenFlowWaitRequest() { + return { timeout: 0, tokenFlowId: "", waitSecret: "" }; +} +var TokenFlowWaitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.timeout !== 0) { + writer.uint32(13).float(message.timeout); + } + if (message.tokenFlowId !== "") { + writer.uint32(18).string(message.tokenFlowId); + } + if (message.waitSecret !== "") { + writer.uint32(26).string(message.waitSecret); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowWaitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + message.timeout = reader.float(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenFlowId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.waitSecret = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + timeout: isSet4(object.timeout) ? globalThis.Number(object.timeout) : 0, + tokenFlowId: isSet4(object.tokenFlowId) ? globalThis.String(object.tokenFlowId) : "", + waitSecret: isSet4(object.waitSecret) ? globalThis.String(object.waitSecret) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.timeout !== 0) { + obj.timeout = message.timeout; + } + if (message.tokenFlowId !== "") { + obj.tokenFlowId = message.tokenFlowId; + } + if (message.waitSecret !== "") { + obj.waitSecret = message.waitSecret; + } + return obj; + }, + create(base) { + return TokenFlowWaitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowWaitRequest(); + message.timeout = object.timeout ?? 0; + message.tokenFlowId = object.tokenFlowId ?? ""; + message.waitSecret = object.waitSecret ?? ""; + return message; + } +}; +function createBaseTokenFlowWaitResponse() { + return { tokenId: "", tokenSecret: "", timeout: false, workspaceUsername: "" }; +} +var TokenFlowWaitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.tokenId !== "") { + writer.uint32(10).string(message.tokenId); + } + if (message.tokenSecret !== "") { + writer.uint32(18).string(message.tokenSecret); + } + if (message.timeout !== false) { + writer.uint32(24).bool(message.timeout); + } + if (message.workspaceUsername !== "") { + writer.uint32(34).string(message.workspaceUsername); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTokenFlowWaitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.tokenId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenSecret = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.timeout = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.workspaceUsername = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tokenId: isSet4(object.tokenId) ? globalThis.String(object.tokenId) : "", + tokenSecret: isSet4(object.tokenSecret) ? globalThis.String(object.tokenSecret) : "", + timeout: isSet4(object.timeout) ? globalThis.Boolean(object.timeout) : false, + workspaceUsername: isSet4(object.workspaceUsername) ? globalThis.String(object.workspaceUsername) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.tokenId !== "") { + obj.tokenId = message.tokenId; + } + if (message.tokenSecret !== "") { + obj.tokenSecret = message.tokenSecret; + } + if (message.timeout !== false) { + obj.timeout = message.timeout; + } + if (message.workspaceUsername !== "") { + obj.workspaceUsername = message.workspaceUsername; + } + return obj; + }, + create(base) { + return TokenFlowWaitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenFlowWaitResponse(); + message.tokenId = object.tokenId ?? ""; + message.tokenSecret = object.tokenSecret ?? ""; + message.timeout = object.timeout ?? false; + message.workspaceUsername = object.workspaceUsername ?? ""; + return message; + } +}; +function createBaseTunnelData() { + return { host: "", port: 0, unencryptedHost: void 0, unencryptedPort: void 0, containerPort: 0 }; +} +var TunnelData = { + encode(message, writer = new BinaryWriter()) { + if (message.host !== "") { + writer.uint32(10).string(message.host); + } + if (message.port !== 0) { + writer.uint32(16).uint32(message.port); + } + if (message.unencryptedHost !== void 0) { + writer.uint32(26).string(message.unencryptedHost); + } + if (message.unencryptedPort !== void 0) { + writer.uint32(32).uint32(message.unencryptedPort); + } + if (message.containerPort !== 0) { + writer.uint32(40).uint32(message.containerPort); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.port = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unencryptedHost = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.unencryptedPort = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.containerPort = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencryptedHost: isSet4(object.unencryptedHost) ? globalThis.String(object.unencryptedHost) : void 0, + unencryptedPort: isSet4(object.unencryptedPort) ? globalThis.Number(object.unencryptedPort) : void 0, + containerPort: isSet4(object.containerPort) ? globalThis.Number(object.containerPort) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencryptedHost !== void 0) { + obj.unencryptedHost = message.unencryptedHost; + } + if (message.unencryptedPort !== void 0) { + obj.unencryptedPort = Math.round(message.unencryptedPort); + } + if (message.containerPort !== 0) { + obj.containerPort = Math.round(message.containerPort); + } + return obj; + }, + create(base) { + return TunnelData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelData(); + message.host = object.host ?? ""; + message.port = object.port ?? 0; + message.unencryptedHost = object.unencryptedHost ?? void 0; + message.unencryptedPort = object.unencryptedPort ?? void 0; + message.containerPort = object.containerPort ?? 0; + return message; + } +}; +function createBaseTunnelStartRequest() { + return { port: 0, unencrypted: false, tunnelType: void 0 }; +} +var TunnelStartRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + if (message.unencrypted !== false) { + writer.uint32(16).bool(message.unencrypted); + } + if (message.tunnelType !== void 0) { + writer.uint32(24).int32(message.tunnelType); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStartRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.unencrypted = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.tunnelType = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencrypted: isSet4(object.unencrypted) ? globalThis.Boolean(object.unencrypted) : false, + tunnelType: isSet4(object.tunnelType) ? tunnelTypeFromJSON(object.tunnelType) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencrypted !== false) { + obj.unencrypted = message.unencrypted; + } + if (message.tunnelType !== void 0) { + obj.tunnelType = tunnelTypeToJSON(message.tunnelType); + } + return obj; + }, + create(base) { + return TunnelStartRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStartRequest(); + message.port = object.port ?? 0; + message.unencrypted = object.unencrypted ?? false; + message.tunnelType = object.tunnelType ?? void 0; + return message; + } +}; +function createBaseTunnelStartResponse() { + return { host: "", port: 0, unencryptedHost: void 0, unencryptedPort: void 0 }; +} +var TunnelStartResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.host !== "") { + writer.uint32(10).string(message.host); + } + if (message.port !== 0) { + writer.uint32(16).uint32(message.port); + } + if (message.unencryptedHost !== void 0) { + writer.uint32(26).string(message.unencryptedHost); + } + if (message.unencryptedPort !== void 0) { + writer.uint32(32).uint32(message.unencryptedPort); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStartResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.host = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.port = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unencryptedHost = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.unencryptedPort = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + host: isSet4(object.host) ? globalThis.String(object.host) : "", + port: isSet4(object.port) ? globalThis.Number(object.port) : 0, + unencryptedHost: isSet4(object.unencryptedHost) ? globalThis.String(object.unencryptedHost) : void 0, + unencryptedPort: isSet4(object.unencryptedPort) ? globalThis.Number(object.unencryptedPort) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.host !== "") { + obj.host = message.host; + } + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + if (message.unencryptedHost !== void 0) { + obj.unencryptedHost = message.unencryptedHost; + } + if (message.unencryptedPort !== void 0) { + obj.unencryptedPort = Math.round(message.unencryptedPort); + } + return obj; + }, + create(base) { + return TunnelStartResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStartResponse(); + message.host = object.host ?? ""; + message.port = object.port ?? 0; + message.unencryptedHost = object.unencryptedHost ?? void 0; + message.unencryptedPort = object.unencryptedPort ?? void 0; + return message; + } +}; +function createBaseTunnelStopRequest() { + return { port: 0 }; +} +var TunnelStopRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.port !== 0) { + writer.uint32(8).uint32(message.port); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.port = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { port: isSet4(object.port) ? globalThis.Number(object.port) : 0 }; + }, + toJSON(message) { + const obj = {}; + if (message.port !== 0) { + obj.port = Math.round(message.port); + } + return obj; + }, + create(base) { + return TunnelStopRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStopRequest(); + message.port = object.port ?? 0; + return message; + } +}; +function createBaseTunnelStopResponse() { + return { exists: false }; +} +var TunnelStopResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.exists !== false) { + writer.uint32(8).bool(message.exists); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseTunnelStopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { exists: isSet4(object.exists) ? globalThis.Boolean(object.exists) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + create(base) { + return TunnelStopResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTunnelStopResponse(); + message.exists = object.exists ?? false; + return message; + } +}; +function createBaseUploadUrlList() { + return { items: [] }; +} +var UploadUrlList = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseUploadUrlList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => globalThis.String(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items; + } + return obj; + }, + create(base) { + return UploadUrlList.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUploadUrlList(); + message.items = object.items?.map((e) => e) || []; + return message; + } +}; +function createBaseVolumeCommitRequest() { + return { volumeId: "" }; +} +var VolumeCommitRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeCommitRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCommitRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeCommitResponse() { + return { skipReload: false }; +} +var VolumeCommitResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.skipReload !== false) { + writer.uint32(8).bool(message.skipReload); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.skipReload = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { skipReload: isSet4(object.skipReload) ? globalThis.Boolean(object.skipReload) : false }; + }, + toJSON(message) { + const obj = {}; + if (message.skipReload !== false) { + obj.skipReload = message.skipReload; + } + return obj; + }, + create(base) { + return VolumeCommitResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCommitResponse(); + message.skipReload = object.skipReload ?? false; + return message; + } +}; +function createBaseVolumeCopyFiles2Request() { + return { volumeId: "", srcPaths: [], dstPath: "", recursive: false }; +} +var VolumeCopyFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.srcPaths) { + writer.uint32(18).string(v); + } + if (message.dstPath !== "") { + writer.uint32(26).string(message.dstPath); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCopyFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.srcPaths.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dstPath = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + srcPaths: globalThis.Array.isArray(object?.srcPaths) ? object.srcPaths.map((e) => globalThis.String(e)) : [], + dstPath: isSet4(object.dstPath) ? globalThis.String(object.dstPath) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.srcPaths?.length) { + obj.srcPaths = message.srcPaths; + } + if (message.dstPath !== "") { + obj.dstPath = message.dstPath; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeCopyFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCopyFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.srcPaths = object.srcPaths?.map((e) => e) || []; + message.dstPath = object.dstPath ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeCopyFilesRequest() { + return { volumeId: "", srcPaths: [], dstPath: "", recursive: false }; +} +var VolumeCopyFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.srcPaths) { + writer.uint32(18).string(v); + } + if (message.dstPath !== "") { + writer.uint32(26).string(message.dstPath); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeCopyFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.srcPaths.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dstPath = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + srcPaths: globalThis.Array.isArray(object?.srcPaths) ? object.srcPaths.map((e) => globalThis.String(e)) : [], + dstPath: isSet4(object.dstPath) ? globalThis.String(object.dstPath) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.srcPaths?.length) { + obj.srcPaths = message.srcPaths; + } + if (message.dstPath !== "") { + obj.dstPath = message.dstPath; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeCopyFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeCopyFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.srcPaths = object.srcPaths?.map((e) => e) || []; + message.dstPath = object.dstPath ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeDeleteRequest() { + return { volumeId: "", environmentName: "" }; +} +var VolumeDeleteRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return VolumeDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeDeleteRequest(); + message.volumeId = object.volumeId ?? ""; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseVolumeGetFile2Request() { + return { volumeId: "", path: "", start: 0, len: 0 }; +} +var VolumeGetFile2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFile2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFile2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFile2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFile2Response() { + return { getUrls: [], size: 0, start: 0, len: 0 }; +} +var VolumeGetFile2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.getUrls) { + writer.uint32(10).string(v); + } + if (message.size !== 0) { + writer.uint32(16).uint64(message.size); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFile2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.getUrls.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + getUrls: globalThis.Array.isArray(object?.getUrls) ? object.getUrls.map((e) => globalThis.String(e)) : [], + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.getUrls?.length) { + obj.getUrls = message.getUrls; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFile2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFile2Response(); + message.getUrls = object.getUrls?.map((e) => e) || []; + message.size = object.size ?? 0; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFileRequest() { + return { volumeId: "", path: "", start: 0, len: 0 }; +} +var VolumeGetFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.start !== 0) { + writer.uint32(24).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFileRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetFileResponse() { + return { data: void 0, dataBlobId: void 0, size: 0, start: 0, len: 0 }; +} +var VolumeGetFileResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data !== void 0) { + writer.uint32(10).bytes(message.data); + } + if (message.dataBlobId !== void 0) { + writer.uint32(18).string(message.dataBlobId); + } + if (message.size !== 0) { + writer.uint32(24).uint64(message.size); + } + if (message.start !== 0) { + writer.uint32(32).uint64(message.start); + } + if (message.len !== 0) { + writer.uint32(40).uint64(message.len); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dataBlobId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.start = longToNumber2(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.len = longToNumber2(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet4(object.data) ? bytesFromBase64(object.data) : void 0, + dataBlobId: isSet4(object.dataBlobId) ? globalThis.String(object.dataBlobId) : void 0, + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + start: isSet4(object.start) ? globalThis.Number(object.start) : 0, + len: isSet4(object.len) ? globalThis.Number(object.len) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.data !== void 0) { + obj.data = base64FromBytes(message.data); + } + if (message.dataBlobId !== void 0) { + obj.dataBlobId = message.dataBlobId; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + create(base) { + return VolumeGetFileResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetFileResponse(); + message.data = object.data ?? void 0; + message.dataBlobId = object.dataBlobId ?? void 0; + message.size = object.size ?? 0; + message.start = object.start ?? 0; + message.len = object.len ?? 0; + return message; + } +}; +function createBaseVolumeGetOrCreateRequest() { + return { deploymentName: "", environmentName: "", objectCreationType: 0, appId: "", version: 0 }; +} +var VolumeGetOrCreateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.deploymentName !== "") { + writer.uint32(10).string(message.deploymentName); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.objectCreationType !== 0) { + writer.uint32(32).int32(message.objectCreationType); + } + if (message.appId !== "") { + writer.uint32(42).string(message.appId); + } + if (message.version !== 0) { + writer.uint32(48).int32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetOrCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.deploymentName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.objectCreationType = reader.int32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.appId = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.version = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deploymentName: isSet4(object.deploymentName) ? globalThis.String(object.deploymentName) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + objectCreationType: isSet4(object.objectCreationType) ? objectCreationTypeFromJSON(object.objectCreationType) : 0, + appId: isSet4(object.appId) ? globalThis.String(object.appId) : "", + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.deploymentName !== "") { + obj.deploymentName = message.deploymentName; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.objectCreationType !== 0) { + obj.objectCreationType = objectCreationTypeToJSON(message.objectCreationType); + } + if (message.appId !== "") { + obj.appId = message.appId; + } + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + return obj; + }, + create(base) { + return VolumeGetOrCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetOrCreateRequest(); + message.deploymentName = object.deploymentName ?? ""; + message.environmentName = object.environmentName ?? ""; + message.objectCreationType = object.objectCreationType ?? 0; + message.appId = object.appId ?? ""; + message.version = object.version ?? 0; + return message; + } +}; +function createBaseVolumeGetOrCreateResponse() { + return { volumeId: "", version: 0, metadata: void 0 }; +} +var VolumeGetOrCreateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.version !== 0) { + writer.uint32(16).int32(message.version); + } + if (message.metadata !== void 0) { + VolumeMetadata.encode(message.metadata, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeGetOrCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.metadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0, + metadata: isSet4(object.metadata) ? VolumeMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + if (message.metadata !== void 0) { + obj.metadata = VolumeMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return VolumeGetOrCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeGetOrCreateResponse(); + message.volumeId = object.volumeId ?? ""; + message.version = object.version ?? 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? VolumeMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseVolumeHeartbeatRequest() { + return { volumeId: "" }; +} +var VolumeHeartbeatRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeHeartbeatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeHeartbeatRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeHeartbeatRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeListFiles2Request() { + return { volumeId: "", path: "", recursive: false, maxEntries: void 0 }; +} +var VolumeListFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + if (message.maxEntries !== void 0) { + writer.uint32(24).uint32(message.maxEntries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxEntries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + maxEntries: isSet4(object.maxEntries) ? globalThis.Number(object.maxEntries) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.maxEntries !== void 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + return obj; + }, + create(base) { + return VolumeListFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.maxEntries = object.maxEntries ?? void 0; + return message; + } +}; +function createBaseVolumeListFiles2Response() { + return { entries: [] }; +} +var VolumeListFiles2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFiles2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumeListFiles2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFiles2Response(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumeListFilesRequest() { + return { volumeId: "", path: "", recursive: false, maxEntries: void 0 }; +} +var VolumeListFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(32).bool(message.recursive); + } + if (message.maxEntries !== void 0) { + writer.uint32(24).uint32(message.maxEntries); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.recursive = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxEntries = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false, + maxEntries: isSet4(object.maxEntries) ? globalThis.Number(object.maxEntries) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + if (message.maxEntries !== void 0) { + obj.maxEntries = Math.round(message.maxEntries); + } + return obj; + }, + create(base) { + return VolumeListFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + message.maxEntries = object.maxEntries ?? void 0; + return message; + } +}; +function createBaseVolumeListFilesResponse() { + return { entries: [] }; +} +var VolumeListFilesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + FileEntry.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(FileEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => FileEntry.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => FileEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumeListFilesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListFilesResponse(); + message.entries = object.entries?.map((e) => FileEntry.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumeListItem() { + return { label: "", volumeId: "", createdAt: 0, metadata: void 0 }; +} +var VolumeListItem = { + encode(message, writer = new BinaryWriter()) { + if (message.label !== "") { + writer.uint32(10).string(message.label); + } + if (message.volumeId !== "") { + writer.uint32(18).string(message.volumeId); + } + if (message.createdAt !== 0) { + writer.uint32(25).double(message.createdAt); + } + if (message.metadata !== void 0) { + VolumeMetadata.encode(message.metadata, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.label = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + message.createdAt = reader.double(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.metadata = VolumeMetadata.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + label: isSet4(object.label) ? globalThis.String(object.label) : "", + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + createdAt: isSet4(object.createdAt) ? globalThis.Number(object.createdAt) : 0, + metadata: isSet4(object.metadata) ? VolumeMetadata.fromJSON(object.metadata) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.label !== "") { + obj.label = message.label; + } + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.createdAt !== 0) { + obj.createdAt = message.createdAt; + } + if (message.metadata !== void 0) { + obj.metadata = VolumeMetadata.toJSON(message.metadata); + } + return obj; + }, + create(base) { + return VolumeListItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListItem(); + message.label = object.label ?? ""; + message.volumeId = object.volumeId ?? ""; + message.createdAt = object.createdAt ?? 0; + message.metadata = object.metadata !== void 0 && object.metadata !== null ? VolumeMetadata.fromPartial(object.metadata) : void 0; + return message; + } +}; +function createBaseVolumeListRequest() { + return { environmentName: "", pagination: void 0 }; +} +var VolumeListRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.environmentName !== "") { + writer.uint32(10).string(message.environmentName); + } + if (message.pagination !== void 0) { + ListPagination.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = ListPagination.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + pagination: isSet4(object.pagination) ? ListPagination.fromJSON(object.pagination) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.pagination !== void 0) { + obj.pagination = ListPagination.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return VolumeListRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListRequest(); + message.environmentName = object.environmentName ?? ""; + message.pagination = object.pagination !== void 0 && object.pagination !== null ? ListPagination.fromPartial(object.pagination) : void 0; + return message; + } +}; +function createBaseVolumeListResponse() { + return { items: [], environmentName: "" }; +} +var VolumeListResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + VolumeListItem.encode(v, writer.uint32(10).fork()).join(); + } + if (message.environmentName !== "") { + writer.uint32(18).string(message.environmentName); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(VolumeListItem.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.environmentName = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => VolumeListItem.fromJSON(e)) : [], + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => VolumeListItem.toJSON(e)); + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + return obj; + }, + create(base) { + return VolumeListResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeListResponse(); + message.items = object.items?.map((e) => VolumeListItem.fromPartial(e)) || []; + message.environmentName = object.environmentName ?? ""; + return message; + } +}; +function createBaseVolumeMetadata() { + return { version: 0, name: "", creationInfo: void 0 }; +} +var VolumeMetadata = { + encode(message, writer = new BinaryWriter()) { + if (message.version !== 0) { + writer.uint32(8).int32(message.version); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.creationInfo !== void 0) { + CreationInfo.encode(message.creationInfo, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.version = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.creationInfo = CreationInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet4(object.version) ? volumeFsVersionFromJSON(object.version) : 0, + name: isSet4(object.name) ? globalThis.String(object.name) : "", + creationInfo: isSet4(object.creationInfo) ? CreationInfo.fromJSON(object.creationInfo) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.version !== 0) { + obj.version = volumeFsVersionToJSON(message.version); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.creationInfo !== void 0) { + obj.creationInfo = CreationInfo.toJSON(message.creationInfo); + } + return obj; + }, + create(base) { + return VolumeMetadata.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeMetadata(); + message.version = object.version ?? 0; + message.name = object.name ?? ""; + message.creationInfo = object.creationInfo !== void 0 && object.creationInfo !== null ? CreationInfo.fromPartial(object.creationInfo) : void 0; + return message; + } +}; +function createBaseVolumeMount() { + return { volumeId: "", mountPath: "", allowBackgroundCommits: false, readOnly: false }; +} +var VolumeMount = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.mountPath !== "") { + writer.uint32(18).string(message.mountPath); + } + if (message.allowBackgroundCommits !== false) { + writer.uint32(24).bool(message.allowBackgroundCommits); + } + if (message.readOnly !== false) { + writer.uint32(32).bool(message.readOnly); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeMount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.mountPath = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.allowBackgroundCommits = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.readOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + mountPath: isSet4(object.mountPath) ? globalThis.String(object.mountPath) : "", + allowBackgroundCommits: isSet4(object.allowBackgroundCommits) ? globalThis.Boolean(object.allowBackgroundCommits) : false, + readOnly: isSet4(object.readOnly) ? globalThis.Boolean(object.readOnly) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.mountPath !== "") { + obj.mountPath = message.mountPath; + } + if (message.allowBackgroundCommits !== false) { + obj.allowBackgroundCommits = message.allowBackgroundCommits; + } + if (message.readOnly !== false) { + obj.readOnly = message.readOnly; + } + return obj; + }, + create(base) { + return VolumeMount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeMount(); + message.volumeId = object.volumeId ?? ""; + message.mountPath = object.mountPath ?? ""; + message.allowBackgroundCommits = object.allowBackgroundCommits ?? false; + message.readOnly = object.readOnly ?? false; + return message; + } +}; +function createBaseVolumePutFiles2Request() { + return { volumeId: "", files: [], disallowOverwriteExistingFiles: false }; +} +var VolumePutFiles2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.files) { + VolumePutFiles2Request_File.encode(v, writer.uint32(18).fork()).join(); + } + if (message.disallowOverwriteExistingFiles !== false) { + writer.uint32(24).bool(message.disallowOverwriteExistingFiles); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.files.push(VolumePutFiles2Request_File.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.disallowOverwriteExistingFiles = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => VolumePutFiles2Request_File.fromJSON(e)) : [], + disallowOverwriteExistingFiles: isSet4(object.disallowOverwriteExistingFiles) ? globalThis.Boolean(object.disallowOverwriteExistingFiles) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.files?.length) { + obj.files = message.files.map((e) => VolumePutFiles2Request_File.toJSON(e)); + } + if (message.disallowOverwriteExistingFiles !== false) { + obj.disallowOverwriteExistingFiles = message.disallowOverwriteExistingFiles; + } + return obj; + }, + create(base) { + return VolumePutFiles2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request(); + message.volumeId = object.volumeId ?? ""; + message.files = object.files?.map((e) => VolumePutFiles2Request_File.fromPartial(e)) || []; + message.disallowOverwriteExistingFiles = object.disallowOverwriteExistingFiles ?? false; + return message; + } +}; +function createBaseVolumePutFiles2Request_File() { + return { path: "", size: 0, blocks: [], mode: void 0 }; +} +var VolumePutFiles2Request_File = { + encode(message, writer = new BinaryWriter()) { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.size !== 0) { + writer.uint32(16).uint64(message.size); + } + for (const v of message.blocks) { + VolumePutFiles2Request_Block.encode(v, writer.uint32(26).fork()).join(); + } + if (message.mode !== void 0) { + writer.uint32(32).uint32(message.mode); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request_File(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.path = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.size = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.blocks.push(VolumePutFiles2Request_Block.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.mode = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: isSet4(object.path) ? globalThis.String(object.path) : "", + size: isSet4(object.size) ? globalThis.Number(object.size) : 0, + blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e) => VolumePutFiles2Request_Block.fromJSON(e)) : [], + mode: isSet4(object.mode) ? globalThis.Number(object.mode) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.size !== 0) { + obj.size = Math.round(message.size); + } + if (message.blocks?.length) { + obj.blocks = message.blocks.map((e) => VolumePutFiles2Request_Block.toJSON(e)); + } + if (message.mode !== void 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + create(base) { + return VolumePutFiles2Request_File.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request_File(); + message.path = object.path ?? ""; + message.size = object.size ?? 0; + message.blocks = object.blocks?.map((e) => VolumePutFiles2Request_Block.fromPartial(e)) || []; + message.mode = object.mode ?? void 0; + return message; + } +}; +function createBaseVolumePutFiles2Request_Block() { + return { contentsSha256: new Uint8Array(0), putResponse: void 0 }; +} +var VolumePutFiles2Request_Block = { + encode(message, writer = new BinaryWriter()) { + if (message.contentsSha256.length !== 0) { + writer.uint32(10).bytes(message.contentsSha256); + } + if (message.putResponse !== void 0) { + writer.uint32(18).bytes(message.putResponse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Request_Block(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contentsSha256 = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.putResponse = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contentsSha256: isSet4(object.contentsSha256) ? bytesFromBase64(object.contentsSha256) : new Uint8Array(0), + putResponse: isSet4(object.putResponse) ? bytesFromBase64(object.putResponse) : void 0 + }; + }, + toJSON(message) { + const obj = {}; + if (message.contentsSha256.length !== 0) { + obj.contentsSha256 = base64FromBytes(message.contentsSha256); + } + if (message.putResponse !== void 0) { + obj.putResponse = base64FromBytes(message.putResponse); + } + return obj; + }, + create(base) { + return VolumePutFiles2Request_Block.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Request_Block(); + message.contentsSha256 = object.contentsSha256 ?? new Uint8Array(0); + message.putResponse = object.putResponse ?? void 0; + return message; + } +}; +function createBaseVolumePutFiles2Response() { + return { missingBlocks: [] }; +} +var VolumePutFiles2Response = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.missingBlocks) { + VolumePutFiles2Response_MissingBlock.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.missingBlocks.push(VolumePutFiles2Response_MissingBlock.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + missingBlocks: globalThis.Array.isArray(object?.missingBlocks) ? object.missingBlocks.map((e) => VolumePutFiles2Response_MissingBlock.fromJSON(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.missingBlocks?.length) { + obj.missingBlocks = message.missingBlocks.map((e) => VolumePutFiles2Response_MissingBlock.toJSON(e)); + } + return obj; + }, + create(base) { + return VolumePutFiles2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Response(); + message.missingBlocks = object.missingBlocks?.map((e) => VolumePutFiles2Response_MissingBlock.fromPartial(e)) || []; + return message; + } +}; +function createBaseVolumePutFiles2Response_MissingBlock() { + return { fileIndex: 0, blockIndex: 0, putUrl: "" }; +} +var VolumePutFiles2Response_MissingBlock = { + encode(message, writer = new BinaryWriter()) { + if (message.fileIndex !== 0) { + writer.uint32(8).uint64(message.fileIndex); + } + if (message.blockIndex !== 0) { + writer.uint32(16).uint64(message.blockIndex); + } + if (message.putUrl !== "") { + writer.uint32(26).string(message.putUrl); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFiles2Response_MissingBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fileIndex = longToNumber2(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.blockIndex = longToNumber2(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.putUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fileIndex: isSet4(object.fileIndex) ? globalThis.Number(object.fileIndex) : 0, + blockIndex: isSet4(object.blockIndex) ? globalThis.Number(object.blockIndex) : 0, + putUrl: isSet4(object.putUrl) ? globalThis.String(object.putUrl) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.fileIndex !== 0) { + obj.fileIndex = Math.round(message.fileIndex); + } + if (message.blockIndex !== 0) { + obj.blockIndex = Math.round(message.blockIndex); + } + if (message.putUrl !== "") { + obj.putUrl = message.putUrl; + } + return obj; + }, + create(base) { + return VolumePutFiles2Response_MissingBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFiles2Response_MissingBlock(); + message.fileIndex = object.fileIndex ?? 0; + message.blockIndex = object.blockIndex ?? 0; + message.putUrl = object.putUrl ?? ""; + return message; + } +}; +function createBaseVolumePutFilesRequest() { + return { volumeId: "", files: [], disallowOverwriteExistingFiles: false }; +} +var VolumePutFilesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + for (const v of message.files) { + MountFile.encode(v, writer.uint32(18).fork()).join(); + } + if (message.disallowOverwriteExistingFiles !== false) { + writer.uint32(24).bool(message.disallowOverwriteExistingFiles); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumePutFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.files.push(MountFile.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.disallowOverwriteExistingFiles = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => MountFile.fromJSON(e)) : [], + disallowOverwriteExistingFiles: isSet4(object.disallowOverwriteExistingFiles) ? globalThis.Boolean(object.disallowOverwriteExistingFiles) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.files?.length) { + obj.files = message.files.map((e) => MountFile.toJSON(e)); + } + if (message.disallowOverwriteExistingFiles !== false) { + obj.disallowOverwriteExistingFiles = message.disallowOverwriteExistingFiles; + } + return obj; + }, + create(base) { + return VolumePutFilesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumePutFilesRequest(); + message.volumeId = object.volumeId ?? ""; + message.files = object.files?.map((e) => MountFile.fromPartial(e)) || []; + message.disallowOverwriteExistingFiles = object.disallowOverwriteExistingFiles ?? false; + return message; + } +}; +function createBaseVolumeReloadRequest() { + return { volumeId: "" }; +} +var VolumeReloadRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeReloadRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + return obj; + }, + create(base) { + return VolumeReloadRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeReloadRequest(); + message.volumeId = object.volumeId ?? ""; + return message; + } +}; +function createBaseVolumeRemoveFile2Request() { + return { volumeId: "", path: "", recursive: false }; +} +var VolumeRemoveFile2Request = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRemoveFile2Request(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeRemoveFile2Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRemoveFile2Request(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeRemoveFileRequest() { + return { volumeId: "", path: "", recursive: false }; +} +var VolumeRemoveFileRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.recursive !== false) { + writer.uint32(24).bool(message.recursive); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRemoveFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.recursive = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + path: isSet4(object.path) ? globalThis.String(object.path) : "", + recursive: isSet4(object.recursive) ? globalThis.Boolean(object.recursive) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.recursive !== false) { + obj.recursive = message.recursive; + } + return obj; + }, + create(base) { + return VolumeRemoveFileRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRemoveFileRequest(); + message.volumeId = object.volumeId ?? ""; + message.path = object.path ?? ""; + message.recursive = object.recursive ?? false; + return message; + } +}; +function createBaseVolumeRenameRequest() { + return { volumeId: "", name: "" }; +} +var VolumeRenameRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.volumeId !== "") { + writer.uint32(10).string(message.volumeId); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseVolumeRenameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.volumeId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + volumeId: isSet4(object.volumeId) ? globalThis.String(object.volumeId) : "", + name: isSet4(object.name) ? globalThis.String(object.name) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.volumeId !== "") { + obj.volumeId = message.volumeId; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + create(base) { + return VolumeRenameRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVolumeRenameRequest(); + message.volumeId = object.volumeId ?? ""; + message.name = object.name ?? ""; + return message; + } +}; +function createBaseWarning() { + return { type: 0, message: "" }; +} +var Warning = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWarning(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? warning_WarningTypeFromJSON(object.type) : 0, + message: isSet4(object.message) ? globalThis.String(object.message) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = warning_WarningTypeToJSON(message.type); + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + create(base) { + return Warning.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWarning(); + message.type = object.type ?? 0; + message.message = object.message ?? ""; + return message; + } +}; +function createBaseWebUrlInfo() { + return { truncated: false, hasUniqueHash: false, labelStolen: false }; +} +var WebUrlInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.truncated !== false) { + writer.uint32(8).bool(message.truncated); + } + if (message.hasUniqueHash !== false) { + writer.uint32(16).bool(message.hasUniqueHash); + } + if (message.labelStolen !== false) { + writer.uint32(24).bool(message.labelStolen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWebUrlInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.truncated = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.hasUniqueHash = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.labelStolen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + truncated: isSet4(object.truncated) ? globalThis.Boolean(object.truncated) : false, + hasUniqueHash: isSet4(object.hasUniqueHash) ? globalThis.Boolean(object.hasUniqueHash) : false, + labelStolen: isSet4(object.labelStolen) ? globalThis.Boolean(object.labelStolen) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.truncated !== false) { + obj.truncated = message.truncated; + } + if (message.hasUniqueHash !== false) { + obj.hasUniqueHash = message.hasUniqueHash; + } + if (message.labelStolen !== false) { + obj.labelStolen = message.labelStolen; + } + return obj; + }, + create(base) { + return WebUrlInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWebUrlInfo(); + message.truncated = object.truncated ?? false; + message.hasUniqueHash = object.hasUniqueHash ?? false; + message.labelStolen = object.labelStolen ?? false; + return message; + } +}; +function createBaseWebhookConfig() { + return { + type: 0, + method: "", + requestedSuffix: "", + asyncMode: 0, + customDomains: [], + webServerPort: 0, + webServerStartupTimeout: 0, + webEndpointDocs: false, + requiresProxyAuth: false + }; +} +var WebhookConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.method !== "") { + writer.uint32(18).string(message.method); + } + if (message.requestedSuffix !== "") { + writer.uint32(34).string(message.requestedSuffix); + } + if (message.asyncMode !== 0) { + writer.uint32(40).int32(message.asyncMode); + } + for (const v of message.customDomains) { + CustomDomainConfig.encode(v, writer.uint32(50).fork()).join(); + } + if (message.webServerPort !== 0) { + writer.uint32(56).uint32(message.webServerPort); + } + if (message.webServerStartupTimeout !== 0) { + writer.uint32(69).float(message.webServerStartupTimeout); + } + if (message.webEndpointDocs !== false) { + writer.uint32(72).bool(message.webEndpointDocs); + } + if (message.requiresProxyAuth !== false) { + writer.uint32(80).bool(message.requiresProxyAuth); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWebhookConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.method = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.requestedSuffix = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.asyncMode = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.customDomains.push(CustomDomainConfig.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.webServerPort = reader.uint32(); + continue; + } + case 8: { + if (tag !== 69) { + break; + } + message.webServerStartupTimeout = reader.float(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.webEndpointDocs = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.requiresProxyAuth = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet4(object.type) ? webhookTypeFromJSON(object.type) : 0, + method: isSet4(object.method) ? globalThis.String(object.method) : "", + requestedSuffix: isSet4(object.requestedSuffix) ? globalThis.String(object.requestedSuffix) : "", + asyncMode: isSet4(object.asyncMode) ? webhookAsyncModeFromJSON(object.asyncMode) : 0, + customDomains: globalThis.Array.isArray(object?.customDomains) ? object.customDomains.map((e) => CustomDomainConfig.fromJSON(e)) : [], + webServerPort: isSet4(object.webServerPort) ? globalThis.Number(object.webServerPort) : 0, + webServerStartupTimeout: isSet4(object.webServerStartupTimeout) ? globalThis.Number(object.webServerStartupTimeout) : 0, + webEndpointDocs: isSet4(object.webEndpointDocs) ? globalThis.Boolean(object.webEndpointDocs) : false, + requiresProxyAuth: isSet4(object.requiresProxyAuth) ? globalThis.Boolean(object.requiresProxyAuth) : false + }; + }, + toJSON(message) { + const obj = {}; + if (message.type !== 0) { + obj.type = webhookTypeToJSON(message.type); + } + if (message.method !== "") { + obj.method = message.method; + } + if (message.requestedSuffix !== "") { + obj.requestedSuffix = message.requestedSuffix; + } + if (message.asyncMode !== 0) { + obj.asyncMode = webhookAsyncModeToJSON(message.asyncMode); + } + if (message.customDomains?.length) { + obj.customDomains = message.customDomains.map((e) => CustomDomainConfig.toJSON(e)); + } + if (message.webServerPort !== 0) { + obj.webServerPort = Math.round(message.webServerPort); + } + if (message.webServerStartupTimeout !== 0) { + obj.webServerStartupTimeout = message.webServerStartupTimeout; + } + if (message.webEndpointDocs !== false) { + obj.webEndpointDocs = message.webEndpointDocs; + } + if (message.requiresProxyAuth !== false) { + obj.requiresProxyAuth = message.requiresProxyAuth; + } + return obj; + }, + create(base) { + return WebhookConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWebhookConfig(); + message.type = object.type ?? 0; + message.method = object.method ?? ""; + message.requestedSuffix = object.requestedSuffix ?? ""; + message.asyncMode = object.asyncMode ?? 0; + message.customDomains = object.customDomains?.map((e) => CustomDomainConfig.fromPartial(e)) || []; + message.webServerPort = object.webServerPort ?? 0; + message.webServerStartupTimeout = object.webServerStartupTimeout ?? 0; + message.webEndpointDocs = object.webEndpointDocs ?? false; + message.requiresProxyAuth = object.requiresProxyAuth ?? false; + return message; + } +}; +function createBaseWorkspaceBillingReportItem() { + return { objectId: "", description: "", environmentName: "", interval: void 0, cost: "", tags: {} }; +} +var WorkspaceBillingReportItem = { + encode(message, writer = new BinaryWriter()) { + if (message.objectId !== "") { + writer.uint32(10).string(message.objectId); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.environmentName !== "") { + writer.uint32(26).string(message.environmentName); + } + if (message.interval !== void 0) { + Timestamp.encode(toTimestamp(message.interval), writer.uint32(34).fork()).join(); + } + if (message.cost !== "") { + writer.uint32(42).string(message.cost); + } + Object.entries(message.tags).forEach(([key, value]) => { + WorkspaceBillingReportItem_TagsEntry.encode({ key, value }, writer.uint32(50).fork()).join(); + }); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.objectId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.environmentName = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.interval = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.cost = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + const entry6 = WorkspaceBillingReportItem_TagsEntry.decode(reader, reader.uint32()); + if (entry6.value !== void 0) { + message.tags[entry6.key] = entry6.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + objectId: isSet4(object.objectId) ? globalThis.String(object.objectId) : "", + description: isSet4(object.description) ? globalThis.String(object.description) : "", + environmentName: isSet4(object.environmentName) ? globalThis.String(object.environmentName) : "", + interval: isSet4(object.interval) ? fromJsonTimestamp(object.interval) : void 0, + cost: isSet4(object.cost) ? globalThis.String(object.cost) : "", + tags: isObject2(object.tags) ? Object.entries(object.tags).reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) : {} + }; + }, + toJSON(message) { + const obj = {}; + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.environmentName !== "") { + obj.environmentName = message.environmentName; + } + if (message.interval !== void 0) { + obj.interval = message.interval.toISOString(); + } + if (message.cost !== "") { + obj.cost = message.cost; + } + if (message.tags) { + const entries = Object.entries(message.tags); + if (entries.length > 0) { + obj.tags = {}; + entries.forEach(([k, v]) => { + obj.tags[k] = v; + }); + } + } + return obj; + }, + create(base) { + return WorkspaceBillingReportItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportItem(); + message.objectId = object.objectId ?? ""; + message.description = object.description ?? ""; + message.environmentName = object.environmentName ?? ""; + message.interval = object.interval ?? void 0; + message.cost = object.cost ?? ""; + message.tags = Object.entries(object.tags ?? {}).reduce((acc, [key, value]) => { + if (value !== void 0) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); + return message; + } +}; +function createBaseWorkspaceBillingReportItem_TagsEntry() { + return { key: "", value: "" }; +} +var WorkspaceBillingReportItem_TagsEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportItem_TagsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet4(object.key) ? globalThis.String(object.key) : "", + value: isSet4(object.value) ? globalThis.String(object.value) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return WorkspaceBillingReportItem_TagsEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportItem_TagsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + } +}; +function createBaseWorkspaceBillingReportRequest() { + return { startTimestamp: void 0, endTimestamp: void 0, resolution: "", tagNames: [] }; +} +var WorkspaceBillingReportRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.startTimestamp !== void 0) { + Timestamp.encode(toTimestamp(message.startTimestamp), writer.uint32(10).fork()).join(); + } + if (message.endTimestamp !== void 0) { + Timestamp.encode(toTimestamp(message.endTimestamp), writer.uint32(18).fork()).join(); + } + if (message.resolution !== "") { + writer.uint32(26).string(message.resolution); + } + for (const v of message.tagNames) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceBillingReportRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.startTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.endTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.resolution = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.tagNames.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + startTimestamp: isSet4(object.startTimestamp) ? fromJsonTimestamp(object.startTimestamp) : void 0, + endTimestamp: isSet4(object.endTimestamp) ? fromJsonTimestamp(object.endTimestamp) : void 0, + resolution: isSet4(object.resolution) ? globalThis.String(object.resolution) : "", + tagNames: globalThis.Array.isArray(object?.tagNames) ? object.tagNames.map((e) => globalThis.String(e)) : [] + }; + }, + toJSON(message) { + const obj = {}; + if (message.startTimestamp !== void 0) { + obj.startTimestamp = message.startTimestamp.toISOString(); + } + if (message.endTimestamp !== void 0) { + obj.endTimestamp = message.endTimestamp.toISOString(); + } + if (message.resolution !== "") { + obj.resolution = message.resolution; + } + if (message.tagNames?.length) { + obj.tagNames = message.tagNames; + } + return obj; + }, + create(base) { + return WorkspaceBillingReportRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceBillingReportRequest(); + message.startTimestamp = object.startTimestamp ?? void 0; + message.endTimestamp = object.endTimestamp ?? void 0; + message.resolution = object.resolution ?? ""; + message.tagNames = object.tagNames?.map((e) => e) || []; + return message; + } +}; +function createBaseWorkspaceNameLookupResponse() { + return { workspaceName: "", username: "" }; +} +var WorkspaceNameLookupResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.workspaceName !== "") { + writer.uint32(10).string(message.workspaceName); + } + if (message.username !== "") { + writer.uint32(18).string(message.username); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === void 0 ? reader.len : reader.pos + length; + const message = createBaseWorkspaceNameLookupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.workspaceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.username = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + workspaceName: isSet4(object.workspaceName) ? globalThis.String(object.workspaceName) : "", + username: isSet4(object.username) ? globalThis.String(object.username) : "" + }; + }, + toJSON(message) { + const obj = {}; + if (message.workspaceName !== "") { + obj.workspaceName = message.workspaceName; + } + if (message.username !== "") { + obj.username = message.username; + } + return obj; + }, + create(base) { + return WorkspaceNameLookupResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWorkspaceNameLookupResponse(); + message.workspaceName = object.workspaceName ?? ""; + message.username = object.username ?? ""; + return message; + } +}; +var ModalClientDefinition = { + name: "ModalClient", + fullName: "modal.client.ModalClient", + methods: { + /** Apps */ + appClientDisconnect: { + name: "AppClientDisconnect", + requestType: AppClientDisconnectRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appCreate: { + name: "AppCreate", + requestType: AppCreateRequest, + requestStream: false, + responseType: AppCreateResponse, + responseStream: false, + options: {} + }, + appDeploy: { + name: "AppDeploy", + requestType: AppDeployRequest, + requestStream: false, + responseType: AppDeployResponse, + responseStream: false, + options: {} + }, + appDeploymentHistory: { + name: "AppDeploymentHistory", + requestType: AppDeploymentHistoryRequest, + requestStream: false, + responseType: AppDeploymentHistoryResponse, + responseStream: false, + options: {} + }, + appGetByDeploymentName: { + name: "AppGetByDeploymentName", + requestType: AppGetByDeploymentNameRequest, + requestStream: false, + responseType: AppGetByDeploymentNameResponse, + responseStream: false, + options: {} + }, + appGetLayout: { + name: "AppGetLayout", + requestType: AppGetLayoutRequest, + requestStream: false, + responseType: AppGetLayoutResponse, + responseStream: false, + options: {} + }, + appGetLogs: { + name: "AppGetLogs", + requestType: AppGetLogsRequest, + requestStream: false, + responseType: TaskLogsBatch, + responseStream: true, + options: {} + }, + appGetObjects: { + name: "AppGetObjects", + requestType: AppGetObjectsRequest, + requestStream: false, + responseType: AppGetObjectsResponse, + responseStream: false, + options: {} + }, + appGetOrCreate: { + name: "AppGetOrCreate", + requestType: AppGetOrCreateRequest, + requestStream: false, + responseType: AppGetOrCreateResponse, + responseStream: false, + options: {} + }, + appGetTags: { + name: "AppGetTags", + requestType: AppGetTagsRequest, + requestStream: false, + responseType: AppGetTagsResponse, + responseStream: false, + options: {} + }, + appHeartbeat: { + name: "AppHeartbeat", + requestType: AppHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appList: { + name: "AppList", + requestType: AppListRequest, + requestStream: false, + responseType: AppListResponse, + responseStream: false, + options: {} + }, + appLookup: { + name: "AppLookup", + requestType: AppLookupRequest, + requestStream: false, + responseType: AppLookupResponse, + responseStream: false, + options: {} + }, + appPublish: { + name: "AppPublish", + requestType: AppPublishRequest, + requestStream: false, + responseType: AppPublishResponse, + responseStream: false, + options: {} + }, + appRollback: { + name: "AppRollback", + requestType: AppRollbackRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appSetObjects: { + name: "AppSetObjects", + requestType: AppSetObjectsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appSetTags: { + name: "AppSetTags", + requestType: AppSetTagsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + appStop: { + name: "AppStop", + requestType: AppStopRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Input Plane */ + attemptAwait: { + name: "AttemptAwait", + requestType: AttemptAwaitRequest, + requestStream: false, + responseType: AttemptAwaitResponse, + responseStream: false, + options: {} + }, + attemptRetry: { + name: "AttemptRetry", + requestType: AttemptRetryRequest, + requestStream: false, + responseType: AttemptRetryResponse, + responseStream: false, + options: {} + }, + attemptStart: { + name: "AttemptStart", + requestType: AttemptStartRequest, + requestStream: false, + responseType: AttemptStartResponse, + responseStream: false, + options: {} + }, + /** Auth Token */ + authTokenGet: { + name: "AuthTokenGet", + requestType: AuthTokenGetRequest, + requestStream: false, + responseType: AuthTokenGetResponse, + responseStream: false, + options: {} + }, + /** Blobs */ + blobCreate: { + name: "BlobCreate", + requestType: BlobCreateRequest, + requestStream: false, + responseType: BlobCreateResponse, + responseStream: false, + options: {} + }, + blobGet: { + name: "BlobGet", + requestType: BlobGetRequest, + requestStream: false, + responseType: BlobGetResponse, + responseStream: false, + options: {} + }, + /** Classes */ + classCreate: { + name: "ClassCreate", + requestType: ClassCreateRequest, + requestStream: false, + responseType: ClassCreateResponse, + responseStream: false, + options: {} + }, + classGet: { + name: "ClassGet", + requestType: ClassGetRequest, + requestStream: false, + responseType: ClassGetResponse, + responseStream: false, + options: {} + }, + /** Clients */ + clientHello: { + name: "ClientHello", + requestType: Empty, + requestStream: false, + responseType: ClientHelloResponse, + responseStream: false, + options: {} + }, + /** Clusters */ + clusterGet: { + name: "ClusterGet", + requestType: ClusterGetRequest, + requestStream: false, + responseType: ClusterGetResponse, + responseStream: false, + options: {} + }, + clusterList: { + name: "ClusterList", + requestType: ClusterListRequest, + requestStream: false, + responseType: ClusterListResponse, + responseStream: false, + options: {} + }, + /** Container */ + containerCheckpoint: { + name: "ContainerCheckpoint", + requestType: ContainerCheckpointRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerExec: { + name: "ContainerExec", + requestType: ContainerExecRequest, + requestStream: false, + responseType: ContainerExecResponse, + responseStream: false, + options: {} + }, + containerExecGetOutput: { + name: "ContainerExecGetOutput", + requestType: ContainerExecGetOutputRequest, + requestStream: false, + responseType: RuntimeOutputBatch, + responseStream: true, + options: {} + }, + containerExecPutInput: { + name: "ContainerExecPutInput", + requestType: ContainerExecPutInputRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerExecWait: { + name: "ContainerExecWait", + requestType: ContainerExecWaitRequest, + requestStream: false, + responseType: ContainerExecWaitResponse, + responseStream: false, + options: {} + }, + containerFilesystemExec: { + name: "ContainerFilesystemExec", + requestType: ContainerFilesystemExecRequest, + requestStream: false, + responseType: ContainerFilesystemExecResponse, + responseStream: false, + options: {} + }, + containerFilesystemExecGetOutput: { + name: "ContainerFilesystemExecGetOutput", + requestType: ContainerFilesystemExecGetOutputRequest, + requestStream: false, + responseType: FilesystemRuntimeOutputBatch, + responseStream: true, + options: {} + }, + containerHeartbeat: { + name: "ContainerHeartbeat", + requestType: ContainerHeartbeatRequest, + requestStream: false, + responseType: ContainerHeartbeatResponse, + responseStream: false, + options: {} + }, + containerHello: { + name: "ContainerHello", + requestType: Empty, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerLog: { + name: "ContainerLog", + requestType: ContainerLogRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + containerReloadVolumes: { + name: "ContainerReloadVolumes", + requestType: ContainerReloadVolumesRequest, + requestStream: false, + responseType: ContainerReloadVolumesResponse, + responseStream: false, + options: {} + }, + containerStop: { + name: "ContainerStop", + requestType: ContainerStopRequest, + requestStream: false, + responseType: ContainerStopResponse, + responseStream: false, + options: {} + }, + /** Dicts */ + dictClear: { + name: "DictClear", + requestType: DictClearRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictContains: { + name: "DictContains", + requestType: DictContainsRequest, + requestStream: false, + responseType: DictContainsResponse, + responseStream: false, + options: {} + }, + dictContents: { + name: "DictContents", + requestType: DictContentsRequest, + requestStream: false, + responseType: DictEntry, + responseStream: true, + options: {} + }, + dictDelete: { + name: "DictDelete", + requestType: DictDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictGet: { + name: "DictGet", + requestType: DictGetRequest, + requestStream: false, + responseType: DictGetResponse, + responseStream: false, + options: {} + }, + dictGetOrCreate: { + name: "DictGetOrCreate", + requestType: DictGetOrCreateRequest, + requestStream: false, + responseType: DictGetOrCreateResponse, + responseStream: false, + options: {} + }, + dictHeartbeat: { + name: "DictHeartbeat", + requestType: DictHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + dictLen: { + name: "DictLen", + requestType: DictLenRequest, + requestStream: false, + responseType: DictLenResponse, + responseStream: false, + options: {} + }, + dictList: { + name: "DictList", + requestType: DictListRequest, + requestStream: false, + responseType: DictListResponse, + responseStream: false, + options: {} + }, + dictPop: { + name: "DictPop", + requestType: DictPopRequest, + requestStream: false, + responseType: DictPopResponse, + responseStream: false, + options: {} + }, + dictUpdate: { + name: "DictUpdate", + requestType: DictUpdateRequest, + requestStream: false, + responseType: DictUpdateResponse, + responseStream: false, + options: {} + }, + /** Domains */ + domainCertificateVerify: { + name: "DomainCertificateVerify", + requestType: DomainCertificateVerifyRequest, + requestStream: false, + responseType: DomainCertificateVerifyResponse, + responseStream: false, + options: {} + }, + domainCreate: { + name: "DomainCreate", + requestType: DomainCreateRequest, + requestStream: false, + responseType: DomainCreateResponse, + responseStream: false, + options: {} + }, + domainList: { + name: "DomainList", + requestType: DomainListRequest, + requestStream: false, + responseType: DomainListResponse, + responseStream: false, + options: {} + }, + /** Environments */ + environmentCreate: { + name: "EnvironmentCreate", + requestType: EnvironmentCreateRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + environmentDelete: { + name: "EnvironmentDelete", + requestType: EnvironmentDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + environmentGetOrCreate: { + name: "EnvironmentGetOrCreate", + requestType: EnvironmentGetOrCreateRequest, + requestStream: false, + responseType: EnvironmentGetOrCreateResponse, + responseStream: false, + options: {} + }, + environmentList: { + name: "EnvironmentList", + requestType: Empty, + requestStream: false, + responseType: EnvironmentListResponse, + responseStream: false, + options: {} + }, + environmentUpdate: { + name: "EnvironmentUpdate", + requestType: EnvironmentUpdateRequest, + requestStream: false, + responseType: EnvironmentListItem, + responseStream: false, + options: {} + }, + /** Modal Flash (experimental) */ + flashContainerDeregister: { + name: "FlashContainerDeregister", + requestType: FlashContainerDeregisterRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + flashContainerList: { + name: "FlashContainerList", + requestType: FlashContainerListRequest, + requestStream: false, + responseType: FlashContainerListResponse, + responseStream: false, + options: {} + }, + flashContainerRegister: { + name: "FlashContainerRegister", + requestType: FlashContainerRegisterRequest, + requestStream: false, + responseType: FlashContainerRegisterResponse, + responseStream: false, + options: {} + }, + flashSetTargetSlotsMetrics: { + name: "FlashSetTargetSlotsMetrics", + requestType: FlashSetTargetSlotsMetricsRequest, + requestStream: false, + responseType: FlashSetTargetSlotsMetricsResponse, + responseStream: false, + options: {} + }, + /** Functions */ + functionAsyncInvoke: { + name: "FunctionAsyncInvoke", + requestType: FunctionAsyncInvokeRequest, + requestStream: false, + responseType: FunctionAsyncInvokeResponse, + responseStream: false, + options: {} + }, + functionBindParams: { + name: "FunctionBindParams", + requestType: FunctionBindParamsRequest, + requestStream: false, + responseType: FunctionBindParamsResponse, + responseStream: false, + options: {} + }, + functionCallCancel: { + name: "FunctionCallCancel", + requestType: FunctionCallCancelRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionCallFromId: { + name: "FunctionCallFromId", + requestType: FunctionCallFromIdRequest, + requestStream: false, + responseType: FunctionCallFromIdResponse, + responseStream: false, + options: {} + }, + functionCallGetDataIn: { + name: "FunctionCallGetDataIn", + requestType: FunctionCallGetDataRequest, + requestStream: false, + responseType: DataChunk, + responseStream: true, + options: {} + }, + functionCallGetDataOut: { + name: "FunctionCallGetDataOut", + requestType: FunctionCallGetDataRequest, + requestStream: false, + responseType: DataChunk, + responseStream: true, + options: {} + }, + functionCallList: { + name: "FunctionCallList", + requestType: FunctionCallListRequest, + requestStream: false, + responseType: FunctionCallListResponse, + responseStream: false, + options: {} + }, + functionCallPutDataOut: { + name: "FunctionCallPutDataOut", + requestType: FunctionCallPutDataRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionCreate: { + name: "FunctionCreate", + requestType: FunctionCreateRequest, + requestStream: false, + responseType: FunctionCreateResponse, + responseStream: false, + options: {} + }, + /** For map RPCs, to signal that all inputs have been sent */ + functionFinishInputs: { + name: "FunctionFinishInputs", + requestType: FunctionFinishInputsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionGet: { + name: "FunctionGet", + requestType: FunctionGetRequest, + requestStream: false, + responseType: FunctionGetResponse, + responseStream: false, + options: {} + }, + functionGetCallGraph: { + name: "FunctionGetCallGraph", + requestType: FunctionGetCallGraphRequest, + requestStream: false, + responseType: FunctionGetCallGraphResponse, + responseStream: false, + options: {} + }, + functionGetCurrentStats: { + name: "FunctionGetCurrentStats", + requestType: FunctionGetCurrentStatsRequest, + requestStream: false, + responseType: FunctionStats, + responseStream: false, + options: {} + }, + functionGetDynamicConcurrency: { + name: "FunctionGetDynamicConcurrency", + requestType: FunctionGetDynamicConcurrencyRequest, + requestStream: false, + responseType: FunctionGetDynamicConcurrencyResponse, + responseStream: false, + options: {} + }, + /** For containers to request next call */ + functionGetInputs: { + name: "FunctionGetInputs", + requestType: FunctionGetInputsRequest, + requestStream: false, + responseType: FunctionGetInputsResponse, + responseStream: false, + options: {} + }, + /** Returns the next result(s) for an entire function call (FunctionMap) */ + functionGetOutputs: { + name: "FunctionGetOutputs", + requestType: FunctionGetOutputsRequest, + requestStream: false, + responseType: FunctionGetOutputsResponse, + responseStream: false, + options: {} + }, + functionGetSerialized: { + name: "FunctionGetSerialized", + requestType: FunctionGetSerializedRequest, + requestStream: false, + responseType: FunctionGetSerializedResponse, + responseStream: false, + options: {} + }, + functionMap: { + name: "FunctionMap", + requestType: FunctionMapRequest, + requestStream: false, + responseType: FunctionMapResponse, + responseStream: false, + options: {} + }, + functionPrecreate: { + name: "FunctionPrecreate", + requestType: FunctionPrecreateRequest, + requestStream: false, + responseType: FunctionPrecreateResponse, + responseStream: false, + options: {} + }, + functionPutInputs: { + name: "FunctionPutInputs", + requestType: FunctionPutInputsRequest, + requestStream: false, + responseType: FunctionPutInputsResponse, + responseStream: false, + options: {} + }, + /** For containers to return result */ + functionPutOutputs: { + name: "FunctionPutOutputs", + requestType: FunctionPutOutputsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionRetryInputs: { + name: "FunctionRetryInputs", + requestType: FunctionRetryInputsRequest, + requestStream: false, + responseType: FunctionRetryInputsResponse, + responseStream: false, + options: {} + }, + functionStartPtyShell: { + name: "FunctionStartPtyShell", + requestType: Empty, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + functionUpdateSchedulingParams: { + name: "FunctionUpdateSchedulingParams", + requestType: FunctionUpdateSchedulingParamsRequest, + requestStream: false, + responseType: FunctionUpdateSchedulingParamsResponse, + responseStream: false, + options: {} + }, + /** Images */ + imageDelete: { + name: "ImageDelete", + requestType: ImageDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + imageFromId: { + name: "ImageFromId", + requestType: ImageFromIdRequest, + requestStream: false, + responseType: ImageFromIdResponse, + responseStream: false, + options: {} + }, + imageGetOrCreate: { + name: "ImageGetOrCreate", + requestType: ImageGetOrCreateRequest, + requestStream: false, + responseType: ImageGetOrCreateResponse, + responseStream: false, + options: {} + }, + imageJoinStreaming: { + name: "ImageJoinStreaming", + requestType: ImageJoinStreamingRequest, + requestStream: false, + responseType: ImageJoinStreamingResponse, + responseStream: true, + options: {} + }, + /** Input Plane Map */ + mapAwait: { + name: "MapAwait", + requestType: MapAwaitRequest, + requestStream: false, + responseType: MapAwaitResponse, + responseStream: false, + options: {} + }, + mapCheckInputs: { + name: "MapCheckInputs", + requestType: MapCheckInputsRequest, + requestStream: false, + responseType: MapCheckInputsResponse, + responseStream: false, + options: {} + }, + mapStartOrContinue: { + name: "MapStartOrContinue", + requestType: MapStartOrContinueRequest, + requestStream: false, + responseType: MapStartOrContinueResponse, + responseStream: false, + options: {} + }, + /** Mounts */ + mountGetOrCreate: { + name: "MountGetOrCreate", + requestType: MountGetOrCreateRequest, + requestStream: false, + responseType: MountGetOrCreateResponse, + responseStream: false, + options: {} + }, + mountPutFile: { + name: "MountPutFile", + requestType: MountPutFileRequest, + requestStream: false, + responseType: MountPutFileResponse, + responseStream: false, + options: {} + }, + /** Notebooks */ + notebookKernelPublishResults: { + name: "NotebookKernelPublishResults", + requestType: NotebookKernelPublishResultsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Proxies */ + proxyAddIp: { + name: "ProxyAddIp", + requestType: ProxyAddIpRequest, + requestStream: false, + responseType: ProxyAddIpResponse, + responseStream: false, + options: {} + }, + proxyCreate: { + name: "ProxyCreate", + requestType: ProxyCreateRequest, + requestStream: false, + responseType: ProxyCreateResponse, + responseStream: false, + options: {} + }, + proxyDelete: { + name: "ProxyDelete", + requestType: ProxyDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + proxyGet: { + name: "ProxyGet", + requestType: ProxyGetRequest, + requestStream: false, + responseType: ProxyGetResponse, + responseStream: false, + options: {} + }, + proxyGetOrCreate: { + name: "ProxyGetOrCreate", + requestType: ProxyGetOrCreateRequest, + requestStream: false, + responseType: ProxyGetOrCreateResponse, + responseStream: false, + options: {} + }, + proxyList: { + name: "ProxyList", + requestType: Empty, + requestStream: false, + responseType: ProxyListResponse, + responseStream: false, + options: {} + }, + proxyRemoveIp: { + name: "ProxyRemoveIp", + requestType: ProxyRemoveIpRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Queues */ + queueClear: { + name: "QueueClear", + requestType: QueueClearRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueDelete: { + name: "QueueDelete", + requestType: QueueDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueGet: { + name: "QueueGet", + requestType: QueueGetRequest, + requestStream: false, + responseType: QueueGetResponse, + responseStream: false, + options: {} + }, + queueGetOrCreate: { + name: "QueueGetOrCreate", + requestType: QueueGetOrCreateRequest, + requestStream: false, + responseType: QueueGetOrCreateResponse, + responseStream: false, + options: {} + }, + queueHeartbeat: { + name: "QueueHeartbeat", + requestType: QueueHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + queueLen: { + name: "QueueLen", + requestType: QueueLenRequest, + requestStream: false, + responseType: QueueLenResponse, + responseStream: false, + options: {} + }, + queueList: { + name: "QueueList", + requestType: QueueListRequest, + requestStream: false, + responseType: QueueListResponse, + responseStream: false, + options: {} + }, + queueNextItems: { + name: "QueueNextItems", + requestType: QueueNextItemsRequest, + requestStream: false, + responseType: QueueNextItemsResponse, + responseStream: false, + options: {} + }, + queuePut: { + name: "QueuePut", + requestType: QueuePutRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Sandboxes */ + sandboxCreate: { + name: "SandboxCreate", + requestType: SandboxCreateRequest, + requestStream: false, + responseType: SandboxCreateResponse, + responseStream: false, + options: {} + }, + sandboxCreateConnectToken: { + name: "SandboxCreateConnectToken", + requestType: SandboxCreateConnectTokenRequest, + requestStream: false, + responseType: SandboxCreateConnectTokenResponse, + responseStream: false, + options: {} + }, + sandboxGetCommandRouterAccess: { + name: "SandboxGetCommandRouterAccess", + requestType: SandboxGetCommandRouterAccessRequest, + requestStream: false, + responseType: SandboxGetCommandRouterAccessResponse, + responseStream: false, + options: {} + }, + sandboxGetFromName: { + name: "SandboxGetFromName", + requestType: SandboxGetFromNameRequest, + requestStream: false, + responseType: SandboxGetFromNameResponse, + responseStream: false, + options: {} + }, + sandboxGetLogs: { + name: "SandboxGetLogs", + requestType: SandboxGetLogsRequest, + requestStream: false, + responseType: TaskLogsBatch, + responseStream: true, + options: {} + }, + sandboxGetResourceUsage: { + name: "SandboxGetResourceUsage", + requestType: SandboxGetResourceUsageRequest, + requestStream: false, + responseType: SandboxGetResourceUsageResponse, + responseStream: false, + options: {} + }, + /** needed for modal container exec */ + sandboxGetTaskId: { + name: "SandboxGetTaskId", + requestType: SandboxGetTaskIdRequest, + requestStream: false, + responseType: SandboxGetTaskIdResponse, + responseStream: false, + options: {} + }, + sandboxGetTunnels: { + name: "SandboxGetTunnels", + requestType: SandboxGetTunnelsRequest, + requestStream: false, + responseType: SandboxGetTunnelsResponse, + responseStream: false, + options: {} + }, + sandboxList: { + name: "SandboxList", + requestType: SandboxListRequest, + requestStream: false, + responseType: SandboxListResponse, + responseStream: false, + options: {} + }, + sandboxRestore: { + name: "SandboxRestore", + requestType: SandboxRestoreRequest, + requestStream: false, + responseType: SandboxRestoreResponse, + responseStream: false, + options: {} + }, + sandboxSnapshot: { + name: "SandboxSnapshot", + requestType: SandboxSnapshotRequest, + requestStream: false, + responseType: SandboxSnapshotResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFs: { + name: "SandboxSnapshotFs", + requestType: SandboxSnapshotFsRequest, + requestStream: false, + responseType: SandboxSnapshotFsResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFsAsync: { + name: "SandboxSnapshotFsAsync", + requestType: SandboxSnapshotFsAsyncRequest, + requestStream: false, + responseType: SandboxSnapshotFsAsyncResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotFsAsyncGet: { + name: "SandboxSnapshotFsAsyncGet", + requestType: SandboxSnapshotFsAsyncGetRequest, + requestStream: false, + responseType: SandboxSnapshotFsResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotGet: { + name: "SandboxSnapshotGet", + requestType: SandboxSnapshotGetRequest, + requestStream: false, + responseType: SandboxSnapshotGetResponse, + responseStream: false, + options: {} + }, + sandboxSnapshotWait: { + name: "SandboxSnapshotWait", + requestType: SandboxSnapshotWaitRequest, + requestStream: false, + responseType: SandboxSnapshotWaitResponse, + responseStream: false, + options: {} + }, + sandboxStdinWrite: { + name: "SandboxStdinWrite", + requestType: SandboxStdinWriteRequest, + requestStream: false, + responseType: SandboxStdinWriteResponse, + responseStream: false, + options: {} + }, + sandboxTagsGet: { + name: "SandboxTagsGet", + requestType: SandboxTagsGetRequest, + requestStream: false, + responseType: SandboxTagsGetResponse, + responseStream: false, + options: {} + }, + sandboxTagsSet: { + name: "SandboxTagsSet", + requestType: SandboxTagsSetRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sandboxTerminate: { + name: "SandboxTerminate", + requestType: SandboxTerminateRequest, + requestStream: false, + responseType: SandboxTerminateResponse, + responseStream: false, + options: {} + }, + sandboxWait: { + name: "SandboxWait", + requestType: SandboxWaitRequest, + requestStream: false, + responseType: SandboxWaitResponse, + responseStream: false, + options: {} + }, + /** Secrets */ + secretDelete: { + name: "SecretDelete", + requestType: SecretDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + secretGetOrCreate: { + name: "SecretGetOrCreate", + requestType: SecretGetOrCreateRequest, + requestStream: false, + responseType: SecretGetOrCreateResponse, + responseStream: false, + options: {} + }, + secretList: { + name: "SecretList", + requestType: SecretListRequest, + requestStream: false, + responseType: SecretListResponse, + responseStream: false, + options: {} + }, + /** SharedVolumes */ + sharedVolumeDelete: { + name: "SharedVolumeDelete", + requestType: SharedVolumeDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sharedVolumeGetFile: { + name: "SharedVolumeGetFile", + requestType: SharedVolumeGetFileRequest, + requestStream: false, + responseType: SharedVolumeGetFileResponse, + responseStream: false, + options: {} + }, + sharedVolumeGetOrCreate: { + name: "SharedVolumeGetOrCreate", + requestType: SharedVolumeGetOrCreateRequest, + requestStream: false, + responseType: SharedVolumeGetOrCreateResponse, + responseStream: false, + options: {} + }, + sharedVolumeHeartbeat: { + name: "SharedVolumeHeartbeat", + requestType: SharedVolumeHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + sharedVolumeList: { + name: "SharedVolumeList", + requestType: SharedVolumeListRequest, + requestStream: false, + responseType: SharedVolumeListResponse, + responseStream: false, + options: {} + }, + sharedVolumeListFiles: { + name: "SharedVolumeListFiles", + requestType: SharedVolumeListFilesRequest, + requestStream: false, + responseType: SharedVolumeListFilesResponse, + responseStream: false, + options: {} + }, + sharedVolumeListFilesStream: { + name: "SharedVolumeListFilesStream", + requestType: SharedVolumeListFilesRequest, + requestStream: false, + responseType: SharedVolumeListFilesResponse, + responseStream: true, + options: {} + }, + sharedVolumePutFile: { + name: "SharedVolumePutFile", + requestType: SharedVolumePutFileRequest, + requestStream: false, + responseType: SharedVolumePutFileResponse, + responseStream: false, + options: {} + }, + sharedVolumeRemoveFile: { + name: "SharedVolumeRemoveFile", + requestType: SharedVolumeRemoveFileRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Tasks */ + taskClusterHello: { + name: "TaskClusterHello", + requestType: TaskClusterHelloRequest, + requestStream: false, + responseType: TaskClusterHelloResponse, + responseStream: false, + options: {} + }, + taskCurrentInputs: { + name: "TaskCurrentInputs", + requestType: Empty, + requestStream: false, + responseType: TaskCurrentInputsResponse, + responseStream: false, + options: {} + }, + /** Used for flash autoscaling */ + taskGetAutoscalingMetrics: { + name: "TaskGetAutoscalingMetrics", + requestType: TaskGetAutoscalingMetricsRequest, + requestStream: false, + responseType: TaskGetAutoscalingMetricsResponse, + responseStream: false, + options: {} + }, + taskGetCommandRouterAccess: { + name: "TaskGetCommandRouterAccess", + requestType: TaskGetCommandRouterAccessRequest, + requestStream: false, + responseType: TaskGetCommandRouterAccessResponse, + responseStream: false, + options: {} + }, + taskList: { + name: "TaskList", + requestType: TaskListRequest, + requestStream: false, + responseType: TaskListResponse, + responseStream: false, + options: {} + }, + taskResult: { + name: "TaskResult", + requestType: TaskResultRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Tokens (web auth flow) */ + tokenFlowCreate: { + name: "TokenFlowCreate", + requestType: TokenFlowCreateRequest, + requestStream: false, + responseType: TokenFlowCreateResponse, + responseStream: false, + options: {} + }, + tokenFlowWait: { + name: "TokenFlowWait", + requestType: TokenFlowWaitRequest, + requestStream: false, + responseType: TokenFlowWaitResponse, + responseStream: false, + options: {} + }, + /** Tunnels */ + tunnelStart: { + name: "TunnelStart", + requestType: TunnelStartRequest, + requestStream: false, + responseType: TunnelStartResponse, + responseStream: false, + options: {} + }, + tunnelStop: { + name: "TunnelStop", + requestType: TunnelStopRequest, + requestStream: false, + responseType: TunnelStopResponse, + responseStream: false, + options: {} + }, + /** Volumes */ + volumeCommit: { + name: "VolumeCommit", + requestType: VolumeCommitRequest, + requestStream: false, + responseType: VolumeCommitResponse, + responseStream: false, + options: {} + }, + volumeCopyFiles: { + name: "VolumeCopyFiles", + requestType: VolumeCopyFilesRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeCopyFiles2: { + name: "VolumeCopyFiles2", + requestType: VolumeCopyFiles2Request, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeDelete: { + name: "VolumeDelete", + requestType: VolumeDeleteRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeGetFile: { + name: "VolumeGetFile", + requestType: VolumeGetFileRequest, + requestStream: false, + responseType: VolumeGetFileResponse, + responseStream: false, + options: {} + }, + volumeGetFile2: { + name: "VolumeGetFile2", + requestType: VolumeGetFile2Request, + requestStream: false, + responseType: VolumeGetFile2Response, + responseStream: false, + options: {} + }, + volumeGetOrCreate: { + name: "VolumeGetOrCreate", + requestType: VolumeGetOrCreateRequest, + requestStream: false, + responseType: VolumeGetOrCreateResponse, + responseStream: false, + options: {} + }, + volumeHeartbeat: { + name: "VolumeHeartbeat", + requestType: VolumeHeartbeatRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeList: { + name: "VolumeList", + requestType: VolumeListRequest, + requestStream: false, + responseType: VolumeListResponse, + responseStream: false, + options: {} + }, + volumeListFiles: { + name: "VolumeListFiles", + requestType: VolumeListFilesRequest, + requestStream: false, + responseType: VolumeListFilesResponse, + responseStream: true, + options: {} + }, + volumeListFiles2: { + name: "VolumeListFiles2", + requestType: VolumeListFiles2Request, + requestStream: false, + responseType: VolumeListFiles2Response, + responseStream: true, + options: {} + }, + volumePutFiles: { + name: "VolumePutFiles", + requestType: VolumePutFilesRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumePutFiles2: { + name: "VolumePutFiles2", + requestType: VolumePutFiles2Request, + requestStream: false, + responseType: VolumePutFiles2Response, + responseStream: false, + options: {} + }, + volumeReload: { + name: "VolumeReload", + requestType: VolumeReloadRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRemoveFile: { + name: "VolumeRemoveFile", + requestType: VolumeRemoveFileRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRemoveFile2: { + name: "VolumeRemoveFile2", + requestType: VolumeRemoveFile2Request, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + volumeRename: { + name: "VolumeRename", + requestType: VolumeRenameRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: {} + }, + /** Workspaces */ + workspaceBillingReport: { + name: "WorkspaceBillingReport", + requestType: WorkspaceBillingReportRequest, + requestStream: false, + responseType: WorkspaceBillingReportItem, + responseStream: true, + options: {} + }, + workspaceNameLookup: { + name: "WorkspaceNameLookup", + requestType: Empty, + requestStream: false, + responseType: WorkspaceNameLookupResponse, + responseStream: false, + options: {} + } + } +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1e3); + const nanos = date.getTime() % 1e3 * 1e6; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1e3; + millis += (t.nanos || 0) / 1e6; + return new globalThis.Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function longToNumber2(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isObject2(value) { + return typeof value === "object" && value !== null; +} +function isSet4(value) { + return value !== null && value !== void 0; +} + +// src/client.ts +import { v4 as uuidv4 } from "uuid"; +import { + ClientError as ClientError9, + createChannel, + createClientFactory, + Metadata, + Status as Status9 +} from "nice-grpc"; + +// src/cloud_bucket_mount.ts +var CloudBucketMountService = class { + #client; + constructor(client2) { + this.#client = client2; + } + create(bucketName, params = {}) { + let bucketType = 1 /* S3 */; + if (params.bucketEndpointUrl) { + const url = new URL(params.bucketEndpointUrl); + if (url.hostname.endsWith("r2.cloudflarestorage.com")) { + bucketType = 2 /* R2 */; + } else if (url.hostname.endsWith("storage.googleapis.com")) { + bucketType = 3 /* GCP */; + } else { + bucketType = 1 /* S3 */; + this.#client.logger.debug( + "CloudBucketMount received unrecognized bucket endpoint URL. Assuming AWS S3 configuration as fallback.", + "bucketEndpointUrl", + params.bucketEndpointUrl + ); + } + } + if (params.requesterPays && !params.secret) { + throw new Error("Credentials required in order to use Requester Pays."); + } + if (params.keyPrefix && !params.keyPrefix.endsWith("/")) { + throw new Error( + "keyPrefix will be prefixed to all object paths, so it must end in a '/'" + ); + } + return new CloudBucketMount2( + bucketName, + params.secret, + params.readOnly ?? false, + params.requesterPays ?? false, + params.bucketEndpointUrl, + params.keyPrefix, + params.oidcAuthRoleArn, + bucketType + ); + } +}; +var CloudBucketMount2 = class { + bucketName; + secret; + readOnly; + requesterPays; + bucketEndpointUrl; + keyPrefix; + oidcAuthRoleArn; + #bucketType; + constructor(bucketName, secretOrParams, readOnly, requesterPays, bucketEndpointUrl, keyPrefix, oidcAuthRoleArn, bucketType) { + if (bucketType !== void 0) { + this.bucketName = bucketName; + this.secret = secretOrParams; + this.readOnly = readOnly; + this.requesterPays = requesterPays; + this.bucketEndpointUrl = bucketEndpointUrl; + this.keyPrefix = keyPrefix; + this.oidcAuthRoleArn = oidcAuthRoleArn; + this.#bucketType = bucketType; + } else { + const params = secretOrParams === void 0 ? {} : secretOrParams; + return getDefaultClient().cloudBucketMounts.create(bucketName, params); + } + } + /** @ignore */ + toProto(mountPath) { + return { + bucketName: this.bucketName, + mountPath, + credentialsSecretId: this.secret?.secretId ?? "", + readOnly: this.readOnly, + bucketType: this.#bucketType, + requesterPays: this.requesterPays, + bucketEndpointUrl: this.bucketEndpointUrl, + keyPrefix: this.keyPrefix, + oidcAuthRoleArn: this.oidcAuthRoleArn + }; + } +}; + +// src/cls.ts +import { ClientError as ClientError3, Status as Status3 } from "nice-grpc"; + +// src/errors.ts +var FunctionTimeoutError = class extends Error { + constructor(message) { + super(message); + this.name = "FunctionTimeoutError"; + } +}; +var RemoteError = class extends Error { + constructor(message) { + super(message); + this.name = "RemoteError"; + } +}; +var InternalFailure = class extends Error { + constructor(message) { + super(message); + this.name = "InternalFailure"; + } +}; +var NotFoundError = class extends Error { + constructor(message) { + super(message); + this.name = "NotFoundError"; + } +}; +var AlreadyExistsError = class extends Error { + constructor(message) { + super(message); + this.name = "AlreadyExistsError"; + } +}; +var InvalidError = class extends Error { + constructor(message) { + super(message); + this.name = "InvalidError"; + } +}; +var QueueEmptyError = class extends Error { + constructor(message) { + super(message); + this.name = "QueueEmptyError"; + } +}; +var QueueFullError = class extends Error { + constructor(message) { + super(message); + this.name = "QueueFullError"; + } +}; +var SandboxFilesystemError = class extends Error { + constructor(message) { + super(message); + this.name = "SandboxFilesystemError"; + } +}; +var SandboxTimeoutError = class extends Error { + constructor(message = "Sandbox operation timed out") { + super(message); + this.name = "SandboxTimeoutError"; + } +}; + +// src/function.ts +import { createHash } from "node:crypto"; + +// src/serialization.ts +import { Encoder, Decoder } from "cbor-x"; +var encoderOptions = { + mapsAsObjects: true, + useRecords: false, + tagUint8Array: false, + useTag259ForMaps: false +}; +var decoderOptions = { + mapsAsObjects: true, + useRecords: false, + tagUint8Array: false, + useTag259ForMaps: false +}; +var encoder = new Encoder(encoderOptions); +var decoder = new Decoder(decoderOptions); +function cborEncode(value) { + return encoder.encode(value); +} +function cborDecode(data) { + return decoder.decode(data); +} + +// src/invocation.ts +var outputsTimeoutMs = 55 * 1e3; +var ControlPlaneInvocation = class _ControlPlaneInvocation { + cpClient; + functionCallId; + input; + functionCallJwt; + inputJwt; + constructor(cpClient, functionCallId, input, functionCallJwt, inputJwt) { + this.cpClient = cpClient; + this.functionCallId = functionCallId; + this.input = input; + this.functionCallJwt = functionCallJwt; + this.inputJwt = inputJwt; + } + static async create(client2, functionId, input, invocationType) { + const functionPutInputsItem = FunctionPutInputsItem.create({ + idx: 0, + input + }); + const functionMapResponse = await client2.cpClient.functionMap({ + functionId, + functionCallType: 1 /* FUNCTION_CALL_TYPE_UNARY */, + functionCallInvocationType: invocationType, + pipelinedInputs: [functionPutInputsItem] + }); + return new _ControlPlaneInvocation( + client2.cpClient, + functionMapResponse.functionCallId, + input, + functionMapResponse.functionCallJwt, + functionMapResponse.pipelinedInputs[0].inputJwt + ); + } + static fromFunctionCallId(client2, functionCallId) { + return new _ControlPlaneInvocation(client2.cpClient, functionCallId); + } + async awaitOutput(timeoutMs) { + return await pollFunctionOutput( + this.cpClient, + (timeoutMs2) => this.#getOutput(timeoutMs2), + timeoutMs + ); + } + async #getOutput(timeoutMs) { + const response = await this.cpClient.functionGetOutputs({ + functionCallId: this.functionCallId, + maxValues: 1, + timeout: timeoutMs / 1e3, + lastEntryId: "0-0", + clearOnSuccess: true, + requestedAt: timeNowSeconds() + }); + return response.outputs ? response.outputs[0] : void 0; + } + async retry(retryCount) { + if (!this.input) { + throw new Error("Cannot retry Function invocation - input missing"); + } + const retryItem = { + inputJwt: this.inputJwt, + input: this.input, + retryCount + }; + const functionRetryResponse = await this.cpClient.functionRetryInputs({ + functionCallJwt: this.functionCallJwt, + inputs: [retryItem] + }); + this.inputJwt = functionRetryResponse.inputJwts[0]; + } +}; +var InputPlaneInvocation = class _InputPlaneInvocation { + cpClient; + ipClient; + functionId; + input; + attemptToken; + constructor(cpClient, ipClient, functionId, input, attemptToken) { + this.cpClient = cpClient; + this.ipClient = ipClient; + this.functionId = functionId; + this.input = input; + this.attemptToken = attemptToken; + } + static async create(client2, inputPlaneUrl, functionId, input) { + const functionPutInputsItem = FunctionPutInputsItem.create({ + idx: 0, + input + }); + const ipClient = client2.ipClient(inputPlaneUrl); + const attemptStartResponse = await ipClient.attemptStart({ + functionId, + input: functionPutInputsItem + }); + return new _InputPlaneInvocation( + client2.cpClient, + ipClient, + functionId, + functionPutInputsItem, + attemptStartResponse.attemptToken + ); + } + async awaitOutput(timeoutMs) { + return await pollFunctionOutput( + this.cpClient, + (timeoutMs2) => this.#getOutput(timeoutMs2), + timeoutMs + ); + } + async #getOutput(timeoutMs) { + const response = await this.ipClient.attemptAwait({ + attemptToken: this.attemptToken, + requestedAt: timeNowSeconds(), + timeoutSecs: timeoutMs / 1e3 + }); + return response.output; + } + async retry(_retryCount) { + const attemptRetryResponse = await this.ipClient.attemptRetry({ + functionId: this.functionId, + input: this.input, + attemptToken: this.attemptToken + }); + this.attemptToken = attemptRetryResponse.attemptToken; + } +}; +function timeNowSeconds() { + return Date.now() / 1e3; +} +async function pollFunctionOutput(cpClient, getOutput, timeoutMs) { + const startTime = Date.now(); + let pollTimeoutMs = outputsTimeoutMs; + if (timeoutMs !== void 0) { + pollTimeoutMs = Math.min(timeoutMs, outputsTimeoutMs); + } + while (true) { + const output = await getOutput(pollTimeoutMs); + if (output) { + return await processResult(cpClient, output.result, output.dataFormat); + } + if (timeoutMs !== void 0) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Timeout exceeded: ${timeoutMs}ms`; + throw new FunctionTimeoutError(message); + } + pollTimeoutMs = Math.min(outputsTimeoutMs, remainingMs); + } + } +} +async function processResult(cpClient, result, dataFormat) { + if (!result) { + throw new Error("Received null result from invocation"); + } + let data = new Uint8Array(); + if (result.data !== void 0) { + data = result.data; + } else if (result.dataBlobId) { + data = await blobDownload(cpClient, result.dataBlobId); + } + switch (result.status) { + case 4 /* GENERIC_STATUS_TIMEOUT */: + throw new FunctionTimeoutError(`Timeout: ${result.exception}`); + case 6 /* GENERIC_STATUS_INTERNAL_FAILURE */: + throw new InternalFailure(`Internal failure: ${result.exception}`); + case 1 /* GENERIC_STATUS_SUCCESS */: + break; + default: + throw new RemoteError(`Remote error: ${result.exception}`); + } + return deserializeDataFormat(data, dataFormat); +} +async function blobDownload(cpClient, blobId) { + const resp = await cpClient.blobGet({ blobId }); + const s3resp = await fetch(resp.downloadUrl); + if (!s3resp.ok) { + throw new Error(`Failed to download blob: ${s3resp.statusText}`); + } + const buf = await s3resp.arrayBuffer(); + return new Uint8Array(buf); +} +function deserializeDataFormat(data, dataFormat) { + if (!data) { + return null; + } + switch (dataFormat) { + case 1 /* DATA_FORMAT_PICKLE */: + throw new Error( + "PICKLE output format is not supported - remote function must return CBOR format" + ); + case 4 /* DATA_FORMAT_CBOR */: + return cborDecode(data); + case 2 /* DATA_FORMAT_ASGI */: + throw new Error("ASGI data format is not supported in modal-js"); + case 3 /* DATA_FORMAT_GENERATOR_DONE */: + return GeneratorDone.decode(data); + default: + throw new Error(`Unsupported data format: ${dataFormat}`); + } +} + +// src/validation.ts +function checkForRenamedParams(params, renames) { + if (!params) return; + for (const [oldName, newName] of Object.entries(renames)) { + if (oldName in params) { + throw new Error( + `Parameter '${oldName}' has been renamed to '${newName}'.` + ); + } + } +} + +// src/function_call.ts +var FunctionCallService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a new {@link FunctionCall} from ID. + */ + async fromId(functionCallId) { + return new FunctionCall(this.#client, functionCallId); + } +}; +var FunctionCall = class _FunctionCall { + functionCallId; + #client; + /** @ignore */ + constructor(client2, functionCallId) { + this.#client = client2; + this.functionCallId = functionCallId; + } + /** + * @deprecated Use {@link FunctionCallService#fromId client.functionCalls.fromId()} instead. + */ + static fromId(functionCallId) { + return new _FunctionCall(void 0, functionCallId); + } + /** Get the result of a FunctionCall, optionally waiting with a timeout. */ + async get(params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const invocation = ControlPlaneInvocation.fromFunctionCallId( + this.#client || getDefaultClient(), + this.functionCallId + ); + return invocation.awaitOutput(params.timeoutMs); + } + /** Cancel a running FunctionCall. */ + async cancel(params = {}) { + const cpClient = this.#client?.cpClient || getDefaultClient().cpClient; + await cpClient.functionCallCancel({ + functionCallId: this.functionCallId, + terminateContainers: params.terminateContainers + }); + } +}; + +// src/function.ts +import { ClientError, Status } from "nice-grpc"; +var maxObjectSizeBytes = 2 * 1024 * 1024; +var maxSystemRetries = 8; +var FunctionService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Function_ Function} by its name in an App. + */ + async fromName(appName, name, params = {}) { + if (name.includes(".")) { + const [clsName, methodName] = name.split(".", 2); + throw new Error( + `Cannot retrieve Cls methods using 'functions.fromName()'. Use: + const cls = await client.cls.fromName("${appName}", "${clsName}"); + const instance = await cls.instance(); + const m = instance.method("${methodName}");` + ); + } + try { + const resp = await this.#client.cpClient.functionGet({ + appName, + objectTag: name, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Retrieved Function", + "function_id", + resp.functionId, + "app_name", + appName, + "function_name", + name + ); + return new Function_( + this.#client, + resp.functionId, + void 0, + resp.handleMetadata + ); + } catch (err) { + if (err instanceof ClientError && err.code === Status.NOT_FOUND) + throw new NotFoundError(`Function '${appName}/${name}' not found`); + throw err; + } + } +}; +var Function_ = class { + functionId; + methodName; + #client; + #handleMetadata; + /** @ignore */ + constructor(client2, functionId, methodName, functionHandleMetadata) { + this.functionId = functionId; + this.methodName = methodName; + this.#client = client2; + this.#handleMetadata = functionHandleMetadata; + } + /** + * @deprecated Use `client.functions.fromName()` instead. + */ + static async lookup(appName, name, params = {}) { + return await getDefaultClient().functions.fromName(appName, name, params); + } + #checkNoWebUrl(fnName) { + if (this.#handleMetadata?.webUrl) { + throw new InvalidError( + `A webhook Function cannot be invoked for remote execution with '.${fnName}'. Invoke this Function via its web url '${this.#handleMetadata.webUrl}' instead.` + ); + } + } + // Execute a single input into a remote Function. + async remote(args = [], kwargs = {}) { + this.#client.logger.debug( + "Executing function call", + "function_id", + this.functionId + ); + this.#checkNoWebUrl("remote"); + const input = await this.#createInput(args, kwargs); + const invocation = await this.#createRemoteInvocation(input); + let retryCount = 0; + while (true) { + try { + const result = await invocation.awaitOutput(); + this.#client.logger.debug( + "Function call completed", + "function_id", + this.functionId + ); + return result; + } catch (err) { + if (err instanceof InternalFailure && retryCount <= maxSystemRetries) { + this.#client.logger.debug( + "Retrying function call due to internal failure", + "function_id", + this.functionId, + "retry_count", + retryCount + ); + await invocation.retry(retryCount); + retryCount++; + } else { + throw err; + } + } + } + } + async #createRemoteInvocation(input) { + if (this.#handleMetadata?.inputPlaneUrl) { + return await InputPlaneInvocation.create( + this.#client, + this.#handleMetadata.inputPlaneUrl, + this.functionId, + input + ); + } + return await ControlPlaneInvocation.create( + this.#client, + this.functionId, + input, + 4 /* FUNCTION_CALL_INVOCATION_TYPE_SYNC */ + ); + } + // Spawn a single input into a remote Function. + async spawn(args = [], kwargs = {}) { + this.#client.logger.debug( + "Spawning function call", + "function_id", + this.functionId + ); + this.#checkNoWebUrl("spawn"); + const input = await this.#createInput(args, kwargs); + const invocation = await ControlPlaneInvocation.create( + this.#client, + this.functionId, + input, + 3 /* FUNCTION_CALL_INVOCATION_TYPE_ASYNC */ + ); + this.#client.logger.debug( + "Function call spawned", + "function_id", + this.functionId, + "function_call_id", + invocation.functionCallId + ); + return new FunctionCall(this.#client, invocation.functionCallId); + } + // Returns statistics about the Function. + async getCurrentStats() { + const resp = await this.#client.cpClient.functionGetCurrentStats( + { functionId: this.functionId }, + { timeoutMs: 1e4 } + ); + return { + backlog: resp.backlog, + numTotalRunners: resp.numTotalTasks + }; + } + // Overrides the current autoscaler behavior for this Function. + async updateAutoscaler(params) { + checkForRenamedParams(params, { scaledownWindow: "scaledownWindowMs" }); + await this.#client.cpClient.functionUpdateSchedulingParams({ + functionId: this.functionId, + warmPoolSizeOverride: 0, + // Deprecated field, always set to 0 + settings: { + minContainers: params.minContainers, + maxContainers: params.maxContainers, + bufferContainers: params.bufferContainers, + scaledownWindow: params.scaledownWindowMs !== void 0 ? Math.trunc(params.scaledownWindowMs / 1e3) : void 0 + } + }); + } + /** + * URL of a Function running as a web endpoint. + * @returns The web URL if this Function is a web endpoint, otherwise undefined + */ + async getWebUrl() { + return this.#handleMetadata?.webUrl || void 0; + } + async #createInput(args = [], kwargs = {}) { + const supported_input_formats = this.#handleMetadata?.supportedInputFormats?.length ? this.#handleMetadata.supportedInputFormats : [1 /* DATA_FORMAT_PICKLE */]; + if (!supported_input_formats.includes(4 /* DATA_FORMAT_CBOR */)) { + throw new InvalidError( + "cannot call Modal Function from JS SDK since it was deployed with an incompatible Python SDK version. Redeploy with Modal Python SDK >= 1.2" + ); + } + const payload = cborEncode([args, kwargs]); + let argsBlobId = void 0; + if (payload.length > maxObjectSizeBytes) { + argsBlobId = await blobUpload(this.#client.cpClient, payload); + } + return { + args: argsBlobId ? void 0 : payload, + argsBlobId, + dataFormat: 4 /* DATA_FORMAT_CBOR */, + methodName: this.methodName, + finalInput: false + // This field isn't specified in the Python client, so it defaults to false. + }; + } +}; +async function blobUpload(cpClient, data) { + const contentMd5 = createHash("md5").update(data).digest("base64"); + const contentSha256 = createHash("sha256").update(data).digest("base64"); + const resp = await cpClient.blobCreate({ + contentMd5, + contentSha256Base64: contentSha256, + contentLength: data.length + }); + if (resp.multipart) { + throw new Error( + "Function input size exceeds multipart upload threshold, unsupported by this SDK version" + ); + } else if (resp.uploadUrl) { + const uploadResp = await fetch(resp.uploadUrl, { + method: "PUT", + headers: { + "Content-Type": "application/octet-stream", + "Content-MD5": contentMd5 + }, + body: data + }); + if (uploadResp.status < 200 || uploadResp.status >= 300) { + throw new Error(`Failed blob upload: ${uploadResp.statusText}`); + } + return resp.blobId; + } else { + throw new Error("Missing upload URL in BlobCreate response"); + } +} + +// src/secret.ts +import { ClientError as ClientError2, Status as Status2 } from "nice-grpc"; +var SecretService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** Reference a {@link Secret} by its name. */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.secretGetOrCreate({ + deploymentName: name, + environmentName: this.#client.environmentName(params?.environment), + requiredKeys: params?.requiredKeys ?? [] + }); + this.#client.logger.debug( + "Retrieved Secret", + "secret_id", + resp.secretId, + "secret_name", + name + ); + return new Secret(resp.secretId, name); + } catch (err) { + if (err instanceof ClientError2 && err.code === Status2.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof ClientError2 && err.code === Status2.FAILED_PRECONDITION && err.details.includes("Secret is missing key")) + throw new NotFoundError(err.details); + throw err; + } + } + /** Create a {@link Secret} from a plain object of key-value pairs. */ + async fromObject(entries, params) { + for (const [, value] of Object.entries(entries)) { + if (value == null || typeof value !== "string") { + throw new InvalidError( + "entries must be an object mapping string keys to string values, but got:\n" + JSON.stringify(entries) + ); + } + } + try { + const resp = await this.#client.cpClient.secretGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + envDict: entries, + environmentName: this.#client.environmentName(params?.environment) + }); + this.#client.logger.debug( + "Created ephemeral Secret", + "secret_id", + resp.secretId + ); + return new Secret(resp.secretId); + } catch (err) { + if (err instanceof ClientError2 && (err.code === Status2.INVALID_ARGUMENT || err.code === Status2.FAILED_PRECONDITION)) + throw new InvalidError(err.details); + throw err; + } + } + /** + * Delete a named {@link Secret}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Secret. + */ + async delete(name, params) { + try { + const secret = await this.fromName(name, { + environment: params?.environment + }); + await this.#client.cpClient.secretDelete({ + secretId: secret.secretId + }); + this.#client.logger.debug( + "Deleted Secret", + "secret_name", + name, + "secret_id", + secret.secretId + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } +}; +var Secret = class { + secretId; + name; + /** @ignore */ + constructor(secretId, name) { + this.secretId = secretId; + this.name = name; + } + /** + * @deprecated Use {@link SecretService#fromName client.secrets.fromName()} instead. + */ + static async fromName(name, params) { + return getDefaultClient().secrets.fromName(name, params); + } + /** + * @deprecated Use {@link SecretService#fromObject client.secrets.fromObject()} instead. + */ + static async fromObject(entries, params) { + return getDefaultClient().secrets.fromObject(entries, params); + } +}; +async function mergeEnvIntoSecrets(client2, env, secrets) { + const result = [...secrets || []]; + if (env && Object.keys(env).length > 0) { + result.push(await client2.secrets.fromObject(env)); + } + return result; +} + +// src/retries.ts +var Retries = class { + maxRetries; + backoffCoefficient; + initialDelayMs; + maxDelayMs; + constructor(params) { + const { + maxRetries, + backoffCoefficient = 2, + initialDelayMs = 1e3, + maxDelayMs = 6e4 + } = params; + if (maxRetries < 0 || maxRetries > 10) { + throw new Error( + `Invalid maxRetries: ${maxRetries}. Must be between 0 and 10.` + ); + } + if (backoffCoefficient < 1 || backoffCoefficient > 10) { + throw new Error( + `Invalid backoffCoefficient: ${backoffCoefficient}. Must be between 1.0 and 10.0` + ); + } + if (initialDelayMs < 0 || initialDelayMs > 6e4) { + throw new Error( + `Invalid initialDelayMs: ${initialDelayMs}. Must be between 0 and 60000 ms.` + ); + } + if (maxDelayMs < 1e3 || maxDelayMs > 6e4) { + throw new Error( + `Invalid maxDelayMs: ${maxDelayMs}. Must be between 1000 and 60000 ms.` + ); + } + this.maxRetries = maxRetries; + this.backoffCoefficient = backoffCoefficient; + this.initialDelayMs = initialDelayMs; + this.maxDelayMs = maxDelayMs; + } +}; +function parseRetries(retries) { + if (retries === void 0) return void 0; + if (typeof retries === "number") { + if (!Number.isInteger(retries) || retries < 0 || retries > 10) { + throw new Error( + `Retries parameter must be an integer between 0 and 10. Found: ${retries}` + ); + } + return new Retries({ + maxRetries: retries, + backoffCoefficient: 1, + initialDelayMs: 1e3 + }); + } + if (retries instanceof Retries) return retries; + throw new Error( + `Retries parameter must be an integer or instance of Retries. Found: ${typeof retries}.` + ); +} + +// src/cls.ts +var ClsService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Cls} from a deployed {@link App} by its name. + */ + async fromName(appName, name, params = {}) { + try { + const serviceFunctionName = `${name}.*`; + const serviceFunction = await this.#client.cpClient.functionGet({ + appName, + objectTag: serviceFunctionName, + environmentName: this.#client.environmentName(params.environment) + }); + const parameterInfo = serviceFunction.handleMetadata?.classParameterInfo; + const schema = parameterInfo?.schema ?? []; + if (schema.length > 0 && parameterInfo?.format !== 2 /* PARAM_SERIALIZATION_FORMAT_PROTO */) { + throw new Error( + `Unsupported parameter format: ${parameterInfo?.format}` + ); + } + this.#client.logger.debug( + "Retrieved Cls", + "function_id", + serviceFunction.functionId, + "app_name", + appName, + "cls_name", + name + ); + return new Cls( + this.#client, + serviceFunction.functionId, + serviceFunction.handleMetadata, + void 0 + ); + } catch (err) { + if (err instanceof ClientError3 && err.code === Status3.NOT_FOUND) + throw new NotFoundError(`Class '${appName}/${name}' not found`); + throw err; + } + } +}; +var Cls = class _Cls { + #client; + #serviceFunctionId; + #serviceFunctionMetadata; + #serviceOptions; + /** @ignore */ + constructor(client2, serviceFunctionId, serviceFunctionMetadata, options) { + this.#client = client2; + this.#serviceFunctionId = serviceFunctionId; + this.#serviceFunctionMetadata = serviceFunctionMetadata; + this.#serviceOptions = options; + } + get #schema() { + return this.#serviceFunctionMetadata.classParameterInfo?.schema ?? []; + } + /** + * @deprecated Use {@link ClsService#fromName client.cls.fromName()} instead. + */ + static async lookup(appName, name, params = {}) { + return getDefaultClient().cls.fromName(appName, name, params); + } + /** Create a new instance of the Cls with parameters and/or runtime options. */ + async instance(parameters = {}) { + let functionId; + if (this.#schema.length === 0 && this.#serviceOptions === void 0) { + functionId = this.#serviceFunctionId; + } else { + functionId = await this.#bindParameters(parameters); + } + const methods = /* @__PURE__ */ new Map(); + for (const [name, methodMetadata] of Object.entries( + this.#serviceFunctionMetadata.methodHandleMetadata + )) { + methods.set( + name, + new Function_(this.#client, functionId, name, methodMetadata) + ); + } + return new ClsInstance(methods); + } + /** Override the static Function configuration at runtime. */ + withOptions(options) { + const merged = mergeServiceOptions(this.#serviceOptions, options); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Create an instance of the Cls with input concurrency enabled or overridden with new values. */ + withConcurrency(params) { + const merged = mergeServiceOptions(this.#serviceOptions, { + maxConcurrentInputs: params.maxInputs, + targetConcurrentInputs: params.targetInputs + }); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Create an instance of the Cls with dynamic batching enabled or overridden with new values. */ + withBatching(params) { + const merged = mergeServiceOptions(this.#serviceOptions, { + batchMaxSize: params.maxBatchSize, + batchWaitMs: params.waitMs + }); + return new _Cls( + this.#client, + this.#serviceFunctionId, + this.#serviceFunctionMetadata, + merged + ); + } + /** Bind parameters to the Cls function. */ + async #bindParameters(parameters) { + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + this.#serviceOptions?.env, + this.#serviceOptions?.secrets + ); + const mergedOptions = mergeServiceOptions(this.#serviceOptions, { + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }); + const serializedParams = encodeParameterSet(this.#schema, parameters); + const functionOptions = await buildFunctionOptionsProto(mergedOptions); + const bindResp = await this.#client.cpClient.functionBindParams({ + functionId: this.#serviceFunctionId, + serializedParams, + functionOptions, + environmentName: this.#client.environmentName() + }); + return bindResp.boundFunctionId; + } +}; +function encodeParameterSet(schema, params) { + const encoded = []; + for (const paramSpec of schema) { + const paramValue = encodeParameter(paramSpec, params[paramSpec.name]); + encoded.push(paramValue); + } + encoded.sort((a, b) => a.name.localeCompare(b.name)); + return ClassParameterSet.encode({ parameters: encoded }).finish(); +} +function mergeServiceOptions(base, diff) { + const filteredDiff = Object.fromEntries( + Object.entries(diff).filter(([, value]) => value !== void 0) + ); + const merged = { ...base ?? {}, ...filteredDiff }; + return Object.keys(merged).length === 0 ? void 0 : merged; +} +async function buildFunctionOptionsProto(options) { + if (!options) return void 0; + const o = options ?? {}; + checkForRenamedParams(o, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + scaledownWindow: "scaledownWindowMs", + timeout: "timeoutMs" + }); + const gpuConfig = parseGpuConfig(o.gpu); + let milliCpu = void 0; + let milliCpuMax = void 0; + if (o.cpu === void 0 && o.cpuLimit !== void 0) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (o.cpu !== void 0) { + if (o.cpu <= 0) { + throw new Error(`cpu (${o.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1e3 * o.cpu); + if (o.cpuLimit !== void 0) { + if (o.cpuLimit < o.cpu) { + throw new Error( + `cpu (${o.cpu}) cannot be higher than cpuLimit (${o.cpuLimit})` + ); + } + milliCpuMax = Math.trunc(1e3 * o.cpuLimit); + } + } + let memoryMb = void 0; + let memoryMbMax = void 0; + if (o.memoryMiB === void 0 && o.memoryLimitMiB !== void 0) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified" + ); + } + if (o.memoryMiB !== void 0) { + if (o.memoryMiB <= 0) { + throw new Error(`memoryMiB (${o.memoryMiB}) must be a positive number`); + } + memoryMb = o.memoryMiB; + if (o.memoryLimitMiB !== void 0) { + if (o.memoryLimitMiB < o.memoryMiB) { + throw new Error( + `memoryMiB (${o.memoryMiB}) cannot be higher than memoryLimitMiB (${o.memoryLimitMiB})` + ); + } + memoryMbMax = o.memoryLimitMiB; + } + } + const resources = milliCpu !== void 0 || milliCpuMax !== void 0 || memoryMb !== void 0 || memoryMbMax !== void 0 || gpuConfig ? { + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, + gpuConfig + } : void 0; + const secretIds = (o.secrets || []).map((s) => s.secretId); + const volumeMounts = o.volumes ? Object.entries(o.volumes).map(([mountPath, volume]) => ({ + volumeId: volume.volumeId, + mountPath, + allowBackgroundCommits: true, + readOnly: volume.isReadOnly + })) : []; + const parsedRetries = parseRetries(o.retries); + const retryPolicy = parsedRetries ? { + retries: parsedRetries.maxRetries, + backoffCoefficient: parsedRetries.backoffCoefficient, + initialDelayMs: parsedRetries.initialDelayMs, + maxDelayMs: parsedRetries.maxDelayMs + } : void 0; + if (o.scaledownWindowMs !== void 0 && o.scaledownWindowMs % 1e3 !== 0) { + throw new Error( + `scaledownWindowMs must be a multiple of 1000ms, got ${o.scaledownWindowMs}` + ); + } + if (o.timeoutMs !== void 0 && o.timeoutMs % 1e3 !== 0) { + throw new Error( + `timeoutMs must be a multiple of 1000ms, got ${o.timeoutMs}` + ); + } + const functionOptions = FunctionOptions.create({ + secretIds, + replaceSecretIds: secretIds.length > 0, + replaceVolumeMounts: volumeMounts.length > 0, + volumeMounts, + resources, + retryPolicy, + concurrencyLimit: o.maxContainers, + bufferContainers: o.bufferContainers, + taskIdleTimeoutSecs: o.scaledownWindowMs !== void 0 ? o.scaledownWindowMs / 1e3 : void 0, + timeoutSecs: o.timeoutMs !== void 0 ? o.timeoutMs / 1e3 : void 0, + maxConcurrentInputs: o.maxConcurrentInputs, + targetConcurrentInputs: o.targetConcurrentInputs, + batchMaxSize: o.batchMaxSize, + batchLingerMs: o.batchWaitMs + }); + return functionOptions; +} +function encodeParameter(paramSpec, value) { + const name = paramSpec.name; + const paramType = paramSpec.type; + const paramValue = { name, type: paramType }; + switch (paramType) { + case 1 /* PARAM_TYPE_STRING */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.stringDefault ?? ""; + } + if (typeof value !== "string") { + throw new Error(`Parameter '${name}' must be a string`); + } + paramValue.stringValue = value; + break; + case 2 /* PARAM_TYPE_INT */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.intDefault ?? 0; + } + if (typeof value !== "number") { + throw new Error(`Parameter '${name}' must be an integer`); + } + paramValue.intValue = value; + break; + case 9 /* PARAM_TYPE_BOOL */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.boolDefault ?? false; + } + if (typeof value !== "boolean") { + throw new Error(`Parameter '${name}' must be a boolean`); + } + paramValue.boolValue = value; + break; + case 4 /* PARAM_TYPE_BYTES */: + if (value == null && paramSpec.hasDefault) { + value = paramSpec.bytesDefault ?? new Uint8Array(); + } + if (!(value instanceof Uint8Array)) { + throw new Error(`Parameter '${name}' must be a byte array`); + } + paramValue.bytesValue = value; + break; + default: + throw new Error(`Unsupported parameter type: ${paramType}`); + } + return paramValue; +} +var ClsInstance = class { + #methods; + constructor(methods) { + this.#methods = methods; + } + method(name) { + const method = this.#methods.get(name); + if (!method) { + throw new NotFoundError(`Method '${name}' not found on class`); + } + return method; + } +}; + +// src/image.ts +import { ClientError as ClientError4 } from "nice-grpc"; +import { Status as Status4 } from "nice-grpc"; +var ImageService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Creates an {@link Image} from an Image ID + * + * @param imageId - Image ID. + */ + async fromId(imageId) { + try { + const resp = await this.#client.cpClient.imageFromId({ imageId }); + return new Image2(this.#client, resp.imageId, ""); + } catch (err) { + if (err instanceof ClientError4 && err.code === Status4.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof ClientError4 && err.code === Status4.FAILED_PRECONDITION && err.details.includes("Could not find image with ID")) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - Optional. A Secret containing credentials for registry authentication. + */ + fromRegistry(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 4 /* REGISTRY_AUTH_TYPE_STATIC_CREDS */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromAwsEcr(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 1 /* REGISTRY_AUTH_TYPE_AWS */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Creates an {@link Image} from a raw registry tag, optionally using a {@link Secret} for authentication. + * + * @param tag - The registry tag for the Image. + * @param secret - A Secret containing credentials for registry authentication. + */ + fromGcpArtifactRegistry(tag, secret) { + let imageRegistryConfig; + if (secret) { + if (!(secret instanceof Secret)) { + throw new TypeError( + "secret must be a reference to an existing Secret, e.g. `await Secret.fromName('my_secret')`" + ); + } + imageRegistryConfig = { + registryAuthType: 2 /* REGISTRY_AUTH_TYPE_GCP */, + secretId: secret.secretId + }; + } + return new Image2(this.#client, "", tag, imageRegistryConfig); + } + /** + * Delete an {@link Image} by ID. Warning: This removes an *entire Image*, and cannot be undone. + */ + async delete(imageId, _ = {}) { + try { + await this.#client.cpClient.imageDelete({ imageId }); + } catch (err) { + if (err instanceof ClientError4 && err.code === Status4.NOT_FOUND) + throw new NotFoundError(err.details); + if (err instanceof ClientError4 && err.code === Status4.FAILED_PRECONDITION && err.details.includes("Could not find image with ID")) + throw new NotFoundError(err.details); + throw err; + } + } +}; +var Image2 = class _Image { + #client; + #imageId; + #tag; + #imageRegistryConfig; + #layers; + /** @ignore */ + constructor(client2, imageId, tag, imageRegistryConfig, layers) { + this.#client = client2; + this.#imageId = imageId; + this.#tag = tag; + this.#imageRegistryConfig = imageRegistryConfig; + this.#layers = layers || [ + { + commands: [], + env: void 0, + secrets: void 0, + gpuConfig: void 0, + forceBuild: false + } + ]; + } + get imageId() { + return this.#imageId; + } + /** + * @deprecated Use {@link ImageService#fromId client.images.fromId()} instead. + */ + static async fromId(imageId) { + return getDefaultClient().images.fromId(imageId); + } + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + static fromRegistry(tag, secret) { + return getDefaultClient().images.fromRegistry(tag, secret); + } + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + static fromAwsEcr(tag, secret) { + return getDefaultClient().images.fromAwsEcr(tag, secret); + } + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + static fromGcpArtifactRegistry(tag, secret) { + return getDefaultClient().images.fromGcpArtifactRegistry(tag, secret); + } + static validateDockerfileCommands(commands) { + for (const command of commands) { + const trimmed = command.trim().toUpperCase(); + if (trimmed.startsWith("COPY ") && !trimmed.startsWith("COPY --FROM=")) { + throw new InvalidError( + "COPY commands that copy from local context are not yet supported." + ); + } + } + } + /** + * Extend an image with arbitrary Dockerfile-like commands. + * + * Each call creates a new Image layer that will be built sequentially. + * The provided options apply only to this layer. + * + * @param commands - Array of Dockerfile commands as strings + * @param params - Optional configuration for this layer's build + * @returns A new Image instance + */ + dockerfileCommands(commands, params) { + if (commands.length === 0) { + return this; + } + _Image.validateDockerfileCommands(commands); + const newLayer = { + commands: [...commands], + env: params?.env, + secrets: params?.secrets, + gpuConfig: params?.gpu ? parseGpuConfig(params.gpu) : void 0, + forceBuild: params?.forceBuild + }; + return new _Image(this.#client, "", this.#tag, this.#imageRegistryConfig, [ + ...this.#layers, + newLayer + ]); + } + /** + * Eagerly builds an Image on Modal. + * + * @param app - App to use to build the Image. + */ + async build(app) { + if (this.imageId !== "") { + return this; + } + this.#client.logger.debug("Building image", "app_id", app.appId); + let baseImageId; + for (let i = 0; i < this.#layers.length; i++) { + const layer = this.#layers[i]; + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + layer.env, + layer.secrets + ); + const secretIds = mergedSecrets.map((secret) => secret.secretId); + const gpuConfig = layer.gpuConfig; + let dockerfileCommands; + let baseImages; + if (i === 0) { + dockerfileCommands = [`FROM ${this.#tag}`, ...layer.commands]; + baseImages = []; + } else { + dockerfileCommands = ["FROM base", ...layer.commands]; + baseImages = [{ dockerTag: "base", imageId: baseImageId }]; + } + const resp = await this.#client.cpClient.imageGetOrCreate({ + appId: app.appId, + image: Image.create({ + dockerfileCommands, + imageRegistryConfig: this.#imageRegistryConfig, + secretIds, + gpuConfig, + contextFiles: [], + baseImages + }), + builderVersion: this.#client.imageBuilderVersion(), + forceBuild: layer.forceBuild || false + }); + let result; + if (resp.result?.status) { + result = resp.result; + } else { + let lastEntryId = ""; + let resultJoined = void 0; + while (!resultJoined) { + for await (const item of this.#client.cpClient.imageJoinStreaming({ + imageId: resp.imageId, + timeout: 55, + lastEntryId + })) { + if (item.entryId) lastEntryId = item.entryId; + if (item.result?.status) { + resultJoined = item.result; + break; + } + } + } + result = resultJoined; + } + if (result.status === 2 /* GENERIC_STATUS_FAILURE */) { + throw new Error( + `Image build for ${resp.imageId} failed with the exception: +${result.exception}` + ); + } else if (result.status === 3 /* GENERIC_STATUS_TERMINATED */) { + throw new Error( + `Image build for ${resp.imageId} terminated due to external shut-down. Please try again.` + ); + } else if (result.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + throw new Error( + `Image build for ${resp.imageId} timed out. Please try again with a larger timeout parameter.` + ); + } else if (result.status !== 1 /* GENERIC_STATUS_SUCCESS */) { + throw new Error( + `Image build for ${resp.imageId} failed with unknown status: ${result.status}` + ); + } + baseImageId = resp.imageId; + } + this.#imageId = baseImageId; + this.#client.logger.debug("Image build completed", "image_id", baseImageId); + return this; + } + /** + * @deprecated Use {@link ImageService#delete client.images.delete()} instead. + */ + static async delete(imageId, _ = {}) { + return getDefaultClient().images.delete(imageId); + } +}; + +// src/proxy.ts +import { ClientError as ClientError5, Status as Status5 } from "nice-grpc"; +var ProxyService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Proxy} by its name. + * + * Normally only ever accessed via the client as: + * ```typescript + * const modal = new ModalClient(); + * const proxy = await modal.proxies.fromName("my-proxy"); + * ``` + */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.proxyGet({ + name, + environmentName: this.#client.environmentName(params?.environment) + }); + if (!resp.proxy?.proxyId) { + throw new NotFoundError(`Proxy '${name}' not found`); + } + return new Proxy3(resp.proxy.proxyId); + } catch (err) { + if (err instanceof ClientError5 && err.code === Status5.NOT_FOUND) + throw new NotFoundError(`Proxy '${name}' not found`); + throw err; + } + } +}; +var Proxy3 = class { + proxyId; + /** @ignore */ + constructor(proxyId) { + this.proxyId = proxyId; + } + /** + * @deprecated Use {@link ProxyService#fromName client.proxies.fromName()} instead. + */ + static async fromName(name, params) { + return getDefaultClient().proxies.fromName(name, params); + } +}; + +// src/pickle.ts +var PickleError = class extends Error { + constructor(message) { + super(message); + this.name = "PickleError"; + } +}; +var Writer = class { + out = []; + byte(b) { + this.out.push(b & 255); + } + bytes(arr) { + for (const b of arr) this.byte(b); + } + uint32LE(x) { + this.byte(x); + this.byte(x >>> 8); + this.byte(x >>> 16); + this.byte(x >>> 24); + } + uint64LE(n) { + let v = BigInt(n); + for (let i = 0; i < 8; i++) { + this.byte(Number(v & 0xffn)); + v >>= 8n; + } + } + float64BE(v) { + const dv = new DataView(new ArrayBuffer(8)); + dv.setFloat64(0, v, false); + this.bytes(new Uint8Array(dv.buffer)); + } + toUint8() { + return new Uint8Array(this.out); + } +}; +var Reader = class { + constructor(buf, pos = 0) { + this.buf = buf; + this.pos = pos; + } + eof() { + return this.pos >= this.buf.length; + } + byte() { + return this.buf[this.pos++]; + } + take(n) { + const s = this.buf.subarray(this.pos, this.pos + n); + this.pos += n; + return s; + } + uint32LE() { + const b0 = this.byte(), b1 = this.byte(), b2 = this.byte(), b3 = this.byte(); + return b0 | b1 << 8 | b2 << 16 | b3 << 24; + } + uint64LE() { + const lo = this.uint32LE() >>> 0; + const hi = this.uint32LE() >>> 0; + return hi * 2 ** 32 + lo; + } + int32LE() { + const v = new DataView( + this.buf.buffer, + this.buf.byteOffset + this.pos, + 4 + ).getInt32(0, true); + this.pos += 4; + return v; + } + float64BE() { + const v = new DataView( + this.buf.buffer, + this.buf.byteOffset + this.pos, + 8 + ).getFloat64(0, false); + this.pos += 8; + return v; + } +}; +function encodeValue(val, w, proto) { + if (val === null || val === void 0) { + w.byte(78 /* NONE */); + return; + } + if (typeof val === "boolean") { + w.byte(val ? 136 /* NEWTRUE */ : 137 /* NEWFALSE */); + return; + } + if (typeof val === "number") { + if (Number.isInteger(val)) { + if (val >= 0 && val <= 255) { + w.byte(75 /* BININT1 */); + w.byte(val); + } else if (val >= 0 && val <= 65535) { + w.byte(77 /* BININT2 */); + w.byte(val & 255); + w.byte(val >> 8 & 255); + } else { + w.byte(74 /* BININT4 */); + w.uint32LE(val >>> 0); + } + } else { + w.byte(71 /* BINFLOAT */); + w.float64BE(val); + } + maybeMemoize(w, proto); + return; + } + if (typeof val === "string") { + const utf8 = new TextEncoder().encode(val); + if (proto >= 4 && utf8.length < 256) { + w.byte(140 /* SHORT_BINUNICODE */); + w.byte(utf8.length); + } else if (proto >= 4 && utf8.length > 4294967295) { + w.byte(141 /* BINUNICODE8 */); + w.uint64LE(utf8.length); + } else { + w.byte(88 /* BINUNICODE */); + w.uint32LE(utf8.length); + } + w.bytes(utf8); + maybeMemoize(w, proto); + return; + } + if (val instanceof Uint8Array) { + const len = val.length; + if (proto >= 4 && len < 256) { + w.byte(67 /* SHORT_BINBYTES */); + w.byte(len); + } else if (proto >= 4 && len > 4294967295) { + w.byte(142 /* BINBYTES8 */); + w.uint64LE(len); + } else { + w.byte(66 /* BINBYTES */); + w.uint32LE(len); + } + w.bytes(val); + maybeMemoize(w, proto); + return; + } + if (Array.isArray(val)) { + w.byte(93 /* EMPTY_LIST */); + maybeMemoize(w, proto); + for (const item of val) { + encodeValue(item, w, proto); + w.byte(97 /* APPEND */); + } + return; + } + if (typeof val === "object") { + w.byte(125 /* EMPTY_DICT */); + maybeMemoize(w, proto); + for (const [k, v] of Object.entries(val)) { + encodeValue(k, w, proto); + encodeValue(v, w, proto); + w.byte(115 /* SETITEM */); + } + return; + } + throw new PickleError( + `The JS Modal SDK does not support encoding/pickling data of type ${typeof val}` + ); +} +function maybeMemoize(w, proto) { + if (proto >= 4) { + w.byte(148 /* MEMOIZE */); + } +} +function dumps(obj, protocol = 4) { + if (![3, 4, 5].includes(protocol)) + throw new PickleError( + `The JS Modal SDK does not support pickle protocol version ${protocol}` + ); + const w = new Writer(); + w.byte(128 /* PROTO */); + w.byte(protocol); + if (protocol === 5) { + w.byte(149 /* FRAME */); + w.uint64LE(0); + } + encodeValue(obj, w, protocol); + w.byte(46 /* STOP */); + return w.toUint8(); +} +function loads(buf) { + const r = new Reader(buf); + const op0 = r.byte(); + if (op0 !== 128 /* PROTO */) throw new PickleError("pickle missing PROTO header"); + const proto = r.byte(); + if (![3, 4, 5].includes(proto)) + throw new PickleError( + `The JS Modal SDK does not support pickle protocol version ${proto}` + ); + const stack = []; + const memo = []; + const tdec = new TextDecoder(); + function push(v) { + stack.push(v); + } + function pop() { + return stack.pop(); + } + if (proto === 5 && buf[r["pos"]] === 149 /* FRAME */) { + r.byte(); + const size = r.uint64LE(); + void size; + } + const MARK = Symbol("pickle-mark"); + while (!r.eof()) { + const op = r.byte(); + switch (op) { + case 46 /* STOP */: + return stack.pop(); + case 78 /* NONE */: + push(null); + break; + case 136 /* NEWTRUE */: + push(true); + break; + case 137 /* NEWFALSE */: + push(false); + break; + case 75 /* BININT1 */: + push(r.byte()); + break; + case 77 /* BININT2 */: { + const lo = r.byte(), hi = r.byte(); + const n = hi << 8 | lo; + push(n); + break; + } + case 74 /* BININT4 */: { + push(r.int32LE()); + break; + } + case 71 /* BINFLOAT */: + push(r.float64BE()); + break; + case 140 /* SHORT_BINUNICODE */: { + const n = r.byte(); + push(tdec.decode(r.take(n))); + break; + } + case 88 /* BINUNICODE */: { + const n = r.uint32LE(); + push(tdec.decode(r.take(n))); + break; + } + case 141 /* BINUNICODE8 */: { + const n = r.uint64LE(); + push(tdec.decode(r.take(n))); + break; + } + case 67 /* SHORT_BINBYTES */: { + const n = r.byte(); + push(r.take(n)); + break; + } + case 66 /* BINBYTES */: { + const n = r.uint32LE(); + push(r.take(n)); + break; + } + case 142 /* BINBYTES8 */: { + const n = r.uint64LE(); + push(r.take(n)); + break; + } + case 93 /* EMPTY_LIST */: + push([]); + break; + case 97 /* APPEND */: { + const v = pop(); + const lst = pop(); + lst.push(v); + push(lst); + break; + } + case 125 /* EMPTY_DICT */: + push({}); + break; + case 115 /* SETITEM */: { + const v = pop(), k = pop(), d = pop(); + d[k] = v; + push(d); + break; + } + // Memo handling ---------------------------------------- + case 148 /* MEMOIZE */: + memo.push(stack[stack.length - 1]); + break; + case 113 /* BINPUT */: + memo[r.byte()] = stack[stack.length - 1]; + break; + case 114 /* LONG_BINPUT */: + memo[r.uint32LE()] = stack[stack.length - 1]; + break; + case 104 /* BINGET */: + push(memo[r.byte()]); + break; + case 106 /* LONG_BINGET */: + push(memo[r.uint32LE()]); + break; + case 149 /* FRAME */: { + const _size = r.uint64LE(); + break; + } + case 40 /* MARK */: + push(MARK); + break; + case 101 /* APPENDS */: { + const markIndex = stack.lastIndexOf(MARK); + if (markIndex === -1) { + throw new PickleError("APPENDS without MARK"); + } + const lst = stack[markIndex - 1]; + if (!Array.isArray(lst)) { + throw new PickleError("APPENDS expects a list below MARK"); + } + const items = stack.slice(markIndex + 1); + lst.push(...items); + stack.length = markIndex - 1; + push(lst); + break; + } + case 117 /* SETITEMS */: { + const markIndex = stack.lastIndexOf(MARK); + if (markIndex === -1) { + throw new PickleError("SETITEMS without MARK"); + } + const d = stack[markIndex - 1]; + if (typeof d !== "object" || d === null || Array.isArray(d)) { + throw new PickleError("SETITEMS expects a dict below MARK"); + } + const items = stack.slice(markIndex + 1); + for (let i = 0; i < items.length; i += 2) { + if (i + 1 < items.length) { + d[items[i]] = items[i + 1]; + } + } + stack.length = markIndex - 1; + push(d); + break; + } + default: + throw new PickleError( + `The JS Modal SDK does not support decoding/unpickling this kind of data. Error: unsupported opcode 0x${op.toString(16)}` + ); + } + } + throw new PickleError("pickle stream ended without STOP"); +} + +// src/queue.ts +import { ClientError as ClientError6, Status as Status6 } from "nice-grpc"; + +// src/ephemeral.ts +var ephemeralObjectHeartbeatSleep = 3e5; +var EphemeralHeartbeatManager = class { + heartbeatFn; + abortController; + constructor(heartbeatFn) { + this.heartbeatFn = heartbeatFn; + this.abortController = new AbortController(); + this.start(); + } + start() { + const signal = this.abortController.signal; + (async () => { + while (!signal.aborted) { + await this.heartbeatFn(); + await Promise.race([ + new Promise((resolve) => { + setTimeout(resolve, ephemeralObjectHeartbeatSleep).unref(); + }), + new Promise((resolve) => { + signal.addEventListener("abort", resolve, { once: true }); + }) + ]); + } + })(); + } + stop() { + this.abortController.abort(); + } +}; + +// src/queue.ts +var queueInitialPutBackoffMs = 100; +var queueDefaultPartitionTtlMs = 24 * 3600 * 1e3; +var QueueService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a nameless, temporary {@link Queue}. + * You will need to call {@link Queue#closeEphemeral Queue.closeEphemeral()} to delete the Queue. + */ + async ephemeral(params = {}) { + const resp = await this.#client.cpClient.queueGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Created ephemeral Queue", + "queue_id", + resp.queueId + ); + const ephemeralHbManager = new EphemeralHeartbeatManager( + () => this.#client.cpClient.queueHeartbeat({ queueId: resp.queueId }) + ); + return new Queue(this.#client, resp.queueId, void 0, ephemeralHbManager); + } + /** + * Reference a {@link Queue} by name. + */ + async fromName(name, params = {}) { + try { + const resp = await this.#client.cpClient.queueGetOrCreate({ + deploymentName: name, + objectCreationType: params.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : void 0, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Retrieved Queue", + "queue_id", + resp.queueId, + "queue_name", + name + ); + return new Queue(this.#client, resp.queueId, name); + } catch (err) { + if (err instanceof ClientError6 && err.code === Status6.NOT_FOUND) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Delete a {@link Queue} by name. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Queue. + */ + async delete(name, params = {}) { + try { + const queue = await this.fromName(name, { + environment: params.environment, + createIfMissing: false + }); + await this.#client.cpClient.queueDelete({ queueId: queue.queueId }); + this.#client.logger.debug( + "Deleted Queue", + "queue_name", + name, + "queue_id", + queue.queueId + ); + } catch (err) { + if (err instanceof NotFoundError && params.allowMissing) { + return; + } + throw err; + } + } +}; +var Queue = class _Queue { + #client; + queueId; + name; + #ephemeralHbManager; + /** @ignore */ + constructor(client2, queueId, name, ephemeralHbManager) { + this.#client = client2; + this.queueId = queueId; + this.name = name; + this.#ephemeralHbManager = ephemeralHbManager; + } + static #validatePartitionKey(partition) { + if (partition) { + const partitionKey = new TextEncoder().encode(partition); + if (partitionKey.length === 0 || partitionKey.length > 64) { + throw new InvalidError( + "Queue partition key must be between 1 and 64 bytes." + ); + } + return partitionKey; + } + return new Uint8Array(); + } + /** + * @deprecated Use {@link QueueService#ephemeral client.queues.ephemeral()} instead. + */ + static async ephemeral(params = {}) { + return getDefaultClient().queues.ephemeral(params); + } + /** Delete the ephemeral Queue. Only usable with ephemeral Queues. */ + closeEphemeral() { + if (this.#ephemeralHbManager) { + this.#ephemeralHbManager.stop(); + } else { + throw new InvalidError("Queue is not ephemeral."); + } + } + /** + * @deprecated Use {@link QueueService#fromName client.queues.fromName()} instead. + */ + static async lookup(name, options = {}) { + return getDefaultClient().queues.fromName(name, options); + } + /** + * @deprecated Use {@link QueueService#delete client.queues.delete()} instead. + */ + static async delete(name, options = {}) { + return getDefaultClient().queues.delete(name, options); + } + /** + * Remove all objects from a Queue partition. + */ + async clear(params = {}) { + if (params.partition && params.all) { + throw new InvalidError( + "Partition must be null when requesting to clear all." + ); + } + await this.#client.cpClient.queueClear({ + queueId: this.queueId, + partitionKey: _Queue.#validatePartitionKey(params.partition), + allPartitions: params.all + }); + } + async #get(n, partition, timeoutMs) { + const partitionKey = _Queue.#validatePartitionKey(partition); + const startTime = Date.now(); + let pollTimeoutMs = 5e4; + if (timeoutMs !== void 0) { + pollTimeoutMs = Math.min(pollTimeoutMs, timeoutMs); + } + while (true) { + const response = await this.#client.cpClient.queueGet({ + queueId: this.queueId, + partitionKey, + timeout: pollTimeoutMs / 1e3, + nValues: n + }); + if (response.values && response.values.length > 0) { + return response.values.map((value) => loads(value)); + } + if (timeoutMs !== void 0) { + const remainingMs = timeoutMs - (Date.now() - startTime); + if (remainingMs <= 0) { + const message = `Queue ${this.queueId} did not return values within ${timeoutMs}ms.`; + throw new QueueEmptyError(message); + } + pollTimeoutMs = Math.min(pollTimeoutMs, remainingMs); + } + } + } + /** + * Remove and return the next object from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + async get(params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const values = await this.#get(1, params.partition, params.timeoutMs); + return values[0]; + } + /** + * Remove and return up to `n` objects from the Queue. + * + * By default, this will wait until at least one item is present in the Queue. + * If `timeoutMs` is set, raises `QueueEmptyError` if no items are available + * within that timeout in milliseconds. + */ + async getMany(n, params = {}) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + return await this.#get(n, params.partition, params.timeoutMs); + } + async #put(values, timeoutMs, partition, partitionTtlMs) { + const valuesEncoded = values.map((v) => dumps(v)); + const partitionKey = _Queue.#validatePartitionKey(partition); + let delay = queueInitialPutBackoffMs; + const deadline = timeoutMs ? Date.now() + timeoutMs : void 0; + while (true) { + try { + await this.#client.cpClient.queuePut({ + queueId: this.queueId, + values: valuesEncoded, + partitionKey, + partitionTtlSeconds: (partitionTtlMs || queueDefaultPartitionTtlMs) / 1e3 + }); + break; + } catch (e) { + if (e instanceof ClientError6 && e.code === Status6.RESOURCE_EXHAUSTED) { + delay = Math.min(delay * 2, 3e4); + if (deadline !== void 0) { + const remaining = deadline - Date.now(); + if (remaining <= 0) + throw new QueueFullError(`Put failed on ${this.queueId}.`); + delay = Math.min(delay, remaining); + } + await new Promise((resolve) => setTimeout(resolve, delay)); + } else { + throw e; + } + } + } + } + /** + * Add an item to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + async put(v, params = {}) { + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs" + }); + await this.#put( + [v], + params.timeoutMs, + params.partition, + params.partitionTtlMs + ); + } + /** + * Add several items to the end of the Queue. + * + * If the Queue is full, this will retry with exponential backoff until the + * provided `timeoutMs` is reached, or indefinitely if `timeoutMs` is not set. + * Raises {@link QueueFullError} if the Queue is still full after the timeout. + */ + async putMany(values, params = {}) { + checkForRenamedParams(params, { + timeout: "timeoutMs", + partitionTtl: "partitionTtlMs" + }); + await this.#put( + values, + params.timeoutMs, + params.partition, + params.partitionTtlMs + ); + } + /** Return the number of objects in the Queue. */ + async len(params = {}) { + if (params.partition && params.total) { + throw new InvalidError( + "Partition must be null when requesting total length." + ); + } + const resp = await this.#client.cpClient.queueLen({ + queueId: this.queueId, + partitionKey: _Queue.#validatePartitionKey(params.partition), + total: params.total + }); + return resp.len; + } + /** Iterate through items in a Queue without mutation. */ + async *iterate(params = {}) { + checkForRenamedParams(params, { itemPollTimeout: "itemPollTimeoutMs" }); + const { partition, itemPollTimeoutMs = 0 } = params; + let lastEntryId = void 0; + const validatedPartitionKey = _Queue.#validatePartitionKey(partition); + let fetchDeadline = Date.now() + itemPollTimeoutMs; + const maxPollDurationMs = 3e4; + while (true) { + const pollDurationMs = Math.max( + 0, + Math.min(maxPollDurationMs, fetchDeadline - Date.now()) + ); + const request = { + queueId: this.queueId, + partitionKey: validatedPartitionKey, + itemPollTimeout: pollDurationMs / 1e3, + lastEntryId: lastEntryId || "" + }; + const response = await this.#client.cpClient.queueNextItems(request); + if (response.items && response.items.length > 0) { + for (const item of response.items) { + yield loads(item.value); + lastEntryId = item.entryId; + } + fetchDeadline = Date.now() + itemPollTimeoutMs; + } else if (Date.now() > fetchDeadline) { + break; + } + } + } +}; + +// src/sandbox.ts +import { ClientError as ClientError7, Status as Status7 } from "nice-grpc"; + +// src/sandbox_snapshot.ts +var SandboxSnapshot = class { + snapshotId; + /** @ignore */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + constructor(client2, snapshotId) { + this.snapshotId = snapshotId; + } + /** + * @deprecated Use {@link SandboxSnapshotService#fromId client.sandboxSnapshots.fromId()} instead. + */ + static async fromId(snapshotId) { + return getDefaultClient().sandboxSnapshots.fromId(snapshotId); + } +}; +var SandboxSnapshotService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Get a {@link SandboxSnapshot} by ID. + */ + async fromId(snapshotId) { + await this.#client.cpClient.sandboxSnapshotGet({ snapshotId }); + return new SandboxSnapshot(this.#client, snapshotId); + } +}; + +// src/sandbox_filesystem.ts +var SandboxFile = class { + #client; + #fileDescriptor; + #taskId; + /** @ignore */ + constructor(client2, fileDescriptor, taskId) { + this.#client = client2; + this.#fileDescriptor = fileDescriptor; + this.#taskId = taskId; + } + /** + * Read data from the file. + * @returns Promise that resolves to the read data as Uint8Array + */ + async read() { + const resp = await runFilesystemExec(this.#client.cpClient, { + fileReadRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + const chunks = resp.chunks; + const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; + } + return result; + } + /** + * Write data to the file. + * @param data - Data to write (string or Uint8Array) + */ + async write(data) { + await runFilesystemExec(this.#client.cpClient, { + fileWriteRequest: { + fileDescriptor: this.#fileDescriptor, + data + }, + taskId: this.#taskId + }); + } + /** + * Flush any buffered data to the file. + */ + async flush() { + await runFilesystemExec(this.#client.cpClient, { + fileFlushRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + } + /** + * Close the file handle. + */ + async close() { + await runFilesystemExec(this.#client.cpClient, { + fileCloseRequest: { + fileDescriptor: this.#fileDescriptor + }, + taskId: this.#taskId + }); + } +}; +async function runFilesystemExec(cpClient, request) { + const response = await cpClient.containerFilesystemExec(request); + const chunks = []; + let retries = 10; + let completed = false; + while (!completed) { + try { + const outputIterator = cpClient.containerFilesystemExecGetOutput({ + execId: response.execId, + timeout: 55 + }); + for await (const batch of outputIterator) { + chunks.push(...batch.output); + if (batch.eof) { + completed = true; + break; + } + if (batch.error !== void 0) { + if (retries > 0) { + retries--; + break; + } + throw new SandboxFilesystemError(batch.error.errorMessage); + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) { + retries--; + } else throw err; + } + } + return { chunks, response }; +} + +// src/streams.ts +function toModalReadStream(stream) { + return Object.assign(stream, readMixin); +} +function toModalWriteStream(stream) { + return Object.assign(stream, writeMixin); +} +var readMixin = { + async readText() { + const reader = this.getReader(); + try { + const decoder2 = new TextDecoder("utf-8"); + const chunks = []; + while (true) { + const { value, done } = await reader.read(); + if (value) { + if (typeof value === "string") chunks.push(value); + else { + chunks.push(decoder2.decode(value.buffer, { stream: true })); + } + } + if (done) { + chunks.push(decoder2.decode(void 0, { stream: false })); + break; + } + } + return chunks.join(""); + } finally { + reader.releaseLock(); + } + }, + async readBytes() { + const chunks = []; + const reader = this.getReader(); + try { + while (true) { + const { value, done } = await reader.read(); + if (value) { + if (typeof value === "string") { + chunks.push(new TextEncoder().encode(value)); + } else { + chunks.push(value); + } + } + if (done) break; + } + } finally { + reader.releaseLock(); + } + let totalLength = 0; + for (const chunk of chunks) { + totalLength += chunk.length; + } + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; + } + return result; + } +}; +var writeMixin = { + async writeText(text) { + const writer = this.getWriter(); + try { + await writer.write(text); + } finally { + writer.releaseLock(); + } + }, + async writeBytes(bytes) { + const writer = this.getWriter(); + try { + await writer.write(bytes); + } finally { + writer.releaseLock(); + } + } +}; +function streamConsumingIter(iterable) { + const iter = iterable[Symbol.asyncIterator](); + return new ReadableStream( + { + async pull(controller) { + const { done, value } = await iter.next(); + if (value) { + controller.enqueue(value); + } + if (done) { + controller.close(); + } + }, + async cancel() { + consumeIterator(iter); + } + }, + new ByteLengthQueuingStrategy({ + highWaterMark: 64 * 1024 + // 64 KiB + }) + ); +} +async function consumeIterator(iter) { + while (true) { + const { done } = await iter.next(); + if (done) break; + } +} + +// src/sandbox.ts +async function buildSandboxCreateRequestProto(appId, imageId, params = {}) { + checkForRenamedParams(params, { + memory: "memoryMiB", + memoryLimit: "memoryLimitMiB", + timeout: "timeoutMs", + idleTimeout: "idleTimeoutMs" + }); + const gpuConfig = parseGpuConfig(params.gpu); + if (params.timeoutMs && params.timeoutMs % 1e3 !== 0) { + throw new Error( + `timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}` + ); + } + if (params.idleTimeoutMs && params.idleTimeoutMs % 1e3 !== 0) { + throw new Error( + `idleTimeoutMs must be a multiple of 1000ms, got ${params.idleTimeoutMs}` + ); + } + if (params.workdir && !params.workdir.startsWith("/")) { + throw new Error(`workdir must be an absolute path, got: ${params.workdir}`); + } + const volumeMounts = params.volumes ? Object.entries(params.volumes).map(([mountPath, volume]) => ({ + volumeId: volume.volumeId, + mountPath, + allowBackgroundCommits: true, + readOnly: volume.isReadOnly + })) : []; + const cloudBucketMounts = params.cloudBucketMounts ? Object.entries(params.cloudBucketMounts).map( + ([mountPath, mount]) => mount.toProto(mountPath) + ) : []; + const openPorts = []; + if (params.encryptedPorts) { + openPorts.push( + ...params.encryptedPorts.map( + (port) => PortSpec.create({ + port, + unencrypted: false + }) + ) + ); + } + if (params.h2Ports) { + openPorts.push( + ...params.h2Ports.map( + (port) => PortSpec.create({ + port, + unencrypted: false, + tunnelType: 1 /* TUNNEL_TYPE_H2 */ + }) + ) + ); + } + if (params.unencryptedPorts) { + openPorts.push( + ...params.unencryptedPorts.map( + (port) => PortSpec.create({ + port, + unencrypted: true + }) + ) + ); + } + const secretIds = (params.secrets || []).map((secret) => secret.secretId); + let networkAccess; + if (params.blockNetwork) { + if (params.cidrAllowlist) { + throw new Error( + "cidrAllowlist cannot be used when blockNetwork is enabled" + ); + } + networkAccess = { + networkAccessType: 2 /* BLOCKED */, + allowedCidrs: [] + }; + } else if (params.cidrAllowlist) { + networkAccess = { + networkAccessType: 3 /* ALLOWLIST */, + allowedCidrs: params.cidrAllowlist + }; + } else { + networkAccess = { + networkAccessType: 1 /* OPEN */, + allowedCidrs: [] + }; + } + const schedulerPlacement = params.regions?.length ? SchedulerPlacement.create({ + regions: params.regions + }) : void 0; + let ptyInfo; + if (params.pty) { + ptyInfo = defaultSandboxPTYInfo(); + } + let milliCpu = void 0; + let milliCpuMax = void 0; + if (params.cpu === void 0 && params.cpuLimit !== void 0) { + throw new Error("must also specify cpu when cpuLimit is specified"); + } + if (params.cpu !== void 0) { + if (params.cpu <= 0) { + throw new Error(`cpu (${params.cpu}) must be a positive number`); + } + milliCpu = Math.trunc(1e3 * params.cpu); + if (params.cpuLimit !== void 0) { + if (params.cpuLimit < params.cpu) { + throw new Error( + `cpu (${params.cpu}) cannot be higher than cpuLimit (${params.cpuLimit})` + ); + } + milliCpuMax = Math.trunc(1e3 * params.cpuLimit); + } + } + let memoryMb = void 0; + let memoryMbMax = void 0; + if (params.memoryMiB === void 0 && params.memoryLimitMiB !== void 0) { + throw new Error( + "must also specify memoryMiB when memoryLimitMiB is specified" + ); + } + if (params.memoryMiB !== void 0) { + if (params.memoryMiB <= 0) { + throw new Error( + `the memoryMiB request (${params.memoryMiB}) must be a positive number` + ); + } + memoryMb = params.memoryMiB; + if (params.memoryLimitMiB !== void 0) { + if (params.memoryLimitMiB < params.memoryMiB) { + throw new Error( + `the memoryMiB request (${params.memoryMiB}) cannot be higher than memoryLimitMiB (${params.memoryLimitMiB})` + ); + } + memoryMbMax = params.memoryLimitMiB; + } + } + return SandboxCreateRequest.create({ + appId, + definition: { + // Sleep default is implicit in image builder version <=2024.10 + entrypointArgs: params.command ?? ["sleep", "48h"], + imageId, + timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 : 600, + idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0, + workdir: params.workdir ?? void 0, + networkAccess, + resources: Resources.create({ + milliCpu, + milliCpuMax, + memoryMb, + memoryMbMax, + gpuConfig + }), + volumeMounts, + cloudBucketMounts, + ptyInfo, + secretIds, + openPorts: PortSpecs.create({ ports: openPorts }), + cloudProviderStr: params.cloud ?? "", + schedulerPlacement, + verbose: params.verbose ?? false, + proxyId: params.proxy?.proxyId, + name: params.name, + experimentalOptions: params.experimentalOptions, + enableSnapshot: params.experimentalEnableSnapshot ?? false + } + }); +} +var SandboxService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Create a new {@link Sandbox} in the {@link App} with the specified {@link Image} and options. + */ + async create(app, image, params = {}) { + await image.build(app); + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + params.env, + params.secrets + ); + const mergedParams = { + ...params, + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }; + const createReq = await buildSandboxCreateRequestProto( + app.appId, + image.imageId, + mergedParams + ); + let createResp; + try { + createResp = await this.#client.cpClient.sandboxCreate(createReq); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.ALREADY_EXISTS) { + throw new AlreadyExistsError(err.details || err.message); + } + throw err; + } + this.#client.logger.debug( + "Created Sandbox", + "sandbox_id", + createResp.sandboxId + ); + const memorySnapshotsEnabled = params.experimentalEnableSnapshot ?? false; + return new Sandbox2(this.#client, createResp.sandboxId, { + memorySnapshotsEnabled + }); + } + /** Returns a running {@link Sandbox} object from an ID. + * + * @returns Sandbox with ID + */ + async fromId(sandboxId, params) { + try { + await this.#client.cpClient.sandboxWait({ + sandboxId, + timeout: 0 + }); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.NOT_FOUND) + throw new NotFoundError(`Sandbox with id: '${sandboxId}' not found`); + throw err; + } + return new Sandbox2(this.#client, sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled + }); + } + /** Get a running {@link Sandbox} by name from a deployed {@link App}. + * + * Raises a {@link NotFoundError} if no running Sandbox is found with the given name. + * A Sandbox's name is the `name` argument passed to {@link SandboxService#create sandboxes.create()}. + * + * @param appName - Name of the deployed App + * @param name - Name of the Sandbox + * @param params - Optional parameters for getting the Sandbox + * @returns Promise that resolves to a Sandbox + */ + async fromName(appName, name, params) { + try { + const resp = await this.#client.cpClient.sandboxGetFromName({ + sandboxName: name, + appName, + environmentName: this.#client.environmentName(params?.environment) + }); + return new Sandbox2(this.#client, resp.sandboxId, { + memorySnapshotsEnabled: params?.memorySnapshotsEnabled + }); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.NOT_FOUND) + throw new NotFoundError( + `Sandbox with name '${name}' not found in App '${appName}'` + ); + throw err; + } + } + /** + * Restore a {@link Sandbox} from a {@link SandboxSnapshot} (experimental). + * + * @param snapshot - The snapshot to restore from + * @param params - Optional parameters for restoring the Sandbox + * @returns Promise that resolves to a Sandbox + */ + async experimentalFromSnapshot(snapshot, params = {}) { + let sandboxNameOverrideType = 0 /* SANDBOX_NAME_OVERRIDE_TYPE_UNSPECIFIED */; + let sandboxNameOverride = ""; + if (params.name === null) { + sandboxNameOverrideType = 1 /* SANDBOX_NAME_OVERRIDE_TYPE_NONE */; + } else if (params.name) { + sandboxNameOverrideType = 2 /* SANDBOX_NAME_OVERRIDE_TYPE_STRING */; + sandboxNameOverride = params.name; + } + let restoreResp; + try { + restoreResp = await this.#client.cpClient.sandboxRestore({ + snapshotId: snapshot.snapshotId, + sandboxNameOverride, + sandboxNameOverrideType + }); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.ALREADY_EXISTS) { + throw new AlreadyExistsError(err.details || err.message); + } + throw err; + } + await this.#client.cpClient.sandboxGetTaskId({ + sandboxId: restoreResp.sandboxId, + waitUntilReady: true, + timeout: 55 + }); + return new Sandbox2(this.#client, restoreResp.sandboxId, { + memorySnapshotsEnabled: true + }); + } + /** + * List all {@link Sandbox}es for the current Environment or App ID (if specified). + * If tags are specified, only Sandboxes that have at least those tags are returned. + */ + async *list(params = {}) { + const env = this.#client.environmentName(params.environment); + const tagsList = params.tags ? Object.entries(params.tags).map(([tagName, tagValue]) => ({ + tagName, + tagValue + })) : []; + let beforeTimestamp = void 0; + while (true) { + try { + const resp = await this.#client.cpClient.sandboxList({ + appId: params.appId, + beforeTimestamp, + environmentName: env, + includeFinished: false, + tags: tagsList + }); + if (!resp.sandboxes || resp.sandboxes.length === 0) { + return; + } + for (const info of resp.sandboxes) { + yield new Sandbox2(this.#client, info.id); + } + beforeTimestamp = resp.sandboxes[resp.sandboxes.length - 1].createdAt; + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + } + } +}; +var Tunnel = class { + /** @ignore */ + constructor(host, port, unencryptedHost, unencryptedPort) { + this.host = host; + this.port = port; + this.unencryptedHost = unencryptedHost; + this.unencryptedPort = unencryptedPort; + } + /** Get the public HTTPS URL of the forwarded port. */ + get url() { + let value = `https://${this.host}`; + if (this.port !== 443) { + value += `:${this.port}`; + } + return value; + } + /** Get the public TLS socket as a [host, port] tuple. */ + get tlsSocket() { + return [this.host, this.port]; + } + /** Get the public TCP socket as a [host, port] tuple. */ + get tcpSocket() { + if (!this.unencryptedHost || this.unencryptedPort === void 0) { + throw new InvalidError( + "This tunnel is not configured for unencrypted TCP." + ); + } + return [this.unencryptedHost, this.unencryptedPort]; + } +}; +function defaultSandboxPTYInfo() { + return PTYInfo.create({ + enabled: true, + winszRows: 24, + winszCols: 80, + envTerm: "xterm-256color", + envColorterm: "truecolor", + envTermProgram: "", + ptyType: 2 /* PTY_TYPE_SHELL */, + noTerminateOnIdleStdin: true + }); +} +async function buildContainerExecRequestProto(taskId, command, params) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const secretIds = (params?.secrets || []).map((secret) => secret.secretId); + let ptyInfo; + if (params?.pty) { + ptyInfo = defaultSandboxPTYInfo(); + } + return ContainerExecRequest.create({ + taskId, + command, + workdir: params?.workdir, + timeoutSecs: params?.timeoutMs ? params.timeoutMs / 1e3 : 0, + secretIds, + ptyInfo + }); +} +var Sandbox2 = class _Sandbox { + #client; + sandboxId; + stdin; + stdout; + stderr; + #taskId; + #tunnels; + #memorySnapshotsEnabled; + /** @ignore */ + constructor(client2, sandboxId, options = {}) { + this.#client = client2; + this.sandboxId = sandboxId; + this.#memorySnapshotsEnabled = options.memorySnapshotsEnabled ?? false; + this.stdin = toModalWriteStream(inputStreamSb(client2.cpClient, sandboxId)); + this.stdout = toModalReadStream( + streamConsumingIter( + outputStreamSb( + client2.cpClient, + sandboxId, + 1 /* FILE_DESCRIPTOR_STDOUT */ + ) + ).pipeThrough(new TextDecoderStream()) + ); + this.stderr = toModalReadStream( + streamConsumingIter( + outputStreamSb( + client2.cpClient, + sandboxId, + 2 /* FILE_DESCRIPTOR_STDERR */ + ) + ).pipeThrough(new TextDecoderStream()) + ); + } + /** Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in {@link SandboxService#list Sandbox.list}. */ + async setTags(tags) { + const tagsList = Object.entries(tags).map(([tagName, tagValue]) => ({ + tagName, + tagValue + })); + try { + await this.#client.cpClient.sandboxTagsSet({ + environmentName: this.#client.environmentName(), + sandboxId: this.sandboxId, + tags: tagsList + }); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + } + /** Get tags (key-value pairs) currently attached to this Sandbox from the server. */ + async getTags() { + let resp; + try { + resp = await this.#client.cpClient.sandboxTagsGet({ + sandboxId: this.sandboxId + }); + } catch (err) { + if (err instanceof ClientError7 && err.code === Status7.INVALID_ARGUMENT) { + throw new InvalidError(err.details || err.message); + } + throw err; + } + const tags = {}; + for (const tag of resp.tags) { + tags[tag.tagName] = tag.tagValue; + } + return tags; + } + /** + * @deprecated Use {@link SandboxService#fromId client.sandboxes.fromId()} instead. + */ + static async fromId(sandboxId) { + return getDefaultClient().sandboxes.fromId(sandboxId); + } + /** + * @deprecated Use {@link SandboxService#fromName client.sandboxes.fromName()} instead. + */ + static async fromName(appName, name, environment) { + return getDefaultClient().sandboxes.fromName(appName, name, { + environment + }); + } + /** + * Open a file in the Sandbox filesystem. + * @param path - Path to the file to open + * @param mode - File open mode (r, w, a, r+, w+, a+) + * @returns Promise that resolves to a {@link SandboxFile} + */ + async open(path2, mode = "r") { + const taskId = await this.#getTaskId(); + const resp = await runFilesystemExec(this.#client.cpClient, { + fileOpenRequest: { + path: path2, + mode + }, + taskId + }); + const fileDescriptor = resp.response.fileDescriptor; + return new SandboxFile(this.#client, fileDescriptor, taskId); + } + async exec(command, params) { + const taskId = await this.#getTaskId(); + const mergedSecrets = await mergeEnvIntoSecrets( + this.#client, + params?.env, + params?.secrets + ); + const mergedParams = { + ...params, + secrets: mergedSecrets, + env: void 0 + // setting env to undefined just to clarify it's not needed anymore + }; + const req = await buildContainerExecRequestProto( + taskId, + command, + mergedParams + ); + const resp = await this.#client.cpClient.containerExec(req); + this.#client.logger.debug( + "Created ContainerProcess", + "exec_id", + resp.execId, + "sandbox_id", + this.sandboxId, + "command", + command + ); + return new ContainerProcess(this.#client, resp.execId, params); + } + async #getTaskId() { + if (this.#taskId === void 0) { + const resp = await this.#client.cpClient.sandboxGetTaskId({ + sandboxId: this.sandboxId + }); + if (!resp.taskId) { + throw new Error( + `Sandbox ${this.sandboxId} does not have a task ID. It may not be running.` + ); + } + if (resp.taskResult) { + throw new Error( + `Sandbox ${this.sandboxId} has already completed with result: ${resp.taskResult}` + ); + } + this.#taskId = resp.taskId; + } + return this.#taskId; + } + async terminate() { + await this.#client.cpClient.sandboxTerminate({ sandboxId: this.sandboxId }); + this.#taskId = void 0; + } + async wait() { + while (true) { + const resp = await this.#client.cpClient.sandboxWait({ + sandboxId: this.sandboxId, + timeout: 10 + }); + if (resp.result) { + const returnCode = _Sandbox.#getReturnCode(resp.result); + this.#client.logger.debug( + "Sandbox wait completed", + "sandbox_id", + this.sandboxId, + "status", + resp.result.status, + "return_code", + returnCode + ); + return returnCode; + } + } + } + /** Get {@link Tunnel} metadata for the Sandbox. + * + * Raises {@link SandboxTimeoutError} if the tunnels are not available after the timeout. + * + * @returns A dictionary of {@link Tunnel} objects which are keyed by the container port. + */ + async tunnels(timeoutMs = 5e4) { + if (this.#tunnels) { + return this.#tunnels; + } + const resp = await this.#client.cpClient.sandboxGetTunnels({ + sandboxId: this.sandboxId, + timeout: timeoutMs / 1e3 + }); + if (resp.result?.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + throw new SandboxTimeoutError(); + } + this.#tunnels = {}; + for (const t of resp.tunnels) { + this.#tunnels[t.containerPort] = new Tunnel( + t.host, + t.port, + t.unencryptedHost, + t.unencryptedPort + ); + } + return this.#tunnels; + } + /** + * Snapshot the filesystem of the Sandbox. + * + * Returns an {@link Image} object which can be used to spawn a new Sandbox with the same filesystem. + * + * @param timeoutMs - Timeout for the snapshot operation in milliseconds + * @returns Promise that resolves to an {@link Image} + */ + async snapshotFilesystem(timeoutMs = 55e3) { + const resp = await this.#client.cpClient.sandboxSnapshotFs({ + sandboxId: this.sandboxId, + timeout: timeoutMs / 1e3 + }); + if (resp.result?.status !== 1 /* GENERIC_STATUS_SUCCESS */) { + throw new Error( + `Sandbox snapshot failed: ${resp.result?.exception || "Unknown error"}` + ); + } + if (!resp.imageId) { + throw new Error("Sandbox snapshot response missing `imageId`"); + } + return new Image2(this.#client, resp.imageId, ""); + } + /** + * Take a memory snapshot of the Sandbox (experimental). + * + * Returns a {@link SandboxSnapshot} object which can be used to restore a new Sandbox. + * + * @returns Promise that resolves to a {@link SandboxSnapshot} + */ + async experimentalSnapshot() { + if (!this.#memorySnapshotsEnabled) { + throw new InvalidError( + "Memory snapshots are not supported for this sandbox. Enable them by setting `experimentalEnableSnapshot: true` when creating the sandbox." + ); + } + await this.#getTaskId(); + const snapshotResp = await this.#client.cpClient.sandboxSnapshot({ + sandboxId: this.sandboxId + }); + const snapshotId = snapshotResp.snapshotId; + if (!snapshotId) { + throw new Error("Sandbox snapshot response missing `snapshotId`"); + } + const waitResp = await this.#client.cpClient.sandboxSnapshotWait({ + snapshotId, + timeout: 55 + }); + const result = waitResp.result; + if (result && result.status !== 1 /* GENERIC_STATUS_SUCCESS */ && result.status !== 0 /* GENERIC_STATUS_UNSPECIFIED */) { + throw new Error(result.exception || "Sandbox snapshot failed"); + } + return new SandboxSnapshot(this.#client, snapshotId); + } + /** + * Check if the Sandbox has finished running. + * + * Returns `null` if the Sandbox is still running, else returns the exit code. + */ + async poll() { + const resp = await this.#client.cpClient.sandboxWait({ + sandboxId: this.sandboxId, + timeout: 0 + }); + return _Sandbox.#getReturnCode(resp.result); + } + /** + * Create a connect token for this Sandbox. + * + * Connect tokens enable authenticated access to services running inside the Sandbox + * through HTTP and WebSocket requests. The token can be transmitted via: + * - Authorization header: `Authorization: Bearer {token}` + * - Query parameter: `_modal_connect_token` in the URL + * - Cookie: `_modal_connect_token` as a cookie + * + * The service inside the container must listen on port 8080. + * + * @param params - Optional parameters for the connect token + * @returns Promise that resolves to a {@link ConnectToken} + */ + async createConnectToken(params = {}) { + const userMetadata = params.userMetadata ? JSON.stringify(params.userMetadata) : ""; + const resp = await this.#client.cpClient.sandboxCreateConnectToken({ + sandboxId: this.sandboxId, + userMetadata + }); + return { + url: resp.url, + token: resp.token + }; + } + /** + * @deprecated Use {@link SandboxService#list client.sandboxes.list()} instead. + */ + static async *list(params = {}) { + yield* getDefaultClient().sandboxes.list(params); + } + static #getReturnCode(result) { + if (result === void 0 || result.status === 0 /* GENERIC_STATUS_UNSPECIFIED */) { + return null; + } + if (result.status === 4 /* GENERIC_STATUS_TIMEOUT */) { + return 124; + } else if (result.status === 3 /* GENERIC_STATUS_TERMINATED */) { + return 137; + } else { + return result.exitcode; + } + } +}; +var ContainerProcess = class { + stdin; + stdout; + stderr; + returncode = null; + #client; + #execId; + constructor(client2, execId, params) { + this.#client = client2; + const mode = params?.mode ?? "text"; + const stdout = params?.stdout ?? "pipe"; + const stderr = params?.stderr ?? "pipe"; + this.#execId = execId; + this.stdin = toModalWriteStream(inputStreamCp(client2.cpClient, execId)); + let stdoutStream = streamConsumingIter( + outputStreamCp( + client2.cpClient, + execId, + 1 /* FILE_DESCRIPTOR_STDOUT */ + ) + ); + if (stdout === "ignore") { + stdoutStream.cancel(); + stdoutStream = ReadableStream.from([]); + } + let stderrStream = streamConsumingIter( + outputStreamCp( + client2.cpClient, + execId, + 2 /* FILE_DESCRIPTOR_STDERR */ + ) + ); + if (stderr === "ignore") { + stderrStream.cancel(); + stderrStream = ReadableStream.from([]); + } + if (mode === "text") { + this.stdout = toModalReadStream( + stdoutStream.pipeThrough(new TextDecoderStream()) + ); + this.stderr = toModalReadStream( + stderrStream.pipeThrough(new TextDecoderStream()) + ); + } else { + this.stdout = toModalReadStream(stdoutStream); + this.stderr = toModalReadStream(stderrStream); + } + } + /** Wait for process completion and return the exit code. */ + async wait() { + while (true) { + const resp = await this.#client.cpClient.containerExecWait({ + execId: this.#execId, + timeout: 55 + }); + if (resp.completed) { + return resp.exitCode ?? 0; + } + } + } +}; +async function* outputStreamSb(cpClient, sandboxId, fileDescriptor) { + let lastIndex = "0-0"; + let completed = false; + let retries = 10; + while (!completed) { + try { + const outputIterator = cpClient.sandboxGetLogs({ + sandboxId, + fileDescriptor, + timeout: 55, + lastEntryId: lastIndex + }); + for await (const batch of outputIterator) { + lastIndex = batch.entryId; + yield* batch.items.map((item) => new TextEncoder().encode(item.data)); + if (batch.eof) { + completed = true; + break; + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) retries--; + else throw err; + } + } +} +async function* outputStreamCp(cpClient, execId, fileDescriptor) { + let lastIndex = 0; + let completed = false; + let retries = 10; + while (!completed) { + try { + const outputIterator = cpClient.containerExecGetOutput({ + execId, + fileDescriptor, + timeout: 55, + getRawBytes: true, + lastBatchIndex: lastIndex + }); + for await (const batch of outputIterator) { + lastIndex = batch.batchIndex; + yield* batch.items.map((item) => item.messageBytes); + if (batch.exitCode !== void 0) { + completed = true; + break; + } + } + } catch (err) { + if (isRetryableGrpc(err) && retries > 0) retries--; + else throw err; + } + } +} +function inputStreamSb(cpClient, sandboxId) { + let index = 1; + return new WritableStream({ + async write(chunk) { + await cpClient.sandboxStdinWrite({ + sandboxId, + input: encodeIfString(chunk), + index + }); + index++; + }, + async close() { + await cpClient.sandboxStdinWrite({ + sandboxId, + index, + eof: true + }); + } + }); +} +function inputStreamCp(cpClient, execId) { + let messageIndex = 1; + return new WritableStream({ + async write(chunk) { + await cpClient.containerExecPutInput({ + execId, + input: { + message: encodeIfString(chunk), + messageIndex + } + }); + messageIndex++; + }, + async close() { + await cpClient.containerExecPutInput({ + execId, + input: { + messageIndex, + eof: true + } + }); + } + }); +} +function encodeIfString(chunk) { + return typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk; +} + +// src/volume.ts +import { ClientError as ClientError8, Status as Status8 } from "nice-grpc"; +var VolumeService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a {@link Volume} by its name. + */ + async fromName(name, params) { + try { + const resp = await this.#client.cpClient.volumeGetOrCreate({ + deploymentName: name, + environmentName: this.#client.environmentName(params?.environment), + objectCreationType: params?.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */ + }); + this.#client.logger.debug( + "Retrieved Volume", + "volume_id", + resp.volumeId, + "volume_name", + name + ); + return new Volume(resp.volumeId, name); + } catch (err) { + if (err instanceof ClientError8 && err.code === Status8.NOT_FOUND) + throw new NotFoundError(err.details); + throw err; + } + } + /** + * Create a nameless, temporary {@link Volume}. + * It persists until closeEphemeral() is called, or the process exits. + */ + async ephemeral(params = {}) { + const resp = await this.#client.cpClient.volumeGetOrCreate({ + objectCreationType: 5 /* OBJECT_CREATION_TYPE_EPHEMERAL */, + environmentName: this.#client.environmentName(params.environment) + }); + this.#client.logger.debug( + "Created ephemeral Volume", + "volume_id", + resp.volumeId + ); + const ephemeralHbManager = new EphemeralHeartbeatManager( + () => this.#client.cpClient.volumeHeartbeat({ volumeId: resp.volumeId }) + ); + return new Volume(resp.volumeId, void 0, false, ephemeralHbManager); + } + /** + * Delete a named {@link Volume}. + * + * Warning: Deletion is irreversible and will affect any Apps currently using the Volume. + */ + async delete(name, params) { + try { + const volume = await this.fromName(name, { + environment: params?.environment, + createIfMissing: false + }); + await this.#client.cpClient.volumeDelete({ + volumeId: volume.volumeId + }); + this.#client.logger.debug( + "Deleted Volume", + "volume_name", + name, + "volume_id", + volume.volumeId + ); + } catch (err) { + if (err instanceof NotFoundError && params?.allowMissing) { + return; + } + throw err; + } + } +}; +var Volume = class _Volume { + volumeId; + name; + _readOnly = false; + #ephemeralHbManager; + /** @ignore */ + constructor(volumeId, name, readOnly = false, ephemeralHbManager) { + this.volumeId = volumeId; + this.name = name; + this._readOnly = readOnly; + this.#ephemeralHbManager = ephemeralHbManager; + } + /** + * @deprecated Use {@link VolumeService#fromName client.volumes.fromName()} instead. + */ + static async fromName(name, options) { + return getDefaultClient().volumes.fromName(name, options); + } + /** Configure Volume to mount as read-only. */ + readOnly() { + return new _Volume(this.volumeId, this.name, true, this.#ephemeralHbManager); + } + get isReadOnly() { + return this._readOnly; + } + /** + * @deprecated Use {@link VolumeService#ephemeral client.volumes.ephemeral()} instead. + */ + static async ephemeral(options = {}) { + return getDefaultClient().volumes.ephemeral(options); + } + /** Delete the ephemeral Volume. Only usable with emphemeral Volumes. */ + closeEphemeral() { + if (this.#ephemeralHbManager) { + this.#ephemeralHbManager.stop(); + } else { + throw new InvalidError("Volume is not ephemeral."); + } + } +}; + +// src/config.ts +import { readFileSync } from "node:fs"; +import { homedir } from "node:os"; +import path from "node:path"; +import { parse as parseToml } from "smol-toml"; +function configFilePath() { + const configPath = process.env["MODAL_CONFIG_PATH"]; + if (configPath && configPath !== "") { + return configPath; + } + return path.join(homedir(), ".modal.toml"); +} +function readConfigFile() { + try { + const configPath = configFilePath(); + const configContent = readFileSync(configPath, { + encoding: "utf-8" + }); + return parseToml(configContent); + } catch (err) { + if (err.code === "ENOENT") { + return {}; + } + return {}; + } +} +var config = readConfigFile(); +function getProfile(profileName) { + if (!profileName) { + for (const [name, profileData2] of Object.entries(config)) { + if (profileData2.active) { + profileName = name; + break; + } + } + } + const profileData = profileName && Object.hasOwn(config, profileName) ? config[profileName] : {}; + const profile = { + serverUrl: process.env["MODAL_SERVER_URL"] || profileData.server_url || "https://api.modal.com:443", + tokenId: process.env["MODAL_TOKEN_ID"] || profileData.token_id, + tokenSecret: process.env["MODAL_TOKEN_SECRET"] || profileData.token_secret, + environment: process.env["MODAL_ENVIRONMENT"] || profileData.environment, + imageBuilderVersion: process.env["MODAL_IMAGE_BUILDER_VERSION"] || profileData.imageBuilderVersion, + logLevel: process.env["MODAL_LOGLEVEL"] || profileData.loglevel + }; + return profile; +} + +// src/auth_token_manager.ts +var REFRESH_WINDOW = 5 * 60; +var DEFAULT_EXPIRY_OFFSET = 20 * 60; +var AuthTokenManager = class { + client; + logger; + currentToken = ""; + tokenExpiry = 0; + stopped = false; + timeoutId = null; + initialTokenPromise = null; + constructor(client2, logger) { + this.client = client2; + this.logger = logger; + } + /** + * Returns the current cached token. + * If the initial token fetch is still in progress, waits for it to complete. + */ + async getToken() { + if (this.initialTokenPromise) { + await this.initialTokenPromise; + } + if (this.currentToken && !this.isExpired()) { + return this.currentToken; + } + throw new Error("No valid auth token available"); + } + /** + * Fetches a new auth token from the server and stores it. + */ + async fetchToken() { + const response = await this.client.authTokenGet({}); + const token = response.token; + if (!token) { + throw new Error( + "Internal error: did not receive auth token from server, please contact Modal support" + ); + } + this.currentToken = token; + const exp = this.decodeJWT(token); + if (exp > 0) { + this.tokenExpiry = exp; + } else { + this.logger.warn("x-modal-auth-token does not contain exp field"); + this.tokenExpiry = Math.floor(Date.now() / 1e3) + DEFAULT_EXPIRY_OFFSET; + } + const now = Math.floor(Date.now() / 1e3); + const expiresIn = this.tokenExpiry - now; + const refreshIn = this.tokenExpiry - now - REFRESH_WINDOW; + this.logger.debug( + "Fetched auth token", + "expires_in", + `${expiresIn}s`, + "refresh_in", + `${refreshIn}s` + ); + } + /** + * Background loop that refreshes tokens REFRESH_WINDOW seconds before they expire. + */ + async backgroundRefresh() { + while (!this.stopped) { + const now = Math.floor(Date.now() / 1e3); + const refreshTime = this.tokenExpiry - REFRESH_WINDOW; + const delay = Math.max(0, refreshTime - now) * 1e3; + await new Promise((resolve) => { + this.timeoutId = setTimeout(resolve, delay); + this.timeoutId.unref(); + }); + if (this.stopped) { + return; + } + try { + await this.fetchToken(); + } catch (error) { + this.logger.error("Failed to refresh auth token", "error", error); + await new Promise((resolve) => setTimeout(resolve, 5e3)); + } + } + } + /** + * Fetches the initial token and starts the refresh loop. + * Throws an error if the initial token fetch fails. + */ + async start() { + this.initialTokenPromise = this.fetchToken(); + try { + await this.initialTokenPromise; + } finally { + this.initialTokenPromise = null; + } + this.stopped = false; + this.backgroundRefresh(); + } + /** + * Stops the background refresh. + */ + stop() { + this.stopped = true; + if (this.timeoutId) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } + } + /** + * Extracts the exp claim from a JWT token. + */ + decodeJWT(token) { + try { + const parts = token.split("."); + if (parts.length !== 3) { + return 0; + } + let payload = parts[1]; + while (payload.length % 4 !== 0) { + payload += "="; + } + const decoded = atob(payload); + const claims = JSON.parse(decoded); + return claims.exp || 0; + } catch { + return 0; + } + } + isExpired() { + const now = Math.floor(Date.now() / 1e3); + return now >= this.tokenExpiry; + } + getCurrentToken() { + return this.currentToken; + } + setToken(token, expiry) { + this.currentToken = token; + this.tokenExpiry = expiry; + } +}; + +// src/version.ts +function getSDKVersion() { + return true ? "0.5.5" : "0.0.0"; +} + +// src/logger.ts +var LOG_LEVELS = { + debug: 0, + info: 1, + warn: 2, + error: 3 +}; +function parseLogLevel(level) { + if (!level) { + return "warn"; + } + const normalized = level.toLowerCase(); + if (normalized === "debug" || normalized === "info" || normalized === "warn" || normalized === "warning" || normalized === "error") { + return normalized === "warning" ? "warn" : normalized; + } + throw new Error( + `Invalid log level value: "${level}" (must be debug, info, warn, or error)` + ); +} +var DefaultLogger = class { + levelValue; + constructor(level = "warn") { + this.levelValue = LOG_LEVELS[level]; + } + debug(message, ...args) { + if (this.levelValue <= LOG_LEVELS.debug) { + console.log(this.formatMessage("DEBUG", message, args)); + } + } + info(message, ...args) { + if (this.levelValue <= LOG_LEVELS.info) { + console.log(this.formatMessage("INFO", message, args)); + } + } + warn(message, ...args) { + if (this.levelValue <= LOG_LEVELS.warn) { + console.warn(this.formatMessage("WARN", message, args)); + } + } + error(message, ...args) { + if (this.levelValue <= LOG_LEVELS.error) { + console.error(this.formatMessage("ERROR", message, args)); + } + } + formatMessage(level, message, args) { + const timestamp = (/* @__PURE__ */ new Date()).toISOString(); + let formatted = `time=${timestamp} level=${level} msg="${message}"`; + if (args.length > 0) { + for (let i = 0; i < args.length; i += 2) { + if (i + 1 < args.length) { + const key = args[i]; + const value = args[i + 1]; + formatted += ` ${key}=${this.formatValue(value)}`; + } + } + } + return formatted; + } + formatValue(value) { + if (typeof value === "string") { + return value.includes(" ") ? `"${value}"` : value; + } + if (value instanceof Error) { + return `"${value.message}"`; + } + if (Array.isArray(value)) { + return `[${value.join(",")}]`; + } + return String(value); + } +}; +var FilteredLogger = class { + constructor(logger, level) { + this.logger = logger; + this.levelValue = LOG_LEVELS[level]; + } + levelValue; + debug(message, ...args) { + if (this.levelValue <= LOG_LEVELS.debug) { + this.logger.debug(message, ...args); + } + } + info(message, ...args) { + if (this.levelValue <= LOG_LEVELS.info) { + this.logger.info(message, ...args); + } + } + warn(message, ...args) { + if (this.levelValue <= LOG_LEVELS.warn) { + this.logger.warn(message, ...args); + } + } + error(message, ...args) { + if (this.levelValue <= LOG_LEVELS.error) { + this.logger.error(message, ...args); + } + } +}; +function createLogger(logger, logLevel = "") { + const level = parseLogLevel(logLevel); + if (logger) { + return new FilteredLogger(logger, level); + } + return new DefaultLogger(level); +} + +// src/client.ts +var ModalClient3 = class { + apps; + cloudBucketMounts; + cls; + functions; + functionCalls; + images; + proxies; + queues; + sandboxes; + sandboxSnapshots; + secrets; + volumes; + /** @ignore */ + cpClient; + profile; + logger; + ipClients; + authTokenManager = null; + customMiddleware; + constructor(params) { + checkForRenamedParams(params, { timeout: "timeoutMs" }); + const baseProfile = getProfile(process.env["MODAL_PROFILE"]); + this.profile = { + ...baseProfile, + ...params?.tokenId && { tokenId: params.tokenId }, + ...params?.tokenSecret && { tokenSecret: params.tokenSecret }, + ...params?.environment && { environment: params.environment } + }; + const logLevelValue = params?.logLevel || this.profile.logLevel || ""; + this.logger = createLogger(params?.logger, logLevelValue); + this.logger.debug( + "Initializing Modal client", + "version", + getSDKVersion(), + "server_url", + this.profile.serverUrl + ); + this.customMiddleware = params?.grpcMiddleware ?? []; + this.ipClients = /* @__PURE__ */ new Map(); + this.cpClient = params?.cpClient ?? this.createClient(this.profile); + this.logger.debug("Modal client initialized successfully"); + this.apps = new AppService(this); + this.cloudBucketMounts = new CloudBucketMountService(this); + this.cls = new ClsService(this); + this.functions = new FunctionService(this); + this.functionCalls = new FunctionCallService(this); + this.images = new ImageService(this); + this.proxies = new ProxyService(this); + this.queues = new QueueService(this); + this.sandboxes = new SandboxService(this); + this.sandboxSnapshots = new SandboxSnapshotService(this); + this.secrets = new SecretService(this); + this.volumes = new VolumeService(this); + } + environmentName(environment) { + return environment || this.profile.environment || ""; + } + imageBuilderVersion(version) { + return version || this.profile.imageBuilderVersion || "2024.10"; + } + /** @ignore */ + ipClient(serverUrl) { + const existing = this.ipClients.get(serverUrl); + if (existing) { + return existing; + } + this.logger.debug("Creating input plane client", "server_url", serverUrl); + const profile = { ...this.profile, serverUrl }; + const newClient = this.createClient(profile); + this.ipClients.set(serverUrl, newClient); + return newClient; + } + close() { + this.logger.debug("Closing Modal client"); + if (this.authTokenManager) { + this.authTokenManager.stop(); + this.authTokenManager = null; + } + this.logger.debug("Modal client closed"); + } + version() { + return getSDKVersion(); + } + createClient(profile) { + const channel = createChannel(profile.serverUrl, void 0, { + "grpc.max_receive_message_length": 100 * 1024 * 1024, + "grpc.max_send_message_length": 100 * 1024 * 1024, + "grpc-node.flow_control_window": 64 * 1024 * 1024 + }); + let factory = createClientFactory().use(this.authMiddleware(profile)).use(this.retryMiddleware()).use(timeoutMiddleware); + for (const middleware of this.customMiddleware) { + factory = factory.use(middleware); + } + return factory.create(ModalClientDefinition, channel); + } + /** Middleware to retry transient errors and timeouts for unary requests. */ + retryMiddleware() { + const logger = this.logger; + return async function* retryMiddleware(call, options) { + const { + retries = 3, + baseDelay = 100, + maxDelay = 1e3, + delayFactor = 2, + additionalStatusCodes = [], + signal, + ...restOptions + } = options; + if (call.requestStream || call.responseStream || !retries) { + return yield* call.next(call.request, restOptions); + } + const retryableCodes = /* @__PURE__ */ new Set([ + ...retryableGrpcStatusCodes, + ...additionalStatusCodes + ]); + const idempotencyKey = uuidv4(); + const startTime = Date.now(); + let attempt = 0; + let delayMs = baseDelay; + logger.debug("Sending gRPC request", "method", call.method.path); + while (true) { + const metadata = new Metadata(restOptions.metadata ?? {}); + metadata.set("x-idempotency-key", idempotencyKey); + metadata.set("x-retry-attempt", String(attempt)); + if (attempt > 0) { + metadata.set( + "x-retry-delay", + ((Date.now() - startTime) / 1e3).toFixed(3) + ); + } + try { + return yield* call.next(call.request, { + ...restOptions, + metadata, + signal + }); + } catch (err) { + if (!(err instanceof ClientError9) || !retryableCodes.has(err.code) || attempt >= retries) { + if (attempt === retries && attempt > 0) { + logger.debug( + "Final retry attempt failed", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8) + ); + } + throw err; + } + if (attempt > 0) { + logger.debug( + "Retryable failure", + "error", + err, + "retries", + attempt, + "delay", + delayMs, + "method", + call.method.path, + "idempotency_key", + idempotencyKey.substring(0, 8) + ); + } + await sleep(delayMs, signal); + delayMs = Math.min(delayMs * delayFactor, maxDelay); + attempt += 1; + } + } + }; + } + authMiddleware(profile) { + const getOrCreateAuthTokenManager = () => { + if (!this.authTokenManager) { + this.authTokenManager = new AuthTokenManager( + this.cpClient, + this.logger + ); + this.authTokenManager.start(); + } + return this.authTokenManager; + }; + return async function* authMiddleware(call, options) { + if (!profile.tokenId || !profile.tokenSecret) { + throw new Error( + `Profile is missing token_id or token_secret. Please set them in .modal.toml, or as environment variables, or via ModalClient constructor.` + ); + } + const { tokenId, tokenSecret } = profile; + options.metadata ??= new Metadata(); + options.metadata.set( + "x-modal-client-type", + String(8 /* CLIENT_TYPE_LIBMODAL_JS */) + ); + options.metadata.set("x-modal-client-version", "1.0.0"); + options.metadata.set( + "x-modal-libmodal-version", + `modal-js/${getSDKVersion()}` + ); + options.metadata.set("x-modal-token-id", tokenId); + options.metadata.set("x-modal-token-secret", tokenSecret); + if (call.method.path !== "/modal.client.ModalClient/AuthTokenGet") { + const tokenManager = getOrCreateAuthTokenManager(); + const token = await tokenManager.getToken(); + if (token) { + options.metadata.set("x-modal-auth-token", token); + } + } + return yield* call.next(call.request, options); + }; + } +}; +var timeoutMiddleware = async function* timeoutMiddleware2(call, options) { + if (!options.timeoutMs || options.signal?.aborted) { + return yield* call.next(call.request, options); + } + const { timeoutMs, signal: origSignal, ...restOptions } = options; + const abortController = new AbortController(); + const abortListener = () => abortController.abort(); + origSignal?.addEventListener("abort", abortListener); + let timedOut = false; + const timer = setTimeout(() => { + timedOut = true; + abortController.abort(); + }, timeoutMs); + try { + return yield* call.next(call.request, { + ...restOptions, + signal: abortController.signal + }); + } finally { + origSignal?.removeEventListener("abort", abortListener); + clearTimeout(timer); + if (timedOut) { + throw new ClientError9( + call.method.path, + Status9.DEADLINE_EXCEEDED, + `Timed out after ${timeoutMs}ms` + ); + } + } +}; +var retryableGrpcStatusCodes = /* @__PURE__ */ new Set([ + Status9.DEADLINE_EXCEEDED, + Status9.UNAVAILABLE, + Status9.CANCELLED, + Status9.INTERNAL, + Status9.UNKNOWN +]); +function isRetryableGrpc(err) { + if (err instanceof ClientError9) { + return retryableGrpcStatusCodes.has(err.code); + } + return false; +} +var sleep = (ms, signal) => new Promise((resolve, reject) => { + if (signal?.aborted) return reject(signal.reason); + const t = setTimeout(resolve, ms); + signal?.addEventListener( + "abort", + () => { + clearTimeout(t); + reject(signal.reason); + }, + { once: true } + ); +}); +var defaultClient; +var defaultClientOptions; +function getDefaultClient() { + if (!defaultClient) { + defaultClient = new ModalClient3(defaultClientOptions); + } + return defaultClient; +} +var client = new Proxy({}, { + get(_target, prop) { + return getDefaultClient().cpClient[prop]; + } +}); +function initializeClient(options) { + defaultClientOptions = { + tokenId: options.tokenId, + tokenSecret: options.tokenSecret, + environment: options.environment + }; + defaultClient = new ModalClient3(defaultClientOptions); +} +function close() { + if (defaultClient) { + defaultClient.close(); + } +} + +// src/app.ts +var AppService = class { + #client; + constructor(client2) { + this.#client = client2; + } + /** + * Reference a deployed {@link App} by name, or create if it does not exist. + */ + async fromName(name, params = {}) { + try { + const resp = await this.#client.cpClient.appGetOrCreate({ + appName: name, + environmentName: this.#client.environmentName(params.environment), + objectCreationType: params.createIfMissing ? 1 /* OBJECT_CREATION_TYPE_CREATE_IF_MISSING */ : 0 /* OBJECT_CREATION_TYPE_UNSPECIFIED */ + }); + this.#client.logger.debug( + "Retrieved App", + "app_id", + resp.appId, + "app_name", + name + ); + return new App2(resp.appId, name); + } catch (err) { + if (err instanceof ClientError10 && err.code === Status10.NOT_FOUND) + throw new NotFoundError(`App '${name}' not found`); + throw err; + } + } +}; +function parseGpuConfig(gpu) { + if (!gpu) { + return GPUConfig.create({}); + } + let gpuType = gpu; + let count = 1; + if (gpu.includes(":")) { + const [type, countStr] = gpu.split(":", 2); + gpuType = type; + count = parseInt(countStr, 10); + if (isNaN(count) || count < 1) { + throw new Error( + `Invalid GPU count: ${countStr}. Value must be a positive integer.` + ); + } + } + return GPUConfig.create({ + count, + gpuType: gpuType.toUpperCase() + }); +} +var App2 = class { + appId; + name; + /** @ignore */ + constructor(appId, name) { + this.appId = appId; + this.name = name; + } + /** + * @deprecated Use {@link AppService#fromName client.apps.fromName()} instead. + */ + // eslint-disable-next-line @typescript-eslint/no-deprecated + static async lookup(name, options = {}) { + return getDefaultClient().apps.fromName(name, options); + } + /** + * @deprecated Use {@link SandboxService#create client.sandboxes.create()} instead. + */ + async createSandbox(image, options = {}) { + return getDefaultClient().sandboxes.create(this, image, options); + } + /** + * @deprecated Use {@link ImageService#fromRegistry client.images.fromRegistry()} instead. + */ + async imageFromRegistry(tag, secret) { + return getDefaultClient().images.fromRegistry(tag, secret).build(this); + } + /** + * @deprecated Use {@link ImageService#fromAwsEcr client.images.fromAwsEcr()} instead. + */ + async imageFromAwsEcr(tag, secret) { + return getDefaultClient().images.fromAwsEcr(tag, secret).build(this); + } + /** + * @deprecated Use {@link ImageService#fromGcpArtifactRegistry client.images.fromGcpArtifactRegistry()} instead. + */ + async imageFromGcpArtifactRegistry(tag, secret) { + return getDefaultClient().images.fromGcpArtifactRegistry(tag, secret).build(this); + } +}; +export { + AlreadyExistsError, + App2 as App, + AppService, + CloudBucketMount2 as CloudBucketMount, + CloudBucketMountService, + Cls, + ClsInstance, + ClsService, + ContainerProcess, + FunctionCall, + FunctionCallService, + FunctionService, + FunctionTimeoutError, + Function_, + Image2 as Image, + ImageService, + InternalFailure, + InvalidError, + ModalClient3 as ModalClient, + NotFoundError, + Proxy3 as Proxy, + ProxyService, + Queue, + QueueEmptyError, + QueueFullError, + QueueService, + RemoteError, + Retries, + Sandbox2 as Sandbox, + SandboxFile, + SandboxService, + SandboxSnapshot, + SandboxSnapshotService, + SandboxTimeoutError, + Secret, + SecretService, + Volume, + VolumeService, + checkForRenamedParams, + close, + initializeClient +};