agency-lang 0.0.17 → 0.0.18

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 = "graph.node(\"{{{name}}}\", async (state) => {\n {{#hasParam}}\n const {{{paramName}}} = state.data;\n {{/hasParam}}\n {{{body}}}\n});\n";
1
+ export declare const template = "graph.node(\"{{{name}}}\", async (state): Promise<any> => {\n {{#hasParam}}\n const {{{paramName}}} = state.data;\n {{/hasParam}}\n {{{body}}}\n});\n";
2
2
  export type TemplateType = {
3
3
  name: string | boolean | number;
4
4
  hasParam: boolean;
@@ -2,7 +2,7 @@
2
2
  // Source: lib/templates/backends/graphGenerator/graphNode.mustache
3
3
  // Any manual changes will be lost.
4
4
  import { apply } from "typestache";
5
- export const template = `graph.node("{{{name}}}", async (state) => {
5
+ export const template = `graph.node("{{{name}}}", async (state): Promise<any> => {
6
6
  {{#hasParam}}
7
7
  const {{{paramName}}} = state.data;
8
8
  {{/hasParam}}
@@ -1,6 +1,7 @@
1
- export declare const template = "export async function {{{nodeName:string}}}(data:any): Promise<any> {\n const result = await graph.run(\"{{{nodeName:string}}}\", { messages: [], data });\n return result.data;\n}\n";
1
+ export declare const template = "export async function {{{nodeName:string}}}(data:any): Promise<{{{returnType:string}}}> {\n const result = await graph.run(\"{{{nodeName:string}}}\", { messages: [], data });\n return result.data;\n}\n";
2
2
  export type TemplateType = {
3
3
  nodeName: string;
4
+ returnType: string;
4
5
  };
5
6
  declare const render: (args: TemplateType) => string;
6
7
  export default render;
@@ -2,7 +2,7 @@
2
2
  // Source: lib/templates/backends/graphGenerator/runNodeFunction.mustache
3
3
  // Any manual changes will be lost.
4
4
  import { apply } from "typestache";
5
- export const template = `export async function {{{nodeName:string}}}(data:any): Promise<any> {
5
+ export const template = `export async function {{{nodeName:string}}}(data:any): Promise<{{{returnType:string}}}> {
6
6
  const result = await graph.run("{{{nodeName:string}}}", { messages: [], data });
7
7
  return result.data;
8
8
  }
@@ -1,7 +1,8 @@
1
- export declare const template = "async function {{{functionName:string}}}({{{args}}}) {\n {{{functionBody}}}\n}";
1
+ export declare const template = "async function {{{functionName:string}}}({{{args}}}) : Promise<{{{returnType}}}> {\n {{{functionBody}}}\n}";
2
2
  export type TemplateType = {
3
3
  functionName: string;
4
4
  args: string | boolean | number;
5
+ returnType: string | boolean | number;
5
6
  functionBody: string | boolean | number;
6
7
  };
7
8
  declare const render: (args: TemplateType) => string;
@@ -2,7 +2,7 @@
2
2
  // Source: lib/templates/backends/typescriptGenerator/functionDefinition.mustache
3
3
  // Any manual changes will be lost.
4
4
  import { apply } from "typestache";
5
- export const template = `async function {{{functionName:string}}}({{{args}}}) {
5
+ export const template = `async function {{{functionName:string}}}({{{args}}}) : Promise<{{{returnType}}}> {
6
6
  {{{functionBody}}}
7
7
  }`;
8
8
  const render = (args) => {
@@ -11,7 +11,7 @@ export type FunctionDefinition = {
11
11
  functionName: string;
12
12
  parameters: FunctionParameter[];
13
13
  body: AgencyNode[];
14
- returnType?: VariableType;
14
+ returnType?: VariableType | null;
15
15
  docString?: DocString;
16
16
  };
17
17
  export type FunctionCall = {
@@ -1,4 +1,4 @@
1
- import { AgencyNode, FunctionCall } from "../types.js";
1
+ import { AgencyNode, FunctionCall, VariableType } from "../types.js";
2
2
  import { AccessExpression } from "./access.js";
3
3
  import { Literal } from "./literals.js";
4
4
  export type GraphNodeDefinition = {
@@ -6,6 +6,7 @@ export type GraphNodeDefinition = {
6
6
  nodeName: string;
7
7
  parameters: string[];
8
8
  body: AgencyNode[];
9
+ returnType?: VariableType | null;
9
10
  };
10
11
  export type NodeCall = {
11
12
  type: "nodeCall";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {