@lokascript/framework 2.0.0

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 (181) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +142 -0
  3. package/dist/aot/aot-orchestrator.d.ts +75 -0
  4. package/dist/aot/aot-orchestrator.d.ts.map +1 -0
  5. package/dist/aot/domain-scanner.d.ts +27 -0
  6. package/dist/aot/domain-scanner.d.ts.map +1 -0
  7. package/dist/aot/index.d.ts +8 -0
  8. package/dist/aot/index.d.ts.map +1 -0
  9. package/dist/aot/types.d.ts +103 -0
  10. package/dist/aot/types.d.ts.map +1 -0
  11. package/dist/api/create-dsl.d.ts +91 -0
  12. package/dist/api/create-dsl.d.ts.map +1 -0
  13. package/dist/api/dispatcher.d.ts +108 -0
  14. package/dist/api/dispatcher.d.ts.map +1 -0
  15. package/dist/api/domain-registry.d.ts +152 -0
  16. package/dist/api/domain-registry.d.ts.map +1 -0
  17. package/dist/api/index.d.ts +7 -0
  18. package/dist/api/index.d.ts.map +1 -0
  19. package/dist/api/index.js +2082 -0
  20. package/dist/api/index.js.map +1 -0
  21. package/dist/core/index.d.ts +7 -0
  22. package/dist/core/index.d.ts.map +1 -0
  23. package/dist/core/index.js +2674 -0
  24. package/dist/core/index.js.map +1 -0
  25. package/dist/core/logger.d.ts +32 -0
  26. package/dist/core/logger.d.ts.map +1 -0
  27. package/dist/core/pattern-matching/index.d.ts +6 -0
  28. package/dist/core/pattern-matching/index.d.ts.map +1 -0
  29. package/dist/core/pattern-matching/index.js +1239 -0
  30. package/dist/core/pattern-matching/index.js.map +1 -0
  31. package/dist/core/pattern-matching/pattern-matcher.d.ts +239 -0
  32. package/dist/core/pattern-matching/pattern-matcher.d.ts.map +1 -0
  33. package/dist/core/pattern-matching/utils/index.d.ts +6 -0
  34. package/dist/core/pattern-matching/utils/index.d.ts.map +1 -0
  35. package/dist/core/pattern-matching/utils/possessive-keywords.d.ts +38 -0
  36. package/dist/core/pattern-matching/utils/possessive-keywords.d.ts.map +1 -0
  37. package/dist/core/pattern-matching/utils/type-validation.d.ts +63 -0
  38. package/dist/core/pattern-matching/utils/type-validation.d.ts.map +1 -0
  39. package/dist/core/tokenization/base-tokenizer.d.ts +344 -0
  40. package/dist/core/tokenization/base-tokenizer.d.ts.map +1 -0
  41. package/dist/core/tokenization/char-classifiers.d.ts +56 -0
  42. package/dist/core/tokenization/char-classifiers.d.ts.map +1 -0
  43. package/dist/core/tokenization/default-extractors.d.ts +48 -0
  44. package/dist/core/tokenization/default-extractors.d.ts.map +1 -0
  45. package/dist/core/tokenization/extractors/index.d.ts +9 -0
  46. package/dist/core/tokenization/extractors/index.d.ts.map +1 -0
  47. package/dist/core/tokenization/extractors/operator.d.ts +23 -0
  48. package/dist/core/tokenization/extractors/operator.d.ts.map +1 -0
  49. package/dist/core/tokenization/extractors/punctuation.d.ts +22 -0
  50. package/dist/core/tokenization/extractors/punctuation.d.ts.map +1 -0
  51. package/dist/core/tokenization/extractors.d.ts +61 -0
  52. package/dist/core/tokenization/extractors.d.ts.map +1 -0
  53. package/dist/core/tokenization/index.d.ts +11 -0
  54. package/dist/core/tokenization/index.d.ts.map +1 -0
  55. package/dist/core/tokenization/index.js +1345 -0
  56. package/dist/core/tokenization/index.js.map +1 -0
  57. package/dist/core/tokenization/morphology/index.d.ts +5 -0
  58. package/dist/core/tokenization/morphology/index.d.ts.map +1 -0
  59. package/dist/core/tokenization/morphology/types.d.ts +110 -0
  60. package/dist/core/tokenization/morphology/types.d.ts.map +1 -0
  61. package/dist/core/tokenization/token-utils.d.ts +111 -0
  62. package/dist/core/tokenization/token-utils.d.ts.map +1 -0
  63. package/dist/core/types.d.ts +382 -0
  64. package/dist/core/types.d.ts.map +1 -0
  65. package/dist/core/types.js +108 -0
  66. package/dist/core/types.js.map +1 -0
  67. package/dist/generation/diagnostics.d.ts +120 -0
  68. package/dist/generation/diagnostics.d.ts.map +1 -0
  69. package/dist/generation/index.d.ts +7 -0
  70. package/dist/generation/index.d.ts.map +1 -0
  71. package/dist/generation/index.js +339 -0
  72. package/dist/generation/index.js.map +1 -0
  73. package/dist/generation/pattern-generator.d.ts +48 -0
  74. package/dist/generation/pattern-generator.d.ts.map +1 -0
  75. package/dist/generation/renderer.d.ts +115 -0
  76. package/dist/generation/renderer.d.ts.map +1 -0
  77. package/dist/grammar/index.d.ts +10 -0
  78. package/dist/grammar/index.d.ts.map +1 -0
  79. package/dist/grammar/index.js +391 -0
  80. package/dist/grammar/index.js.map +1 -0
  81. package/dist/grammar/transformer.d.ts +56 -0
  82. package/dist/grammar/transformer.d.ts.map +1 -0
  83. package/dist/grammar/types.d.ts +236 -0
  84. package/dist/grammar/types.d.ts.map +1 -0
  85. package/dist/index.cjs +4454 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +46 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +4336 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/interfaces/dictionary.d.ts +82 -0
  92. package/dist/interfaces/dictionary.d.ts.map +1 -0
  93. package/dist/interfaces/index.d.ts +10 -0
  94. package/dist/interfaces/index.d.ts.map +1 -0
  95. package/dist/interfaces/profile-provider.d.ts +67 -0
  96. package/dist/interfaces/profile-provider.d.ts.map +1 -0
  97. package/dist/interfaces/value-extractor.d.ts +168 -0
  98. package/dist/interfaces/value-extractor.d.ts.map +1 -0
  99. package/dist/multilingual/index.d.ts +8 -0
  100. package/dist/multilingual/index.d.ts.map +1 -0
  101. package/dist/multilingual/index.js +1 -0
  102. package/dist/multilingual/index.js.map +1 -0
  103. package/dist/parsing/index.d.ts +8 -0
  104. package/dist/parsing/index.d.ts.map +1 -0
  105. package/dist/parsing/index.js +1415 -0
  106. package/dist/parsing/index.js.map +1 -0
  107. package/dist/parsing/multi-statement.d.ts +265 -0
  108. package/dist/parsing/multi-statement.d.ts.map +1 -0
  109. package/dist/schema/command-schema.d.ts +78 -0
  110. package/dist/schema/command-schema.d.ts.map +1 -0
  111. package/dist/schema/index.d.ts +5 -0
  112. package/dist/schema/index.d.ts.map +1 -0
  113. package/dist/schema/index.js +25 -0
  114. package/dist/schema/index.js.map +1 -0
  115. package/dist/test-setup.d.ts +9 -0
  116. package/dist/test-setup.d.ts.map +1 -0
  117. package/dist/testing/index.d.ts +50 -0
  118. package/dist/testing/index.d.ts.map +1 -0
  119. package/dist/testing/index.js +16969 -0
  120. package/dist/testing/index.js.map +1 -0
  121. package/package.json +122 -0
  122. package/src/__test__/fixtures/sql-dsl.ts +232 -0
  123. package/src/__test__/sql-integration.test.ts +189 -0
  124. package/src/__test__/test-utils.ts +260 -0
  125. package/src/aot/aot-orchestrator.test.ts +413 -0
  126. package/src/aot/aot-orchestrator.ts +238 -0
  127. package/src/aot/domain-scanner.ts +178 -0
  128. package/src/aot/index.ts +8 -0
  129. package/src/aot/types.ts +124 -0
  130. package/src/api/create-dsl.ts +367 -0
  131. package/src/api/dispatcher.test.ts +336 -0
  132. package/src/api/dispatcher.ts +222 -0
  133. package/src/api/domain-registry.test.ts +336 -0
  134. package/src/api/domain-registry.ts +500 -0
  135. package/src/api/index.ts +7 -0
  136. package/src/core/index.ts +7 -0
  137. package/src/core/logger.ts +130 -0
  138. package/src/core/pattern-matching/index.ts +6 -0
  139. package/src/core/pattern-matching/pattern-matcher.test.ts +900 -0
  140. package/src/core/pattern-matching/pattern-matcher.ts +1548 -0
  141. package/src/core/pattern-matching/pattern-matcher.ts.backup +1267 -0
  142. package/src/core/pattern-matching/utils/index.ts +6 -0
  143. package/src/core/pattern-matching/utils/possessive-keywords.ts +55 -0
  144. package/src/core/pattern-matching/utils/type-validation.test.ts +316 -0
  145. package/src/core/pattern-matching/utils/type-validation.ts +134 -0
  146. package/src/core/tokenization/base-tokenizer.ts +916 -0
  147. package/src/core/tokenization/char-classifiers.ts +79 -0
  148. package/src/core/tokenization/create-simple-tokenizer.test.ts +260 -0
  149. package/src/core/tokenization/default-extractors.ts +69 -0
  150. package/src/core/tokenization/extractors/index.ts +9 -0
  151. package/src/core/tokenization/extractors/operator.ts +75 -0
  152. package/src/core/tokenization/extractors/punctuation.ts +39 -0
  153. package/src/core/tokenization/extractors.ts +452 -0
  154. package/src/core/tokenization/index.ts +11 -0
  155. package/src/core/tokenization/morphology/index.ts +5 -0
  156. package/src/core/tokenization/morphology/types.ts +211 -0
  157. package/src/core/tokenization/token-utils.ts +252 -0
  158. package/src/core/types.ts +589 -0
  159. package/src/generation/diagnostics.test.ts +171 -0
  160. package/src/generation/diagnostics.ts +239 -0
  161. package/src/generation/index.ts +7 -0
  162. package/src/generation/pattern-generator.test.ts +430 -0
  163. package/src/generation/pattern-generator.ts +315 -0
  164. package/src/generation/renderer.test.ts +266 -0
  165. package/src/generation/renderer.ts +244 -0
  166. package/src/grammar/index.ts +12 -0
  167. package/src/grammar/transformer.ts +159 -0
  168. package/src/grammar/types.ts +630 -0
  169. package/src/index.ts +157 -0
  170. package/src/interfaces/dictionary.ts +123 -0
  171. package/src/interfaces/index.ts +10 -0
  172. package/src/interfaces/profile-provider.ts +88 -0
  173. package/src/interfaces/value-extractor.ts +435 -0
  174. package/src/multilingual/index.ts +9 -0
  175. package/src/parsing/index.ts +27 -0
  176. package/src/parsing/multi-statement.test.ts +480 -0
  177. package/src/parsing/multi-statement.ts +648 -0
  178. package/src/schema/command-schema.ts +118 -0
  179. package/src/schema/index.ts +5 -0
  180. package/src/test-setup.ts +45 -0
  181. package/src/testing/index.ts +137 -0
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Command Schema Types
3
+ *
4
+ * Defines the structure of DSL commands for pattern generation.
5
+ * These schemas are language-neutral and describe the semantic structure
6
+ * of commands rather than their surface syntax.
7
+ */
8
+ import type { ActionType, SemanticRole, SemanticValue, ExpectedType } from '../core/types';
9
+ /**
10
+ * Command schema - defines a DSL command's structure.
11
+ */
12
+ export interface CommandSchema {
13
+ /** The action type (command name) */
14
+ readonly action: ActionType;
15
+ /** Human-readable description */
16
+ readonly description: string;
17
+ /** Roles this command accepts */
18
+ readonly roles: RoleSpec[];
19
+ /** The primary role (what the command acts on) */
20
+ readonly primaryRole: SemanticRole;
21
+ /** Category for grouping (DSL-specific) */
22
+ readonly category: string;
23
+ /** Whether this command typically has a body (like event handlers, blocks) */
24
+ readonly hasBody?: boolean;
25
+ /** Notes about special handling or usage */
26
+ readonly notes?: string;
27
+ }
28
+ /**
29
+ * Role specification - defines a semantic role in a command.
30
+ */
31
+ export interface RoleSpec {
32
+ /** The semantic role */
33
+ readonly role: SemanticRole;
34
+ /** Description of what this role represents */
35
+ readonly description: string;
36
+ /** Whether this role is required */
37
+ readonly required: boolean;
38
+ /** Expected value types */
39
+ readonly expectedTypes: Array<ExpectedType>;
40
+ /** Default value if not provided */
41
+ readonly default?: SemanticValue;
42
+ /** Position hint for SVO languages (higher = earlier) */
43
+ readonly svoPosition?: number;
44
+ /** Position hint for SOV languages (higher = earlier) */
45
+ readonly sovPosition?: number;
46
+ /**
47
+ * Override the default role marker for this command.
48
+ * Maps language code to the marker to use (e.g., { en: 'from', ja: 'から' }).
49
+ * If not specified, uses the language profile's default roleMarker.
50
+ */
51
+ readonly markerOverride?: Record<string, string>;
52
+ /**
53
+ * Override the rendering marker separately from parsing.
54
+ * Used when the parsing grammar differs from rendered output.
55
+ * Maps language code to the rendering marker.
56
+ */
57
+ readonly renderOverride?: Record<string, string>;
58
+ /**
59
+ * When true, this role captures all remaining tokens until the next
60
+ * recognized marker keyword or end of input, joining their values
61
+ * with spaces into a single ExpressionValue.
62
+ *
63
+ * Only meaningful for the last role in a sequence or a role followed
64
+ * by a marked role. Default: false.
65
+ */
66
+ readonly greedy?: boolean;
67
+ }
68
+ /**
69
+ * Helper to create a command schema with sensible defaults.
70
+ * Provides defaults for description, category, and primaryRole.
71
+ */
72
+ export declare function defineCommand(schema: Partial<CommandSchema> & Pick<CommandSchema, 'action' | 'roles'>): CommandSchema;
73
+ /**
74
+ * Helper to create a role spec with sensible defaults.
75
+ * Provides default for description.
76
+ */
77
+ export declare function defineRole(role: Partial<RoleSpec> & Pick<RoleSpec, 'role' | 'required' | 'expectedTypes'>): RoleSpec;
78
+ //# sourceMappingURL=command-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-schema.d.ts","sourceRoot":"","sources":["../../src/schema/command-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,iCAAiC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAE3B,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IAEnC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,wBAAwB;IACxB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,2BAA2B;IAC3B,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAE5C,oCAAoC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IAEjC,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjD;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjD;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,GACvE,aAAa,CASf;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC,GAC9E,QAAQ,CAQV"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Schema types for defining DSL commands
3
+ */
4
+ export * from './command-schema';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,25 @@
1
+ // src/schema/command-schema.ts
2
+ function defineCommand(schema) {
3
+ return {
4
+ description: schema.description || `${schema.action} command`,
5
+ category: schema.category || "general",
6
+ primaryRole: schema.primaryRole || schema.roles[0]?.role || "patient",
7
+ ...schema,
8
+ action: schema.action,
9
+ roles: schema.roles
10
+ };
11
+ }
12
+ function defineRole(role) {
13
+ return {
14
+ description: role.description || `${role.role} role`,
15
+ ...role,
16
+ role: role.role,
17
+ required: role.required,
18
+ expectedTypes: role.expectedTypes
19
+ };
20
+ }
21
+ export {
22
+ defineCommand,
23
+ defineRole
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schema/command-schema.ts"],"sourcesContent":["/**\n * Command Schema Types\n *\n * Defines the structure of DSL commands for pattern generation.\n * These schemas are language-neutral and describe the semantic structure\n * of commands rather than their surface syntax.\n */\n\nimport type { ActionType, SemanticRole, SemanticValue, ExpectedType } from '../core/types';\n\n/**\n * Command schema - defines a DSL command's structure.\n */\nexport interface CommandSchema {\n /** The action type (command name) */\n readonly action: ActionType;\n\n /** Human-readable description */\n readonly description: string;\n\n /** Roles this command accepts */\n readonly roles: RoleSpec[];\n\n /** The primary role (what the command acts on) */\n readonly primaryRole: SemanticRole;\n\n /** Category for grouping (DSL-specific) */\n readonly category: string;\n\n /** Whether this command typically has a body (like event handlers, blocks) */\n readonly hasBody?: boolean;\n\n /** Notes about special handling or usage */\n readonly notes?: string;\n}\n\n/**\n * Role specification - defines a semantic role in a command.\n */\nexport interface RoleSpec {\n /** The semantic role */\n readonly role: SemanticRole;\n\n /** Description of what this role represents */\n readonly description: string;\n\n /** Whether this role is required */\n readonly required: boolean;\n\n /** Expected value types */\n readonly expectedTypes: Array<ExpectedType>;\n\n /** Default value if not provided */\n readonly default?: SemanticValue;\n\n /** Position hint for SVO languages (higher = earlier) */\n readonly svoPosition?: number;\n\n /** Position hint for SOV languages (higher = earlier) */\n readonly sovPosition?: number;\n\n /**\n * Override the default role marker for this command.\n * Maps language code to the marker to use (e.g., { en: 'from', ja: 'から' }).\n * If not specified, uses the language profile's default roleMarker.\n */\n readonly markerOverride?: Record<string, string>;\n\n /**\n * Override the rendering marker separately from parsing.\n * Used when the parsing grammar differs from rendered output.\n * Maps language code to the rendering marker.\n */\n readonly renderOverride?: Record<string, string>;\n\n /**\n * When true, this role captures all remaining tokens until the next\n * recognized marker keyword or end of input, joining their values\n * with spaces into a single ExpressionValue.\n *\n * Only meaningful for the last role in a sequence or a role followed\n * by a marked role. Default: false.\n */\n readonly greedy?: boolean;\n}\n\n/**\n * Helper to create a command schema with sensible defaults.\n * Provides defaults for description, category, and primaryRole.\n */\nexport function defineCommand(\n schema: Partial<CommandSchema> & Pick<CommandSchema, 'action' | 'roles'>\n): CommandSchema {\n return {\n description: schema.description || `${schema.action} command`,\n category: schema.category || 'general',\n primaryRole: schema.primaryRole || schema.roles[0]?.role || 'patient',\n ...schema,\n action: schema.action,\n roles: schema.roles,\n } as CommandSchema;\n}\n\n/**\n * Helper to create a role spec with sensible defaults.\n * Provides default for description.\n */\nexport function defineRole(\n role: Partial<RoleSpec> & Pick<RoleSpec, 'role' | 'required' | 'expectedTypes'>\n): RoleSpec {\n return {\n description: role.description || `${role.role} role`,\n ...role,\n role: role.role,\n required: role.required,\n expectedTypes: role.expectedTypes,\n };\n}\n"],"mappings":";AA0FO,SAAS,cACd,QACe;AACf,SAAO;AAAA,IACL,aAAa,OAAO,eAAe,GAAG,OAAO,MAAM;AAAA,IACnD,UAAU,OAAO,YAAY;AAAA,IAC7B,aAAa,OAAO,eAAe,OAAO,MAAM,CAAC,GAAG,QAAQ;AAAA,IAC5D,GAAG;AAAA,IACH,QAAQ,OAAO;AAAA,IACf,OAAO,OAAO;AAAA,EAChB;AACF;AAMO,SAAS,WACd,MACU;AACV,SAAO;AAAA,IACL,aAAa,KAAK,eAAe,GAAG,KAAK,IAAI;AAAA,IAC7C,GAAG;AAAA,IACH,MAAM,KAAK;AAAA,IACX,UAAU,KAAK;AAAA,IACf,eAAe,KAAK;AAAA,EACtB;AACF;","names":[]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Global test setup for @lokascript/framework
3
+ * Runs before each test file to provide a clean testing environment
4
+ */
5
+ /**
6
+ * Cleanup utility for manual cleanup in tests
7
+ */
8
+ export declare function cleanupGlobalState(): void;
9
+ //# sourceMappingURL=test-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmCH;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @lokascript/framework/testing — Test utilities for domain packages
3
+ *
4
+ * Provides assertion helpers and type guards for testing domain DSLs
5
+ * built on the framework. Import from '@lokascript/framework/testing'
6
+ * in test files only (requires vitest as a peer dependency).
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { expectSemanticNode, isLiteralValue } from '@lokascript/framework/testing';
11
+ *
12
+ * test('parses select command', () => {
13
+ * const node = dsl.parse('select name from users', 'en');
14
+ * expectSemanticNode(node, 'select', { columns: 'name', source: 'users' });
15
+ * });
16
+ * ```
17
+ */
18
+ import type { SemanticNode, CommandSemanticNode, SemanticValue, LiteralValue, SelectorValue, ExpressionValue, ReferenceValue } from '../core/types';
19
+ /**
20
+ * Assert that a semantic node has the expected action and role values.
21
+ * Role values can be strings (matched against `value` or `raw`) or full SemanticValue objects.
22
+ */
23
+ export declare function expectSemanticNode(node: SemanticNode, action: string, roles: Record<string, string | SemanticValue>): void;
24
+ /**
25
+ * Assert that a value is a literal semantic value with the expected value.
26
+ */
27
+ export declare function expectLiteralValue(value: SemanticValue | undefined, expectedValue: string | number | boolean): void;
28
+ /**
29
+ * Assert that a value is a selector semantic value.
30
+ */
31
+ export declare function expectSelectorValue(value: SemanticValue | undefined, expectedSelector: string, expectedKind?: SelectorValue['selectorKind']): void;
32
+ /**
33
+ * Assert that a value is an expression semantic value.
34
+ */
35
+ export declare function expectExpressionValue(value: SemanticValue | undefined, expectedRaw: string): void;
36
+ /**
37
+ * Assert that a value is a reference semantic value.
38
+ */
39
+ export declare function expectReferenceValue(value: SemanticValue | undefined, expectedRef: string): void;
40
+ /** Type guard for LiteralValue */
41
+ export declare function isLiteralValue(value: SemanticValue): value is LiteralValue;
42
+ /** Type guard for SelectorValue */
43
+ export declare function isSelectorValue(value: SemanticValue): value is SelectorValue;
44
+ /** Type guard for ExpressionValue */
45
+ export declare function isExpressionValue(value: SemanticValue): value is ExpressionValue;
46
+ /** Type guard for ReferenceValue */
47
+ export declare function isReferenceValue(value: SemanticValue): value is ReferenceValue;
48
+ /** Type guard for CommandSemanticNode */
49
+ export declare function isCommandNode(node: SemanticNode): node is CommandSemanticNode;
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACf,MAAM,eAAe,CAAC;AAMvB;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,GAC5C,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GACvC,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,gBAAgB,EAAE,MAAM,EACxB,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,GAC3C,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAIjG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAIhG;AAMD,kCAAkC;AAClC,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,YAAY,CAE1E;AAED,mCAAmC;AACnC,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,aAAa,CAE5E;AAED,qCAAqC;AACrC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,eAAe,CAEhF;AAED,oCAAoC;AACpC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,IAAI,cAAc,CAE9E;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,IAAI,mBAAmB,CAE7E"}