agentlang 0.0.3 → 0.0.5

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.
Files changed (122) hide show
  1. package/README.md +16 -47
  2. package/out/api/http.d.ts.map +1 -1
  3. package/out/api/http.js +39 -19
  4. package/out/api/http.js.map +1 -1
  5. package/out/cli/main.d.ts +1 -3
  6. package/out/cli/main.d.ts.map +1 -1
  7. package/out/cli/main.js +6 -12
  8. package/out/cli/main.js.map +1 -1
  9. package/out/language/generated/ast.d.ts +98 -19
  10. package/out/language/generated/ast.d.ts.map +1 -1
  11. package/out/language/generated/ast.js +144 -26
  12. package/out/language/generated/ast.js.map +1 -1
  13. package/out/language/generated/grammar.d.ts +1 -1
  14. package/out/language/generated/grammar.d.ts.map +1 -1
  15. package/out/language/generated/grammar.js +1000 -305
  16. package/out/language/generated/grammar.js.map +1 -1
  17. package/out/language/generated/module.d.ts +1 -1
  18. package/out/language/generated/module.js +1 -1
  19. package/out/language/main.cjs +1097 -312
  20. package/out/language/main.cjs.map +2 -2
  21. package/out/language/parser.js +13 -6
  22. package/out/language/parser.js.map +1 -1
  23. package/out/runtime/agents/common.d.ts +1 -1
  24. package/out/runtime/agents/common.d.ts.map +1 -1
  25. package/out/runtime/agents/common.js +1 -1
  26. package/out/runtime/auth/cognito.d.ts +4 -1
  27. package/out/runtime/auth/cognito.d.ts.map +1 -1
  28. package/out/runtime/auth/cognito.js +540 -73
  29. package/out/runtime/auth/cognito.js.map +1 -1
  30. package/out/runtime/auth/defs.d.ts +3 -0
  31. package/out/runtime/auth/defs.d.ts.map +1 -1
  32. package/out/runtime/auth/defs.js +17 -1
  33. package/out/runtime/auth/defs.js.map +1 -1
  34. package/out/runtime/auth/interface.d.ts +6 -1
  35. package/out/runtime/auth/interface.d.ts.map +1 -1
  36. package/out/runtime/defs.d.ts +21 -0
  37. package/out/runtime/defs.d.ts.map +1 -1
  38. package/out/runtime/defs.js +35 -0
  39. package/out/runtime/defs.js.map +1 -1
  40. package/out/runtime/interpreter.d.ts.map +1 -1
  41. package/out/runtime/interpreter.js +45 -36
  42. package/out/runtime/interpreter.js.map +1 -1
  43. package/out/runtime/loader.d.ts +4 -2
  44. package/out/runtime/loader.d.ts.map +1 -1
  45. package/out/runtime/loader.js +164 -29
  46. package/out/runtime/loader.js.map +1 -1
  47. package/out/runtime/module.d.ts +49 -5
  48. package/out/runtime/module.d.ts.map +1 -1
  49. package/out/runtime/module.js +214 -9
  50. package/out/runtime/module.js.map +1 -1
  51. package/out/runtime/modules/ai.d.ts +7 -5
  52. package/out/runtime/modules/ai.d.ts.map +1 -1
  53. package/out/runtime/modules/ai.js +50 -24
  54. package/out/runtime/modules/ai.js.map +1 -1
  55. package/out/runtime/modules/auth.d.ts +17 -1
  56. package/out/runtime/modules/auth.d.ts.map +1 -1
  57. package/out/runtime/modules/auth.js +295 -32
  58. package/out/runtime/modules/auth.js.map +1 -1
  59. package/out/runtime/modules/core.d.ts.map +1 -1
  60. package/out/runtime/modules/core.js +3 -1
  61. package/out/runtime/modules/core.js.map +1 -1
  62. package/out/runtime/relgraph.d.ts.map +1 -1
  63. package/out/runtime/relgraph.js +2 -2
  64. package/out/runtime/relgraph.js.map +1 -1
  65. package/out/runtime/resolvers/interface.d.ts +37 -2
  66. package/out/runtime/resolvers/interface.d.ts.map +1 -1
  67. package/out/runtime/resolvers/interface.js +103 -5
  68. package/out/runtime/resolvers/interface.js.map +1 -1
  69. package/out/runtime/resolvers/registry.d.ts +3 -2
  70. package/out/runtime/resolvers/registry.d.ts.map +1 -1
  71. package/out/runtime/resolvers/registry.js +3 -0
  72. package/out/runtime/resolvers/registry.js.map +1 -1
  73. package/out/runtime/resolvers/sqldb/database.d.ts +4 -2
  74. package/out/runtime/resolvers/sqldb/database.d.ts.map +1 -1
  75. package/out/runtime/resolvers/sqldb/database.js +43 -4
  76. package/out/runtime/resolvers/sqldb/database.js.map +1 -1
  77. package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
  78. package/out/runtime/resolvers/sqldb/impl.js +7 -3
  79. package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
  80. package/out/runtime/state.d.ts +31 -3
  81. package/out/runtime/state.d.ts.map +1 -1
  82. package/out/runtime/state.js +11 -1
  83. package/out/runtime/state.js.map +1 -1
  84. package/out/runtime/util.d.ts +5 -0
  85. package/out/runtime/util.d.ts.map +1 -1
  86. package/out/runtime/util.js +27 -0
  87. package/out/runtime/util.js.map +1 -1
  88. package/out/syntaxes/agentlang.monarch.js +2 -2
  89. package/out/syntaxes/agentlang.monarch.js.map +1 -1
  90. package/out/utils/http.d.ts +2 -0
  91. package/out/utils/http.d.ts.map +1 -0
  92. package/out/utils/http.js +5 -0
  93. package/out/utils/http.js.map +1 -0
  94. package/package.json +8 -6
  95. package/src/api/http.ts +41 -17
  96. package/src/cli/main.ts +6 -12
  97. package/src/language/agentlang.langium +35 -10
  98. package/src/language/generated/ast.ts +257 -45
  99. package/src/language/generated/grammar.ts +1000 -305
  100. package/src/language/generated/module.ts +1 -1
  101. package/src/language/parser.ts +12 -8
  102. package/src/runtime/agents/common.ts +1 -1
  103. package/src/runtime/auth/cognito.ts +605 -74
  104. package/src/runtime/auth/defs.ts +17 -1
  105. package/src/runtime/auth/interface.ts +6 -1
  106. package/src/runtime/defs.ts +45 -0
  107. package/src/runtime/interpreter.ts +43 -34
  108. package/src/runtime/loader.ts +172 -30
  109. package/src/runtime/module.ts +257 -10
  110. package/src/runtime/modules/ai.ts +52 -28
  111. package/src/runtime/modules/auth.ts +343 -40
  112. package/src/runtime/modules/core.ts +3 -1
  113. package/src/runtime/relgraph.ts +2 -8
  114. package/src/runtime/resolvers/interface.ts +141 -6
  115. package/src/runtime/resolvers/registry.ts +5 -2
  116. package/src/runtime/resolvers/sqldb/database.ts +55 -4
  117. package/src/runtime/resolvers/sqldb/impl.ts +8 -7
  118. package/src/runtime/state.ts +11 -1
  119. package/src/runtime/util.ts +29 -0
  120. package/src/syntaxes/agentlang.monarch.ts +2 -2
  121. package/src/utils/http.ts +5 -0
  122. package/src/index.ts +0 -29
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 3.5.0.
2
+ * This file was generated by langium-cli 3.5.2.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -190,13 +190,17 @@ function introspectPattern(pat: Pattern): BasePattern {
190
190
  function isQueryPattern(pat: Pattern): boolean {
191
191
  if (pat.crudMap) {
192
192
  const crudMap: CrudMap = pat.crudMap;
193
- return (
194
- crudMap.name.endsWith(QuerySuffix) ||
195
- (crudMap.attributes.length > 0 &&
196
- crudMap.attributes.every((v: SetAttribute) => {
193
+ const r = crudMap.name.endsWith(QuerySuffix);
194
+ if (!r && crudMap.body) {
195
+ return (
196
+ crudMap.body.attributes.length > 0 &&
197
+ crudMap.body.attributes.every((v: SetAttribute) => {
197
198
  return v.name.endsWith(QuerySuffix);
198
- }))
199
- );
199
+ })
200
+ );
201
+ } else {
202
+ return r;
203
+ }
200
204
  }
201
205
  return false;
202
206
  }
@@ -240,7 +244,7 @@ function introspectExpression(expr: Expr | Expr): BasePattern {
240
244
  function introspectQueryPattern(crudMap: CrudMap): CrudPattern {
241
245
  if (crudMap) {
242
246
  const cp: CrudPattern = new CrudPattern(crudMap.name);
243
- crudMap.attributes.forEach((sa: SetAttribute) => {
247
+ crudMap.body?.attributes.forEach((sa: SetAttribute) => {
244
248
  cp.addAttribute(sa.name, introspectExpression(sa.value), sa.op);
245
249
  });
246
250
  crudMap.relationships.forEach((rp: RelationshipPattern) => {
@@ -255,7 +259,7 @@ function introspectQueryPattern(crudMap: CrudMap): CrudPattern {
255
259
  function introspectCreatePattern(crudMap: CrudMap): CrudPattern {
256
260
  if (crudMap) {
257
261
  const cp: CrudPattern = new CrudPattern(crudMap.name);
258
- crudMap.attributes.forEach((sa: SetAttribute) => {
262
+ crudMap.body?.attributes.forEach((sa: SetAttribute) => {
259
263
  if (!cp.isQueryUpdate && sa.name.endsWith(QuerySuffix)) {
260
264
  cp.isQueryUpdate = true;
261
265
  }
@@ -46,7 +46,7 @@ Other than the create-pattern for entities and events, some of the most useful p
46
46
  To lookup all instances of an entity, use the syntax: '{EntityName?: {}}'.
47
47
  2. Update - e.g: '{Erp/Employee {employeeId? "56392e13-0d9a-42f7-b556-0d7cd9468a24", firstName "Joe"}}'. This pattern updates the firstName of the employee
48
48
  with the given employeeId.
49
- 3. Upsert - e.g: upsert '{Erp/Employee {employeeId "56392e13-0d9a-42f7-b556-0d7cd9468a24", firstName "Joe"}}'. The 'upsert' pattern will create a new
49
+ 3. Upsert - e.g: '{Erp/Employee {employeeId "56392e13-0d9a-42f7-b556-0d7cd9468a24", firstName "Joe"}, @upsert}'. The 'upsert' pattern will create a new
50
50
  instance, if the instance does not already exist.
51
51
  4. Delete - e.g: delete '{Erp/Employee {employeeId? "56392e13-0d9a-42f7-b556-0d7cd9468a24"}}'
52
52