@axonflow/sdk 1.4.1 → 1.5.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.
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAId,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACb,MAAM,SAAS,CAAC;AAOjB;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAUZ;IACF,OAAO,CAAC,YAAY,CAAyB;gBAEjC,MAAM,EAAE,cAAc;IAqDlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA4D5D;;OAEG;YACW,cAAc;IAiB5B;;OAEG;YACW,aAAa;IAyE3B;;OAEG;YACW,QAAQ;IAYtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAQvB;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,GAAE,MAAmB,GAAG,QAAQ;IAarD;;;;;;;;;;;;OAYG;IACG,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IA0C1C;;;;;;;;;;;;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