agency-lang 0.0.39 → 0.0.40

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.
@@ -1,4 +1,4 @@
1
- export declare const template = "goToNode(\"{{{nodeName:string}}}\",\n {\n messages: state.messages,\n __metadata: {\n graph: __graph,\n statelogClient,\n },\n {{#hasData}}\n data: {{{data:string}}}\n {{/hasData}}\n {{^hasData}}\n data: null\n {{/hasData}}\n }\n);";
1
+ export declare const template = "goToNode(\"{{{nodeName:string}}}\",\n {\n messages: __messages,\n __metadata: {\n graph: __graph,\n statelogClient,\n },\n {{#hasData}}\n data: {{{data:string}}}\n {{/hasData}}\n {{^hasData}}\n data: null\n {{/hasData}}\n }\n);";
2
2
  export type TemplateType = {
3
3
  nodeName: string;
4
4
  hasData: boolean;
@@ -4,7 +4,7 @@
4
4
  import { apply } from "typestache";
5
5
  export const template = `goToNode("{{{nodeName:string}}}",
6
6
  {
7
- messages: state.messages,
7
+ messages: __messages,
8
8
  __metadata: {
9
9
  graph: __graph,
10
10
  statelogClient,
@@ -1,4 +1,4 @@
1
- export declare const template = "\ngraph.node(\"{{{name}}}\", async (state): Promise<any> => {\n const __messages: Message[] = [];\n const __graph = state.__metadata?.graph || graph;\n const statelogClient = state.__metadata?.statelogClient || __statelogClient;\n {{#hasParam}}\n const {{{paramNames}}} = state.data;\n {{/hasParam}}\n {{{body}}}\n});\n";
1
+ export declare const template = "\ngraph.node(\"{{{name}}}\", async (state): Promise<any> => {\n const __messages: Message[] = state.messages || [];\n const __graph = state.__metadata?.graph || graph;\n const statelogClient = state.__metadata?.statelogClient || __statelogClient;\n {{#hasParam}}\n const {{{paramNames}}} = state.data;\n {{/hasParam}}\n {{{body}}}\n return { ...state, data: undefined };\n});\n";
2
2
  export type TemplateType = {
3
3
  name: string | boolean | number;
4
4
  hasParam: boolean;
@@ -4,13 +4,14 @@
4
4
  import { apply } from "typestache";
5
5
  export const template = `
6
6
  graph.node("{{{name}}}", async (state): Promise<any> => {
7
- const __messages: Message[] = [];
7
+ const __messages: Message[] = state.messages || [];
8
8
  const __graph = state.__metadata?.graph || graph;
9
9
  const statelogClient = state.__metadata?.statelogClient || __statelogClient;
10
10
  {{#hasParam}}
11
11
  const {{{paramNames}}} = state.data;
12
12
  {{/hasParam}}
13
13
  {{{body}}}
14
+ return { ...state, data: undefined };
14
15
  });
15
16
  `;
16
17
  const render = (args) => {
@@ -73,9 +73,14 @@ function readFile(inputFile) {
73
73
  return contents;
74
74
  }
75
75
  function getImports(program) {
76
- return program.nodes
77
- .filter((node) => node.type === "importNodeStatement")
76
+ const toolAndNodeImports = program.nodes
77
+ .filter((node) => node.type === "importNodeStatement" ||
78
+ node.type === "importToolStatement")
78
79
  .map((node) => node.agencyFile.trim());
80
+ const importStatements = program.nodes
81
+ .filter((node) => node.type === "importStatement")
82
+ .map((node) => node.modulePath.trim());
83
+ return [...toolAndNodeImports, ...importStatements];
79
84
  }
80
85
  const compiledFiles = new Set();
81
86
  const dirSearched = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {