@naylence/advanced-security 0.3.14 → 0.4.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 (136) hide show
  1. package/dist/browser/index.cjs +5813 -3134
  2. package/dist/browser/index.mjs +5837 -3158
  3. package/dist/cjs/advanced-security-isomorphic.js +4 -0
  4. package/dist/cjs/advanced-security-isomorphic.js.map +1 -1
  5. package/dist/cjs/browser.js +11 -0
  6. package/dist/cjs/browser.js.map +1 -1
  7. package/dist/cjs/naylence/fame/expr/ast.js +135 -0
  8. package/dist/cjs/naylence/fame/expr/ast.js.map +1 -0
  9. package/dist/cjs/naylence/fame/expr/builtins.js +477 -0
  10. package/dist/cjs/naylence/fame/expr/builtins.js.map +1 -0
  11. package/dist/cjs/naylence/fame/expr/errors.js +88 -0
  12. package/dist/cjs/naylence/fame/expr/errors.js.map +1 -0
  13. package/dist/cjs/naylence/fame/expr/evaluator.js +385 -0
  14. package/dist/cjs/naylence/fame/expr/evaluator.js.map +1 -0
  15. package/dist/cjs/naylence/fame/expr/index.js +21 -0
  16. package/dist/cjs/naylence/fame/expr/index.js.map +1 -0
  17. package/dist/cjs/naylence/fame/expr/limits.js +80 -0
  18. package/dist/cjs/naylence/fame/expr/limits.js.map +1 -0
  19. package/dist/cjs/naylence/fame/expr/parser.js +429 -0
  20. package/dist/cjs/naylence/fame/expr/parser.js.map +1 -0
  21. package/dist/cjs/naylence/fame/expr/tokenizer.js +336 -0
  22. package/dist/cjs/naylence/fame/expr/tokenizer.js.map +1 -0
  23. package/dist/cjs/naylence/fame/factory-manifest.js +2 -0
  24. package/dist/cjs/naylence/fame/factory-manifest.js.map +1 -1
  25. package/dist/cjs/naylence/fame/security/auth/index.js +7 -0
  26. package/dist/cjs/naylence/fame/security/auth/index.js.map +1 -0
  27. package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.js +70 -0
  28. package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.js.map +1 -0
  29. package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy.js +562 -0
  30. package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy.js.map +1 -0
  31. package/dist/cjs/naylence/fame/security/auth/policy/expr-builtins.js +129 -0
  32. package/dist/cjs/naylence/fame/security/auth/policy/expr-builtins.js.map +1 -0
  33. package/dist/cjs/naylence/fame/security/auth/policy/index.js +15 -0
  34. package/dist/cjs/naylence/fame/security/auth/policy/index.js.map +1 -0
  35. package/dist/cjs/naylence/fame/security/index.js +2 -0
  36. package/dist/cjs/naylence/fame/security/index.js.map +1 -1
  37. package/dist/cjs/naylence/fame/security/register-advanced-security-factories.js +2 -0
  38. package/dist/cjs/naylence/fame/security/register-advanced-security-factories.js.map +1 -1
  39. package/dist/cjs/naylence/fame/security/strict-overlay-security-profile.js +64 -0
  40. package/dist/cjs/naylence/fame/security/strict-overlay-security-profile.js.map +1 -0
  41. package/dist/cjs/node.js +27 -0
  42. package/dist/cjs/node.js.map +1 -1
  43. package/dist/cjs/plugin.js +2 -0
  44. package/dist/cjs/plugin.js.map +1 -1
  45. package/dist/cjs/version.js +2 -2
  46. package/dist/cjs/version.js.map +1 -1
  47. package/dist/esm/advanced-security-isomorphic.js +4 -0
  48. package/dist/esm/advanced-security-isomorphic.js.map +1 -1
  49. package/dist/esm/browser.js +11 -0
  50. package/dist/esm/browser.js.map +1 -1
  51. package/dist/esm/naylence/fame/expr/ast.js +135 -0
  52. package/dist/esm/naylence/fame/expr/ast.js.map +1 -0
  53. package/dist/esm/naylence/fame/expr/builtins.js +477 -0
  54. package/dist/esm/naylence/fame/expr/builtins.js.map +1 -0
  55. package/dist/esm/naylence/fame/expr/errors.js +88 -0
  56. package/dist/esm/naylence/fame/expr/errors.js.map +1 -0
  57. package/dist/esm/naylence/fame/expr/evaluator.js +385 -0
  58. package/dist/esm/naylence/fame/expr/evaluator.js.map +1 -0
  59. package/dist/esm/naylence/fame/expr/index.js +21 -0
  60. package/dist/esm/naylence/fame/expr/index.js.map +1 -0
  61. package/dist/esm/naylence/fame/expr/limits.js +80 -0
  62. package/dist/esm/naylence/fame/expr/limits.js.map +1 -0
  63. package/dist/esm/naylence/fame/expr/parser.js +429 -0
  64. package/dist/esm/naylence/fame/expr/parser.js.map +1 -0
  65. package/dist/esm/naylence/fame/expr/tokenizer.js +336 -0
  66. package/dist/esm/naylence/fame/expr/tokenizer.js.map +1 -0
  67. package/dist/esm/naylence/fame/factory-manifest.js +2 -0
  68. package/dist/esm/naylence/fame/factory-manifest.js.map +1 -1
  69. package/dist/esm/naylence/fame/security/auth/index.js +7 -0
  70. package/dist/esm/naylence/fame/security/auth/index.js.map +1 -0
  71. package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.js +70 -0
  72. package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.js.map +1 -0
  73. package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy.js +562 -0
  74. package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy.js.map +1 -0
  75. package/dist/esm/naylence/fame/security/auth/policy/expr-builtins.js +129 -0
  76. package/dist/esm/naylence/fame/security/auth/policy/expr-builtins.js.map +1 -0
  77. package/dist/esm/naylence/fame/security/auth/policy/index.js +15 -0
  78. package/dist/esm/naylence/fame/security/auth/policy/index.js.map +1 -0
  79. package/dist/esm/naylence/fame/security/index.js +2 -0
  80. package/dist/esm/naylence/fame/security/index.js.map +1 -1
  81. package/dist/esm/naylence/fame/security/register-advanced-security-factories.js +2 -0
  82. package/dist/esm/naylence/fame/security/register-advanced-security-factories.js.map +1 -1
  83. package/dist/esm/naylence/fame/security/strict-overlay-security-profile.js +64 -0
  84. package/dist/esm/naylence/fame/security/strict-overlay-security-profile.js.map +1 -0
  85. package/dist/esm/node.js +27 -0
  86. package/dist/esm/node.js.map +1 -1
  87. package/dist/esm/plugin.js +2 -0
  88. package/dist/esm/plugin.js.map +1 -1
  89. package/dist/esm/version.js +2 -2
  90. package/dist/esm/version.js.map +1 -1
  91. package/dist/node/index.cjs +2795 -6
  92. package/dist/node/index.mjs +2770 -15
  93. package/dist/node/node.cjs +6083 -3241
  94. package/dist/node/node.mjs +8347 -5540
  95. package/dist/types/advanced-security-isomorphic.d.ts +2 -0
  96. package/dist/types/advanced-security-isomorphic.d.ts.map +1 -1
  97. package/dist/types/browser.d.ts.map +1 -1
  98. package/dist/types/naylence/fame/expr/ast.d.ts +85 -0
  99. package/dist/types/naylence/fame/expr/ast.d.ts.map +1 -0
  100. package/dist/types/naylence/fame/expr/builtins.d.ts +79 -0
  101. package/dist/types/naylence/fame/expr/builtins.d.ts.map +1 -0
  102. package/dist/types/naylence/fame/expr/errors.d.ts +61 -0
  103. package/dist/types/naylence/fame/expr/errors.d.ts.map +1 -0
  104. package/dist/types/naylence/fame/expr/evaluator.d.ts +90 -0
  105. package/dist/types/naylence/fame/expr/evaluator.d.ts.map +1 -0
  106. package/dist/types/naylence/fame/expr/index.d.ts +16 -0
  107. package/dist/types/naylence/fame/expr/index.d.ts.map +1 -0
  108. package/dist/types/naylence/fame/expr/limits.d.ts +65 -0
  109. package/dist/types/naylence/fame/expr/limits.d.ts.map +1 -0
  110. package/dist/types/naylence/fame/expr/parser.d.ts +102 -0
  111. package/dist/types/naylence/fame/expr/parser.d.ts.map +1 -0
  112. package/dist/types/naylence/fame/expr/tokenizer.d.ts +51 -0
  113. package/dist/types/naylence/fame/expr/tokenizer.d.ts.map +1 -0
  114. package/dist/types/naylence/fame/factory-manifest.d.ts +1 -1
  115. package/dist/types/naylence/fame/factory-manifest.d.ts.map +1 -1
  116. package/dist/types/naylence/fame/security/auth/index.d.ts +7 -0
  117. package/dist/types/naylence/fame/security/auth/index.d.ts.map +1 -0
  118. package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.d.ts +47 -0
  119. package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy-factory.d.ts.map +1 -0
  120. package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy.d.ts +73 -0
  121. package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy.d.ts.map +1 -0
  122. package/dist/types/naylence/fame/security/auth/policy/expr-builtins.d.ts +14 -0
  123. package/dist/types/naylence/fame/security/auth/policy/expr-builtins.d.ts.map +1 -0
  124. package/dist/types/naylence/fame/security/auth/policy/index.d.ts +12 -0
  125. package/dist/types/naylence/fame/security/auth/policy/index.d.ts.map +1 -0
  126. package/dist/types/naylence/fame/security/index.d.ts +2 -0
  127. package/dist/types/naylence/fame/security/index.d.ts.map +1 -1
  128. package/dist/types/naylence/fame/security/register-advanced-security-factories.d.ts +1 -0
  129. package/dist/types/naylence/fame/security/register-advanced-security-factories.d.ts.map +1 -1
  130. package/dist/types/naylence/fame/security/strict-overlay-security-profile.d.ts +11 -0
  131. package/dist/types/naylence/fame/security/strict-overlay-security-profile.d.ts.map +1 -0
  132. package/dist/types/node.d.ts.map +1 -1
  133. package/dist/types/plugin.d.ts.map +1 -1
  134. package/dist/types/version.d.ts +1 -1
  135. package/dist/types/version.d.ts.map +1 -1
  136. package/package.json +3 -3
