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.locationIsProtectedbooleanDescription Whether location is DDoS protected Default false
body.resourcePackagestringDescription Resource package slug Default fleet-s1 Example fleet-s1

Returns

Promise<object>

Activation confirmation

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

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 Default api_key @enum {string}
body.codestringDescription Initial source code Example exports.handler = async (event, ctx) => { return { statusCode: 200, body: "Hello" }; };
body.description?stringDescription Function description
body.entrypointstringDescription Entrypoint function name Default handler
body.envVars?object[]Description Initial environment variables
body.memorynumberDescription Memory limit in MB (128-1024) Default 256
body.namestringDescription Function name Example process-webhook
body.runtime"nodejs20" | "nodejs22"Description Runtime environment Default nodejs20 @enum {string}
body.slug?stringDescription URL-friendly slug (auto-generated if not provided) Example process-webhook
body.timeoutnumberDescription Execution timeout in ms (1000-300000) Default 30000

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
distTagsRecord<string, never>Description Dist tags (latest, next, beta, etc.) Example { * "latest": "6.0.6", * "next": "7.0.0-beta.1" * }4Players/cortex-typescript-sdk/src/types.ts:4773
namestringDescription Package name Example node-mailjet4Players/cortex-typescript-sdk/src/types.ts:4756
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:4765

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:4784
latestVersion?stringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4796
messagestringDescription Status message4Players/cortex-typescript-sdk/src/types.ts:4786
runtimeVersion?null | stringDescription Runtime version this deployment is pinned to (null = legacy/unpinned) Example v14Players/cortex-typescript-sdk/src/types.ts:4791
serverCount?numberDescription Number of running servers4Players/cortex-typescript-sdk/src/types.ts:4782
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description Runtime status4Players/cortex-typescript-sdk/src/types.ts:4780
upgradeAvailable?booleanDescription Whether a newer runtime version is available to upgrade to4Players/cortex-typescript-sdk/src/types.ts:4798

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:4850
lateststringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4855
upgradeAvailablebooleanDescription Whether a newer runtime version is available4Players/cortex-typescript-sdk/src/types.ts:4857
versionsobject[]Description All published runtime versions (oldest first)4Players/cortex-typescript-sdk/src/types.ts:4859

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:4556
activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4554
dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4593
envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4595
fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4558
fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4566
fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4562
fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4581
fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4560
fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4564
isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4549
locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4576
maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4586
maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4591
resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4571

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:4805
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4810

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:4805
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4810

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:4817
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description New runtime status4Players/cortex-typescript-sdk/src/types.ts:4822

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:4719
settingsobjectDescription Updated settings4Players/cortex-typescript-sdk/src/types.ts:4714
settings.activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4556
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:4554
settings.dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4593
settings.envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4595
settings.fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4558
settings.fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4566
settings.fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4562
settings.fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4581
settings.fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4560
settings.fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4564
settings.isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4549
settings.locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4576
settings.maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4586
settings.maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4591
settings.resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4571

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:4749
settingsobjectDescription Updated settings4Players/cortex-typescript-sdk/src/types.ts:4744
settings.activationError?stringDescription Error message if activation failed4Players/cortex-typescript-sdk/src/types.ts:4556
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:4554
settings.dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4593
settings.envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4595
settings.fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4558
settings.fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4566
settings.fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4562
settings.fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4581
settings.fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4560
settings.fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4564
settings.isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4549
settings.locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4576
settings.maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4586
settings.maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4591
settings.resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4571

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:4556
activationStep?| "pending" | "registry" | "image" | "config" | "deployment" | "server" | "complete" | "error"Description Current activation step (for async progress tracking)4Players/cortex-typescript-sdk/src/types.ts:4554
dependencies?object[]Description NPM dependencies shared by all functions4Players/cortex-typescript-sdk/src/types.ts:4593
envVars?object[]Description Environment variables shared by all functions (secrets masked)4Players/cortex-typescript-sdk/src/types.ts:4595
fleetAppId?numberDescription Fleet app ID4Players/cortex-typescript-sdk/src/types.ts:4558
fleetDeploymentId?numberDescription Fleet deployment ID (app location setting)4Players/cortex-typescript-sdk/src/types.ts:4566
fleetImageId?stringDescription Fleet binary/image ID4Players/cortex-typescript-sdk/src/types.ts:4562
fleetRegion?stringDescription Fleet region (deprecated, use locationCity) Example eu-west4Players/cortex-typescript-sdk/src/types.ts:4581
fleetRegistryId?numberDescription Fleet Docker registry ID4Players/cortex-typescript-sdk/src/types.ts:4560
fleetServerConfigId?stringDescription Fleet server config ID4Players/cortex-typescript-sdk/src/types.ts:4564
isActivatedbooleanDescription Whether Functions feature is activated4Players/cortex-typescript-sdk/src/types.ts:4549
locationCity?stringDescription Deployment location city Example frankfurt4Players/cortex-typescript-sdk/src/types.ts:4576
maxFunctionsnumberDescription Maximum functions allowed Example 104Players/cortex-typescript-sdk/src/types.ts:4586
maxMemoryPerFunctionnumberDescription Maximum memory per function (MB) Example 5124Players/cortex-typescript-sdk/src/types.ts:4591
resourcePackageSlug?stringDescription Resource package slug Example fleet-s14Players/cortex-typescript-sdk/src/types.ts:4571

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:4784
latestVersion?stringDescription The latest available runtime version Example v14Players/cortex-typescript-sdk/src/types.ts:4796
messagestringDescription Status message4Players/cortex-typescript-sdk/src/types.ts:4786
runtimeVersion?null | stringDescription Runtime version this deployment is pinned to (null = legacy/unpinned) Example v14Players/cortex-typescript-sdk/src/types.ts:4791
serverCount?numberDescription Number of running servers4Players/cortex-typescript-sdk/src/types.ts:4782
status| "running" | "stopped" | "starting" | "stopping" | "unknown"Description Runtime status4Players/cortex-typescript-sdk/src/types.ts:4780
upgradeAvailable?booleanDescription Whether a newer runtime version is available to upgrade to4Players/cortex-typescript-sdk/src/types.ts:4798

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:4601
validbooleanDescription Whether credentials are valid4Players/cortex-typescript-sdk/src/types.ts:4599

Defined in

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