Skip to main content

Class: FunctionsManager

Manages serverless functions (settings, runtime, and CRUD) for a project.

Constructors

new FunctionsManager()

new FunctionsManager(ctx, projectId): FunctionsManager

Internal

Parameters

ParameterType
ctxClientContext
projectIdstring

Returns

FunctionsManager

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:46

Methods

activate()

activate(body): Promise<object>

Activate Functions for this project (async)

Parameters

ParameterTypeDescription
bodyobjectActivation payload
body.locationCitystringDescription Deployment location city Example frankfurt
body.locationCityDisplay?stringDescription Deployment location city display name Example Frankfurt, Germany
body.locationContinentstringDescription Deployment location continent Example europe
body.locationCountrystringDescription Deployment location country Example de
body.locationIsProtected?booleanDescription Whether location is DDoS protected. Defaults to false when omitted.
body.resourcePackage?stringDescription Resource package slug. Defaults to "fleet-s1" when omitted. Example fleet-s1

Returns

Promise<object>

Activation confirmation

NameTypeDescriptionDefined in
messagestringDescription Status message Example Activation started4Players/cortex-typescript-sdk/src/types.ts:4321

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:124


create()

create(body): Promise<CortexFunctionInstance>

Create a new serverless function

Parameters

ParameterTypeDescription
bodyobjectFunction creation payload
body.authMode?"api_key" | "public" | "signed"Description Authentication mode. Defaults to "api_key" when omitted.
body.codestringDescription Initial source code Example exports.handler = async (event, ctx) => { return { statusCode: 200, body: "Hello" }; };
body.description?stringDescription Function description
body.entrypoint?stringDescription Entrypoint function name. Defaults to "handler" when omitted.
body.envVars?object[]Description Initial environment variables
body.memory?numberDescription Memory limit in MB (128-1024). Defaults to 256 when omitted.
body.namestringDescription Function name Example process-webhook
body.runtime?"nodejs20" | "nodejs22"Description Runtime environment. Defaults to "nodejs20" when omitted.
body.slug?stringDescription URL-friendly slug (auto-generated if not provided) Example process-webhook
body.timeout?numberDescription Execution timeout in ms (1000-300000). Defaults to 30000 when omitted.

Returns

Promise<CortexFunctionInstance>

Live CortexFunctionInstance object

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:277


get()

get(functionId): Promise<CortexFunctionInstance>

Get a function by ID

Parameters

ParameterTypeDescription
functionIdstringFunction ID

Returns

Promise<CortexFunctionInstance>

Live CortexFunctionInstance object

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:291


getDeploymentLocations()

getDeploymentLocations(): Promise<object[]>

Get available deployment locations

Returns

Promise<object[]>

Array of locations

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:110


getNpmPackageInfo()

getNpmPackageInfo(packageName): Promise<object>

Lookup npm package versions

Parameters

ParameterTypeDescription
packageNamestringNPM package name

Returns

Promise<object>

Package info with available versions

NameTypeDescriptionDefined in
distTagsobjectDescription Dist tags (latest, next, beta, etc.) Example { * "latest": "6.0.6", * "next": "7.0.0-beta.1" * }4Players/cortex-typescript-sdk/src/types.ts:4393
namestringDescription Package name Example node-mailjet4Players/cortex-typescript-sdk/src/types.ts:4376
versionsstring[]Description All available versions (sorted newest first) Example [ "6.0.6", "6.0.5", "6.0.4" ]4Players/cortex-typescript-sdk/src/types.ts:4385

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:166


getResourcePackages()

getResourcePackages(): Promise<object[]>

Get available resource packages for function deployment

Returns

Promise<object[]>

Array of resource packages

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:97


getRuntimeStatus()

getRuntimeStatus(): Promise<object>

Get function runtime status

Returns

Promise<object>

Runtime status

NameTypeDescriptionDefined in
fleetDeploymentId?numberDescription Fleet deployment ID4Players/cortex-typescript-sdk/src/types.ts:4406
latestVersion?stringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4418
messagestringDescription Status message4Players/cortex-typescript-sdk/src/types.ts:4408
runtimeVersion?null | stringDescription Runtime version this deployment is pinned to (null = legacy/unpinned) Example v14Players/cortex-typescript-sdk/src/types.ts:4413
serverCount?numberDescription Number of running servers4Players/cortex-typescript-sdk/src/types.ts:4404
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description Runtime status4Players/cortex-typescript-sdk/src/types.ts:4402
upgradeAvailable?booleanDescription Whether a newer runtime version is available to upgrade to4Players/cortex-typescript-sdk/src/types.ts:4420

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:181


getRuntimeVersions()

getRuntimeVersions(): Promise<object>

List the available function-runtime versions and the project's current pin.

Returns

Promise<object>

Runtime version catalog (current, latest, upgradeAvailable, versions)

NameTypeDescriptionDefined in
currentnull | stringDescription Version the project is currently pinned to (null = legacy/unpinned) Example v14Players/cortex-typescript-sdk/src/types.ts:4472
lateststringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4477
upgradeAvailablebooleanDescription Whether a newer runtime version is available4Players/cortex-typescript-sdk/src/types.ts:4479
versionsobject[]Description All published runtime versions (oldest first)4Players/cortex-typescript-sdk/src/types.ts:4481

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:233


getSettings()

getSettings(): Promise<object>

