@highflame/policy 2.0.1 → 2.0.3

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 (47) hide show
  1. package/dist/annotations.d.ts +127 -0
  2. package/dist/annotations.d.ts.map +1 -0
  3. package/dist/annotations.js +175 -0
  4. package/dist/annotations.js.map +1 -0
  5. package/dist/builder.d.ts +114 -25
  6. package/dist/builder.d.ts.map +1 -1
  7. package/dist/builder.js +295 -113
  8. package/dist/builder.js.map +1 -1
  9. package/dist/entity-metadata-types.gen.d.ts +17 -0
  10. package/dist/entity-metadata-types.gen.d.ts.map +1 -0
  11. package/dist/entity-metadata-types.gen.js +3 -0
  12. package/dist/entity-metadata-types.gen.js.map +1 -0
  13. package/dist/index.d.ts +5 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +5 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/overwatch-entities.gen.d.ts +12 -0
  18. package/dist/overwatch-entities.gen.d.ts.map +1 -0
  19. package/dist/overwatch-entities.gen.js +38 -0
  20. package/dist/overwatch-entities.gen.js.map +1 -0
  21. package/dist/palisade-entities.gen.d.ts +12 -0
  22. package/dist/palisade-entities.gen.d.ts.map +1 -0
  23. package/dist/palisade-entities.gen.js +46 -0
  24. package/dist/palisade-entities.gen.js.map +1 -0
  25. package/dist/parser.d.ts +1 -1
  26. package/dist/parser.d.ts.map +1 -1
  27. package/dist/parser.js +18 -11
  28. package/dist/parser.js.map +1 -1
  29. package/dist/parser.test.js +2 -2
  30. package/dist/parser.test.js.map +1 -1
  31. package/dist/studio-ui.test.js +526 -1
  32. package/dist/studio-ui.test.js.map +1 -1
  33. package/dist/types.d.ts +5 -1
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/types.js +6 -1
  36. package/dist/types.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/annotations.ts +243 -0
  39. package/src/builder.ts +386 -127
  40. package/src/entity-metadata-types.gen.ts +19 -0
  41. package/src/index.ts +13 -1
  42. package/src/overwatch-entities.gen.ts +41 -0
  43. package/src/palisade-entities.gen.ts +49 -0
  44. package/src/parser.test.ts +2 -2
  45. package/src/parser.ts +20 -12
  46. package/src/studio-ui.test.ts +606 -0
  47. package/src/types.ts +15 -1
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Cedar Policy Annotations
3
+ *
4
+ * Provides types and utilities for working with Cedar policy annotations.
5
+ * Annotations are key-value pairs attached to Cedar policies that provide
6
+ * metadata without affecting policy evaluation.
7
+ *
8
+ * Cedar annotation syntax:
9
+ * @id("rule-001")
10
+ * @name("Block critical threats")
11
+ * @severity("high")
12
+ * permit(...) when {...};
13
+ *
14
+ * @see https://docs.cedarpolicy.com/policies/syntax-policy.html
15
+ */
16
+ /**
17
+ * Rule severity levels for UI display and prioritization.
18
+ * Used to indicate the importance/criticality of a rule.
19
+ */
20
+ export type PolicySeverity = 'critical' | 'high' | 'medium' | 'low';
21
+ /**
22
+ * Predefined annotation keys with known semantics.
23
+ * These annotations are extracted/embedded with special handling in the parser/builder.
24
+ */
25
+ export declare const PREDEFINED_ANNOTATION_KEYS: readonly ["id", "name", "description", "severity", "tags"];
26
+ export type PredefinedAnnotationKey = (typeof PREDEFINED_ANNOTATION_KEYS)[number];
27
+ /**
28
+ * Predefined Cedar annotations with known semantics.
29
+ * These are embedded in Cedar policy text using @annotation("value") syntax.
30
+ *
31
+ * id and name are required for all rules created via the UI.
32
+ */
33
+ export interface PolicyAnnotations {
34
+ /** Unique identifier for this rule (auto-generated UUID if not provided) */
35
+ id: string;
36
+ /** Human-readable rule name (required) */
37
+ name: string;
38
+ /** Longer explanation of what this rule does */
39
+ description?: string;
40
+ /** Severity/priority level for display and filtering */
41
+ severity?: PolicySeverity;
42
+ /** Categorization tags for grouping and filtering */
43
+ tags?: string[];
44
+ }
45
+ /**
46
+ * Custom user-defined annotations.
47
+ * Keys must be valid Cedar identifiers (alphanumeric + underscore, starting with letter/underscore).
48
+ * Values are always strings (Cedar annotation constraint).
49
+ *
50
+ * Common use cases:
51
+ * - @compliance("SOC2"), @compliance("HIPAA")
52
+ * - @ticket("SEC-1234"), @jira("PROJ-123")
53
+ * - @owner("security-team"), @team("platform")
54
+ * - @review_date("2024-06-01")
55
+ */
56
+ export type CustomAnnotations = Record<string, string>;
57
+ /**
58
+ * Check if a key is a predefined annotation key.
59
+ *
60
+ * @param key - The annotation key to check
61
+ * @returns true if the key is a predefined annotation key
62
+ */
63
+ export declare function isPredefinedAnnotationKey(key: string): boolean;
64
+ /**
65
+ * Validate a custom annotation key.
66
+ * Cedar annotation keys must be valid identifiers: start with letter or underscore,
67
+ * followed by letters, numbers, or underscores.
68
+ *
69
+ * @param key - The annotation key to validate
70
+ * @returns true if the key is valid for Cedar annotations
71
+ */
72
+ export declare function isValidAnnotationKey(key: string): boolean;
73
+ /**
74
+ * Escape a string value for use in Cedar annotation.
75
+ * Escapes backslashes and double quotes.
76
+ *
77
+ * @param value - The value to escape
78
+ * @returns Escaped string safe for Cedar annotation value
79
+ */
80
+ export declare function escapeAnnotationValue(value: string): string;
81
+ /**
82
+ * Unescape a Cedar annotation value.
83
+ * Reverses the escaping done by escapeAnnotationValue.
84
+ *
85
+ * @param value - The escaped value
86
+ * @returns Unescaped string
87
+ */
88
+ export declare function unescapeAnnotationValue(value: string): string;
89
+ /**
90
+ * Generate Cedar annotation syntax for a single annotation.
91
+ *
92
+ * @param key - The annotation key
93
+ * @param value - The annotation value (will be escaped)
94
+ * @returns Cedar annotation string, e.g., '@severity("high")'
95
+ */
96
+ export declare function formatAnnotation(key: string, value: string): string;
97
+ /**
98
+ * Generate all Cedar annotations from PolicyAnnotations and optional custom annotations.
99
+ * Returns array of annotation lines to prepend to policy.
100
+ *
101
+ * @param annotations - Predefined annotations
102
+ * @param customAnnotations - Optional custom annotations
103
+ * @returns Array of Cedar annotation strings
104
+ */
105
+ export declare function generateAnnotationLines(annotations: PolicyAnnotations, customAnnotations?: CustomAnnotations): string[];
106
+ /**
107
+ * Result of parsing Cedar annotations.
108
+ * Separates predefined annotations from custom annotations.
109
+ */
110
+ export interface ParseAnnotationsResult {
111
+ annotations: PolicyAnnotations;
112
+ customAnnotations?: CustomAnnotations;
113
+ }
114
+ /**
115
+ * Parse Cedar annotations from a Record<string, string> (as returned by cedar-wasm).
116
+ * Separates predefined annotations from custom annotations.
117
+ *
118
+ * @param rawAnnotations - Raw annotation map from Cedar JSON
119
+ * @returns Parsed annotations object
120
+ */
121
+ export declare function parseAnnotations(rawAnnotations: Record<string, string> | undefined): ParseAnnotationsResult;
122
+ /**
123
+ * Generate a UUID v4 for rule IDs.
124
+ * Uses crypto.randomUUID if available, falls back to manual generation.
125
+ */
126
+ export declare function generateRuleId(): string;
127
+ //# sourceMappingURL=annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,4DAA6D,CAAC;AACrG,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,iBAAiB,EAC9B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,MAAM,EAAE,CA6BV;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,sBAAsB,CA+C3G;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAUvC"}
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Cedar Policy Annotations
3
+ *
4
+ * Provides types and utilities for working with Cedar policy annotations.
5
+ * Annotations are key-value pairs attached to Cedar policies that provide
6
+ * metadata without affecting policy evaluation.
7
+ *
8
+ * Cedar annotation syntax:
9
+ * @id("rule-001")
10
+ * @name("Block critical threats")
11
+ * @severity("high")
12
+ * permit(...) when {...};
13
+ *
14
+ * @see https://docs.cedarpolicy.com/policies/syntax-policy.html
15
+ */
16
+ /**
17
+ * Predefined annotation keys with known semantics.
18
+ * These annotations are extracted/embedded with special handling in the parser/builder.
19
+ */
20
+ export const PREDEFINED_ANNOTATION_KEYS = ['id', 'name', 'description', 'severity', 'tags'];
21
+ /**
22
+ * Check if a key is a predefined annotation key.
23
+ *
24
+ * @param key - The annotation key to check
25
+ * @returns true if the key is a predefined annotation key
26
+ */
27
+ export function isPredefinedAnnotationKey(key) {
28
+ return PREDEFINED_ANNOTATION_KEYS.includes(key);
29
+ }
30
+ /**
31
+ * Validate a custom annotation key.
32
+ * Cedar annotation keys must be valid identifiers: start with letter or underscore,
33
+ * followed by letters, numbers, or underscores.
34
+ *
35
+ * @param key - The annotation key to validate
36
+ * @returns true if the key is valid for Cedar annotations
37
+ */
38
+ export function isValidAnnotationKey(key) {
39
+ // Must not be a predefined key (those are handled separately)
40
+ if (isPredefinedAnnotationKey(key)) {
41
+ return false;
42
+ }
43
+ // Must be a valid Cedar identifier
44
+ return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key);
45
+ }
46
+ /**
47
+ * Escape a string value for use in Cedar annotation.
48
+ * Escapes backslashes and double quotes.
49
+ *
50
+ * @param value - The value to escape
51
+ * @returns Escaped string safe for Cedar annotation value
52
+ */
53
+ export function escapeAnnotationValue(value) {
54
+ return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
55
+ }
56
+ /**
57
+ * Unescape a Cedar annotation value.
58
+ * Reverses the escaping done by escapeAnnotationValue.
59
+ *
60
+ * @param value - The escaped value
61
+ * @returns Unescaped string
62
+ */
63
+ export function unescapeAnnotationValue(value) {
64
+ return value.replace(/\\"/g, '"').replace(/\\\\/g, '\\');
65
+ }
66
+ /**
67
+ * Generate Cedar annotation syntax for a single annotation.
68
+ *
69
+ * @param key - The annotation key
70
+ * @param value - The annotation value (will be escaped)
71
+ * @returns Cedar annotation string, e.g., '@severity("high")'
72
+ */
73
+ export function formatAnnotation(key, value) {
74
+ return `@${key}("${escapeAnnotationValue(value)}")`;
75
+ }
76
+ /**
77
+ * Generate all Cedar annotations from PolicyAnnotations and optional custom annotations.
78
+ * Returns array of annotation lines to prepend to policy.
79
+ *
80
+ * @param annotations - Predefined annotations
81
+ * @param customAnnotations - Optional custom annotations
82
+ * @returns Array of Cedar annotation strings
83
+ */
84
+ export function generateAnnotationLines(annotations, customAnnotations) {
85
+ const lines = [];
86
+ // Predefined annotations in consistent order
87
+ lines.push(formatAnnotation('id', annotations.id));
88
+ lines.push(formatAnnotation('name', annotations.name));
89
+ if (annotations.description) {
90
+ lines.push(formatAnnotation('description', annotations.description));
91
+ }
92
+ if (annotations.severity) {
93
+ lines.push(formatAnnotation('severity', annotations.severity));
94
+ }
95
+ if (annotations.tags && annotations.tags.length > 0) {
96
+ // Cedar annotations are single string values, so join tags with comma
97
+ lines.push(formatAnnotation('tags', annotations.tags.join(',')));
98
+ }
99
+ // Custom annotations (alphabetical order for consistency)
100
+ if (customAnnotations) {
101
+ const sortedKeys = Object.keys(customAnnotations).sort();
102
+ for (const key of sortedKeys) {
103
+ if (isValidAnnotationKey(key)) {
104
+ lines.push(formatAnnotation(key, customAnnotations[key]));
105
+ }
106
+ }
107
+ }
108
+ return lines;
109
+ }
110
+ /**
111
+ * Parse Cedar annotations from a Record<string, string> (as returned by cedar-wasm).
112
+ * Separates predefined annotations from custom annotations.
113
+ *
114
+ * @param rawAnnotations - Raw annotation map from Cedar JSON
115
+ * @returns Parsed annotations object
116
+ */
117
+ export function parseAnnotations(rawAnnotations) {
118
+ const annotations = {
119
+ id: '',
120
+ name: '',
121
+ };
122
+ const customAnnotations = {};
123
+ if (!rawAnnotations) {
124
+ return { annotations };
125
+ }
126
+ for (const [key, value] of Object.entries(rawAnnotations)) {
127
+ const unescapedValue = unescapeAnnotationValue(value);
128
+ switch (key) {
129
+ case 'id':
130
+ annotations.id = unescapedValue;
131
+ break;
132
+ case 'name':
133
+ annotations.name = unescapedValue;
134
+ break;
135
+ case 'description':
136
+ annotations.description = unescapedValue;
137
+ break;
138
+ case 'severity':
139
+ if (['critical', 'high', 'medium', 'low'].includes(unescapedValue)) {
140
+ annotations.severity = unescapedValue;
141
+ }
142
+ break;
143
+ case 'tags':
144
+ annotations.tags = unescapedValue.split(',').map((t) => t.trim()).filter(Boolean);
145
+ break;
146
+ default:
147
+ // Custom annotation
148
+ customAnnotations[key] = unescapedValue;
149
+ }
150
+ }
151
+ // Use id as name if name not provided
152
+ if (!annotations.name && annotations.id) {
153
+ annotations.name = annotations.id;
154
+ }
155
+ return {
156
+ annotations,
157
+ customAnnotations: Object.keys(customAnnotations).length > 0 ? customAnnotations : undefined,
158
+ };
159
+ }
160
+ /**
161
+ * Generate a UUID v4 for rule IDs.
162
+ * Uses crypto.randomUUID if available, falls back to manual generation.
163
+ */
164
+ export function generateRuleId() {
165
+ if (typeof crypto !== 'undefined' && crypto.randomUUID) {
166
+ return crypto.randomUUID();
167
+ }
168
+ // Fallback for older environments
169
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
170
+ const r = (Math.random() * 16) | 0;
171
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
172
+ return v.toString(16);
173
+ });
174
+ }
175
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAmCrG;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,OAAQ,0BAAgD,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,8DAA8D;IAC9D,IAAI,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,mCAAmC;IACnC,OAAO,0BAA0B,CAAC,I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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/builder.d.ts CHANGED
@@ -14,15 +14,25 @@
14
14
  * .when("context.environment == \"production\"")
