agency-lang 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,6 +174,7 @@ export class TypeScriptGenerator extends BaseGenerator {
174
174
  typeAnnotation,
175
175
  functionCode: code.trim(),
176
176
  nodeContext: this.getCurrentScope() === "node",
177
+ globalScope: this.getCurrentScope() === "global",
177
178
  });
178
179
  }
179
180
  else if (value.type === "timeBlock") {
@@ -1,8 +1,9 @@
1
- export declare const template = "{{{variableName:string}}}{{{typeAnnotation:string}}} = await {{{functionCode:string}}};\n\nif (isInterrupt({{{variableName:string}}})) {\n {{#nodeContext}}\n return { ...state, data: {{{variableName:string}}} };\n {{/nodeContext}}\n {{^nodeContext}}\n return { data: {{{variableName:string}}} };\n {{/nodeContext}}\n}";
1
+ export declare const template = "{{{variableName:string}}}{{{typeAnnotation:string}}} = await {{{functionCode:string}}};\n\n{{^globalScope}}\nif (isInterrupt({{{variableName:string}}})) {\n {{#nodeContext}}\n return { ...state, data: {{{variableName:string}}} };\n {{/nodeContext}}\n {{^nodeContext}}\n return { data: {{{variableName:string}}} };\n {{/nodeContext}}\n}\n{{/globalScope}}";
2
2
  export type TemplateType = {
3
3
  variableName: string;
4
4
  typeAnnotation: string;
5
5
  functionCode: string;
6
+ globalScope: boolean;
6
7
  nodeContext: boolean;
7
8
  };
8
9
  declare const render: (args: TemplateType) => string;
@@ -4,6 +4,7 @@
4
4
  import { apply } from "typestache";
5
5
  export const template = `{{{variableName:string}}}{{{typeAnnotation:string}}} = await {{{functionCode:string}}};
6
6
 
7
+ {{^globalScope}}
7
8
  if (isInterrupt({{{variableName:string}}})) {
8
9
  {{#nodeContext}}
9
10
  return { ...state, data: {{{variableName:string}}} };
@@ -11,7 +12,8 @@ if (isInterrupt({{{variableName:string}}})) {
11
12
  {{^nodeContext}}
12
13
  return { data: {{{variableName:string}}} };
13
14
  {{/nodeContext}}
14
- }`;
15
+ }
16
+ {{/globalScope}}`;
15
17
  const render = (args) => {
16
18
  return apply(template, args);
17
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {