Skip to content

Commit 4f5211f

Browse files
committed
fix: expose currentTime and utcOffset to template logic in trigger() and init()
Signed-off-by: Supritha Rajashekar <supritharajashekar10@gmail.com>
1 parent d25a21a commit 4f5211f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/TemplateArchiveProcessor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class TemplateArchiveProcessor {
8787
* @param {object} request - the request to send to the template logic
8888
* @param {object} state - the current state of the template
8989
* @param {[string]} currentTime - the current time, defaults to now
90-
* @param {[number]} utcOffset - the UTC offer, defaults to zero
90+
* @param {[number]} utcOffset - the UTC offset, defaults to zero
9191
* @returns {Promise} the response and any events
9292
*/
9393
async trigger(data: any, request: any, state?: any, currentTime?: string, utcOffset?: number): Promise<TriggerResponse> {
@@ -118,7 +118,7 @@ export class TemplateArchiveProcessor {
118118
verbose: false,
119119
functionName: 'trigger',
120120
code: compiledCode['logic/logic.ts'].code, // TODO DCS - how to find the code to run?
121-
argumentNames: ['data', 'request', 'state'],
121+
argumentNames: ['data', 'request', 'state', 'currentTime', 'utcOffset'],
122122
arguments: [data, request, state, currentTime, utcOffset]
123123
});
124124
if(evalResponse.result) {
@@ -136,7 +136,7 @@ export class TemplateArchiveProcessor {
136136
/**
137137
* Init the logic of a template
138138
* @param {[string]} currentTime - the current time, defaults to now
139-
* @param {[number]} utcOffset - the UTC offer, defaults to zero
139+
* @param {[number]} utcOffset - the UTC offset, defaults to zero
140140
* @returns {Promise} the response and any events
141141
*/
142142
async init(data: any, currentTime?: string, utcOffset?: number): Promise<InitResponse> {
@@ -167,7 +167,7 @@ export class TemplateArchiveProcessor {
167167
verbose: false,
168168
functionName: 'init',
169169
code: compiledCode['logic/logic.ts'].code, // TODO DCS - how to find the code to run?
170-
argumentNames: ['data'],
170+
argumentNames: ['data', 'currentTime', 'utcOffset'],
171171
arguments: [data, currentTime, utcOffset]
172172
});
173173
if(evalResponse.result) {

0 commit comments

Comments
 (0)