@axonflow/sdk 1.4.2 → 1.6.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.
@@ -0,0 +1,362 @@
1
+ /**
2
+ * Policy CRUD types for AxonFlow SDK
3
+ * Part of Unified Policy Architecture v2.0.0
4
+ */
5
+ /**
6
+ * Policy categories for organization and filtering
7
+ */
8
+ export type PolicyCategory = 'security-sqli' | 'security-admin' | 'pii-global' | 'pii-us' | 'pii-eu' | 'pii-india' | 'dynamic-risk' | 'dynamic-compliance' | 'dynamic-security' | 'dynamic-cost' | 'dynamic-access' | 'custom';
9
+ /**
10
+ * Policy tiers determine where policies apply
11
+ * - system: Platform-wide policies (read-only, managed by AxonFlow)
12
+ * - organization: Organization-specific policies (Enterprise)
13
+ * - tenant: Tenant-specific policies
14
+ */
15
+ export type PolicyTier = 'system' | 'organization' | 'tenant';
16
+ /**
17
+ * Override action for policy overrides
18
+ * - block: Immediately block the request
19
+ * - require_approval: Pause for human approval (HITL)
20
+ * - redact: Mask sensitive content
21
+ * - warn: Log warning, allow request
22
+ * - log: Audit only
23
+ */
24
+ export type OverrideAction = 'block' | 'require_approval' | 'redact' | 'warn' | 'log';
25
+ /**
26
+ * Action to take when policy matches
27
+ * - block: Immediately block the request
28
+ * - require_approval: Pause for human approval (HITL)
29
+ * - redact: Mask sensitive content
30
+ * - warn: Log warning, allow request
31
+ * - log: Audit only
32
+ * - allow: Explicitly allow (for overrides)
33
+ */
34
+ export type PolicyAction = 'block' | 'require_approval' | 'redact' | 'warn' | 'log' | 'allow';
35
+ /**
36
+ * Policy severity levels
37
+ */
38
+ export type PolicySeverity = 'critical' | 'high' | 'medium' | 'low';
39
+ /**
40
+ * Static policy definition
41
+ */
42
+ export interface StaticPolicy {
43
+ /** Unique policy identifier */
44
+ id: string;
45
+ /** Human-readable policy name */
46
+ name: string;
47
+ /** Policy description */
48
+ description?: string;
49
+ /** Policy category for grouping and filtering */
50
+ category: PolicyCategory;
51
+ /** Policy tier (system, organization, tenant) */
52
+ tier: PolicyTier;
53
+ /** Regex pattern to match against input */
54
+ pattern: string;
55
+ /** Severity level (critical, high, medium, low) */
56
+ severity: PolicySeverity;
57
+ /** Whether the policy is enabled */
58
+ enabled: boolean;
59
+ /** Action to take when pattern matches */
60
+ action: PolicyAction;
61
+ /** Organization ID (for organization-tier policies) */
62
+ organizationId?: string;
63
+ /** Tenant ID (for tenant-tier policies) */
64
+ tenantId?: string;
65
+ /** Creation timestamp */
66
+ createdAt: string;
67
+ /** Last update timestamp */
68
+ updatedAt: string;
69
+ /** Version number for tracking changes */
70
+ version?: number;
71
+ /** Whether this policy has an active override */
72
+ hasOverride?: boolean;
73
+ /** Active override details */
74
+ override?: PolicyOverride;
75
+ }
76
+ /**
77
+ * Options for listing static policies
78
+ */
79
+ export interface ListStaticPoliciesOptions {
80
+ /** Filter by category */
81
+ category?: PolicyCategory;
82
+ /** Filter by tier */
83
+ tier?: PolicyTier;
84
+ /** Filter by enabled status */
85
+ enabled?: boolean;
86
+ /** Maximum number of results to return */
87
+ limit?: number;
88
+ /** Offset for pagination */
89
+ offset?: number;
90
+ /** Sort field */
91
+ sortBy?: 'name' | 'severity' | 'category' | 'createdAt' | 'updatedAt';
92
+ /** Sort order */
93
+ sortOrder?: 'asc' | 'desc';
94
+ /** Search query for name/description */
95
+ search?: string;
96
+ }
97
+ /**
98
+ * Request to create a new static policy
99
+ */
100
+ export interface CreateStaticPolicyRequest {
101
+ /** Human-readable policy name */
102
+ name: string;
103
+ /** Policy description */
104
+ description?: string;
105
+ /** Policy category */
106
+ category: PolicyCategory;
107
+ /** Policy tier (defaults to 'tenant' for custom policies) */
108
+ tier?: PolicyTier;
109
+ /** Regex pattern to match */
110
+ pattern: string;
111
+ /** Severity level (critical, high, medium, low) */
112
+ severity?: PolicySeverity;
113
+ /** Whether the policy is enabled */
114
+ enabled?: boolean;
115
+ /** Action to take when pattern matches */
116
+ action?: PolicyAction;
117
+ }
118
+ /**
119
+ * Request to update an existing static policy
120
+ */
121
+ export interface UpdateStaticPolicyRequest {
122
+ /** Updated policy name */
123
+ name?: string;
124
+ /** Updated description */
125
+ description?: string;
126
+ /** Updated category */
127
+ category?: PolicyCategory;
128
+ /** Updated pattern */
129
+ pattern?: string;
130
+ /** Updated severity */
131
+ severity?: PolicySeverity;
132
+ /** Updated enabled status */
133
+ enabled?: boolean;
134
+ /** Updated action */
135
+ action?: PolicyAction;
136
+ }
137
+ /**
138
+ * Policy override configuration
139
+ */
140
+ export interface PolicyOverride {
141
+ /** Policy ID this override applies to */
142
+ policyId: string;
143
+ /** Override action */
144
+ action: OverrideAction;
145
+ /** Reason for the override */
146
+ reason: string;
147
+ /** Who created the override */
148
+ createdBy?: string;
149
+ /** When the override was created */
150
+ createdAt: string;
151
+ /** When the override expires (optional) */
152
+ expiresAt?: string;
153
+ /** Whether the override is currently active */
154
+ active: boolean;
155
+ }
156
+ /**
157
+ * Request to create a policy override
158
+ */
159
+ export interface CreatePolicyOverrideRequest {
160
+ /** Override action */
161
+ action: OverrideAction;
162
+ /** Reason for the override */
163
+ reason: string;
164
+ /** Optional expiration date (ISO 8601 format) */
165
+ expiresAt?: string;
166
+ }
167
+ /**
168
+ * Dynamic policy definition
169
+ */
170
+ export interface DynamicPolicy {
171
+ /** Unique policy identifier */
172
+ id: string;
173
+ /** Human-readable policy name */
174
+ name: string;
175
+ /** Policy description */
176
+ description?: string;
177
+ /** Policy category */
178
+ category: PolicyCategory;
179
+ /** Policy tier */
180
+ tier: PolicyTier;
181
+ /** Whether the policy is enabled */
182
+ enabled: boolean;
183
+ /** Organization ID (for organization-tier policies) */
184
+ organizationId?: string;
185
+ /** Tenant ID (for tenant-tier policies) */
186
+ tenantId?: string;
187
+ /** Policy configuration/rules */
188
+ config: DynamicPolicyConfig;
189
+ /** Creation timestamp */
190
+ createdAt: string;
191
+ /** Last update timestamp */
192
+ updatedAt: string;
193
+ /** Version number */
194
+ version?: number;
195
+ }
196
+ /**
197
+ * Configuration for a dynamic policy
198
+ */
199
+ export interface DynamicPolicyConfig {
200
+ /** Policy type (e.g., 'rate-limit', 'cost-control', 'access-control') */
201
+ type: string;
202
+ /** Type-specific rules */
203
+ rules: Record<string, unknown>;
204
+ /** Conditions for when the policy applies */
205
+ conditions?: DynamicPolicyCondition[];
206
+ /** Action to take when policy triggers */
207
+ action: PolicyAction;
208
+ /** Additional parameters */
209
+ parameters?: Record<string, unknown>;
210
+ }
211
+ /**
212
+ * Condition for dynamic policy evaluation
213
+ */
214
+ export interface DynamicPolicyCondition {
215
+ /** Field to evaluate */
216
+ field: string;
217
+ /** Comparison operator */
218
+ operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'in' | 'not_in' | 'regex';
219
+ /** Value to compare against */
220
+ value: unknown;
221
+ }
222
+ /**
223
+ * Options for listing dynamic policies
224
+ */
225
+ export interface ListDynamicPoliciesOptions {
226
+ /** Filter by category */
227
+ category?: PolicyCategory;
228
+ /** Filter by tier */
229
+ tier?: PolicyTier;
230
+ /** Filter by enabled status */
231
+ enabled?: boolean;
232
+ /** Maximum number of results */
233
+ limit?: number;
234
+ /** Offset for pagination */
235
+ offset?: number;
236
+ /** Sort field */
237
+ sortBy?: 'name' | 'category' | 'createdAt' | 'updatedAt';
238
+ /** Sort order */
239
+ sortOrder?: 'asc' | 'desc';
240
+ /** Search query */
241
+ search?: string;
242
+ }
243
+ /**
244
+ * Request to create a dynamic policy
245
+ */
246
+ export interface CreateDynamicPolicyRequest {
247
+ /** Policy name */
248
+ name: string;
249
+ /** Policy description */
250
+ description?: string;
251
+ /** Policy category */
252
+ category: PolicyCategory;
253
+ /** Policy configuration */
254
+ config: DynamicPolicyConfig;
255
+ /** Whether the policy is enabled */
256
+ enabled?: boolean;
257
+ }
258
+ /**
259
+ * Request to update a dynamic policy
260
+ */
261
+ export interface UpdateDynamicPolicyRequest {
262
+ /** Updated name */
263
+ name?: string;
264
+ /** Updated description */
265
+ description?: string;
266
+ /** Updated category */
267
+ category?: PolicyCategory;
268
+ /** Updated configuration */
269
+ config?: DynamicPolicyConfig;
270
+ /** Updated enabled status */
271
+ enabled?: boolean;
272
+ }
273
+ /**
274
+ * Result of testing a regex pattern
275
+ */
276
+ export interface TestPatternResult {
277
+ /** Whether the pattern is valid */
278
+ valid: boolean;
279
+ /** Error message if pattern is invalid */
280
+ error?: string;
281
+ /** The pattern that was tested */
282
+ pattern: string;
283
+ /** The inputs that were tested */
284
+ inputs: string[];
285
+ /** Match results for each input */
286
+ matches: TestPatternMatch[];
287
+ }
288
+ /**
289
+ * Individual pattern match result
290
+ */
291
+ export interface TestPatternMatch {
292
+ /** The input that was tested */
293
+ input: string;
294
+ /** Whether the pattern matched */
295
+ matched: boolean;
296
+ /** Captured groups if any */
297
+ groups?: string[];
298
+ }
299
+ /**
300
+ * Policy version history entry
301
+ */
302
+ export interface PolicyVersion {
303
+ /** Version number */
304
+ version: number;
305
+ /** Who made the change */
306
+ changedBy?: string;
307
+ /** When the change was made */
308
+ changedAt: string;
309
+ /** Type of change */
310
+ changeType: 'created' | 'updated' | 'enabled' | 'disabled' | 'deleted';
311
+ /** Description of changes */
312
+ changeDescription?: string;
313
+ /** Previous values (for updates) */
314
+ previousValues?: Record<string, unknown>;
315
+ /** New values */
316
+ newValues?: Record<string, unknown>;
317
+ }
318
+ /**
319
+ * Options for getting effective policies
320
+ */
321
+ export interface EffectivePoliciesOptions {
322
+ /** Filter by category */
323
+ category?: PolicyCategory;
324
+ /** Include disabled policies */
325
+ includeDisabled?: boolean;
326
+ /** Include overridden policies */
327
+ includeOverridden?: boolean;
328
+ }
329
+ /**
330
+ * Response containing effective policies with tier inheritance applied
331
+ */
332
+ export interface EffectivePoliciesResponse {
333
+ /** Effective policies after tier inheritance */
334
+ policies: StaticPolicy[] | DynamicPolicy[];
335
+ /** Inheritance chain information */
336
+ inheritance: {
337
+ /** System policies count */
338
+ systemPolicies: number;
339
+ /** Organization policies count */
340
+ organizationPolicies: number;
341
+ /** Tenant policies count */
342
+ tenantPolicies: number;
343
+ /** Overrides applied */
344
+ overridesApplied: number;
345
+ };
346
+ }
347
+ /**
348
+ * Paginated response wrapper
349
+ */
350
+ export interface PaginatedResponse<T> {
351
+ /** Array of items */
352
+ items: T[];
353
+ /** Total number of items */
354
+ total: number;
355
+ /** Current page limit */
356
+ limit: number;
357
+ /** Current offset */
358
+ offset: number;
359
+ /** Whether there are more items */
360
+ hasMore: boolean;
361
+ }
362
+ //# sourceMappingURL=policies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/types/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,cAAc,GACd,oBAAoB,GACpB,kBAAkB,GAClB,cAAc,GACd,gBAAgB,GAChB,QAAQ,CAAC;AAEb;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAMpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,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C5B,cAAc,EAAE,MAAM,CAAC;QACvB,kCAAkC;QAClC,oBAAoB,EAAE,MAAM,CAAC;QAC7B,4BAA4B;QAC5B,cAAc,EAAE,MAAM,CAAC;QACvB,wBAAwB;QACxB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAMD;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,qBAAqB;IACrB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Policy CRUD types for AxonFlow SDK
4
+ * Part of Unified Policy Architecture v2.0.0
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=policies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/types/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -21,6 +21,30 @@ export interface ExecuteQueryOptions {
21
21
  /** Additional context for policy evaluation and processing */
22
22
  context?: Record<string, unknown>;
23
23
  }
