agency-lang 0.0.18 → 0.0.19

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.
@@ -4,6 +4,10 @@ export const DEFAULT_SCHEMA = "z.string()";
4
4
  * Maps Agency types to Zod schema strings
5
5
  */
6
6
  export function mapTypeToZodSchema(variableType, typeAliases) {
7
+ console.log({ variableType, typeAliases });
8
+ if (!variableType) {
9
+ throw new Error("Variable type is undefined");
10
+ }
7
11
  if (variableType.type === "primitiveType") {
8
12
  switch (variableType.value.toLowerCase()) {
9
13
  case "number":
@@ -162,6 +162,7 @@ export class TypeScriptGenerator extends BaseGenerator {
162
162
  type: "primitiveType",
163
163
  value: "string",
164
164
  };
165
+ console.log({ typeHint, typeAliases: this.typeAliases });
165
166
  const tsType = mapTypeToZodSchema(typeHint, this.typeAliases);
166
167
  properties[param.name] = tsType;
167
168
  });
@@ -306,6 +307,7 @@ export class TypeScriptGenerator extends BaseGenerator {
306
307
  type: "primitiveType",
307
308
  value: "string",
308
309
  };
310
+ console.log(">>>", { variableType });
309
311
  const zodSchema = mapTypeToZodSchema(variableType, this.typeAliases);
310
312
  //console.log("Generated Zod schema for variable", variableName, "Variable type:", variableType, ":", zodSchema, "aliases:", this.typeAliases, "hints:", this.typeHints);
311
313
  const typeString = variableTypeToString(variableType, this.typeAliases);
@@ -1,7 +1,7 @@
1
1
  import { optionalSpaces, varNameChar } from "./utils.js";
2
2
  import { capture, captureCaptures, char, count, digit, many1Till, many1WithJoin, oneOf, or, sepBy, seqC, seqR, set, space, spaces, str, trace, } from "tarsec";
3
3
  import { optionalSemicolon } from "./parserUtils.js";
4
- export const primitiveTypeParser = trace("primitiveTypeParser", seqC(set("type", "primitiveType"), capture(or(str("number"), str("string"), str("boolean")), "value")));
4
+ export const primitiveTypeParser = trace("primitiveTypeParser", seqC(set("type", "primitiveType"), capture(or(str("number"), str("string"), str("boolean"), str("undefined"), str("null")), "value")));
5
5
  export const typeAliasVariableParser = trace("typeAliasVariableParser", seqC(set("type", "typeAliasVariable"), capture(many1WithJoin(varNameChar), "aliasName")));
6
6
  export const arrayTypeParser = (input) => {
7
7
  const parser = trace("arrayTypeParser", seqC(set("type", "arrayType"), capture(or(objectTypeParser, primitiveTypeParser), "elementType"), capture(count(str("[]")), "arrayDepth")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.0.3",
51
51
  "nanoid": "^5.1.6",
52
- "piemachine": "^0.0.2",
52
+ "piemachine": "^0.0.3",
53
53
  "statelog-client": "^0.0.31",
54
54
  "tsc-alias": "^1.8.16",
55
55
  "typescript": "^5.9.3",