15
15
  * .build();
16
16
  *
17
- * // Get Cedar policy text
17
+ * // Get Cedar policy text (with proper @annotations)
18
18
  * const cedarText = policy.toCedar();
19
19
  *
20
20
  * // Get JSON representation (for storage/editing)
21
21
  * const policyJson = policy.toJSON();
22
22
  * ```
23
+ *
24
+ * Cedar Annotations:
25
+ * Policies include proper Cedar annotations that are embedded in the policy text:
26
+ * ```cedar
27
+ * @id("rule-001")
28
+ * @name("Block critical threats")
29
+ * @severity("high")
30
+ * permit(...) when {...};
31
+ * ```
23
32
  */
24
33
  import { EntityType, EntityUID } from './entities.gen.js';
25
34
  import { ActionType } from './actions.gen.js';
35
+ import { type PolicyAnnotations, type CustomAnnotations, type PolicySeverity } from './annotations.js';
26
36
  /**
27
37
  * Policy effect - permit or forbid
28
38
  */
@@ -57,13 +67,12 @@ export interface PolicyEntity {
57
67
  export type PolicyPrincipal = PolicyEntity;
58
68
  /** Alias for PolicyEntity when used as resource constraint */
59
69
  export type PolicyResource = PolicyEntity;
60
- /**
61
- * Rule severity levels for UI display and prioritization
62
- */
63
- export type PolicySeverity = 'critical' | 'high' | 'medium' | 'low';
70
+ export type { PolicySeverity } from './annotations.js';
64
71
  /**
65
72
  * JSON representation of a policy for storage and editing.
66
- * This is the base interface used by PolicyBuilder.
73
+ * This is the base interface used by PolicyBuilder (legacy format).
74
+ *
75
+ * @deprecated Use PolicyRule with annotations for new code.
67
76
  */
68
77
  export interface PolicyJSON {
69
78
  /** Unique identifier for this policy */
@@ -84,46 +93,78 @@ export interface PolicyJSON {
84
93
  rawCondition?: string;
85
94
  }
86
95
  /**
87
- * A policy rule with UI/storage metadata.
88
- * Extends PolicyJSON with fields needed for UI editing and database storage.
96
+ * A policy rule with full Cedar annotation support.
89
97
  *
90
98
  * This is the canonical type used across all Highflame services:
91
99
  * - highflame-studio (UI)
92
100
  * - highflame-authz (Go backend)
93
101
  * - Any Python services
94
102
  *
95
- * Each PolicyRule maps 1:1 to a Cedar policy statement.
103
+ * Each PolicyRule maps 1:1 to a Cedar policy statement with proper annotations.
104
+ *
105
+ * Annotations are embedded in Cedar text:
106
+ * ```cedar
107
+ * @id("rule-001")
108
+ * @name("Block critical threats")
109
+ * @severity("high")
110
+ * @tags("security,baseline")
111
+ * @compliance("SOC2")
112
+ * forbid(...) when {...};
113
+ * ```
114
+ */
115
+ export interface PolicyRule {
116
+ /** Predefined annotations (embedded in Cedar text) */
117
+ annotations: PolicyAnnotations;
118
+ /** Custom user-defined annotations (embedded in Cedar text) */
119
+ customAnnotations?: CustomAnnotations;
120
+ /** Policy effect - permit or forbid */
121
+ effect: PolicyEffect;
122
+ /** Principal constraint */
123
+ principal: PolicyEntity | null;
124
+ /** Action constraint - single action or array of actions */
125
+ action: string | string[];
126
+ /** Resource constraint */
127
+ resource: PolicyEntity | null;
128
+ /** Structured conditions (when clause) */
129
+ conditions: PolicyCondition[];
130
+ /** Raw condition string (for advanced/complex conditions) */
131
+ rawCondition?: string;
132
+ /** Whether this rule is active - NOT embedded in Cedar (runtime state) */
133
+ enabled: boolean;
134
+ /** Display/evaluation order - NOT embedded in Cedar (runtime state) */
135
+ order: number;
136
+ }
137
+ /**
138
+ * Legacy PolicyRule format for backwards compatibility.
139
+ * Used when parsing policies that don't have the new annotations structure.
140
+ *
141
+ * @deprecated Use PolicyRule with annotations for new code.
96
142
  */
97
- export interface PolicyRule extends PolicyJSON {
98
- /** Whether this rule is active (used for toggling rules on/off in UI) */
143
+ export interface LegacyPolicyRule extends PolicyJSON {
99
144
  enabled: boolean;
100
- /** Display/evaluation order (0-indexed) */
101
145
  order: number;
102
- /** Optional description (separate from name for longer explanations) */
103
146
  description?: string;
104
- /** Rule severity for display and prioritization */
105
147
  severity?: PolicySeverity;
106
- /** Optional tags for categorization and filtering */
107
148
  tags?: string[];
108
149
  }
109
150
  /**
110
- * A built policy that can be converted to Cedar text or JSON
151
+ * Convert a legacy PolicyRule to the new annotations-based format.
152
+ */
153
+ export declare function convertLegacyRule(legacy: LegacyPolicyRule, index?: number): PolicyRule;
154
+ /**
155
+ * A built policy that can be converted to Cedar text or JSON.
156
+ * This class is used by PolicyBuilder for the legacy API.
157
+ *
158
+ * For new code, use ruleToCedar() and rulesToCedar() functions with PolicyRule.
111
159
  */
112
160
  export declare class Policy {
113
161
  private readonly data;
114
162
  constructor(data: PolicyJSON);
115
163
  /**
116
- * Convert to Cedar policy text
164
+ * Convert to Cedar policy text.
165
+ * Uses proper Cedar @annotation syntax.
117
166
  */
118
167
  toCedar(): string;
119
- /**
120
- * Convert a condition to Cedar syntax
121
- */
122
- private conditionToCedar;
123
- /**
124
- * Convert a value to Cedar string representation
125
- */
126
- private valueToString;
127
168
  /**
128
169
  * Get JSON representation for storage
129
170
  */
@@ -137,6 +178,54 @@ export declare class Policy {
137
178
  */
138
179
  getName(): string | undefined;
139
180
  }
181
+ /**
182
+ * Convert a PolicyRule to Cedar policy text with proper annotations.
183
+ *
184
+ * @param rule - The PolicyRule to convert
185
+ * @returns Cedar policy text string
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const rule: PolicyRule = {
190
+ * annotations: { id: 'rule-001', name: 'Block threats', severity: 'high' },
191
+ * effect: 'forbid',
192
+ * principal: null,
193
+ * action: 'call_tool',
194
+ * resource: null,
195
+ * conditions: [{ field: 'threat_count', operator: 'gt', value: 0 }],
196
+ * enabled: true,
197
+ * order: 0,
198
+ * };
199
+ *
200
+ * const cedar = ruleToCedar(rule);
201
+ * // Output:
202
+ * // @id("rule-001")
203
+ * // @name("Block threats")
204
+ * // @severity("high")
205
+ * // forbid (
206
+ * // principal,
207
+ * // action == Action::"call_tool",
208
+ * // resource
209
+ * // )
210
+ * // when { context.threat_count > 0 };
211
+ * ```
212
+ */
213
+ export declare function ruleToCedar(rule: PolicyRule): string;
214
+ /**
215
+ * Convert multiple PolicyRules to Cedar policy text.
216
+ * Only enabled rules are included, sorted by order.
217
+ *
218
+ * @param rules - Array of PolicyRules to convert
219
+ * @param includeDisabled - If true, include disabled rules as comments (default: false)
220
+ * @returns Cedar policy text with all rules separated by blank lines
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * const rules: PolicyRule[] = [...];
225
+ * const cedarText = rulesToCedar(rules);
226
+ * ```
227
+ */
228
+ export declare function rulesToCedar(rules: PolicyRule[], includeDisabled?: boolean): string;
140
229
  /**
141
230
  * Builder for constructing Cedar policies with type safety.
142
231
  */
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgB9C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACvB,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,IAAI,GACJ,MAAM,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,mCAAmC;IACnC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF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