Logic and automation
Serverless functions
Author and run backend logic using the documented function runtime.
This document provides a comprehensive guide to building backend serverless functions on the Pikbase platform. It covers the fundamental concepts, available services, best practices, and examples to help developers and AI build robust functions.
1. Introduction to GSB Serverless Functions
GSB Serverless Functions are JavaScript code snippets that run on the GSB backend in response to various events or triggers. They allow developers to extend and customize the platform's functionality without managing server infrastructure.
Functions are typically defined in a JSON structure, which includes:
id: A unique identifier for the function.name: A human-readable name for the function.code: The JavaScript code for the function.references: An array of objects containing library/service definition IDs that the function depends on. Each object has the format{"id": "uuid-of-the-service"}. This tells the runtime which services (likeGsbEntityService,GsbUtil, etc.) to make available to the function's scope.operations(optional): A JSON string defining a sequence of declarative operations that can be part_of the function's execution. These operations can include setting entity properties, running scripts, sending notifications, etc.
Execution Environment
When a GSB serverless function executes, it has access to a specific environment and a set of global objects:
_runtime: An object providing methods to interact with the function's execution context (e.g., ending the function, logging, accessing tenant information)._instance: An object containing instance-specific data relevant to the current function execution, such as the triggering entity or parameters passed to the function._defs: An object that provides access to GSB entity definitions. This allows you to strongly-type entity objects (e.g.,let order = new _defs.GsbPrtOrder();)._enums: An object providing access to various enumerations defined in GSB (e.g.,_enums.OrderStatus.Cancelled).- Service Instances: Services referenced in the function's
referencesarray are available as pre-instantiated objects or classes that you can instantiate (e.g.,GsbEntityService,Utils).
The runtime also injects these values directly into function and library scope. Use them as globals; do not call require() or add package imports for them:
- Execution context:
_runtime,runtime,_instance,instance,tenantCode,_tenantCode. - Platform data:
Big,_defs,_enums,_cache,_settings. - Templates and utilities:
nunjucks,nunjucks_date_filter,nunjucks_comma_filter,axios,xlsx,cheerio,fetch,FormData,multer. - Messaging and storage:
nodemailer,aws_s3,aws_ses,aws_translate,aws_sqs,azure_storage_blob,azure_storage_queue,bullmq,ioredis.
For example, create an SMTP transporter with nodemailer.createTransport(...), not require("nodemailer").
All I/O operations, especially calls to GSB services, are asynchronous. Therefore, functions heavily rely on JavaScript's async/await syntax and Promises.
2. Core Concepts
_runtime Object
The _runtime object is crucial for controlling the function's lifecycle and interacting with the GSB environment. A function can finish through any of these methods:
_runtime.end(code = 200, message = "", result = "", response = undefined, action = undefined)-code: The HTTP response status. This is part of the caller-facing transport contract, not an application-specific error code. -message: An execution message. -result: The workflow result used to select a conditional route. -response: The payload returned to the caller.action: A process-action name such as"BreakActivity"that controls what the workflow engine does next.
_runtime.success(result = "", response = undefined, action = undefined): Ends successfully with HTTP 200.resultstill controls workflow routing; it is not a display message._runtime.error(exception = undefined, message = undefined, userMessage = undefined, action = undefined, code = undefined): Ends with an error.exceptionis the full caught error, including its stack, andmessageis the diagnostic text written to system logs.userMessageis the safe caller-facing override; when it is omitted, the caller seesmessage. Pass the workflowactionand HTTP statuscodein their dedicated positions.
Runtime termination does not make JavaScript control flow unreachable. Always return immediately: return _runtime.end(...), return _runtime.success(...), or return _runtime.error(...). This prevents writes, external calls, or a second termination attempt after the runtime has ended.
Standard response boundary
New and migrated serverless functions should reference serverlessResponseService and create one ServerlessResponseService per execution. It preserves every _runtime.end dimension through named options, validates HTTP statuses, gives expected failures stable application codes, and emits one error envelope:
{ success: false, error: { code, message, issues, details? } }
- Use
return responseService.respond({ httpStatus, message, result, response, action })for a completed outcome. OmittedhttpStatusis 200. Note: in standalone function executions (runWfFunction/gsb test), the engine reads_instance.responseto populate the caller-visibleresponsefield;ServerlessResponseService.respondsets_runtime.instance.response = options.response, or you can explicitly set_instance.response = databefore ending if using an older tenant copy ofserverlessResponseService. - Use
responseService.fail({ code, httpStatus, message, userMessage?, issues?, details?, result?, action? })for an expected domain failure. It throws a typed boundary error; default workflow failure control isresult: "Error"andaction: "BreakFunction". - Use
responseService.validation({ issues, ... })for request validation. Its default code isINVALID_REQUESTand default status is 400. - Catch once at the outer execution boundary and
return responseService.sendError(error, fallback?). Unknown exceptions become the sanitized fallback 500 response. - Do not call
_runtime.errorin migrated functions. It ends with 500 unless its final positional code is explicitly supplied, and positional arguments are easy to misapply.
Example:
const responseService = new ServerlessResponseService(_runtime);
async function runAll() {
try {
if (!order) {
responseService.fail({
code: "ORDER_NOT_FOUND",
httpStatus: 404,
message: "The order was not found.",
});
}
return responseService.respond({
result: "approved",
response: { orderId: order.id },
});
} catch (error) {
return responseService.sendError(error);
}
}
runAll().then();
Pass action as its canonical text name, for example "BreakActivity" or "CancelWorkflow". The runtime also accepts _enums.ProcessAction.BreakActivity and legacy numeric values, but text is clearer in authored code and serialized requests. IntelliSense exposes all supported names and numeric compatibility values through RuntimeProcessAction.
Use proper HTTP statuses. Typical choices are 200 for success, 400 for malformed input, 401 for missing authentication, 403 for denied authorization, 404 for a missing resource, 409 for a state conflict, 422 for a semantically invalid request, 429 for rate limiting, and 500, 502, or 503 for server or dependency failures. Do not return HTTP 200 for an error.
| Process-action name | Engine behavior |
|---|---|
Continue |
Continue normal processing |
BreakOperation |
Stop the current operation |
BreakFunction |
Stop the current function |
BreakActivity |
Stop the current activity |
BreakWorkflow |
Stop the current workflow |
ReRunOperation |
Run the current operation again |
ReRunFunction |
Run the current function again |
ReRunActivity |
Run the current activity again |
RestartWorkflow |
Restart the workflow |
CancelWorkflow |
Cancel the workflow |
_runtime.log(message, operation, exception, type): Logs a message to the GSB logging system. (Often superseded byGsbLogService)._runtime.route(routeName): Used in workflow functions to direct the workflow to a specific route._runtime.token: Authentication token of the system user running the current function. Use it for API calls in that execution context._runtime.tenantCode: Accesses the current tenant's code._runtime.apiUrl: Base API URL for the current execution._runtime.userToken: Current user token when one is available._runtime.instance: The current function instance._runtime.transactionId: Current execution transaction ID._runtime.hostName/_runtime.protocol: API host and protocol for the current execution._runtime.settings: The same module settings exposed byinstance?.moduleSettings._runtime.variation: The same variation exposed byinstance?.variation.
The runtime constructs this context before executing authored code: apiUrl, token,
userToken, instance, transactionId, hostName, protocol, settings, and
variation are therefore execution-owned values. Do not replace them with caller-supplied
parameters or persist tokens from them in entities, logs, or background-job payloads.
Email, scheduling, and document paths
For SMTP, SES, attachments, and queued email, use the document delivery guide. For periodic function execution, use Recurring jobs.
Document-generation operation
Use OperationType.CreatePDFDocument (numeric value 12). The HTML and PDF guide
owns the inline/stored-template examples, output fields, encoding, and storage side effects.
See workflow function operation types for all supported names and values.
_instance Object
The _instance object provides data specific to the current invocation of the serverless function.
_instance.entity: Often represents the primary GSB entity that the function is operating on. Its type can be cast using_defs(e.g.,let order = _instance.entity as _defs.GsbPrtOrder;)._instance.entity_id: The ID of the primary entity._instance.prms: An object to store or pass parameters within a function's execution, especially useful in workflows with multiple steps or when setting up sub-flow instances. For example,_instance.prms.dynamicAssignRole = 'role_id';or_instance.prms.subFlowInstances = [];._instance.response: Can be used to build up a response object during the function's execution._instance.result: Can hold a result message or status._instance.parentResult: In sub-flows, this can be used to set a result for the parent flow.
_defs (Definitions)
The _defs object acts as a namespace for all GSB entity type definitions. This is extremely useful for:
- Strongly typing variables:
let newInvoice = new _defs.GsbPrtInvoice(); - IntelliSense and code completion in supporting IDEs.
- Clarity and maintainability of code.
Example:
let customerOrder = _instance.entity as _defs.GsbPrtOrder;
let newProduct = new _defs.GsbInvProduct({ title: "New Product" });
_enums (Enumerations)
The _enums object provides access to predefined sets of constants (enumerations) used throughout GSB. This helps avoid using "magic strings" or numbers and improves code readability.
Example:
upOrder.status = _enums.OrderStatus.Completed;
if (order.type == _enums.OrderType.Sales) { ... }
payment.paymentOption.paymentType == _enums.PaymentType.BankTransfer
Common _enums include:
OrderStatusInvoiceStatusPaymentStatusOrderQuantityStatusQuerySortTypeQueryFunction(for query conditions)QueryRelation(AND/OR for query conditions)ProcessAction(for workflow control)DataPassTypeOrderSubProcessTypeTriggerGroup
Asynchronous Operations
Service I/O returns Promises. Await it inside an async function, with failures handled once at the standard response boundary.
Authentication password-change contract
Password changes belong to native authentication, not an ordinary entity mutation. See Password changes and resets for requesting recovery email, confirming a reset link, and changing a password while signed in.
3. Available Services (from Code Library)
GSB provides a set of built-in services, defined in the "Code Library," that functions can use by referencing their IDs.
When a code library is referenced in a function, the code library is automatically added to the function's scope.
All you need to do is to reference the code library in the function's references array and instantiate it.
For example if you have entity service in your code library, you can directly instantiate it like this:
let entityService = new GsbEntityService(_runtime);
GsbApiService
Service for making general API calls, either to internal GSB endpoints or external HTTP/HTTPS services.
Definition ID: 57bfbcdd-95a2-4d0f-9efb-67433c5b83fa
Instantiation:
let apiService = new GsbApiService(_runtime);
Key Methods:
callApi(req, endPoint, tenantCode = undefined, token = this.runtime.token): Promise- Calls a GSB API endpoint.
req: The request object.endPoint: The API endpoint path (e.g.,/api/entity/queryJson).tenantCode(optional): Tenant code.token(optional): Bearer token. Defaults to_runtime.token.
// Example: // let response = await apiService.callApi({ someData: 'value' }, '/api/custom/endpoint');httpCall(dto: HttpCallRequest, callback, errorCallback): (Legacy) Calls an HTTP/HTTPS API with callbacks. PreferhttpCallAsync.httpCallAsync(dto: HttpCallRequest): Promise: Calls an HTTP/HTTPS API asynchronously.dto: AnHttpCallRequestobject.
// Example: // let request = new HttpCallRequest(); // request.method = "GET"; // request.protocol = "https"; // request.hostName = "api.example.com"; // request.path = "/data"; // request.bearerToken = "some_token"; // let externalData = await apiService.httpCallAsync(request);convertToRequestData(requestParameters: Object): string: Converts an object to a request data string (likely query string).
GsbEntityService
The primary service for interacting with GSB entities (CRUD operations, queries, etc.).
Definition ID: 99e4c845-3032-458f-996f-8db3302f4e38
Instantiation:
let entityService = new GsbEntityService(_runtime);
The constructor constructor(_runtime) also initializes this.apiService = new GsbApiService(_runtime); internally.
Key Methods:
query(req: EntityQueryParams, tenantCode?, token?): Promise<GsbQueryResponse>: Queries entities.req: AnEntityQueryParamsobject defining the query.
delete(req: EntityQueryParams, tenantCode?, token?): Promise<GsbDeleteResponse>: Deletes entities matching the query.queryMapped(req: EntityQueryParams, tenantCode?, token?): Promise<GsbQueryResponse>: Queries entities with mapping.get(req: EntityQueryParams, tenantCode?, token?): Promise<GsbGetResponse>: Retrieves a single entity based on query parameters (expects one result).save(req: GsbSaveRequest, tenantCode?, token?): Promise<GsbSaveResponse>: Saves a single entity.req: AGsbSaveRequestobject, which includesentDefNameandentitydata.
// Example: Save // let newCustomer = new _defs.GsbPartyCustomer({ name: "New Co" }); // let saveReq = new GsbSaveRequest(); // saveReq.entDefName = "GsbPartyCustomer"; // saveReq.entity = newCustomer; // let saveResponse = await entityService.save(saveReq); // let newCustomerId = saveResponse.id;saveEnt(entity: any, tenantCode?, token?): Promise<GsbSaveResponse>: A more direct way to save an entity. The entity object should be an instance of a_defsclass. The service infersentDefName.// Example: saveEnt // let productToUpdate = new _defs.GsbInvProduct({ id: 'existing-id', price: 29.99 }); // await entityService.saveEnt(productToUpdate);updateQuery(req: EntityQueryParams, tenantCode?, token?): Promise<GsbSaveResponse>(Note: Response type might beGsbQueryOpResponsebased on library, oftenGsbSaveResponseis used butaffectedRowCountis the key)- Updates entities matching a query. The
reqobject'sentityproperty should contain the fields to update. - See query-selected updates for the example.
- Updates entities matching a query. The
saveMulti(req: GsbSaveMultiRequest, tenantCode?, token?): Promise<GsbSaveMultiResponse>: Saves multiple entities of the same type.req: AGsbSaveMultiRequestobject withentDefNameand anentitiesarray.
getCode(req: GsbGetCodeRequest, tenantCode?, token?): Promise<GsbGetCodeResponse>: Generates a unique code (e.g., order number).getById<T>(definitionType: (new () => T) | string, id: string): Promise<T | null>: Retrieves an entity by its ID.definitionType: The entity class from_defs(e.g.,_defs.GsbPrtOrder) or its name as a string.id: The entity's ID.
// Example: getById // let order = await entityService.getById(_defs.GsbPrtOrder, 'order-uuid'); // if (order) { /* ... */ }runWorkflow(req, tenantCode?, token?): Promise<any>: Executes a workflow.startWorkflow(req, tenantCode?, token?): Promise<any>: Starts a workflow.runWfFunction(req, tenantCode?, token?): Promise<any>: Runs a workflow function.iterateTask(req, tenantCode?, token?): Promise<any>: Iterates a task in a workflow.getCopy<T>(definitionType: (new () => T) | string, id: string): Promise<T | null>: Retrieves a copy of an entity.
GsbLogService
Provides methods for structured logging.
Definition ID: ca071e22-184e-443b-b7e5-05ad29a1dc13
Instantiation:
let logService = new GsbLogService(_runtime);
Key Methods:
Each method returns a Promise<any>.
log(msg, operation, exception, type): Promise<any>: Generic log method.logError(msg, operation?, exception?): Promise<any>logInfo(msg, operation?, exception?): Promise<any>logWarning(msg, operation?, exception?): Promise<any>logCritical(msg, operation?, exception?): Promise<any>
Apply the logging guidance rather than adding a second error-termination path.
GsbUtil (available as Utils)
A collection of utility functions. It's often available directly as a pre-instantiated Utils object if referenced.
Definition ID: 085d21cb-349f-4a99-b5dc-679c8ee7947e
The library defines const Utils = new GsbUtil();, so you can use Utils directly.
Key Methods:
getSettings(): any: Gets system settings.translate(text, langCode): string: Translates text.getMlDictionary(): []: Gets the multilingual dictionary.equalsCaseInsensitive(v1: string, v2: string): boolean: Case-insensitive string comparison.idEquals(v1: string, v2: string): boolean: Compares two GSB IDs (handles nulls/empties gracefully).isIdEmpty(id): boolean: Checks if a GSB ID is null, undefined, or an empty string.// if (!Utils.isIdEmpty(entity.invoice_id)) { /* ... */ }removeNestedObjects(obj, exceptionProps = []): any: Removes nested objects, useful for simplifying objects before saving.newId(): string: Generates a new GSB-compatible unique ID (GUID).// let newItem = new _defs.MyEntity({ id: Utils.newId(), name: "Test" });checkPropId(entity, propName, createIfNotExists = false): Checks if a linked entity property (e.g.,entity.customer_idandentity.customer) has an ID, optionally creating one.sortByOrderNum(arr: any[], prop = undefined): any[]: Sorts an array of objects by anorderNumberproperty (or a custom property).deepCopy(source): any: Creates a deep copy of an object.isAdmin(): boolean: Checks if the current user is an admin.entityHasMoreThanId(entity:any) : boolean: Checks if an entity object has properties other than just itsid.
4. Building Queries with QueryParams
Reference the installed QueryParams library before using EntityQueryParams in a function.
The QueryParams guide covers runtime construction,
filtering, projections, includes, sorting, pagination, and query-selected updates.
Use advanced queries for aggregates and nested predicates,
and the query API reference for wire fields and supported enum values.
Important runtime & transaction rules in serverless functions:
QueryFunctionenum names: In thequeryParamslibrary (a326feb2-80c3-4ff7-a295-72987a11f1fc), strict inequality operators areQueryFunction.Greater(2) andQueryFunction.Smaller(3) (alongsideQueryFunction.GreaterOrEqual(13) andQueryFunction.SmallerOrEqual(14)). Do not passQueryFunction.GreaterThanorQueryFunction.LessThan—those names do not exist onQueryFunction, evaluate toundefined, and cause.filter(col, val, undefined)to silently fall back toQueryFunction.Equals(0).- Read-after-write within a single execution (
_runtime.transactionId): Writes performed viaentityService.save/saveEnt/updateQueryare buffered in the function execution's unit-of-work transaction until the function run completes. CallingentityService.queryimmediately afterentityService.savein the same function run will not observe rows inserted or modified on the preceding line. Merge the in-memory saved object with pre-existing query results when constructing the function's response. - Partial updates require
isPrimaryKey: trueonid: The backend checksisRequired: trueon create (insert), not on omitted fields during an update. If a partial update{ id, ...changes }fails withisRequirederrors or inserts a duplicate row, the schema'sidproperty is missingisPrimaryKey: true(or the row was only created earlier in the same uncommitted transaction), causing the backend to treat the save as an insert.
5. Working with Operations
The operations field is a JSON string representing an ordered array of function steps.
See Using declarative operations for the serialized example
and workflow function operation types for supported names and values.
operationType: Selects the operation using its numeric enum value.scriptCode: IfoperationTypeis for a script, this field contains the JavaScript code (often base64 encoded or escaped). This script runs within the same GSB function context.setEntityOptions: For operations that modify entities, this defines which properties to set.getEntityOptions: For operations that fetch entities, this defines query parameters.notification: Defines notification settings if the operation sends one.
Operations run in order. Script operations use the same _runtime, _instance, and referenced services as the primary function code.
This allows for a mix of declarative (JSON-defined operations) and imperative (JavaScript) logic within a single GSB function definition.
6. Function Structure and Examples
Use the standard response boundary example as the execution skeleton: instantiate referenced services once per execution, validate instance inputs, await domain work, and return a single outcome.
For multi-entity work, combine entity writes with query-selected updates. Read transactions and commit control before introducing a commit checkpoint or an external side effect.
7. Error Handling and Logging
Keep error termination at the standard response boundary.
Use GsbLogService for operational events that need persistent diagnostics, with an
operation name and request or execution identifier. Redact credentials, tokens, and
personal data; never expose an exception stack as the caller-facing message.
8. Best Practices
- Explicit Dependencies: Always list the services your function uses in its
referencesarray as objects with id properties (e.g.,[{"id": "99e4c845-3032-458f-996f-8db3302f4e38"}]forGsbEntityService). - Asynchronous Code: Correctly use
async/awaitfor all Promises. Avoid blocking operations. - Error Handling: Use the standard response boundary rather than adding another termination path.
- Type Safety: Use
_defsto cast entities and instantiate new ones (let order = _instance.entity as _defs.GsbPrtOrder;). Use_enumsfor status codes, types, etc. - Modularity: Keep functions focused on a single responsibility. For complex logic, consider breaking it into smaller helper functions within the script or multiple GSB functions orchestrated by a workflow.
- Readability: Write clean, well-commented code.
- Idempotency: If a function might be retried, design it to be idempotent (running it multiple times with the same input has the same effect as running it once).
- Input Validation: Validate input parameters (
_instance.prms,_instance.entity) at the beginning of your function. - Service Usage:
- Instantiate services once at the top of your script if they are used multiple times.
- Use
GsbEntityService.saveEnt()for simple saves if you have a typed entity object. UseGsbEntityService.save()withGsbSaveRequestif you need more control or don't have a fully typed object. - Leverage
QueryParamseffectively for precise data retrieval and updates.
- Performance:
- Only select the data you need using
QueryParams.select(). - Be mindful of N+1 query problems when fetching related data; use
QueryParams.include()where appropriate.
- Only select the data you need using
- Security:
- Be cautious when constructing queries or commands from user input to prevent injection attacks (though GSB services and
QueryParamsgenerally mitigate SQL injection). - Do not log sensitive information.
- Be cautious when constructing queries or commands from user input to prevent injection attacks (though GSB services and
- Configuration: Avoid hardcoding IDs or configuration values. If possible, retrieve them from GSB settings or entity configurations.
UtilsObject: Make use of theGsbUtil(viaUtils) for common tasks like ID checking (Utils.isIdEmpty), ID generation (Utils.newId()), and comparisons (Utils.idEquals).
By following this guide and utilizing the provided services and concepts, developers can effectively build powerful and reliable serverless functions within the GSB platform.
9. Creating GSB Serverless Functions
Function Creation Process
- Define the function's name, code, and library references described in the introduction.
- Use the execution skeleton and add only the services needed.
- Test the supplied definition with testWfFunction before publishing.
- Follow CLI function management for pull, test, and push commands, and source control for the resource layout.
Tests execute real operations even though they do not save the supplied function definition. Use a non-production workspace and clean up records, files, and other test side effects.
Using Declarative Operations
From a TypeScript client, build the operation array and serialize it once. This code authors a definition; it is not an SDK import inside the tenant's function runtime.
import { OperationType } from "@gsb-core/workflow-service";
const operations = [
{
orderNumber: 1,
operationType: OperationType.SetEntity,
title: "Set Entity Status",
setEntityOptions: {
setProps: [{ name: "status", value: "processed" }],
},
},
{
orderNumber: 2,
operationType: OperationType.RunScriptCode,
title: "Complete Processing",
scriptCode: "return _runtime.success('processed');",
},
];
const definition = {
name: "ProcessRecord",
operations: JSON.stringify(operations),
};
Workflow function operation types
OperationType is exported by @gsb-core/workflow-service. Use the named member in
TypeScript; serialization writes its numeric value into operationType. For example,
OperationType.SetEntity serializes as 10 and OperationType.RunScriptCode as 7
in the operation array above.
| Enum member | Numeric value |
|---|---|
OperationType.SetProperties |
1 |
OperationType.SendSms |
2 |
OperationType.CallGSBAPI |
3 |
OperationType.CallExternalAPI |
4 |
OperationType.SendEmail |
5 |
OperationType.SendEmailAdvanced |
6 |
OperationType.RunScriptCode |
7 |
OperationType.CommitChanges |
8 |
OperationType.GetEntity |
9 |
OperationType.SetEntity |
10 |
OperationType.DeleteEntity |
11 |
OperationType.CreatePDFDocument |
12 |
OperationType.SendNotification |
13 |
OperationType.SaveEntity |
14 |
10. Calling Functions
Calling Functions from UI
In the GSB UI, functions can be triggered through various means:
- Button Actions: Buttons can be configured to call functions
- Workflow Tasks: User tasks in workflows can call functions upon completion
- Event Handlers: UI events (form submit, field change) can trigger functions
The UI typically sends:
- The function ID or name to execute
- The current entity context
- Optional parameters
Calling Functions from Other Functions
Functions can call other functions using the GsbEntityService.runWfFunction() method:
const functionRequest = {
function: {
name: "Function Name Here"
},
instance: {
// The entity to pass to the function (optional)
entity: myEntity,
// Additional parameters to pass (optional)
prms: {
param1: "value1",
param2: "value2"
}
}
};
const result = await entityService.runWfFunction(functionRequest);
if (!result.success) {
throw new Error(result.message || "Function execution failed");
}
const functionResponse = result.response;
Function Call Response
The response payload is the value supplied at the called function's response boundary. Check the execution outcome before consuming that payload; its domain shape is defined by the called function. See runWfFunction for request and response fields.
Passing Data Between Functions
Use instance.entity for the entity context, instance.prms for additional input,
and the response payload for returned data, as shown in the invocation example above.
Do not pass execution-owned credentials in parameters. For a durable process spanning
multiple functions or human decisions, use Workflows.
How to manage functions
Use the function creation process and the CLI's resource commands rather than maintaining a second deployment flow. The API distinction is testWfFunction for a supplied definition and runWfFunction for an installed function.
Full contract
Request and response schemas and type definitions are available from the CLI once you have run gsb init. Supported enum names and values are included in the public reference:
gsb call getServerlessFunctionDocs
Inspect your workspace's live definitions with gsb call inspectSchema and gsb call getEntityDef.
@gsb-core/mcp-docs:getServerlessFunctionDocs