Get function settings

Returns

Promise<object>

Function settings

NameTypeDescriptionDefined in
activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4183
activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4181
dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4220
envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4222
fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4185
fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4193
fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4189
fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4208
fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4187
fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4191
isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4176
locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4203
maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4213
maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4218
resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4198

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:57


list()

list(): Promise<object[]>

List functions for this project

Returns

Promise<object[]>

Array of functions

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:263


restartRuntime()

restartRuntime(): Promise<object>

Restart the function runtime

Returns

Promise<object>

Restart confirmation

NameTypeDescriptionDefined in
messagestringDescription Status message Example Runtime started successfully4Players/cortex-typescript-sdk/src/types.ts:4427
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4432

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:220


startRuntime()

startRuntime(): Promise<object>

Start the function runtime

Returns

Promise<object>

Start confirmation

NameTypeDescriptionDefined in
messagestringDescription Status message Example Runtime started successfully4Players/cortex-typescript-sdk/src/types.ts:4427
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4432

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:194


stopRuntime()

stopRuntime(): Promise<object>

Stop the function runtime

Returns

Promise<object>

Stop confirmation

NameTypeDescriptionDefined in
messagestringDescription Status message Example Runtime stopped successfully4Players/cortex-typescript-sdk/src/types.ts:4439
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4444

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:207


updateDependencies()

updateDependencies(body): Promise<object>

Update project-wide function dependencies

Parameters

ParameterTypeDescription
bodyobjectDependencies payload
body.dependenciesobject[]Description NPM dependencies for the project

Returns

Promise<object>

Updated settings with message

NameTypeDescriptionDefined in
messagestringDescription Status message Example Dependencies updated. Runtime restarting...4Players/cortex-typescript-sdk/src/types.ts:4342
settingsobjectDescription Updated settings4Players/cortex-typescript-sdk/src/types.ts:4337
settings.activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4183
settings.activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4181
settings.dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4220
settings.envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4222
settings.fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4185
settings.fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4193
settings.fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4189
settings.fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4208
settings.fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4187
settings.fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4191
settings.isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4176
settings.locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4203
settings.maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4213
settings.maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4218
settings.resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4198

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:138


updateEnvVars()

updateEnvVars(body): Promise<object>

Update project-wide environment variables

Parameters

ParameterTypeDescription
bodyobjectEnvironment variables payload
body.envVarsobject[]Description Environment variables for the project

Returns

Promise<object>

Updated settings with message

NameTypeDescriptionDefined in
messagestringDescription Status message Example Environment variables updated. Runtime restarting...4Players/cortex-typescript-sdk/src/types.ts:4369
settingsobjectDescription Updated settings4Players/cortex-typescript-sdk/src/types.ts:4364
settings.activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4183
settings.activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4181
settings.dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4220
settings.envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4222
settings.fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4185
settings.fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4193
settings.fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4189
settings.fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4208
settings.fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4187
settings.fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4191
settings.isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4176
settings.locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4203
settings.maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4213
settings.maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4218
settings.resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4198

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:152


updateSettings()

updateSettings(body): Promise<object>

Update function settings

Parameters

ParameterTypeDescription
bodyobjectUpdated settings
body.fleetRegion?stringDescription Fleet region
body.maxFunctions?numberDescription Maximum functions allowed (requires upgrade)
body.maxMemoryPerFunction?numberDescription Maximum memory per function (MB)

Returns

Promise<object>

Updated function settings

NameTypeDescriptionDefined in
activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4183
activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4181
dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4220
envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4222
fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4185
fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4193
fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4189
fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4208
fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4187
fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4191
isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4176
locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4203
maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4213
maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4218
resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4198

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:71


upgradeRuntime()

upgradeRuntime(version): Promise<object>

Upgrade (or change) the pinned runtime version. Swaps the Fleet binary image and restarts the runtime so the new image is pulled.

Parameters

ParameterTypeDescription
versionstringThe runtime version to deploy (e.g. "v1")

Returns

Promise<object>

Runtime status after triggering the upgrade

NameTypeDescriptionDefined in
fleetDeploymentId?numberDescription Fleet deployment ID4Players/cortex-typescript-sdk/src/types.ts:4406
latestVersion?stringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4418
messagestringDescription Status message4Players/cortex-typescript-sdk/src/types.ts:4408
runtimeVersion?null | stringDescription Runtime version this deployment is pinned to (null = legacy/unpinned) Example v14Players/cortex-typescript-sdk/src/types.ts:4413
serverCount?numberDescription Number of running servers4Players/cortex-typescript-sdk/src/types.ts:4404
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description Runtime status4Players/cortex-typescript-sdk/src/types.ts:4402
upgradeAvailable?booleanDescription Whether a newer runtime version is available to upgrade to4Players/cortex-typescript-sdk/src/types.ts:4420

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:248


verifyFleetCredentials()

verifyFleetCredentials(): Promise<object>

Verify Fleet credentials for function activation

Returns

Promise<object>

Verification result

NameTypeDescriptionDefined in
emailstringDescription User email4Players/cortex-typescript-sdk/src/types.ts:4228
validbooleanDescription Whether credentials are valid4Players/cortex-typescript-sdk/src/types.ts:4226

Defined in

4Players/cortex-typescript-sdk/src/resources/functions.ts:84