Class: CortexFunctionInstance
A live function object. Every field from the API response is available directly
on the object (e.g. fn.name, fn.slug), and the object also exposes action
methods (publish(), deploy(), stop(), …).
Named CortexFunctionInstance to avoid shadowing the global Function type.
Extends
Constructors
new CortexFunctionInstance()
Internal
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | ClientContext | - |
_projectId | string | - |
data | object | - |
data.activeDeployment? | object | Deprecated Description Active deployment info (deprecated - use status field instead) |
data.activeDeployment.createdAt | string | Format: date-time Description Creation timestamp |
data.activeDeployment.fleetDeploymentId? | string | Description Fleet deployment ID |
data.activeDeployment.fleetServiceId? | string | Description Fleet service ID |
data.activeDeployment.functionId | string | Description Function ID |
data.activeDeployment.id | string | Description Deployment UUID |
data.activeDeployment.invokeUrl? | string | Description Invoke URL (external via Cortex proxy) |
data.activeDeployment.lastError? | string | Description Last error message |
data.activeDeployment.lastInvokedAt? | string | Format: date-time Description Last invocation timestamp |
data.activeDeployment.requestCount | number | Description Total request count Example 0 |
data.activeDeployment.serviceIp? | string | Description Service IP address (internal) |
data.activeDeployment.servicePort? | number | Description Service port (internal) |
data.activeDeployment.status | | "pending" | "failed" | "running" | "stopped" | "deploying" | Description Deployment status |
data.activeDeployment.updatedAt | string | Format: date-time Description Last update timestamp |
data.activeDeployment.versionId | string | Description Deployed version ID |
data.authMode | "api_key" | "public" | "signed" | Description Authentication mode |
data.createdAt | string | Format: date-time Description Creation timestamp |
data.description? | string | Description Function description |
data.draftCode | string | Description Draft source code |
data.draftEntrypoint | string | Description Entrypoint function name Example handler |
data.envVars | object[] | Description Environment variables (secrets masked) |
data.id | string | Description Function UUID |
data.memory | number | Description Memory limit in MB Example 256 |
data.name | string | Description Function name Example process-webhook |
data.projectId | string | Description Project ID |
data.publishedVersionId? | string | Description Published version ID (if published) |
data.runtime | "nodejs20" | "nodejs22" | Description Runtime environment |
data.slug | string | Description URL-friendly identifier Example process-webhook |
data.status | "draft" | "published" | Description Function status: draft (not published) or published (available in runtime) |
data.tenantId | string | Description Tenant ID |
data.timeout | number | Description Execution timeout in milliseconds Example 30000 |
data.updatedAt | string | Format: date-time Description Last update timestamp |
Returns
Inherited from
CortexFunction.constructor
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:322
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
activeDeployment? | object | Deprecated Description Active deployment info (deprecated - use status field instead) | CortexFunction.activeDeployment | 4Players/cortex-typescript-sdk/src/types.ts:4972 |
activeDeployment.createdAt | string | Format: date-time Description Creation timestamp | - | 4Players/cortex-typescript-sdk/src/types.ts:4906 |
activeDeployment.fleetDeploymentId? | string | Description Fleet deployment ID | - | 4Players/cortex-typescript-sdk/src/types.ts:4883 |
activeDeployment.fleetServiceId? | string | Description Fleet service ID | - | 4Players/cortex-typescript-sdk/src/types.ts:4881 |
activeDeployment.functionId | string | Description Function ID | - | 4Players/cortex-typescript-sdk/src/types.ts:4872 |
activeDeployment.id | string | Description Deployment UUID | - | 4Players/cortex-typescript-sdk/src/types.ts:4870 |
activeDeployment.invokeUrl? | string | Description Invoke URL (external via Cortex proxy) | - | 4Players/cortex-typescript-sdk/src/types.ts:4889 |
activeDeployment.lastError? | string | Description Last error message | - | 4Players/cortex-typescript-sdk/src/types.ts:4891 |
activeDeployment.lastInvokedAt? | string | Format: date-time Description Last invocation timestamp | - | 4Players/cortex-typescript-sdk/src/types.ts:4901 |
activeDeployment.requestCount | number | Description Total request count Example 0 | - | 4Players/cortex-typescript-sdk/src/types.ts:4896 |
activeDeployment.serviceIp? | string | Description Service IP address (internal) | - | 4Players/cortex-typescript-sdk/src/types.ts:4885 |
activeDeployment.servicePort? | number | Description Service port (internal) | - | 4Players/cortex-typescript-sdk/src/types.ts:4887 |
activeDeployment.status | | "pending" | "failed" | "running" | "stopped" | "deploying" | Description Deployment status | - | 4Players/cortex-typescript-sdk/src/types.ts:4879 |
activeDeployment.updatedAt | string | Format: date-time Description Last update timestamp | - | 4Players/cortex-typescript-sdk/src/types.ts:4911 |
activeDeployment.versionId | string | Description Deployed version ID | - | 4Players/cortex-typescript-sdk/src/types.ts:4874 |
authMode | "api_key" | "public" | "signed" | Description Authentication mode | CortexFunction.authMode | 4Players/cortex-typescript-sdk/src/types.ts:4948 |
createdAt | string | Format: date-time Description Creation timestamp | CortexFunction.createdAt | 4Players/cortex-typescript-sdk/src/types.ts:4977 |
description? | string | Description Function description | CortexFunction.description | 4Players/cortex-typescript-sdk/src/types.ts:4931 |
draftCode | string | Description Draft source code | CortexFunction.draftCode | 4Players/cortex-typescript-sdk/src/types.ts:4933 |
draftEntrypoint | string | Description Entrypoint function name Example handler | CortexFunction.draftEntrypoint | 4Players/cortex-typescript-sdk/src/types.ts:4938 |
envVars | object[] | Description Environment variables (secrets masked) | CortexFunction.envVars | 4Players/cortex-typescript-sdk/src/types.ts:4960 |
id | string | Description Function UUID | CortexFunction.id | 4Players/cortex-typescript-sdk/src/types.ts:4915 |
memory | number | Description Memory limit in MB Example 256 | CortexFunction.memory | 4Players/cortex-typescript-sdk/src/types.ts:4958 |
name | string | Description Function name Example process-webhook | CortexFunction.name | 4Players/cortex-typescript-sdk/src/types.ts:4924 |
projectId | string | Description Project ID | CortexFunction.projectId | 4Players/cortex-typescript-sdk/src/types.ts:4919 |
publishedVersionId? | string | Description Published version ID (if published) | CortexFunction.publishedVersionId | 4Players/cortex-typescript-sdk/src/types.ts:4962 |
runtime | "nodejs20" | "nodejs22" | Description Runtime environment | CortexFunction.runtime | 4Players/cortex-typescript-sdk/src/types.ts:4943 |
slug | string | Description URL-friendly identifier Example process-webhook | CortexFunction.slug | 4Players/cortex-typescript-sdk/src/types.ts:4929 |
status | "draft" | "published" | Description Function status: draft (not published) or published (available in runtime) | CortexFunction.status | 4Players/cortex-typescript-sdk/src/types.ts:4967 |
tenantId | string | Description Tenant ID | CortexFunction.tenantId | 4Players/cortex-typescript-sdk/src/types.ts:4917 |
timeout | number | Description Execution timeout in milliseconds Example 30000 | CortexFunction.timeout | 4Players/cortex-typescript-sdk/src/types.ts:4953 |
updatedAt | string | Format: date-time Description Last update timestamp | CortexFunction.updatedAt | 4Players/cortex-typescript-sdk/src/types.ts:4982 |
Accessors
data
The raw API response object.
Deprecated
The response fields are now available directly on this object
(e.g. fn.name instead of fn.data.name). This accessor will be removed
before the stable release.
Returns
object
| Name | Type | Description | Defined in |
|---|---|---|---|
activeDeployment? | object | Deprecated Description Active deployment info (deprecated - use status field instead) | 4Players/cortex-typescript-sdk/src/types.ts:4972 |
activeDeployment.createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4906 |
activeDeployment.fleetDeploymentId? | string | Description Fleet deployment ID | 4Players/cortex-typescript-sdk/src/types.ts:4883 |
activeDeployment.fleetServiceId? | string | Description Fleet service ID | 4Players/cortex-typescript-sdk/src/types.ts:4881 |
activeDeployment.functionId | string | Description Function ID | 4Players/cortex-typescript-sdk/src/types.ts:4872 |
activeDeployment.id | string | Description Deployment UUID | 4Players/cortex-typescript-sdk/src/types.ts:4870 |
activeDeployment.invokeUrl? | string | Description Invoke URL (external via Cortex proxy) | 4Players/cortex-typescript-sdk/src/types.ts:4889 |
activeDeployment.lastError? | string | Description Last error message | 4Players/cortex-typescript-sdk/src/types.ts:4891 |
activeDeployment.lastInvokedAt? | string | Format: date-time Description Last invocation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4901 |
activeDeployment.requestCount | number | Description Total request count Example 0 | 4Players/cortex-typescript-sdk/src/types.ts:4896 |
activeDeployment.serviceIp? | string | Description Service IP address (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4885 |
activeDeployment.servicePort? | number | Description Service port (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4887 |
activeDeployment.status | | "pending" | "failed" | "running" | "stopped" | "deploying" | Description Deployment status | 4Players/cortex-typescript-sdk/src/types.ts:4879 |
activeDeployment.updatedAt | string | Format: date-time Description Last update timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4911 |
activeDeployment.versionId | string | Description Deployed version ID | 4Players/cortex-typescript-sdk/src/types.ts:4874 |
authMode | "api_key" | "public" | "signed" | Description Authentication mode | 4Players/cortex-typescript-sdk/src/types.ts:4948 |
createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4977 |
description? | string | Description Function description | 4Players/cortex-typescript-sdk/src/types.ts:4931 |
draftCode | string | Description Draft source code | 4Players/cortex-typescript-sdk/src/types.ts:4933 |
draftEntrypoint | string | Description Entrypoint function name Example handler | 4Players/cortex-typescript-sdk/src/types.ts:4938 |
envVars | object[] | Description Environment variables (secrets masked) | 4Players/cortex-typescript-sdk/src/types.ts:4960 |
id | string | Description Function UUID | 4Players/cortex-typescript-sdk/src/types.ts:4915 |
memory | number | Description Memory limit in MB Example 256 | 4Players/cortex-typescript-sdk/src/types.ts:4958 |
name | string | Description Function name Example process-webhook | 4Players/cortex-typescript-sdk/src/types.ts:4924 |
projectId | string | Description Project ID | 4Players/cortex-typescript-sdk/src/types.ts:4919 |
publishedVersionId? | string | Description Published version ID (if published) | 4Players/cortex-typescript-sdk/src/types.ts:4962 |
runtime | "nodejs20" | "nodejs22" | Description Runtime environment | 4Players/cortex-typescript-sdk/src/types.ts:4943 |
slug | string | Description URL-friendly identifier Example process-webhook | 4Players/cortex-typescript-sdk/src/types.ts:4929 |
status | "draft" | "published" | Description Function status: draft (not published) or published (available in runtime) | 4Players/cortex-typescript-sdk/src/types.ts:4967 |
tenantId | string | Description Tenant ID | 4Players/cortex-typescript-sdk/src/types.ts:4917 |
timeout | number | Description Execution timeout in milliseconds Example 30000 | 4Players/cortex-typescript-sdk/src/types.ts:4953 |
updatedAt | string | Format: date-time Description Last update timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4982 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:334
Methods
delete()
Delete this function and all its versions
Returns
Promise<object>
Deletion confirmation
| Name | Type | Description | Defined in |
|---|---|---|---|
message | string | Description Status message Example Function deleted successfully | 4Players/cortex-typescript-sdk/src/types.ts:5063 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:356
deploy()
Deploy this function to Fleet
Returns
Promise<object>
Deployment details with invoke URL
| Name | Type | Description | Defined in |
|---|---|---|---|
deployment | object | Description The deployment | 4Players/cortex-typescript-sdk/src/types.ts:5122 |
deployment.createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4906 |
deployment.fleetDeploymentId? | string | Description Fleet deployment ID | 4Players/cortex-typescript-sdk/src/types.ts:4883 |
deployment.fleetServiceId? | string | Description Fleet service ID | 4Players/cortex-typescript-sdk/src/types.ts:4881 |
deployment.functionId | string | Description Function ID | 4Players/cortex-typescript-sdk/src/types.ts:4872 |
deployment.id | string | Description Deployment UUID | 4Players/cortex-typescript-sdk/src/types.ts:4870 |
deployment.invokeUrl? | string | Description Invoke URL (external via Cortex proxy) | 4Players/cortex-typescript-sdk/src/types.ts:4889 |
deployment.lastError? | string | Description Last error message | 4Players/cortex-typescript-sdk/src/types.ts:4891 |
deployment.lastInvokedAt? | string | Format: date-time Description Last invocation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4901 |
deployment.requestCount | number | Description Total request count Example 0 | 4Players/cortex-typescript-sdk/src/types.ts:4896 |
deployment.serviceIp? | string | Description Service IP address (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4885 |
deployment.servicePort? | number | Description Service port (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4887 |
deployment.status | | "pending" | "failed" | "running" | "stopped" | "deploying" | Description Deployment status | 4Players/cortex-typescript-sdk/src/types.ts:4879 |
deployment.updatedAt | string | Format: date-time Description Last update timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4911 |
deployment.versionId | string | Description Deployed version ID | 4Players/cortex-typescript-sdk/src/types.ts:4874 |
invokeUrl | string | Description Public invoke URL Example https://ots.odin.4players.io/invoke/proj123/my-function | 4Players/cortex-typescript-sdk/src/types.ts:5127 |
message | string | Description Status message Example Deployment started | 4Players/cortex-typescript-sdk/src/types.ts:5132 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:396
listVersions()
List published versions of this function
Returns
Promise<object[]>
Array of function versions
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:369
publish()
Publish a version of this function
Parameters
| Parameter | Type | Description |
|---|---|---|
body | object | Publish payload (optional changelog) |
body.changelog? | string | Description Changelog/description of changes |
Returns
Promise<object>
Published version with message
| Name | Type | Description | Defined in |
|---|---|---|---|
message | string | Description Status message Example Version 1 published successfully | 4Players/cortex-typescript-sdk/src/types.ts:5118 |
version | object | Description The published version | 4Players/cortex-typescript-sdk/src/types.ts:5113 |
version.buildError? | string | Description Build error message | 4Players/cortex-typescript-sdk/src/types.ts:5087 |
version.buildLogs? | string | Description Build logs output | 4Players/cortex-typescript-sdk/src/types.ts:5085 |
version.changelog? | string | Description Changelog description | 4Players/cortex-typescript-sdk/src/types.ts:5100 |
version.code | string | Description Source code (frozen) | 4Players/cortex-typescript-sdk/src/types.ts:5076 |
version.createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:5105 |
version.entrypoint | string | Description Entrypoint function name | 4Players/cortex-typescript-sdk/src/types.ts:5078 |
version.functionId | string | Description Function ID | 4Players/cortex-typescript-sdk/src/types.ts:5069 |
version.id | string | Description Version UUID | 4Players/cortex-typescript-sdk/src/types.ts:5067 |
version.memory | number | Description Memory limit in MB | 4Players/cortex-typescript-sdk/src/types.ts:5096 |
version.publishedBy? | string | Description User who published this version | 4Players/cortex-typescript-sdk/src/types.ts:5098 |
version.runtime | "nodejs20" | "nodejs22" | Description Runtime environment | 4Players/cortex-typescript-sdk/src/types.ts:5092 |
version.status | "failed" | "ready" | "building" | Description Build status | 4Players/cortex-typescript-sdk/src/types.ts:5083 |
version.timeout | number | Description Execution timeout in ms | 4Players/cortex-typescript-sdk/src/types.ts:5094 |
version.version | number | Description Version number Example 1 | 4Players/cortex-typescript-sdk/src/types.ts:5074 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:383
stop()
Stop this function's deployment
Returns
Promise<object>
Stop confirmation
| Name | Type | Description | Defined in |
|---|---|---|---|
message | string | Description Status message Example Function stopped successfully | 4Players/cortex-typescript-sdk/src/types.ts:5139 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:409
update()
Update this function's draft code and configuration
Parameters
| Parameter | Type | Description |
|---|---|---|
body | object | Updated function data |
body.authMode? | "api_key" | "public" | "signed" | Description Authentication mode |
body.description? | string | Description Function description |
body.draftCode? | string | Description Draft source code |
body.draftEntrypoint? | string | Description Entrypoint function name |
body.envVars? | object[] | Description Updated environment variables (replaces all) |
body.memory? | number | Description Memory limit in MB (128-1024) |
body.name? | string | Description Function name |
body.runtime? | "nodejs20" | "nodejs22" | Description Runtime environment |
body.timeout? | number | Description Execution timeout in ms (1000-300000) |
Returns
Promise<object>
Updated function
| Name | Type | Description | Defined in |
|---|---|---|---|
activeDeployment? | object | Deprecated Description Active deployment info (deprecated - use status field instead) | 4Players/cortex-typescript-sdk/src/types.ts:4972 |
activeDeployment.createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4906 |
activeDeployment.fleetDeploymentId? | string | Description Fleet deployment ID | 4Players/cortex-typescript-sdk/src/types.ts:4883 |
activeDeployment.fleetServiceId? | string | Description Fleet service ID | 4Players/cortex-typescript-sdk/src/types.ts:4881 |
activeDeployment.functionId | string | Description Function ID | 4Players/cortex-typescript-sdk/src/types.ts:4872 |
activeDeployment.id | string | Description Deployment UUID | 4Players/cortex-typescript-sdk/src/types.ts:4870 |
activeDeployment.invokeUrl? | string | Description Invoke URL (external via Cortex proxy) | 4Players/cortex-typescript-sdk/src/types.ts:4889 |
activeDeployment.lastError? | string | Description Last error message | 4Players/cortex-typescript-sdk/src/types.ts:4891 |
activeDeployment.lastInvokedAt? | string | Format: date-time Description Last invocation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4901 |
activeDeployment.requestCount | number | Description Total request count Example 0 | 4Players/cortex-typescript-sdk/src/types.ts:4896 |
activeDeployment.serviceIp? | string | Description Service IP address (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4885 |
activeDeployment.servicePort? | number | Description Service port (internal) | 4Players/cortex-typescript-sdk/src/types.ts:4887 |
activeDeployment.status | | "pending" | "failed" | "running" | "stopped" | "deploying" | Description Deployment status | 4Players/cortex-typescript-sdk/src/types.ts:4879 |
activeDeployment.updatedAt | string | Format: date-time Description Last update timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4911 |
activeDeployment.versionId | string | Description Deployed version ID | 4Players/cortex-typescript-sdk/src/types.ts:4874 |
authMode | "api_key" | "public" | "signed" | Description Authentication mode | 4Players/cortex-typescript-sdk/src/types.ts:4948 |
createdAt | string | Format: date-time Description Creation timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4977 |
description? | string | Description Function description | 4Players/cortex-typescript-sdk/src/types.ts:4931 |
draftCode | string | Description Draft source code | 4Players/cortex-typescript-sdk/src/types.ts:4933 |
draftEntrypoint | string | Description Entrypoint function name Example handler | 4Players/cortex-typescript-sdk/src/types.ts:4938 |
envVars | object[] | Description Environment variables (secrets masked) | 4Players/cortex-typescript-sdk/src/types.ts:4960 |
id | string | Description Function UUID | 4Players/cortex-typescript-sdk/src/types.ts:4915 |
memory | number | Description Memory limit in MB Example 256 | 4Players/cortex-typescript-sdk/src/types.ts:4958 |
name | string | Description Function name Example process-webhook | 4Players/cortex-typescript-sdk/src/types.ts:4924 |
projectId | string | Description Project ID | 4Players/cortex-typescript-sdk/src/types.ts:4919 |
publishedVersionId? | string | Description Published version ID (if published) | 4Players/cortex-typescript-sdk/src/types.ts:4962 |
runtime | "nodejs20" | "nodejs22" | Description Runtime environment | 4Players/cortex-typescript-sdk/src/types.ts:4943 |
slug | string | Description URL-friendly identifier Example process-webhook | 4Players/cortex-typescript-sdk/src/types.ts:4929 |
status | "draft" | "published" | Description Function status: draft (not published) or published (available in runtime) | 4Players/cortex-typescript-sdk/src/types.ts:4967 |
tenantId | string | Description Tenant ID | 4Players/cortex-typescript-sdk/src/types.ts:4917 |
timeout | number | Description Execution timeout in milliseconds Example 30000 | 4Players/cortex-typescript-sdk/src/types.ts:4953 |
updatedAt | string | Format: date-time Description Last update timestamp | 4Players/cortex-typescript-sdk/src/types.ts:4982 |
Defined in
4Players/cortex-typescript-sdk/src/resources/functions.ts:343