@sequenceholdings/orm 0.1.3 → 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.
@@ -19,6 +19,9 @@ type PolicyOperand =
19
19
  value: string | number | boolean | null;
20
20
  };
21
21
  type PolicyNode = {
22
+ kind: 'literal';
23
+ value: boolean;
24
+ } | {
22
25
  kind: 'and';
23
26
  operands: readonly PolicyNode[];
24
27
  } | {
@@ -19,6 +19,9 @@ type PolicyOperand =
19
19
  value: string | number | boolean | null;
20
20
  };
21
21
  type PolicyNode = {
22
+ kind: 'literal';
23
+ value: boolean;
24
+ } | {
22
25
  kind: 'and';
23
26
  operands: readonly PolicyNode[];
24
27
  } | {
@@ -748,6 +748,10 @@ var Parser = class {
748
748
  this.expect("rparen", "')'");
749
749
  return inner;
750
750
  }
751
+ if (this.peekKeyword("true") || this.peekKeyword("false")) {
752
+ const token = this.advance();
753
+ return { kind: "literal", value: token.value === "true" };
754
+ }
751
755
  if (this.peekKeyword("capability") || this.peekKeyword("role")) {
752
756
  const fn = this.peek().value;
753
757
  const node = this.parseBooleanCall(fn);
@@ -931,6 +935,8 @@ var PolicyCompiler = class {
931
935
  }
932
936
  compile(node, table, depth) {
933
937
  switch (node.kind) {
938
+ case "literal":
939
+ return { kind: "const", value: node.value };
934
940
  case "and":
935
941
  case "or":
936
942
  return { kind: node.kind, operands: node.operands.map((operand) => this.compile(operand, table, depth)) };