@axonflow/sdk 1.14.0 → 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.
- package/dist/cjs/client.d.ts +61 -10
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +169 -49
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/types/config.d.ts +2 -10
- package/dist/cjs/types/config.d.ts.map +1 -1
- package/dist/cjs/types/gateway.d.ts +83 -0
- package/dist/cjs/types/gateway.d.ts.map +1 -1
- package/dist/esm/client.d.ts +61 -10
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +169 -49
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/types/config.d.ts +2 -10
- package/dist/esm/types/config.d.ts.map +1 -1
- package/dist/esm/types/gateway.d.ts +83 -0
- package/dist/esm/types/gateway.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, ConnectorHealthStatus, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus, StaticPolicy, DynamicPolicy, PolicyOverride, ListStaticPoliciesOptions, ListDynamicPoliciesOptions, CreateStaticPolicyRequest, UpdateStaticPolicyRequest, CreateDynamicPolicyRequest, UpdateDynamicPolicyRequest, CreatePolicyOverrideRequest, TestPatternResult, PolicyVersion, EffectivePoliciesOptions, GitProviderType, ConfigureGitProviderRequest, ConfigureGitProviderResponse, ValidateGitProviderRequest, ValidateGitProviderResponse, ListGitProvidersResponse, CreatePRRequest, CreatePRResponse, PRRecord, ListPRsOptions, ListPRsResponse, CodeGovernanceMetrics, ExportOptions, ExportResponse, ExecutionSnapshot, TimelineEntry, ExecutionDetail, ListExecutionsResponse, ListExecutionsOptions, ExecutionExportOptions, Budget, BudgetsResponse, BudgetStatus, BudgetAlertsResponse, BudgetDecision, UsageSummary, UsageBreakdown, UsageRecordsResponse, PricingListResponse, CreateBudgetRequest, UpdateBudgetRequest, ListBudgetsOptions, BudgetCheckRequest, ListUsageRecordsOptions } from './types';
|
|
1
|
+
import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, ConnectorHealthStatus, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, AuditSearchRequest, AuditQueryOptions, AuditSearchResponse, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus, StaticPolicy, DynamicPolicy, PolicyOverride, ListStaticPoliciesOptions, ListDynamicPoliciesOptions, CreateStaticPolicyRequest, UpdateStaticPolicyRequest, CreateDynamicPolicyRequest, UpdateDynamicPolicyRequest, CreatePolicyOverrideRequest, TestPatternResult, PolicyVersion, EffectivePoliciesOptions, GitProviderType, ConfigureGitProviderRequest, ConfigureGitProviderResponse, ValidateGitProviderRequest, ValidateGitProviderResponse, ListGitProvidersResponse, CreatePRRequest, CreatePRResponse, PRRecord, ListPRsOptions, ListPRsResponse, CodeGovernanceMetrics, ExportOptions, ExportResponse, ExecutionSnapshot, TimelineEntry, ExecutionDetail, ListExecutionsResponse, ListExecutionsOptions, ExecutionExportOptions, Budget, BudgetsResponse, BudgetStatus, BudgetAlertsResponse, BudgetDecision, UsageSummary, UsageBreakdown, UsageRecordsResponse, PricingListResponse, CreateBudgetRequest, UpdateBudgetRequest, ListBudgetsOptions, BudgetCheckRequest, ListUsageRecordsOptions } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Main AxonFlow client for invisible AI governance
|
|
4
4
|
*/
|
|
@@ -239,6 +239,61 @@ export declare class AxonFlow {
|
|
|
239
239
|
* ```
|
|
240
240
|
*/
|
|
241
241
|
auditLLMCall(options: AuditOptions): Promise<AuditResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Search audit logs with optional filters.
|
|
244
|
+
*
|
|
245
|
+
* Query the AxonFlow orchestrator for audit logs matching the specified
|
|
246
|
+
* criteria. Use this for compliance dashboards, security investigations,
|
|
247
|
+
* and operational monitoring.
|
|
248
|
+
*
|
|
249
|
+
* @param request - Search filters and pagination options
|
|
250
|
+
* @returns Promise resolving to audit search response
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* // Search for logs from a specific user in the last 24 hours
|
|
255
|
+
* const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
256
|
+
* const result = await client.searchAuditLogs({
|
|
257
|
+
* userEmail: 'analyst@company.com',
|
|
258
|
+
* startTime: yesterday,
|
|
259
|
+
* limit: 100,
|
|
260
|
+
* });
|
|
261
|
+
*
|
|
262
|
+
* for (const entry of result.entries) {
|
|
263
|
+
* console.log(`[${entry.timestamp}] ${entry.userEmail}: ${entry.querySummary}`);
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
searchAuditLogs(request?: AuditSearchRequest): Promise<AuditSearchResponse>;
|
|
268
|
+
/**
|
|
269
|
+
* Get recent audit logs for a specific tenant.
|
|
270
|
+
*
|
|
271
|
+
* Convenience method for tenant-scoped audit queries. Use this when you
|
|
272
|
+
* need to view all recent activity for a specific tenant.
|
|
273
|
+
*
|
|
274
|
+
* @param tenantId - The tenant identifier to query
|
|
275
|
+
* @param options - Pagination options (limit, offset)
|
|
276
|
+
* @returns Promise resolving to audit search response
|
|
277
|
+
* @throws Error if tenantId is empty
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* // Get the last 50 audit logs for a tenant
|
|
282
|
+
* const result = await client.getAuditLogsByTenant('tenant-abc');
|
|
283
|
+
* console.log(`Found ${result.entries.length} entries`);
|
|
284
|
+
*
|
|
285
|
+
* // With custom options
|
|
286
|
+
* const result2 = await client.getAuditLogsByTenant('tenant-abc', {
|
|
287
|
+
* limit: 100,
|
|
288
|
+
* offset: 50,
|
|
289
|
+
* });
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
getAuditLogsByTenant(tenantId: string, options?: AuditQueryOptions): Promise<AuditSearchResponse>;
|
|
293
|
+
/**
|
|
294
|
+
* Parse a raw audit log entry from the API into the typed interface
|
|
295
|
+
*/
|
|
296
|
+
private parseAuditLogEntry;
|
|
242
297
|
/**
|
|
243
298
|
* Build authentication headers for API requests
|
|
244
299
|
*/
|
|
@@ -742,21 +797,17 @@ export declare class AxonFlow {
|
|
|
742
797
|
*/
|
|
743
798
|
exportCodeGovernanceDataCSV(options?: ExportOptions): Promise<string>;
|
|
744
799
|
/**
|
|
745
|
-
* Get the
|
|
746
|
-
*
|
|
800
|
+
* Get the endpoint URL for API requests.
|
|
801
|
+
* All routes now go through the single Agent endpoint (ADR-026).
|
|
747
802
|
*/
|
|
748
|
-
private
|
|
803
|
+
private getEndpointUrl;
|
|
749
804
|
/**
|
|
750
|
-
* Generic HTTP request helper for
|
|
805
|
+
* Generic HTTP request helper for APIs (routes through single endpoint per ADR-026)
|
|
751
806
|
*/
|
|
752
807
|
private orchestratorRequest;
|
|
753
|
-
/**
|
|
754
|
-
* Get the portal URL for enterprise PR workflow features.
|
|
755
|
-
* Falls back to agent endpoint with port 8082 if not configured.
|
|
756
|
-
*/
|
|
757
|
-
private getPortalUrl;
|
|
758
808
|
/**
|
|
759
809
|
* Generic HTTP request helper for Customer Portal APIs (enterprise features).
|
|
810
|
+
* Routes through single endpoint per ADR-026.
|
|
760
811
|
* Requires prior authentication via loginToPortal().
|
|
761
812
|
*/
|
|
762
813
|
private portalRequest;
|
package/dist/cjs/client.d.ts.map
CHANGED
|
@@ -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,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EAEZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EAExB,eAAe,EACf,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EAEd,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EAEtB,MAAM,EACN,eAAe,EACf,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,cAAc,EAGd,oBAAoB,EAEpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAOjB;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,
|
|
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,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EAEZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,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AC;IAmBzE;;;;;;OAMG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAenF;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnD;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAiB9D;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuBtE;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IA6BvE;;;;;OAKG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAe7D;;;;;;OAMG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6BlF;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAoCxF;;;;;;OAMG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2BjF,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,kBAAkB;IAY1B;;;;OAIG;YACW,iBAAiB;CAkChC"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -22,8 +22,6 @@ class AxonFlow {
|
|
|
22
22
|
apiKey: config.apiKey,
|
|
23
23
|
licenseKey: config.licenseKey,
|
|
24
24
|
endpoint,
|
|
25
|
-
orchestratorEndpoint: config.orchestratorEndpoint,
|
|
26
|
-
portalEndpoint: config.portalEndpoint,
|
|
27
25
|
mode: config.mode || (hasCredentials ? 'production' : 'sandbox'),
|
|
28
26
|
tenant: config.tenant || 'default',
|
|
29
27
|
debug: config.debug || false,
|
|
@@ -327,7 +325,7 @@ class AxonFlow {
|
|
|
327
325
|
* ```
|
|
328
326
|
*/
|
|
329
327
|
async orchestratorHealthCheck() {
|
|
330
|
-
const url = `${this.
|
|
328
|
+
const url = `${this.config.endpoint}/health`;
|
|
331
329
|
try {
|
|
332
330
|
const response = await fetch(url, {
|
|
333
331
|
method: 'GET',
|
|
@@ -785,6 +783,7 @@ class AxonFlow {
|
|
|
785
783
|
const result = {
|
|
786
784
|
contextId: data.context_id,
|
|
787
785
|
approved: data.approved,
|
|
786
|
+
requiresRedaction: data.requires_redaction || false,
|
|
788
787
|
approvedData: data.approved_data || {},
|
|
789
788
|
policies: data.policies || [],
|
|
790
789
|
expiresAt,
|
|
@@ -889,6 +888,153 @@ class AxonFlow {
|
|
|
889
888
|
return result;
|
|
890
889
|
}
|
|
891
890
|
// ============================================================================
|
|
891
|
+
// Audit Log Read Methods
|
|
892
|
+
// ============================================================================
|
|
893
|
+
/**
|
|
894
|
+
* Search audit logs with optional filters.
|
|
895
|
+
*
|
|
896
|
+
* Query the AxonFlow orchestrator for audit logs matching the specified
|
|
897
|
+
* criteria. Use this for compliance dashboards, security investigations,
|
|
898
|
+
* and operational monitoring.
|
|
899
|
+
*
|
|
900
|
+
* @param request - Search filters and pagination options
|
|
901
|
+
* @returns Promise resolving to audit search response
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```typescript
|
|
905
|
+
* // Search for logs from a specific user in the last 24 hours
|
|
906
|
+
* const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
907
|
+
* const result = await client.searchAuditLogs({
|
|
908
|
+
* userEmail: 'analyst@company.com',
|
|
909
|
+
* startTime: yesterday,
|
|
910
|
+
* limit: 100,
|
|
911
|
+
* });
|
|
912
|
+
*
|
|
913
|
+
* for (const entry of result.entries) {
|
|
914
|
+
* console.log(`[${entry.timestamp}] ${entry.userEmail}: ${entry.querySummary}`);
|
|
915
|
+
* }
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
async searchAuditLogs(request) {
|
|
919
|
+
const limit = Math.min(request?.limit ?? 100, 1000);
|
|
920
|
+
const offset = request?.offset ?? 0;
|
|
921
|
+
// Build request body with only defined values
|
|
922
|
+
const body = { limit };
|
|
923
|
+
if (request?.userEmail)
|
|
924
|
+
body.user_email = request.userEmail;
|
|
925
|
+
if (request?.clientId)
|
|
926
|
+
body.client_id = request.clientId;
|
|
927
|
+
if (request?.startTime)
|
|
928
|
+
body.start_time = request.startTime.toISOString();
|
|
929
|
+
if (request?.endTime)
|
|
930
|
+
body.end_time = request.endTime.toISOString();
|
|
931
|
+
if (request?.requestType)
|
|
932
|
+
body.request_type = request.requestType;
|
|
933
|
+
if (offset > 0)
|
|
934
|
+
body.offset = offset;
|
|
935
|
+
if (this.config.debug) {
|
|
936
|
+
(0, helpers_1.debugLog)('Searching audit logs', { limit, offset });
|
|
937
|
+
}
|
|
938
|
+
const response = await this.orchestratorRequest('POST', '/api/v1/audit/search', body);
|
|
939
|
+
// Handle both array and wrapped response formats
|
|
940
|
+
if (Array.isArray(response)) {
|
|
941
|
+
const entries = response.map(e => this.parseAuditLogEntry(e));
|
|
942
|
+
return {
|
|
943
|
+
entries,
|
|
944
|
+
total: entries.length,
|
|
945
|
+
limit,
|
|
946
|
+
offset,
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
const data = response;
|
|
950
|
+
const entries = (data.entries || []).map(e => this.parseAuditLogEntry(e));
|
|
951
|
+
return {
|
|
952
|
+
entries,
|
|
953
|
+
total: data.total ?? entries.length,
|
|
954
|
+
limit: data.limit ?? limit,
|
|
955
|
+
offset: data.offset ?? offset,
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Get recent audit logs for a specific tenant.
|
|
960
|
+
*
|
|
961
|
+
* Convenience method for tenant-scoped audit queries. Use this when you
|
|
962
|
+
* need to view all recent activity for a specific tenant.
|
|
963
|
+
*
|
|
964
|
+
* @param tenantId - The tenant identifier to query
|
|
965
|
+
* @param options - Pagination options (limit, offset)
|
|
966
|
+
* @returns Promise resolving to audit search response
|
|
967
|
+
* @throws Error if tenantId is empty
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
* ```typescript
|
|
971
|
+
* // Get the last 50 audit logs for a tenant
|
|
972
|
+
* const result = await client.getAuditLogsByTenant('tenant-abc');
|
|
973
|
+
* console.log(`Found ${result.entries.length} entries`);
|
|
974
|
+
*
|
|
975
|
+
* // With custom options
|
|
976
|
+
* const result2 = await client.getAuditLogsByTenant('tenant-abc', {
|
|
977
|
+
* limit: 100,
|
|
978
|
+
* offset: 50,
|
|
979
|
+
* });
|
|
980
|
+
* ```
|
|
981
|
+
*/
|
|
982
|
+
async getAuditLogsByTenant(tenantId, options) {
|
|
983
|
+
if (!tenantId) {
|
|
984
|
+
throw new Error('tenantId is required');
|
|
985
|
+
}
|
|
986
|
+
const limit = Math.min(options?.limit ?? 50, 1000);
|
|
987
|
+
const offset = options?.offset ?? 0;
|
|
988
|
+
if (this.config.debug) {
|
|
989
|
+
(0, helpers_1.debugLog)('Getting audit logs for tenant', { tenantId, limit, offset });
|
|
990
|
+
}
|
|
991
|
+
const path = `/api/v1/audit/tenant/${encodeURIComponent(tenantId)}?limit=${limit}&offset=${offset}`;
|
|
992
|
+
const response = await this.orchestratorRequest('GET', path);
|
|
993
|
+
// Handle both array and wrapped response formats
|
|
994
|
+
if (Array.isArray(response)) {
|
|
995
|
+
const entries = response.map(e => this.parseAuditLogEntry(e));
|
|
996
|
+
return {
|
|
997
|
+
entries,
|
|
998
|
+
total: entries.length,
|
|
999
|
+
limit,
|
|
1000
|
+
offset,
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
const data = response;
|
|
1004
|
+
const entries = (data.entries || []).map(e => this.parseAuditLogEntry(e));
|
|
1005
|
+
return {
|
|
1006
|
+
entries,
|
|
1007
|
+
total: data.total ?? entries.length,
|
|
1008
|
+
limit: data.limit ?? limit,
|
|
1009
|
+
offset: data.offset ?? offset,
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Parse a raw audit log entry from the API into the typed interface
|
|
1014
|
+
*/
|
|
1015
|
+
parseAuditLogEntry(raw) {
|
|
1016
|
+
const data = raw;
|
|
1017
|
+
return {
|
|
1018
|
+
id: data.id ?? '',
|
|
1019
|
+
requestId: data.request_id ?? '',
|
|
1020
|
+
timestamp: data.timestamp ? new Date(data.timestamp) : new Date(),
|
|
1021
|
+
userEmail: data.user_email ?? '',
|
|
1022
|
+
clientId: data.client_id ?? '',
|
|
1023
|
+
tenantId: data.tenant_id ?? '',
|
|
1024
|
+
requestType: data.request_type ?? '',
|
|
1025
|
+
querySummary: data.query_summary ?? '',
|
|
1026
|
+
success: data.success ?? true,
|
|
1027
|
+
blocked: data.blocked ?? false,
|
|
1028
|
+
riskScore: data.risk_score ?? 0,
|
|
1029
|
+
provider: data.provider ?? '',
|
|
1030
|
+
model: data.model ?? '',
|
|
1031
|
+
tokensUsed: data.tokens_used ?? 0,
|
|
1032
|
+
latencyMs: data.latency_ms ?? 0,
|
|
1033
|
+
policyViolations: data.policy_violations ?? [],
|
|
1034
|
+
metadata: data.metadata ?? {},
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
// ============================================================================
|
|
892
1038
|
// Policy CRUD Methods - Static Policies
|
|
893
1039
|
// ============================================================================
|
|
894
1040
|
/**
|
|
@@ -1273,7 +1419,7 @@ class AxonFlow {
|
|
|
1273
1419
|
if (options?.search)
|
|
1274
1420
|
params.set('search', options.search);
|
|
1275
1421
|
const queryString = params.toString();
|
|
1276
|
-
const path = `/api/v1/policies
|
|
1422
|
+
const path = `/api/v1/dynamic-policies${queryString ? `?${queryString}` : ''}`;
|
|
1277
1423
|
if (this.config.debug) {
|
|
1278
1424
|
(0, helpers_1.debugLog)('Listing dynamic policies', { options });
|
|
1279
1425
|
}
|
|
@@ -1289,7 +1435,7 @@ class AxonFlow {
|
|
|
1289
1435
|
if (this.config.debug) {
|
|
1290
1436
|
(0, helpers_1.debugLog)('Getting dynamic policy', { id });
|
|
1291
1437
|
}
|
|
1292
|
-
return this.orchestratorRequest('GET', `/api/v1/policies
|
|
1438
|
+
return this.orchestratorRequest('GET', `/api/v1/dynamic-policies/${id}`);
|
|
1293
1439
|
}
|
|
1294
1440
|
/**
|
|
1295
1441
|
* Create a new dynamic policy.
|
|
@@ -1314,7 +1460,7 @@ class AxonFlow {
|
|
|
1314
1460
|
if (this.config.debug) {
|
|
1315
1461
|
(0, helpers_1.debugLog)('Creating dynamic policy', { name: policy.name });
|
|
1316
1462
|
}
|
|
1317
|
-
return this.orchestratorRequest('POST', '/api/v1/policies
|
|
1463
|
+
return this.orchestratorRequest('POST', '/api/v1/dynamic-policies', policy);
|
|
1318
1464
|
}
|
|
1319
1465
|
/**
|
|
1320
1466
|
* Update an existing dynamic policy.
|
|
@@ -1327,7 +1473,7 @@ class AxonFlow {
|
|
|
1327
1473
|
if (this.config.debug) {
|
|
1328
1474
|
(0, helpers_1.debugLog)('Updating dynamic policy', { id, updates: Object.keys(policy) });
|
|
1329
1475
|
}
|
|
1330
|
-
return this.orchestratorRequest('PUT', `/api/v1/policies
|
|
1476
|
+
return this.orchestratorRequest('PUT', `/api/v1/dynamic-policies/${id}`, policy);
|
|
1331
1477
|
}
|
|
1332
1478
|
/**
|
|
1333
1479
|
* Delete a dynamic policy.
|
|
@@ -1338,7 +1484,7 @@ class AxonFlow {
|
|
|
1338
1484
|
if (this.config.debug) {
|
|
1339
1485
|
(0, helpers_1.debugLog)('Deleting dynamic policy', { id });
|
|
1340
1486
|
}
|
|
1341
|
-
await this.orchestratorRequest('DELETE', `/api/v1/policies
|
|
1487
|
+
await this.orchestratorRequest('DELETE', `/api/v1/dynamic-policies/${id}`);
|
|
1342
1488
|
}
|
|
1343
1489
|
/**
|
|
1344
1490
|
* Toggle a dynamic policy's enabled status.
|
|
@@ -1351,7 +1497,7 @@ class AxonFlow {
|
|
|
1351
1497
|
if (this.config.debug) {
|
|
1352
1498
|
(0, helpers_1.debugLog)('Toggling dynamic policy', { id, enabled });
|
|
1353
1499
|
}
|
|
1354
|
-
return this.orchestratorRequest('PATCH', `/api/v1/policies
|
|
1500
|
+
return this.orchestratorRequest('PATCH', `/api/v1/dynamic-policies/${id}`, {
|
|
1355
1501
|
enabled,
|
|
1356
1502
|
});
|
|
1357
1503
|
}
|
|
@@ -1368,7 +1514,7 @@ class AxonFlow {
|
|
|
1368
1514
|
if (options?.includeDisabled)
|
|
1369
1515
|
params.set('include_disabled', 'true');
|
|
1370
1516
|
const queryString = params.toString();
|
|
1371
|
-
const path = `/api/v1/policies/
|
|
1517
|
+
const path = `/api/v1/dynamic-policies/effective${queryString ? `?${queryString}` : ''}`;
|
|
1372
1518
|
if (this.config.debug) {
|
|
1373
1519
|
(0, helpers_1.debugLog)('Getting effective dynamic policies', { options });
|
|
1374
1520
|
}
|
|
@@ -1395,7 +1541,7 @@ class AxonFlow {
|
|
|
1395
1541
|
* ```
|
|
1396
1542
|
*/
|
|
1397
1543
|
async loginToPortal(orgId, password) {
|
|
1398
|
-
const url = `${this.
|
|
1544
|
+
const url = `${this.config.endpoint}/api/v1/auth/login`;
|
|
1399
1545
|
const response = await fetch(url, {
|
|
1400
1546
|
method: 'POST',
|
|
1401
1547
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -1438,7 +1584,7 @@ class AxonFlow {
|
|
|
1438
1584
|
return;
|
|
1439
1585
|
}
|
|
1440
1586
|
try {
|
|
1441
|
-
await fetch(`${this.
|
|
1587
|
+
await fetch(`${this.config.endpoint}/api/v1/auth/logout`, {
|
|
1442
1588
|
method: 'POST',
|
|
1443
1589
|
headers: { Cookie: `axonflow_session=${this.sessionCookie}` },
|
|
1444
1590
|
signal: AbortSignal.timeout(this.config.timeout),
|
|
@@ -1919,28 +2065,17 @@ class AxonFlow {
|
|
|
1919
2065
|
// Execution Replay Methods
|
|
1920
2066
|
// ============================================================================
|
|
1921
2067
|
/**
|
|
1922
|
-
* Get the
|
|
1923
|
-
*
|
|
2068
|
+
* Get the endpoint URL for API requests.
|
|
2069
|
+
* All routes now go through the single Agent endpoint (ADR-026).
|
|
1924
2070
|
*/
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
return this.config.orchestratorEndpoint;
|
|
1928
|
-
}
|
|
1929
|
-
// Default: assume orchestrator is on same host as agent, port 8081
|
|
1930
|
-
try {
|
|
1931
|
-
const url = new URL(this.config.endpoint);
|
|
1932
|
-
url.port = '8081';
|
|
1933
|
-
return url.toString().replace(/\/$/, '');
|
|
1934
|
-
}
|
|
1935
|
-
catch {
|
|
1936
|
-
return 'http://localhost:8081';
|
|
1937
|
-
}
|
|
2071
|
+
getEndpointUrl() {
|
|
2072
|
+
return this.config.endpoint;
|
|
1938
2073
|
}
|
|
1939
2074
|
/**
|
|
1940
|
-
* Generic HTTP request helper for
|
|
2075
|
+
* Generic HTTP request helper for APIs (routes through single endpoint per ADR-026)
|
|
1941
2076
|
*/
|
|
1942
2077
|
async orchestratorRequest(method, path, body) {
|
|
1943
|
-
const url = `${this.
|
|
2078
|
+
const url = `${this.config.endpoint}${path}`;
|
|
1944
2079
|
const headers = this.buildAuthHeaders();
|
|
1945
2080
|
const options = {
|
|
1946
2081
|
method,
|
|
@@ -1967,33 +2102,18 @@ class AxonFlow {
|
|
|
1967
2102
|
}
|
|
1968
2103
|
return response.json();
|
|
1969
2104
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
* Falls back to agent endpoint with port 8082 if not configured.
|
|
1973
|
-
*/
|
|
1974
|
-
getPortalUrl() {
|
|
1975
|
-
if (this.config.portalEndpoint) {
|
|
1976
|
-
return this.config.portalEndpoint;
|
|
1977
|
-
}
|
|
1978
|
-
// Default: assume portal is on same host as agent, port 8082
|
|
1979
|
-
try {
|
|
1980
|
-
const url = new URL(this.config.endpoint);
|
|
1981
|
-
url.port = '8082';
|
|
1982
|
-
return url.toString().replace(/\/$/, '');
|
|
1983
|
-
}
|
|
1984
|
-
catch {
|
|
1985
|
-
return 'http://localhost:8082';
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
2105
|
+
// Note: getPortalUrl() was removed in v2.0.0 (ADR-026 Single Entry Point).
|
|
2106
|
+
// All routes now go through the single Agent endpoint (this.config.endpoint).
|
|
1988
2107
|
/**
|
|
1989
2108
|
* Generic HTTP request helper for Customer Portal APIs (enterprise features).
|
|
2109
|
+
* Routes through single endpoint per ADR-026.
|
|
1990
2110
|
* Requires prior authentication via loginToPortal().
|
|
1991
2111
|
*/
|
|
1992
2112
|
async portalRequest(method, path, body) {
|
|
1993
2113
|
if (!this.sessionCookie) {
|
|
1994
2114
|
throw new errors_1.AuthenticationError('Not logged in to Customer Portal. Call loginToPortal() first.');
|
|
1995
2115
|
}
|
|
1996
|
-
const url = `${this.
|
|
2116
|
+
const url = `${this.config.endpoint}${path}`;
|
|
1997
2117
|
const headers = {
|
|
1998
2118
|
'Content-Type': 'application/json',
|
|
1999
2119
|
Cookie: `axonflow_session=${this.sessionCookie}`,
|
|
@@ -2591,7 +2711,7 @@ class AxonFlow {
|
|
|
2591
2711
|
if (!this.sessionCookie) {
|
|
2592
2712
|
throw new errors_1.AuthenticationError('Not logged in to Customer Portal. Call loginToPortal() first.');
|
|
2593
2713
|
}
|
|
2594
|
-
const url = `${this.
|
|
2714
|
+
const url = `${this.config.endpoint}${path}`;
|
|
2595
2715
|
const headers = {
|
|
2596
2716
|
Cookie: `axonflow_session=${this.sessionCookie}`,
|
|
2597
2717
|
};
|