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.
- package/dist/lib/templates/backends/graphGenerator/goToNode.d.ts +1 -1
- package/dist/lib/templates/backends/graphGenerator/goToNode.js +1 -1
- package/dist/lib/templates/backends/graphGenerator/graphNode.d.ts +1 -1
- package/dist/lib/templates/backends/graphGenerator/graphNode.js +2 -1
- package/dist/scripts/agency.js +7 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const template = "goToNode(\"{{{nodeName:string}}}\",\n {\n messages:
|
|
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;
|
|
@@ -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) => {
|
package/dist/scripts/agency.js
CHANGED
|
@@ -73,9 +73,14 @@ function readFile(inputFile) {
|
|
|
73
73
|
return contents;
|
|
74
74
|
}
|
|
75
75
|
function getImports(program) {
|
|
76
|
-
|
|
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();
|