24
+ /**
25
+ * Code artifact metadata detected in LLM responses.
26
+ *
27
+ * When an LLM generates code, AxonFlow automatically detects and analyzes it.
28
+ * This metadata is included in policyInfo for audit and compliance.
29
+ */
30
+ export interface CodeArtifact {
31
+ /** Whether the response contains code */
32
+ is_code_output: boolean;
33
+ /** Detected programming language */
34
+ language: string;
35
+ /** Code category (function, class, script, config, snippet, module) */
36
+ code_type: string;
37
+ /** Size of detected code in bytes */
38
+ size_bytes: number;
39
+ /** Number of lines of code */
40
+ line_count: number;
41
+ /** Count of potential secrets found */
42
+ secrets_detected: number;
43
+ /** Count of unsafe code patterns */
44
+ unsafe_patterns: number;
45
+ /** Code governance policies evaluated */
46
+ policies_checked?: string[];
47
+ }
24
48
  /**
25
49
  * Policy evaluation information from the agent
26
50
  */
@@ -33,6 +57,8 @@ export interface PolicyInfo {
33
57
  processingTime: string;
34
58
  /** Tenant ID associated with the request */
35
59
  tenantId: string;
60
+ /** Code artifact metadata if code was detected in the response */
61
+ codeArtifact?: CodeArtifact;
36
62
  }
