From 1c92aec7a3107e1410cf9b324ad1e31d02ea6311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Ormaechea?= Date: Thu, 1 Feb 2024 17:31:31 -0300 Subject: [PATCH] Added SF context object docs --- lib/lambda-bases/lambda.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/lambda-bases/lambda.js b/lib/lambda-bases/lambda.js index 65f1861..960fb95 100644 --- a/lib/lambda-bases/lambda.js +++ b/lib/lambda-bases/lambda.js @@ -7,6 +7,13 @@ const lodashPick = require('lodash/pick'); const NANOID_LENGTH = 10; const nanoid = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789', NANOID_LENGTH); +/** + * @typedef {object} StepFunctionContext + * @property {string} EnteredTime ISO 8601 Date string + * @property {string} Name The name of the State Machine + * @property {number} RetryCount The current number of retry attempts of a task + */ + module.exports = class Lambda { /** @@ -40,7 +47,7 @@ module.exports = class Lambda { } /** - * @param {*} taskToken The task token. Only present for async invoked tasks of state machines + * @param {string?} [] The task token. Only present for async invoked tasks of state machines */ set taskToken(taskToken) { /** @private */ @@ -48,14 +55,14 @@ module.exports = class Lambda { } /** - * @returns {*} The task token. Only present for async invoked tasks of state machines + * @returns {string?} The task token. Only present for async invoked tasks of state machines */ get taskToken() { return this._taskToken; } /** - * @param {*} state The invocation state. Only present for async invoked tasks of state machines + * @param {StepFunctionContext?} state The invocation state. Only present for async invoked tasks of state machines */ set state(state) { /** @private */ @@ -63,7 +70,7 @@ module.exports = class Lambda { } /** - * @returns {*} The invocation state. Only present for async invoked tasks of state machines + * @returns {StepFunctionContext?} The invocation state. Only present for async invoked tasks of state machines */ get state() { return this._state;