@@ -5,6 +5,8 @@
5
5
  * installing the shared dynamic importer shim used by Naylence plugins.
6
6
  */
7
7
  export { VERSION } from "./version.js";
8
+ export * from "./naylence/fame/expr/index.js";
9
+ export * from "./naylence/fame/security/auth/index.js";
8
10
  export { validateJwkX5cCertificate, type ValidateJwkX5cCertificateOptions, type ValidateJwkX5cCertificateResult, publicKeyFromX5c, type PublicKeyFromX5cOptions, } from "./naylence/fame/security/cert/util.js";
9
11
  export { GRANT_PURPOSE_CA_SIGN } from "./naylence/fame/security/cert/grants.js";
10
12
  export { createEd25519Csr, type CreateEd25519CsrOptions, } from "./naylence/fame/security/cert/browser-csr.js";
@@ -1 +1 @@
1
- {"version":3,"file":"advanced-security-isomorphic.d.ts","sourceRoot":"","sources":["../../src/advanced-security-isomorphic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE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AAM,8BAA8B,oBACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACN,yBAAyB,EACzB,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,gBAAgB,EAChB,KAAK,uBAAuB,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,gBAAgB,EAChB,KAAK,uBAAuB,GAC5B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,GACrB,MAAM,oDAAoD,CAAC;AAE5D,cAAc,8CAA8C,CAAC;AAE7D,OAAO,EACN,kCAAkC,EAClC,YAAY,IAAI,2CAA2C,EAC3D,KAAK,yBAAyB,GAC9B,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EACN,oCAAoC,EACpC,YAAY,IAAI,6CAA6C,EAC7D,KAAK,2BAA2B,GAChC,MAAM,qEAAqE,CAAC;AAC7E,OAAO,EACN,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC1B,MAAM,6DAA6D,CAAC;AAErE,cAAc,wCAAwC,CAAC;AAEvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACN,yBAAyB,EACzB,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,gBAAgB,EAChB,KAAK,uBAAuB,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,gBAAgB,EAChB,KAAK,uBAAuB,GAC5B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,GACrB,MAAM,oDAAoD,CAAC;AAE5D,cAAc,8CAA8C,CAAC;AAE7D,OAAO,EACN,kCAAkC,EAClC,YAAY,IAAI,2CAA2C,EAC3D,KAAK,yBAAyB,GAC9B,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EACN,oCAAoC,EACpC,YAAY,IAAI,6CAA6C,EAC7D,KAAK,2BAA2B,GAChC,MAAM,qEAAqE,CAAC;AAC7E,OAAO,EACN,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC1B,MAAM,6DAA6D,CAAC;AAErE,cAAc,wCAAwC,CAAC;AAEvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Abstract Syntax Tree (AST) node types for the expression language.
3
+ *
4
+ * The AST is produced by the parser and consumed by the evaluator.
5
+ */
6
+ /**
7
+ * Base interface for all AST nodes.
8
+ */
9
+ export interface AstNodeBase {
10
+ /** Discriminator for node type */
11
+ readonly type: string;
12
+ /** Position in source expression (for error reporting) */
13
+ readonly position: number;
14
+ }
15
+ export interface StringLiteralNode extends AstNodeBase {
16
+ readonly type: "StringLiteral";
17
+ readonly value: string;
18
+ }
19
+ export interface NumberLiteralNode extends AstNodeBase {
20
+ readonly type: "NumberLiteral";
21
+ readonly value: number;
22
+ }
23
+ export interface BooleanLiteralNode extends AstNodeBase {
24
+ readonly type: "BooleanLiteral";
25
+ readonly value: boolean;
26
+ }
27
+ export interface NullLiteralNode extends AstNodeBase {
28
+ readonly type: "NullLiteral";
29
+ }
30
+ export interface ArrayLiteralNode extends AstNodeBase {
31
+ readonly type: "ArrayLiteral";
32
+ readonly elements: readonly AstNode[];
33
+ }
34
+ export interface IdentifierNode extends AstNodeBase {
35
+ readonly type: "Identifier";
36
+ readonly name: string;
37
+ }
38
+ export interface MemberAccessNode extends AstNodeBase {
39
+ readonly type: "MemberAccess";
40
+ readonly object: AstNode;
41
+ readonly property: string;
42
+ }
43
+ export interface IndexAccessNode extends AstNodeBase {
44
+ readonly type: "IndexAccess";
45
+ readonly object: AstNode;
46
+ readonly index: AstNode;
47
+ }
48
+ export interface FunctionCallNode extends AstNodeBase {
49
+ readonly type: "FunctionCall";
50
+ readonly name: string;
51
+ readonly args: readonly AstNode[];
52
+ }
53
+ export type UnaryOperator = "!" | "-";
54
+ export interface UnaryOpNode extends AstNodeBase {
55
+ readonly type: "UnaryOp";
56
+ readonly operator: UnaryOperator;
57
+ readonly operand: AstNode;
58
+ }
59
+ export type BinaryOperator = "*" | "/" | "%" | "+" | "-" | "<" | "<=" | ">" | ">=" | "==" | "!=" | "in" | "not in" | "&&" | "||";
60
+ export interface BinaryOpNode extends AstNodeBase {
61
+ readonly type: "BinaryOp";
62
+ readonly operator: BinaryOperator;
63
+ readonly left: AstNode;
64
+ readonly right: AstNode;
65
+ }
66
+ export interface TernaryOpNode extends AstNodeBase {
67
+ readonly type: "TernaryOp";
68
+ readonly condition: AstNode;
69
+ readonly consequent: AstNode;
70
+ readonly alternate: AstNode;
71
+ }
72
+ export type AstNode = StringLiteralNode | NumberLiteralNode | BooleanLiteralNode | NullLiteralNode | ArrayLiteralNode | IdentifierNode | MemberAccessNode | IndexAccessNode | FunctionCallNode | UnaryOpNode | BinaryOpNode | TernaryOpNode;
73
+ /**
74
+ * Counts the total number of nodes in an AST.
75
+ */
76
+ export declare function countAstNodes(node: AstNode): number;
77
+ /**
78
+ * Calculates the maximum depth of an AST.
79
+ */
80
+ export declare function calculateAstDepth(node: AstNode): number;
81
+ /**
82
+ * Returns a human-readable representation of an AST node for debugging.
83
+ */
84
+ export declare function astToString(node: AstNode, indent?: number): string;
85
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAMD,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CACvC;AAMD,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED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AAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAMD,MAAM,MAAM,OAAO,GACf,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,WAAW,GACX,YAAY,GACZ,aAAa,CAAC;AAMlB;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CA2CnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAqDvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,SAAI,GAAG,MAAM,CAuE7D"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Built-in functions for the expression language.
3
+ *
4
+ * All built-in functions are pure and deterministic.
5
+ *
6
+ * Null handling semantics:
7
+ * - `undefined` is normalized to `null` throughout the expression value model.
8
+ * - Predicate-style builtins (starts_with, ends_with, contains, glob_match,
9
+ * regex_match, etc.) return `false` when passed `null` for required args
10
+ * instead of throwing an error.
11
+ * - Wrong non-null types still raise BuiltinError to surface real bugs.
12
+ * - Non-predicate operations (arithmetic, comparisons) remain strict.
13
+ */
14
+ import { type ExpressionLimits } from "./limits.js";
15
+ /**
16
+ * Runtime value types for the expression language.
17
+ *
18
+ * Note: `undefined` is NOT a valid ExprValue. Any JavaScript `undefined`
19
+ * values should be normalized to `null` before entering the expression system.
20
+ */
21
+ export type ExprValue = string | number | boolean | null | readonly ExprValue[] | {
22
+ readonly [key: string]: ExprValue;
23
+ };
24
+ /**
25
+ * Normalizes a JavaScript value to an ExprValue.
26
+ *
27
+ * Rules:
28
+ * - `undefined` -> `null`
29
+ * - `null` -> `null`
30
+ * - boolean/number/string -> returned as-is
31
+ * - array -> elements are recursively normalized
32
+ * - object -> returned as-is (reads will normalize on access)
33
+ * - other types (function, symbol, etc.) -> `null`
34
+ *
35
+ * This ensures `undefined` never leaks into the expression value model.
36
+ */
37
+ export declare function normalizeJsValue(value: unknown): ExprValue;
38
+ /**
39
+ * Signature of a built-in function.
40
+ */
41
+ export type BuiltinFunction = (args: readonly ExprValue[], context: BuiltinContext) => ExprValue;
42
+ /**
43
+ * Context passed to built-in functions.
44
+ */
45
+ export interface BuiltinContext {
46
+ /** Expression limits for pattern validation */
47
+ readonly limits: ExpressionLimits;
48
+ /** Position in source for error reporting */
49
+ readonly position: number;
50
+ /** Source expression for error reporting */
51
+ readonly source: string;
52
+ }
53
+ /**
54
+ * Function registry for built-in and injected functions.
55
+ */
56
+ export type FunctionRegistry = ReadonlyMap<string, BuiltinFunction>;
57
+ /**
58
+ * Gets the type name of a value for error messages.
59
+ */
60
+ export declare function getTypeName(value: ExprValue): string;
61
+ /**
62
+ * Registry of all built-in functions.
63
+ */
64
+ export declare const BUILTIN_FUNCTIONS: FunctionRegistry;
65
+ /**
66
+ * Calls a built-in function by name.
67
+ *
68
+ * @param name - The function name
69
+ * @param args - The function arguments
70
+ * @param context - The evaluation context
71
+ * @returns The function result
72
+ * @throws BuiltinError if the function doesn't exist or fails
73
+ */
74
+ export declare function callBuiltin(name: string, args: readonly ExprValue[], context: BuiltinContext, functions?: FunctionRegistry): ExprValue;
75
+ /**
76
+ * Checks if a name is a built-in function.
77
+ */
78
+ export declare function isBuiltinFunction(name: string, functions?: FunctionRegistry): boolean;
79
+ //# sourceMappingURL=builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAwB1D;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,SAAS,SAAS,EAAE,EAC1B,OAAO,EAAE,cAAc,KACpB,SAAS,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAIpD;AAudD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAqB9B,CAAC;AAEH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,SAAS,EAAE,EAC1B,OAAO,EAAE,cAAc,EACvB,SAAS,GAAE,gBAAoC,GAC9C,SAAS,CAUX;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,gBAAoC,GAC9C,OAAO,CAET"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Error types for the expression evaluation engine.
3
+ *
4
+ * All expression errors extend ExpressionError for consistent handling.
5
+ */
6
+ /**
7
+ * Base error class for all expression-related errors.
8
+ */
9
+ export declare class ExpressionError extends Error {
10
+ readonly position?: number;
11
+ readonly expression?: string;
12
+ constructor(message: string, position?: number, expression?: string);
13
+ /**
14
+ * Returns a formatted error message with position context.
15
+ */
16
+ formatWithContext(): string;
17
+ }
18
+ /**
19
+ * Error thrown during tokenization (lexical analysis).
20
+ */
21
+ export declare class TokenizerError extends ExpressionError {
22
+ constructor(message: string, position?: number, expression?: string);
23
+ }
24
+ /**
25
+ * Error thrown during parsing (syntax analysis).
26
+ */
27
+ export declare class ParseError extends ExpressionError {
28
+ constructor(message: string, position?: number, expression?: string);
29
+ }
30
+ /**
31
+ * Error thrown during evaluation (runtime error).
32
+ */
33
+ export declare class EvaluationError extends ExpressionError {
34
+ readonly path?: string;
35
+ constructor(message: string, position?: number, expression?: string, path?: string);
36
+ }
37
+ /**
38
+ * Error thrown for type mismatches during evaluation.
39
+ */
40
+ export declare class TypeError extends EvaluationError {
41
+ readonly expected: string;
42
+ readonly actual: string;
43
+ constructor(expected: string, actual: string, position?: number, expression?: string);
44
+ }
45
+ /**
46
+ * Error thrown when expression limits are exceeded.
47
+ */
48
+ export declare class LimitExceededError extends ExpressionError {
49
+ readonly limitName: string;
50
+ readonly limit: number;
51
+ readonly actual: number;
52
+ constructor(limitName: string, limit: number, actual: number);
53
+ }
54
+ /**
55
+ * Error thrown when a built-in function encounters an error.
56
+ */
57
+ export declare class BuiltinError extends EvaluationError {
58
+ readonly functionName: string;
59
+ constructor(functionName: string, message: string, position?: number, expression?: string);
60
+ }
61
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;g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ACf,QAAQ,CAAC,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM;CAMtB"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Expression evaluator.
3
+ *
4
+ * Evaluates an AST against a set of variable bindings and returns a value.
5
+ *
6
+ * Null handling semantics:
7
+ * - `undefined` values are normalized to `null` throughout evaluation.
8
+ * - Missing identifiers evaluate to `null`.
9
+ * - Member access on `null` or non-object returns `null`.
10
+ * - Missing properties return `null` (including properties set to `undefined`).
11
+ */
12
+ import type { AstNode } from "./ast.js";
13
+ import { type ExprValue, type FunctionRegistry } from "./builtins.js";
14
+ import { type ExpressionLimits } from "./limits.js";
15
+ /**
16
+ * Evaluation context with variable bindings.
17
+ */
18
+ export interface EvaluationContext {
19
+ /** Variable bindings available to expressions */
20
+ readonly bindings: Readonly<Record<string, ExprValue>>;
21
+ /** Expression limits */
22
+ readonly limits?: ExpressionLimits;
23
+ /** Source expression for error reporting */
24
+ readonly source?: string;
25
+ /** Function registry for built-ins and injected helpers */
26
+ readonly functions?: FunctionRegistry;
27
+ }
28
+ /**
29
+ * Result of expression evaluation with trace information.
30
+ */
31
+ export interface EvaluationResult {
32
+ /** The evaluated value */
33
+ readonly value: ExprValue;
34
+ /** Whether evaluation succeeded */
35
+ readonly success: boolean;
36
+ /** Error message if evaluation failed */
37
+ readonly error?: string;
38
+ }
39
+ /**
40
+ * Evaluates an AST node and returns the result.
41
+ */
42
+ export declare class Evaluator {
43
+ private readonly context;
44
+ private readonly limits;
45
+ private readonly source;
46
+ private readonly functions;
47
+ private memberAccessDepth;
48
+ constructor(context: EvaluationContext);
49
+ /**
50
+ * Evaluates an AST node and returns the value.
51
+ */
52
+ evaluate(node: AstNode): ExprValue;
53
+ /**
54
+ * Evaluates as boolean with strict type checking.
55
+ */
56
+ evaluateAsBoolean(node: AstNode): boolean;
57
+ private evaluateIdentifier;
58
+ private evaluateMemberAccess;
59
+ private evaluateIndexAccess;
60
+ private evaluateFunctionCall;
61
+ private evaluateUnaryOp;
62
+ private evaluateBinaryOp;
63
+ private evaluateComparison;
64
+ private evaluateIn;
65
+ private evaluateTernaryOp;
66
+ /**
67
+ * Deep equality check for expression values.
68
+ */
69
+ private valuesEqual;
70
+ }
71
+ /**
72
+ * Evaluates an AST against a context and returns the result.
73
+ *
74
+ * @param ast - The AST to evaluate
75
+ * @param context - The evaluation context with bindings
76
+ * @returns The evaluation result
77
+ */
78
+ export declare function evaluate(ast: AstNode, context: EvaluationContext): EvaluationResult;
79
+ /**
80
+ * Evaluates an AST as a boolean condition.
81
+ *
82
+ * @param ast - The AST to evaluate
83
+ * @param context - The evaluation context with bindings
84
+ * @returns true if the condition is met, false otherwise (including errors)
85
+ */
86
+ export declare function evaluateAsBoolean(ast: AstNode, context: EvaluationContext): {
87
+ value: boolean;
88
+ error?: string;
89
+ };
90
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,UAAU,CAAC;AACvE,OAAO,EAML,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACvD,wBAAwB;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,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3
+ *
4
+ * This module provides a deterministic, side-effect-free expression
5
+ * evaluation engine with injectable built-in functions.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export * from "./ast.js";
10
+ export * from "./errors.js";
11
+ export * from "./limits.js";
12
+ export { tokenize, Tokenizer, type Token, type TokenType } from "./tokenizer.js";
13
+ export { parse, Parser } from "./parser.js";
14
+ export { evaluate, evaluateAsBoolean, Evaluator, type EvaluationContext, type EvaluationResult, } from "./evaluator.js";
15
+ export { BUILTIN_FUNCTIONS, callBuiltin, isBuiltinFunction, getTypeName, normalizeJsValue, type ExprValue, type BuiltinFunction, type BuiltinContext, type FunctionRegistry, } from "./builtins.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGjF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Resource limits for expression parsing and evaluation.
3
+ *
4
+ * These limits protect against resource exhaustion attacks and
5
+ * overly complex expressions.
6
+ */
7
+ /**
8
+ * Expression limits configuration.
9
+ */
10
+ export interface ExpressionLimits {
11
+ /** Maximum expression string length in characters */
12
+ readonly maxExpressionLength: number;
13
+ /** Maximum AST depth (nesting level) */
14
+ readonly maxAstDepth: number;
15
+ /** Maximum number of AST nodes */
16
+ readonly maxAstNodes: number;
17
+ /** Maximum regex pattern length */
18
+ readonly maxRegexPatternLength: number;
19
+ /** Maximum glob pattern length */
20
+ readonly maxGlobPatternLength: number;
21
+ /** Maximum string literal length */
22
+ readonly maxStringLength: number;
23
+ /** Maximum array literal length */
24
+ readonly maxArrayLength: number;
25
+ /** Maximum function call arguments */
26
+ readonly maxFunctionArgs: number;
27
+ /** Maximum member access chain depth */
28
+ readonly maxMemberAccessDepth: number;
29
+ }
30
+ /**
31
+ * Default expression limits.
32
+ *
33
+ * These values are chosen to allow reasonable expressions while
34
+ * preventing resource exhaustion.
35
+ */
36
+ export declare const DEFAULT_EXPRESSION_LIMITS: Readonly<ExpressionLimits>;
37
+ /**
38
+ * Validates that expression length is within limits.
39
+ */
40
+ export declare function checkExpressionLength(expression: string, limits?: ExpressionLimits): void;
41
+ /**
42
+ * Validates AST depth during parsing.
43
+ */
44
+ export declare function checkAstDepth(depth: number, limits?: ExpressionLimits): void;
45
+ /**
46
+ * Validates AST node count during parsing.
47
+ */
48
+ export declare function checkAstNodeCount(count: number, limits?: ExpressionLimits): void;
49
+ /**
50
+ * Validates regex pattern length before compilation.
51
+ */
52
+ export declare function checkRegexPatternLength(pattern: string, limits?: ExpressionLimits): void;
53
+ /**
54
+ * Validates glob pattern length before compilation.
55
+ */
56
+ export declare function checkGlobPatternLength(pattern: string, limits?: ExpressionLimits): void;
57
+ /**
58
+ * Validates array length during evaluation.
59
+ */
60
+ export declare function checkArrayLength(length: number, limits?: ExpressionLimits): void;
61
+ /**
62
+ * Validates function argument count.
63
+ */
64
+ export declare function checkFunctionArgCount(count: number, limits?: ExpressionLimits): void;
65
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.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4C,GACnD,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAA4C,GACnD,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,gBAA4C,GACnD,IAAI,CAMN"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Parser for the expression language.
3
+ *
4
+ * Parses a stream of tokens into an Abstract Syntax Tree (AST).
5
+ * Uses recursive descent parsing with operator precedence.
6
+ *
7
+ * Precedence (lowest to highest):
8
+ * 1. Ternary: ? :
9
+ * 2. Logical OR: ||
10
+ * 3. Logical AND: &&
11
+ * 4. Membership: in, not in
12
+ * 5. Equality: ==, !=
13
+ * 6. Comparison: <, <=, >, >=
14
+ * 7. Additive: +, -
15
+ * 8. Multiplicative: *, /, %
16
+ * 9. Unary: !, -
17
+ * 10. Postfix: . [] ()
18
+ * 11. Primary: literals, identifiers, parentheses
19
+ */
20
+ import type { AstNode } from "./ast.js";
21
+ import { type ExpressionLimits } from "./limits.js";
22
+ import { type Token } from "./tokenizer.js";
23
+ /**
24
+ * Parser for expression strings.
25
+ */
26
+ export declare class Parser {
27
+ private readonly tokens;
28
+ private readonly limits;
29
+ private readonly source;
30
+ private current;
31
+ constructor(tokens: Token[], source: string, limits?: ExpressionLimits);
32
+ /**
33
+ * Parses the token stream into an AST.
34
+ */
35
+ parse(): AstNode;
36
+ private isAtEnd;
37
+ private peek;
38
+ private previous;
39
+ private advance;
40
+ private check;
41
+ private match;
42
+ private consume;
43
+ /**
44
+ * Parses ternary expressions: condition ? consequent : alternate
45
+ */
46
+ private parseTernary;
47
+ /**
48
+ * Parses logical OR: ||
49
+ */
50
+ private parseOr;
51
+ /**
52
+ * Parses logical AND: &&
53
+ */
54
+ private parseAnd;
55
+ /**
56
+ * Parses equality: ==, !=
57
+ */
58
+ private parseEquality;
59
+ /**
60
+ * Parses membership: in, not in
61
+ */
62
+ private parseMembership;
63
+ /**
64
+ * Parses comparison: <, <=, >, >=
65
+ */
66
+ private parseComparison;
67
+ /**
68
+ * Parses additive: +, -
69
+ */
70
+ private parseAdditive;
71
+ /**
72
+ * Parses multiplicative: *, /, %
73
+ */
74
+ private parseMultiplicative;
75
+ /**
76
+ * Parses unary: !, -
77
+ */
78
+ private parseUnary;
79
+ /**
80
+ * Parses postfix: . [] ()
81
+ */
82
+ private parsePostfix;
83
+ /**
84
+ * Parses function argument list (already consumed opening paren).
85
+ */
86
+ private parseArgumentList;
87
+ /**
88
+ * Parses primary expressions: literals, identifiers, parentheses, arrays.
89
+ */
90
+ private parsePrimary;
91
+ }
92
+ /**
93
+ * Parses an expression string into an AST.
94
+ *
95
+ * @param source - The expression string to parse
96
+ * @param limits - Optional expression limits
97
+ * @returns The parsed AST
98
+ * @throws TokenizerError if tokenization fails
99
+ * @throws ParseError if parsing fails
100
+ */
101
+ export declare function parse(source: string, limits?: ExpressionLimits): AstNode;
102
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,OAAO,EAGR,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAY,KAAK,KAAK,EAAkB,MAAM,gBAAgB,CAAC;AAEtE;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,OAAO,CAAK;gBAGlB,MAAM,EAAE,KAAK,EAAE,EACf,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAA4C;IAOtD;;OAEG;IACI,KAAK,IAAI,OAAO;IA0BvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,OAAO;IAYf;;OAEG;IACH,OAAO,CAAC,YAAY;IAqBpB;;OAEG;IACH,OAAO,CAAC,OAAO;IAkBf;;OAEG;IACH,OAAO,CAAC,QAAQ;IAkBhB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmBrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAwCvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmBrB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAqC3B;;OAEG;IACH,OAAO,CAAC,UAAU;IAiBlB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoDpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,YAAY;CAyErB;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAA4C,GACnD,OAAO,CAIT"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Tokenizer (lexer) for the expression language.
3
+ *
4
+ * Converts expression strings into a stream of tokens for the parser.
5
+ */
6
+ import { type ExpressionLimits } from "./limits.js";
7
+ /**
8
+ * Token types produced by the tokenizer.
9
+ */
10
+ export type TokenType = "STRING" | "NUMBER" | "TRUE" | "FALSE" | "NULL" | "IDENTIFIER" | "PLUS" | "MINUS" | "STAR" | "SLASH" | "PERCENT" | "LT" | "LE" | "GT" | "GE" | "EQ" | "NE" | "AND" | "OR" | "NOT" | "IN" | "NOT_IN" | "QUESTION" | "COLON" | "LPAREN" | "RPAREN" | "LBRACKET" | "RBRACKET" | "DOT" | "COMMA" | "EOF";
11
+ /**
12
+ * A token produced by the tokenizer.
13
+ */
14
+ export interface Token {
15
+ readonly type: TokenType;
16
+ readonly value: string;
17
+ readonly position: number;
18
+ }
19
+ /**
20
+ * Tokenizer for expression strings.
21
+ */
22
+ export declare class Tokenizer {
23
+ private readonly source;
24
+ private readonly limits?;
25
+ private position;
26
+ private readonly tokens;
27
+ constructor(source: string, limits?: ExpressionLimits);
28
+ /**
29
+ * Tokenizes the source expression and returns all tokens.
30
+ */
31
+ tokenize(): Token[];
32
+ private isAtEnd;
33
+ private peek;
34
+ private peekNext;
35
+ private advance;
36
+ private addToken;
37
+ private scanToken;
38
+ private scanString;
39
+ private scanNumber;
40
+ private scanIdentifier;
41
+ }
42
+ /**
43
+ * Tokenizes an expression string into tokens.
44
+ *
45
+ * @param source - The expression string to tokenize
46
+ * @param limits - Optional expression limits
47
+ * @returns Array of tokens
48
+ * @throws TokenizerError if the expression contains invalid tokens
49
+ */
50
+ export declare function tokenize(source: string, limits?: ExpressionLimits): Token[];
51
+ //# sourceMappingURL=tokenizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../../../../src/naylence/fame/expr/tokenizer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,SAAS,GAEjB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,MAAM,GAEN,YAAY,GAEZ,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,QAAQ,GACR,UAAU,GACV,OAAO,GAEP,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,KAAK,GACL,OAAO,GAEP,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AA6CD;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAKrD;;OAEG;IACI,QAAQ,IAAI,KAAK,EAAE;IAgB1B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,SAAS;IAmJjB,OAAO,CAAC,UAAU;IAmElB,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,cAAc;CA6CvB;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,gBAAgB,GACxB,KAAK,EAAE,CAGT"}
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Provides the list of advanced security factory modules for registration.
6
6
  */
7
- export declare const MODULES: readonly ["./security/cert/default-ca-service-factory.js", "./security/cert/default-certificate-manager-factory.js", "./security/cert/trust-store/browser-trust-store-provider-factory.js", "./security/cert/trust-store/node-trust-store-provider-factory.js", "./security/encryption/channel/channel-encryption-manager-factory.js", "./security/encryption/composite-encryption-manager-factory.js", "./security/encryption/default-secure-channel-manager-factory.js", "./security/encryption/sealed/x25519-encryption-manager-factory.js", "./security/keys/x5c-key-manager-factory.js", "./security/signing/eddsa-envelope-signer-factory.js", "./security/signing/eddsa-envelope-verifier-factory.js", "./stickiness/aft-load-balancer-stickiness-manager-factory.js", "./stickiness/aft-replica-stickiness-manager-factory.js", "./welcome/advanced-welcome-service-factory.js"];
7
+ export declare const MODULES: readonly ["./security/auth/policy/advanced-authorization-policy-factory.js", "./security/cert/default-ca-service-factory.js", "./security/cert/default-certificate-manager-factory.js", "./security/cert/trust-store/browser-trust-store-provider-factory.js", "./security/cert/trust-store/node-trust-store-provider-factory.js", "./security/encryption/channel/channel-encryption-manager-factory.js", "./security/encryption/composite-encryption-manager-factory.js", "./security/encryption/default-secure-channel-manager-factory.js", "./security/encryption/sealed/x25519-encryption-manager-factory.js", "./security/keys/x5c-key-manager-factory.js", "./security/signing/eddsa-envelope-signer-factory.js", "./security/signing/eddsa-envelope-verifier-factory.js", "./stickiness/aft-load-balancer-stickiness-manager-factory.js", "./stickiness/aft-replica-stickiness-manager-factory.js", "./welcome/advanced-welcome-service-factory.js"];
8
8
  export type FactoryModuleSpec = (typeof MODULES)[number];
9
9
  export type FactoryModuleLoader = () => Promise<Record<string, unknown>>;
10
10
  export declare const MODULE_LOADERS: Record<FactoryModuleSpec, FactoryModuleLoader>;
@@ -1 +1 @@
1
- {"version":3,"file":"factory-manifest.d.ts","sourceRoot":"","sources":["../../../../src/naylence/fame/factory-manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,01BAeV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEzE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAezE,CAAC"}
1
+ {"version":3,"file":"factory-manifest.d.ts","sourceRoot":"","sources":["../../../../src/naylence/fame/factory-manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,65BAgBV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEzE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAgBzE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Advanced security authentication/authorization module exports.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export * from "./policy/index.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/naylence/fame/security/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAC"}