@ptkl/sdk - v1.18.0
    Preparing search index...

    Sandbox client — spark (FaaS) functions/apps, long-running runtimes, and their K8s deployments. All routes go through the sandbox/… gateway prefix (/luma/sandbox/v1/...), matching the sandbox service's REST surface (internal/controllers/{spark.go,spark.v1.go,runtime.v1.go} and the deployment lifecycle in internal/controllers/ecomm/deployment.go).

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • Optionaloptions: { env?: string; host?: string; token?: string }

      Returns default

    Properties

    client: AxiosInstance
    env: null | string = null
    host: null | string = null
    token: null | string = null

    Methods

    • Cancel an in-progress spark deployment.

      Parameters

      • uuid: string
      • Optionalenv: SparkEnv

        defaults to "dev" on the server if omitted

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Create a new runtime.

      Parameters

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Create a new spark (function or app).

      Parameters

      Returns Promise<AxiosResponse<Spark, any>>

      const spark = await platform.sandbox().createSpark({ name: "myFunction", runtime: "node20", memory: 256 })
      
    • Delete a runtime.

      Parameters

      • ref: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Delete a spark.

      Parameters

      • uuid: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • (Re)deploy a runtime.

      Parameters

      • ref: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Deploy a specific spark version to the dev environment.

      Parameters

      • uuid: string
      • version: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Execute a deployed spark by name. Mirrors spark() but accepts the full request shape (method/query/headers) — the exec route accepts GET/POST/PATCH/PUT/DELETE.

      Parameters

      • name: string
      • Optionaldata: any
      • Optionaloptions: {
            headers?: Record<string, string>;
            method?: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
            query?: Record<string, string>;
        }

      Returns Promise<AxiosResponse<any, any>>

      const result = await platform.sandbox().execSpark("myFunction", { foo: "bar" })
      const result = await platform.sandbox().execSpark("myFunction", undefined, { method: "GET" })
    • Get a runtime by ref (name/uuid).

      Parameters

      • ref: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Get a spark by uuid.

      Parameters

      • uuid: string

      Returns Promise<AxiosResponse<Spark, any>>

    • List all runtimes for the current project.

      Returns Promise<AxiosResponse<Runtime[], any>>

    • List all sparks for the current project.

      Returns Promise<AxiosResponse<Spark[], any>>

    • Release a deployed spark version to the live/public environment.

      Parameters

      • uuid: string
      • version: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Restart a running runtime.

      Parameters

      • ref: string

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Fetch logs for a runtime.

      Parameters

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • client: AxiosInstance

      Returns default

    • Call the sandbox service to execute a serverless function.

      Kept for backwards compatibility — equivalent to execSpark(name, data).

      Parameters

      • name: string
      • data: any

      Returns Promise<AxiosResponse<any, any>>

      const result = await platform.sandbox().spark("myFunction", { foo: "bar" })
      
    • Fetch logs for a spark.

      Parameters

      Returns Promise<AxiosResponse<any, any>>

    • Get the current project's spark tier (plan/quota).

      Returns Promise<AxiosResponse<SparkTier, any>>

    • Update a runtime's image/resources/env vars/tags.

      Parameters

      Returns Promise<AxiosResponse<{ status: boolean }, any>>

    • Update a spark's memory/settings/env vars.

      Parameters

      Returns Promise<AxiosResponse<Spark, any>>