37
63
  /**
38
64
  * Response from executeQuery in Proxy Mode
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/types/proxy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BA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qD;IACrD,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7C,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE"}
@@ -1,4 +1,4 @@
1
- import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus } from './types';
1
+ import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus, StaticPolicy, DynamicPolicy, PolicyOverride, ListStaticPoliciesOptions, ListDynamicPoliciesOptions, CreateStaticPolicyRequest, UpdateStaticPolicyRequest, CreateDynamicPolicyRequest, UpdateDynamicPolicyRequest, CreatePolicyOverrideRequest, TestPatternResult, PolicyVersion, EffectivePoliciesOptions } from './types';
2
2
  /**
3
3
  * Main AxonFlow client for invisible AI governance
4
4
  */
@@ -213,5 +213,250 @@ export declare class AxonFlow {
213
213
  * ```
214
214
  */
215
215
  auditLLMCall(options: AuditOptions): Promise<AuditResult>;
216
+ /**
217
+ * Build authentication headers for API requests
218
+ */
219
+ private buildAuthHeaders;
220
+ /**
221
+ * Generic HTTP request helper for policy APIs
222
+ */
223
+ private policyRequest;
224
+ /**
225
+ * List all static policies with optional filtering.
226
+ *
227
+ * @param options - Filtering and pagination options
228
+ * @returns Array of static policies
229
+ *
230
+ * @example
231
+ * ```typescript
232
+ * // List all enabled SQL injection policies
233
+ * const policies = await axonflow.listStaticPolicies({
234
+ * category: 'security-sqli',
235
+ * enabled: true
236
+ * });
237
+ * ```
238
+ */
239
+ listStaticPolicies(options?: ListStaticPoliciesOptions): Promise<StaticPolicy[]>;
240
+ /**
241
+ * Get a specific static policy by ID.
242
+ *
243
+ * @param id - Policy ID
244
+ * @returns The static policy
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * const policy = await axonflow.getStaticPolicy('pol_123');
249
+ * console.log(policy.name, policy.pattern);
250
+ * ```
251
+ */
252
+ getStaticPolicy(id: string): Promise<StaticPolicy>;
253
+ /**
254
+ * Create a new static policy.
255
+ *
256
+ * @param policy - Policy creation request
257
+ * @returns The created policy
258
+ *
259
+ * @example
260
+ * ```typescript
261
+ * const policy = await axonflow.createStaticPolicy({
262
+ * name: 'Block Credit Card Numbers',
263
+ * category: 'pii-global',
264
+ * pattern: '\\b(?:\\d{4}[- ]?){3}\\d{4}\\b',
265
+ * severity: 8,
266
+ * action: 'block'
267
+ * });
268
+ * ```
269
+ */
270
+ createStaticPolicy(policy: CreateStaticPolicyRequest): Promise<StaticPolicy>;
271
+ /**
272
+ * Update an existing static policy.
273
+ *
274
+ * @param id - Policy ID
275
+ * @param policy - Fields to update
276
+ * @returns The updated policy
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * const updated = await axonflow.updateStaticPolicy('pol_123', {
281
+ * severity: 10,
282
+ * description: 'Updated description'
283
+ * });
284
+ * ```
285
+ */
286
+ updateStaticPolicy(id: string, policy: UpdateStaticPolicyRequest): Promise<StaticPolicy>;
287
+ /**
288
+ * Delete a static policy.
289
+ *
290
+ * @param id - Policy ID
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * await axonflow.deleteStaticPolicy('pol_123');
295
+ * ```
296
+ */
297
+ deleteStaticPolicy(id: string): Promise<void>;
298
+ /**
299
+ * Toggle a static policy's enabled status.
300
+ *
301
+ * @param id - Policy ID
302
+ * @param enabled - Whether the policy should be enabled
303
+ * @returns The updated policy
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * // Disable a policy
308
+ * await axonflow.toggleStaticPolicy('pol_123', false);
309
+ * ```
310
+ */
311
+ toggleStaticPolicy(id: string, enabled: boolean): Promise<StaticPolicy>;
312
+ /**
313
+ * Get effective static policies with tier inheritance applied.
314
+ * This returns the policies that would actually be enforced, taking into
315
+ * account system, organization, and tenant policies with proper inheritance.
316
+ *
317
+ * @param options - Filtering options
318
+ * @returns Array of effective policies
319
+ *
320
+ * @example
321
+ * ```typescript
322
+ * const effective = await axonflow.getEffectiveStaticPolicies({
323
+ * category: 'security-sqli'
324
+ * });
325
+ * ```
326
+ */
327
+ getEffectiveStaticPolicies(options?: EffectivePoliciesOptions): Promise<StaticPolicy[]>;
328
+ /**
329
+ * Test a regex pattern against sample inputs.
330
+ * Use this to validate patterns before creating policies.
331
+ *
332
+ * @param pattern - Regex pattern to test
333
+ * @param testInputs - Array of strings to test against
334
+ * @returns Test results showing matches
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const result = await axonflow.testPattern(
339
+ * '\\b\\d{3}-\\d{2}-\\d{4}\\b',
340
+ * ['My SSN is 123-45-6789', 'No SSN here', 'Another: 987-65-4321']
341
+ * );
342
+ * console.log(result.results); // Shows which inputs matched
343
+ * ```
344
+ */
345
+ testPattern(pattern: string, testInputs: string[]): Promise<TestPatternResult>;
346
+ /**
347
+ * Get version history for a static policy.
348
+ *
349
+ * @param id - Policy ID
350
+ * @returns Array of version history entries
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * const versions = await axonflow.getStaticPolicyVersions('pol_123');
355
+ * versions.forEach(v => console.log(v.version, v.changeType, v.changedAt));
356
+ * ```
357
+ */
358
+ getStaticPolicyVersions(id: string): Promise<PolicyVersion[]>;
359
+ /**
360
+ * Create an override for a static policy.
361
+ * Overrides allow changing how a system policy behaves at the organization level.
362
+ *
363
+ * @param policyId - ID of the policy to override
364
+ * @param override - Override configuration
365
+ * @returns The created override
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * // Change a blocking policy to warn-only
370
+ * const override = await axonflow.createPolicyOverride('pol_123', {
371
+ * action: 'warn',
372
+ * reason: 'Temporarily reducing strictness for migration',
373
+ * expiresAt: '2025-01-31T23:59:59Z'
374
+ * });
375
+ * ```
376
+ */
377
+ createPolicyOverride(policyId: string, override: CreatePolicyOverrideRequest): Promise<PolicyOverride>;
378
+ /**
379
+ * Delete an override for a static policy.
380
+ * This restores the policy to its default behavior.
381
+ *
382
+ * @param policyId - ID of the policy whose override to delete
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * await axonflow.deletePolicyOverride('pol_123');
387
+ * ```
388
+ */
389
+ deletePolicyOverride(policyId: string): Promise<void>;
390
+ /**
391
+ * List all dynamic policies with optional filtering.
392
+ *
393
+ * @param options - Filtering and pagination options
394
+ * @returns Array of dynamic policies
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * const policies = await axonflow.listDynamicPolicies({
399
+ * category: 'dynamic-cost',
400
+ * enabled: true
401
+ * });
402
+ * ```
403
+ */
404
+ listDynamicPolicies(options?: ListDynamicPoliciesOptions): Promise<DynamicPolicy[]>;
405
+ /**
406
+ * Get a specific dynamic policy by ID.
407
+ *
408
+ * @param id - Policy ID
409
+ * @returns The dynamic policy
410
+ */
411
+ getDynamicPolicy(id: string): Promise<DynamicPolicy>;
412
+ /**
413
+ * Create a new dynamic policy.
414
+ *
415
+ * @param policy - Policy creation request
416
+ * @returns The created policy
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * const policy = await axonflow.createDynamicPolicy({
421
+ * name: 'Rate Limit API Calls',
422
+ * category: 'dynamic-cost',
423
+ * config: {
424
+ * type: 'rate-limit',
425
+ * rules: { maxRequestsPerMinute: 100 },
426
+ * action: 'block'
427
+ * }
428
+ * });
429
+ * ```
430
+ */
431
+ createDynamicPolicy(policy: CreateDynamicPolicyRequest): Promise<DynamicPolicy>;
432
+ /**
433
+ * Update an existing dynamic policy.
434
+ *
435
+ * @param id - Policy ID
436
+ * @param policy - Fields to update
437
+ * @returns The updated policy
438
+ */
439
+ updateDynamicPolicy(id: string, policy: UpdateDynamicPolicyRequest): Promise<DynamicPolicy>;
440
+ /**
441
+ * Delete a dynamic policy.
442
+ *
443
+ * @param id - Policy ID
444
+ */
445
+ deleteDynamicPolicy(id: string): Promise<void>;
446
+ /**
447
+ * Toggle a dynamic policy's enabled status.
448
+ *
449
+ * @param id - Policy ID
450
+ * @param enabled - Whether the policy should be enabled
451
+ * @returns The updated policy
452
+ */
453
+ toggleDynamicPolicy(id: string, enabled: boolean): Promise<DynamicPolicy>;
454
+ /**
455
+ * Get effective dynamic policies with tier inheritance applied.
456
+ *
457
+ * @param options - Filtering options
458
+ * @returns Array of effective dynamic policies
459
+ */
460
+ getEffectiveDynamicPolicies(options?: EffectivePoliciesOptions): Promise<DynamicPolicy[]>;
216
461
  }
217
462
  //# sourceMappingURL=client.d.ts.map