@amigo-ai/platform-sdk 0.1.0 → 0.2.1
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/README.md +114 -2
- package/dist/core/branded-types.js +1 -0
- package/dist/core/branded-types.js.map +1 -1
- package/dist/core/errors.js +43 -3
- package/dist/core/errors.js.map +1 -1
- package/dist/core/openapi-client.js +60 -48
- package/dist/core/openapi-client.js.map +1 -1
- package/dist/core/rate-limit.js +13 -0
- package/dist/core/rate-limit.js.map +1 -0
- package/dist/core/webhooks.js +17 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/generated/api.js +2 -0
- package/dist/{types → generated}/api.js.map +1 -1
- package/dist/index.cjs +1668 -371
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +59 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1658 -371
- package/dist/index.mjs.map +4 -4
- package/dist/resources/actions.js +52 -0
- package/dist/resources/actions.js.map +1 -0
- package/dist/resources/agents.js +30 -30
- package/dist/resources/agents.js.map +1 -1
- package/dist/resources/analytics.js +34 -15
- package/dist/resources/analytics.js.map +1 -1
- package/dist/resources/api-keys.js +17 -19
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/audit.js +35 -0
- package/dist/resources/audit.js.map +1 -0
- package/dist/resources/base.js +12 -44
- package/dist/resources/base.js.map +1 -1
- package/dist/resources/billing.js +35 -7
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/calls.js +25 -9
- package/dist/resources/calls.js.map +1 -1
- package/dist/resources/compliance.js +19 -0
- package/dist/resources/compliance.js.map +1 -0
- package/dist/resources/context-graphs.js +46 -18
- package/dist/resources/context-graphs.js.map +1 -1
- package/dist/resources/data-sources.js +30 -12
- package/dist/resources/data-sources.js.map +1 -1
- package/dist/resources/functions.js +42 -0
- package/dist/resources/functions.js.map +1 -0
- package/dist/resources/integrations.js +32 -15
- package/dist/resources/integrations.js.map +1 -1
- package/dist/resources/memory.js +13 -4
- package/dist/resources/memory.js.map +1 -1
- package/dist/resources/operators.js +102 -0
- package/dist/resources/operators.js.map +1 -0
- package/dist/resources/personas.js +31 -0
- package/dist/resources/personas.js.map +1 -0
- package/dist/resources/phone-numbers.js +31 -16
- package/dist/resources/phone-numbers.js.map +1 -1
- package/dist/resources/recordings.js +19 -0
- package/dist/resources/recordings.js.map +1 -0
- package/dist/resources/review-queue.js +94 -0
- package/dist/resources/review-queue.js.map +1 -0
- package/dist/resources/safety.js +31 -0
- package/dist/resources/safety.js.map +1 -0
- package/dist/resources/services.js +18 -12
- package/dist/resources/services.js.map +1 -1
- package/dist/resources/settings.js +50 -24
- package/dist/resources/settings.js.map +1 -1
- package/dist/resources/simulations.js +23 -17
- package/dist/resources/simulations.js.map +1 -1
- package/dist/resources/skills.js +22 -16
- package/dist/resources/skills.js.map +1 -1
- package/dist/resources/triggers.js +51 -0
- package/dist/resources/triggers.js.map +1 -0
- package/dist/resources/webhook-destinations.js +44 -0
- package/dist/resources/webhook-destinations.js.map +1 -0
- package/dist/resources/workspaces.js +24 -38
- package/dist/resources/workspaces.js.map +1 -1
- package/dist/resources/world.js +58 -60
- package/dist/resources/world.js.map +1 -1
- package/dist/types/core/branded-types.d.ts +3 -0
- package/dist/types/core/branded-types.d.ts.map +1 -1
- package/dist/types/core/errors.d.ts +3 -0
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/openapi-client.d.ts +13 -5
- package/dist/types/core/openapi-client.d.ts.map +1 -1
- package/dist/types/core/rate-limit.d.ts +8 -0
- package/dist/types/core/rate-limit.d.ts.map +1 -0
- package/dist/types/core/webhooks.d.ts +9 -0
- package/dist/types/core/webhooks.d.ts.map +1 -0
- package/dist/types/generated/api.d.ts +35120 -0
- package/dist/types/generated/api.d.ts.map +1 -0
- package/dist/types/index.d.ts +45 -43
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/actions.d.ts +158 -0
- package/dist/types/resources/actions.d.ts.map +1 -0
- package/dist/types/resources/agents.d.ts +70 -22
- package/dist/types/resources/agents.d.ts.map +1 -1
- package/dist/types/resources/analytics.d.ts +100 -118
- package/dist/types/resources/analytics.d.ts.map +1 -1
- package/dist/types/resources/api-keys.d.ts +36 -7
- package/dist/types/resources/api-keys.d.ts.map +1 -1
- package/dist/types/resources/audit.d.ts +70 -0
- package/dist/types/resources/audit.d.ts.map +1 -0
- package/dist/types/resources/base.d.ts +13 -13
- package/dist/types/resources/base.d.ts.map +1 -1
- package/dist/types/resources/billing.d.ts +52 -12
- package/dist/types/resources/billing.d.ts.map +1 -1
- package/dist/types/resources/calls.d.ts +89 -35
- package/dist/types/resources/calls.d.ts.map +1 -1
- package/dist/types/resources/compliance.d.ts +45 -0
- package/dist/types/resources/compliance.d.ts.map +1 -0
- package/dist/types/resources/context-graphs.d.ts +77 -14
- package/dist/types/resources/context-graphs.d.ts.map +1 -1
- package/dist/types/resources/data-sources.d.ts +105 -9
- package/dist/types/resources/data-sources.d.ts.map +1 -1
- package/dist/types/resources/functions.d.ts +46 -0
- package/dist/types/resources/functions.d.ts.map +1 -0
- package/dist/types/resources/integrations.d.ts +83 -12
- package/dist/types/resources/integrations.d.ts.map +1 -1
- package/dist/types/resources/memory.d.ts +26 -73
- package/dist/types/resources/memory.d.ts.map +1 -1
- package/dist/types/resources/operators.d.ts +157 -0
- package/dist/types/resources/operators.d.ts.map +1 -0
- package/dist/types/resources/personas.d.ts +60 -0
- package/dist/types/resources/personas.d.ts.map +1 -0
- package/dist/types/resources/phone-numbers.d.ts +70 -10
- package/dist/types/resources/phone-numbers.d.ts.map +1 -1
- package/dist/types/resources/recordings.d.ts +29 -0
- package/dist/types/resources/recordings.d.ts.map +1 -0
- package/dist/types/resources/review-queue.d.ts +184 -0
- package/dist/types/resources/review-queue.d.ts.map +1 -0
- package/dist/types/resources/safety.d.ts +57 -0
- package/dist/types/resources/safety.d.ts.map +1 -0
- package/dist/types/resources/services.d.ts +85 -5
- package/dist/types/resources/services.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts +79 -78
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/simulations.d.ts +41 -12
- package/dist/types/resources/simulations.d.ts.map +1 -1
- package/dist/types/resources/skills.d.ts +131 -6
- package/dist/types/resources/skills.d.ts.map +1 -1
- package/dist/types/resources/triggers.d.ts +129 -0
- package/dist/types/resources/triggers.d.ts.map +1 -0
- package/dist/types/resources/webhook-destinations.d.ts +75 -0
- package/dist/types/resources/webhook-destinations.d.ts.map +1 -0
- package/dist/types/resources/workspaces.d.ts +60 -15
- package/dist/types/resources/workspaces.d.ts.map +1 -1
- package/dist/types/resources/world.d.ts +152 -143
- package/dist/types/resources/world.d.ts.map +1 -1
- package/package.json +6 -3
- package/dist/types/api.js +0 -12
- package/dist/types/types/api.d.ts +0 -739
- package/dist/types/types/api.d.ts.map +0 -1
|
@@ -1,111 +1,4 @@
|
|
|
1
1
|
import { WorkspaceScopedResource } from './base.js';
|
|
2
|
-
/** A metric value paired with its period-over-period change */
|
|
3
|
-
export interface MetricWithDelta {
|
|
4
|
-
value: number | null;
|
|
5
|
-
delta_pct: number | null;
|
|
6
|
-
}
|
|
7
|
-
export interface AnalyticsQueryParams {
|
|
8
|
-
/** Shorthand period, e.g. "7d", "30d" */
|
|
9
|
-
period?: string;
|
|
10
|
-
start_date?: string;
|
|
11
|
-
end_date?: string;
|
|
12
|
-
agent_id?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface AnalyticsDashboard {
|
|
15
|
-
call_volume: MetricWithDelta;
|
|
16
|
-
avg_quality: MetricWithDelta;
|
|
17
|
-
avg_ttfb_ms: MetricWithDelta;
|
|
18
|
-
escalation_rate: MetricWithDelta;
|
|
19
|
-
tool_success_rate: MetricWithDelta;
|
|
20
|
-
avg_duration_s: MetricWithDelta;
|
|
21
|
-
period_days: number;
|
|
22
|
-
}
|
|
23
|
-
export interface CallAnalytics {
|
|
24
|
-
workspace_id: string;
|
|
25
|
-
period_start: string;
|
|
26
|
-
period_end: string;
|
|
27
|
-
total_calls: number;
|
|
28
|
-
total_duration_seconds: number;
|
|
29
|
-
avg_duration_seconds: number;
|
|
30
|
-
calls_by_date: Array<{
|
|
31
|
-
date: string;
|
|
32
|
-
count: number;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
export interface AgentAnalytics {
|
|
36
|
-
agent_id: string;
|
|
37
|
-
agent_name: string;
|
|
38
|
-
total_calls: number;
|
|
39
|
-
completed_calls: number;
|
|
40
|
-
avg_duration_seconds: number;
|
|
41
|
-
completion_rate: number;
|
|
42
|
-
}
|
|
43
|
-
export interface AgentAnalyticsResponse {
|
|
44
|
-
agents: AgentAnalytics[];
|
|
45
|
-
period: string;
|
|
46
|
-
}
|
|
47
|
-
export interface CallQualityMetrics {
|
|
48
|
-
avg_sentiment: number | null;
|
|
49
|
-
positive_pct: number;
|
|
50
|
-
negative_pct: number;
|
|
51
|
-
neutral_pct: number;
|
|
52
|
-
avg_transcription_confidence: number | null;
|
|
53
|
-
flagged_calls: number;
|
|
54
|
-
}
|
|
55
|
-
export interface EmotionTrends {
|
|
56
|
-
data: Array<{
|
|
57
|
-
date: string;
|
|
58
|
-
emotions: Record<string, number>;
|
|
59
|
-
}>;
|
|
60
|
-
}
|
|
61
|
-
export interface LatencyMetrics {
|
|
62
|
-
avg_ttfb_ms: number;
|
|
63
|
-
p50_ttfb_ms: number;
|
|
64
|
-
p95_ttfb_ms: number;
|
|
65
|
-
avg_response_ms: number;
|
|
66
|
-
p95_response_ms: number;
|
|
67
|
-
}
|
|
68
|
-
export interface ToolPerformance {
|
|
69
|
-
tool_name: string;
|
|
70
|
-
call_count: number;
|
|
71
|
-
success_rate: number;
|
|
72
|
-
avg_latency_ms: number;
|
|
73
|
-
}
|
|
74
|
-
export interface DataQualityMetrics {
|
|
75
|
-
completeness_score: number;
|
|
76
|
-
duplicate_rate: number;
|
|
77
|
-
missing_canonical_id_pct: number;
|
|
78
|
-
stale_entities: number;
|
|
79
|
-
}
|
|
80
|
-
export interface AdvancedCallStats {
|
|
81
|
-
abandonment_rate: number;
|
|
82
|
-
transfer_rate: number;
|
|
83
|
-
avg_silence_pct: number;
|
|
84
|
-
avg_interruptions: number;
|
|
85
|
-
by_hour_of_day: Array<{
|
|
86
|
-
hour: number;
|
|
87
|
-
count: number;
|
|
88
|
-
}>;
|
|
89
|
-
by_day_of_week: Array<{
|
|
90
|
-
day: string;
|
|
91
|
-
count: number;
|
|
92
|
-
}>;
|
|
93
|
-
}
|
|
94
|
-
export interface CallComparison {
|
|
95
|
-
period_a: {
|
|
96
|
-
start: string;
|
|
97
|
-
end: string;
|
|
98
|
-
calls: number;
|
|
99
|
-
conversion_rate: number;
|
|
100
|
-
};
|
|
101
|
-
period_b: {
|
|
102
|
-
start: string;
|
|
103
|
-
end: string;
|
|
104
|
-
calls: number;
|
|
105
|
-
conversion_rate: number;
|
|
106
|
-
};
|
|
107
|
-
change_pct: Record<string, number>;
|
|
108
|
-
}
|
|
109
2
|
/**
|
|
110
3
|
* Analytics — aggregate metrics about calls, agents, quality, and usage.
|
|
111
4
|
*/
|
|
@@ -113,27 +6,114 @@ export declare class AnalyticsResource extends WorkspaceScopedResource {
|
|
|
113
6
|
/** High-level dashboard summary — pass `days` (default: 7) for the lookback window */
|
|
114
7
|
getDashboard(params?: {
|
|
115
8
|
days?: number;
|
|
116
|
-
}): Promise<
|
|
9
|
+
}): Promise<{
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}>;
|
|
117
12
|
/** Call volume and duration metrics */
|
|
118
|
-
getCalls(params?:
|
|
13
|
+
getCalls(params?: {
|
|
14
|
+
days?: number;
|
|
15
|
+
date_from?: string | null;
|
|
16
|
+
date_to?: string | null;
|
|
17
|
+
interval?: '1h' | '1d' | '1w';
|
|
18
|
+
service_id?: string | null;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
workspace_id: string;
|
|
21
|
+
period_start: string;
|
|
22
|
+
period_end: string;
|
|
23
|
+
total_calls: number;
|
|
24
|
+
total_duration_seconds: number;
|
|
25
|
+
avg_duration_seconds: number;
|
|
26
|
+
calls_by_date: {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}[];
|
|
29
|
+
}>;
|
|
119
30
|
/** Per-agent performance breakdown */
|
|
120
31
|
getAgents(params?: {
|
|
121
32
|
period?: string;
|
|
122
|
-
}): Promise<
|
|
33
|
+
}): Promise<{
|
|
34
|
+
agents: import("../index.js").components["schemas"]["AgentAnalyticsEntry"][];
|
|
35
|
+
period?: string | null;
|
|
36
|
+
}>;
|
|
123
37
|
/** Call quality — sentiment, transcription confidence, flagged calls */
|
|
124
|
-
getCallQuality(params?:
|
|
38
|
+
getCallQuality(params?: {
|
|
39
|
+
days?: number;
|
|
40
|
+
date_from?: string | null;
|
|
41
|
+
date_to?: string | null;
|
|
42
|
+
interval?: '1h' | '1d' | '1w';
|
|
43
|
+
service_id?: string | null;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}>;
|
|
125
47
|
/** Emotion trend data over time */
|
|
126
|
-
getEmotionTrends(params?:
|
|
48
|
+
getEmotionTrends(params?: {
|
|
49
|
+
days?: number;
|
|
50
|
+
date_from?: string | null;
|
|
51
|
+
date_to?: string | null;
|
|
52
|
+
interval?: '1h' | '1d' | '1w';
|
|
53
|
+
service_id?: string | null;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}>;
|
|
127
57
|
/** Voice pipeline latency metrics (TTFB, response time) */
|
|
128
|
-
getLatency(params?:
|
|
58
|
+
getLatency(params?: {
|
|
59
|
+
days?: number;
|
|
60
|
+
date_from?: string | null;
|
|
61
|
+
date_to?: string | null;
|
|
62
|
+
interval?: '1h' | '1d' | '1w';
|
|
63
|
+
service_id?: string | null;
|
|
64
|
+
}): Promise<{
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}>;
|
|
129
67
|
/** Tool call performance — success rates and latency per tool */
|
|
130
|
-
getToolPerformance(params?:
|
|
68
|
+
getToolPerformance(params?: {
|
|
69
|
+
days?: number;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}>;
|
|
131
73
|
/** Data quality metrics for the workspace world model */
|
|
132
|
-
getDataQuality(params?:
|
|
74
|
+
getDataQuality(params?: {
|
|
75
|
+
days?: number;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
workspace_id: string;
|
|
78
|
+
period_start: string;
|
|
79
|
+
period_end: string;
|
|
80
|
+
confidence_distribution: import("../index.js").components["schemas"]["ConfidenceBucket"][];
|
|
81
|
+
confidence_by_source: {
|
|
82
|
+
[key: string]: import("../index.js").components["schemas"]["ConfidenceBucket"][];
|
|
83
|
+
};
|
|
84
|
+
review_pipeline: {
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
timeseries: {
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}[];
|
|
90
|
+
total_events: number;
|
|
91
|
+
}>;
|
|
133
92
|
/** Usage summary — API requests, call minutes, storage */
|
|
134
|
-
getUsage(params?:
|
|
93
|
+
getUsage(params?: {
|
|
94
|
+
days?: number;
|
|
95
|
+
date_from?: string | null;
|
|
96
|
+
date_to?: string | null;
|
|
97
|
+
interval?: '1h' | '1d' | '1w';
|
|
98
|
+
service_id?: string | null;
|
|
99
|
+
direction?: string | null;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
workspace_id: string;
|
|
102
|
+
period_start: string;
|
|
103
|
+
period_end: string;
|
|
104
|
+
buckets: import("../index.js").components["schemas"]["UsageBucket"][];
|
|
105
|
+
total_events: number;
|
|
106
|
+
}>;
|
|
135
107
|
/** Advanced call statistics (abandonment, transfers, silence, hour-of-day) */
|
|
136
|
-
getAdvancedCallStats(params?:
|
|
108
|
+
getAdvancedCallStats(params?: {
|
|
109
|
+
days?: number;
|
|
110
|
+
date_from?: string | null;
|
|
111
|
+
date_to?: string | null;
|
|
112
|
+
interval?: '1h' | '1d' | '1w';
|
|
113
|
+
service_id?: string | null;
|
|
114
|
+
}): Promise<{
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}>;
|
|
137
117
|
/** Compare two time periods side by side */
|
|
138
118
|
compareCallPeriods(params: {
|
|
139
119
|
current_from: string;
|
|
@@ -141,6 +121,8 @@ export declare class AnalyticsResource extends WorkspaceScopedResource {
|
|
|
141
121
|
previous_from: string;
|
|
142
122
|
previous_to: string;
|
|
143
123
|
service_id?: string;
|
|
144
|
-
}): Promise<
|
|
124
|
+
}): Promise<{
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
}>;
|
|
145
127
|
}
|
|
146
128
|
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/resources/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/resources/analytics.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { components } from '../generated/api.js';
|
|
2
2
|
import type { ApiKeyId } from '../core/branded-types.js';
|
|
3
3
|
import { WorkspaceScopedResource } from './base.js';
|
|
4
4
|
import type { ListParams } from '../core/utils.js';
|
|
@@ -13,16 +13,45 @@ export declare class ApiKeysResource extends WorkspaceScopedResource {
|
|
|
13
13
|
* Get info about the currently authenticated API key.
|
|
14
14
|
* Does not require a workspace ID in the path.
|
|
15
15
|
*/
|
|
16
|
-
me(): Promise<
|
|
16
|
+
me(): Promise<{
|
|
17
|
+
workspace_id: string;
|
|
18
|
+
key_id: string;
|
|
19
|
+
name: string | null;
|
|
20
|
+
expires_at: string;
|
|
21
|
+
expires_in_seconds: number;
|
|
22
|
+
}>;
|
|
17
23
|
/** Create a new API key */
|
|
18
|
-
create(body: CreateApiKeyRequest): Promise<
|
|
24
|
+
create(body: components['schemas']['CreateApiKeyRequest']): Promise<{
|
|
25
|
+
key_id: string;
|
|
26
|
+
api_key: string;
|
|
27
|
+
name: string | null;
|
|
28
|
+
role: string;
|
|
29
|
+
permissions: string[];
|
|
30
|
+
expires_at: string;
|
|
31
|
+
created_by_entity_id: string | null;
|
|
32
|
+
created_by_credential_id: string | null;
|
|
33
|
+
}>;
|
|
19
34
|
/** List API keys in the workspace */
|
|
20
|
-
list(params?: ListParams
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
list(params?: ListParams & {
|
|
36
|
+
mine_only?: boolean;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
items: components["schemas"]["ApiKeyResponse"][];
|
|
39
|
+
has_more: boolean;
|
|
40
|
+
continuation_token?: number | null;
|
|
41
|
+
total?: number | null;
|
|
42
|
+
}>;
|
|
23
43
|
/** Revoke an API key */
|
|
24
44
|
revoke(keyId: ApiKeyId | string): Promise<void>;
|
|
25
45
|
/** Rotate an API key — invalidates the old key and issues a new one */
|
|
26
|
-
rotate(keyId: ApiKeyId | string): Promise<
|
|
46
|
+
rotate(keyId: ApiKeyId | string, body: components['schemas']['RotateApiKeyRequest']): Promise<{
|
|
47
|
+
key_id: string;
|
|
48
|
+
api_key: string;
|
|
49
|
+
name: string | null;
|
|
50
|
+
role: string;
|
|
51
|
+
permissions: string[];
|
|
52
|
+
expires_at: string;
|
|
53
|
+
created_by_entity_id: string | null;
|
|
54
|
+
created_by_credential_id: string | null;
|
|
55
|
+
}>;
|
|
27
56
|
}
|
|
28
57
|
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAe,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,uBAAuB;IAC1D;;;OAGG;IACG,EAAE;;;;;;;IAIR,2BAA2B;IACrB,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;IAS/D,qCAAqC;IAC/B,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;eAyBo1/Z,qBAAsB;;;;;IAjBl6/Z,wBAAwB;IAClB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrD,uEAAuE;IACjE,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;CAQ1F"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { components } from '../generated/api.js';
|
|
2
|
+
import { WorkspaceScopedResource } from './base.js';
|
|
3
|
+
export interface ListAuditParams {
|
|
4
|
+
service?: string | null;
|
|
5
|
+
action?: string | null;
|
|
6
|
+
actor_entity_id?: string | null;
|
|
7
|
+
resource_type?: string | null;
|
|
8
|
+
resource_id?: string | null;
|
|
9
|
+
phi_only?: boolean;
|
|
10
|
+
date_from?: string | null;
|
|
11
|
+
date_to?: string | null;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PhiAccessParams {
|
|
16
|
+
entity_id?: string | null;
|
|
17
|
+
date_from?: string | null;
|
|
18
|
+
date_to?: string | null;
|
|
19
|
+
limit?: number;
|
|
20
|
+
offset?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface EntityAccessLogParams {
|
|
23
|
+
date_from?: string | null;
|
|
24
|
+
date_to?: string | null;
|
|
25
|
+
limit?: number;
|
|
26
|
+
offset?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare class AuditResource extends WorkspaceScopedResource {
|
|
29
|
+
list(params?: ListAuditParams): Promise<{
|
|
30
|
+
events: components["schemas"]["src__routes__audit__AuditEventResponse"][];
|
|
31
|
+
total: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
offset: number;
|
|
34
|
+
has_more: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
getSummary(params?: {
|
|
37
|
+
date_from?: string | null;
|
|
38
|
+
date_to?: string | null;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
total_events: number;
|
|
41
|
+
phi_access_events: number;
|
|
42
|
+
unique_actors: number;
|
|
43
|
+
services_with_events: number;
|
|
44
|
+
}>;
|
|
45
|
+
getPhiAccess(params?: PhiAccessParams): Promise<{
|
|
46
|
+
events: components["schemas"]["src__routes__audit__AuditEventResponse"][];
|
|
47
|
+
total: number;
|
|
48
|
+
limit: number;
|
|
49
|
+
offset: number;
|
|
50
|
+
has_more: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
createExport(body: components['schemas']['AuditExportRequest']): Promise<{
|
|
53
|
+
export_id: string;
|
|
54
|
+
s3_key: string;
|
|
55
|
+
row_count: number;
|
|
56
|
+
download_url: string;
|
|
57
|
+
created_at: string;
|
|
58
|
+
}>;
|
|
59
|
+
listExports(): Promise<{
|
|
60
|
+
exports: components["schemas"]["AuditExportListItem"][];
|
|
61
|
+
}>;
|
|
62
|
+
getEntityAccessLog(entityId: string, params?: EntityAccessLogParams): Promise<{
|
|
63
|
+
events: components["schemas"]["src__routes__audit__AuditEventResponse"][];
|
|
64
|
+
total: number;
|
|
65
|
+
limit: number;
|
|
66
|
+
offset: number;
|
|
67
|
+
has_more: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/resources/audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAe,MAAM,WAAW,CAAA;AAEhE,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,aAAc,SAAQ,uBAAuB;IAClD,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe;gBAiD69+N,qBAAsB;;;;;;IAzChh/N,UAAU,CAAC,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;;;;;IAQ1E,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe;gBAiCq9+N,qBAAsB;;;;;;IAzBhh/N,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC;;;;;;;IAS9D,WAAW;iBAgBqtgO,qBAAsB;;IARtvgO,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB;gBAQu7+N,qBAAsB;;;;;;CADvh/N"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Base class for
|
|
3
|
-
*
|
|
2
|
+
* Base class for workspace-scoped resources.
|
|
3
|
+
*
|
|
4
|
+
* Uses the openapi-fetch client (with auth + error + retry middleware)
|
|
5
|
+
* injected from AmigoClient. Resources call typed HTTP methods that
|
|
6
|
+
* flow through the middleware chain automatically.
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
8
|
+
import type { Client } from 'openapi-fetch';
|
|
9
|
+
import type { paths } from '../generated/api.js';
|
|
10
|
+
import { extractData } from '../core/utils.js';
|
|
11
|
+
export type PlatformFetch = Client<paths>;
|
|
10
12
|
export declare abstract class WorkspaceScopedResource {
|
|
11
|
-
protected readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
protected workspaceUrl(path: string): string;
|
|
15
|
-
protected fetch<T>(path: string, init?: RequestInit): Promise<T>;
|
|
13
|
+
protected readonly client: PlatformFetch;
|
|
14
|
+
protected readonly workspaceId: string;
|
|
15
|
+
constructor(client: PlatformFetch, workspaceId: string);
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export { extractData };
|
|
18
18
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/resources/base.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/resources/base.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AAEzC,8BAAsB,uBAAuB;IAEzC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa;IACxC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM;gBADnB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM;CAEzC;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,19 +1,59 @@
|
|
|
1
|
-
import type { UsageSummary, Invoice, PaginatedResponse } from '../types/api.js';
|
|
2
1
|
import { WorkspaceScopedResource } from './base.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { ListParams } from '../core/utils.js';
|
|
3
|
+
export interface ListInvoicesParams extends ListParams {
|
|
4
|
+
status?: 'draft' | 'sent' | 'paid' | 'void';
|
|
5
|
+
date_from?: string;
|
|
6
|
+
date_to?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UsageTrendsParams {
|
|
9
|
+
days?: number;
|
|
10
|
+
date_from?: string;
|
|
11
|
+
date_to?: string;
|
|
12
|
+
meter_key?: string;
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
8
|
-
* Billing — usage summaries and
|
|
15
|
+
* Billing — dashboard, usage summaries, invoices, and usage trends.
|
|
9
16
|
*/
|
|
10
17
|
export declare class BillingResource extends WorkspaceScopedResource {
|
|
11
|
-
/** Get
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
/** Get composite billing dashboard — KPIs, period comparison, top meters, invoice summary */
|
|
19
|
+
getDashboard(): Promise<{
|
|
20
|
+
workspace_id: string;
|
|
21
|
+
current_period_total: number;
|
|
22
|
+
previous_period_total: number | null;
|
|
23
|
+
delta_pct: number | null;
|
|
24
|
+
top_meters: import("../index.js").components["schemas"]["MeterSummary"][];
|
|
25
|
+
invoice_status_summary: {
|
|
26
|
+
[key: string]: number;
|
|
27
|
+
};
|
|
28
|
+
period_start: string | null;
|
|
29
|
+
period_end: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
/** Get usage summary for the workspace */
|
|
32
|
+
getUsage(): Promise<{
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}>;
|
|
35
|
+
/** Get usage time-series per meter for trend charts */
|
|
36
|
+
getUsageTrends(params?: UsageTrendsParams): Promise<{
|
|
37
|
+
period_start: string;
|
|
38
|
+
period_end: string;
|
|
39
|
+
meter_key: string;
|
|
40
|
+
value: number;
|
|
41
|
+
unit: string;
|
|
42
|
+
}[]>;
|
|
43
|
+
/** List invoices for the workspace */
|
|
44
|
+
listInvoices(params?: ListInvoicesParams): Promise<{
|
|
45
|
+
items: import("../index.js").components["schemas"]["InvoiceItem"][];
|
|
46
|
+
has_more: boolean;
|
|
47
|
+
continuation_token?: number | null;
|
|
48
|
+
total?: number | null;
|
|
49
|
+
}>;
|
|
50
|
+
/** Get invoice detail */
|
|
51
|
+
getInvoice(invoiceId: string): Promise<{
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}>;
|
|
54
|
+
/** Get presigned S3 URL for invoice PDF download */
|
|
55
|
+
getInvoicePdf(invoiceId: string): Promise<{
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}>;
|
|
18
58
|
}
|
|
19
59
|
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAe,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,uBAAuB;IAC1D,6FAA6F;IACvF,YAAY;;;;;oBAqD851O,2CAAsB;;;;;;;IA7Ct81O,0CAA0C;IACpC,QAAQ;;;IAQd,uDAAuD;IACjD,cAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB;;;;;;;IAQ/C,sCAAsC;IAChC,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB;eA0Bknma,2CAAsB;;;;;IAlBtrma,yBAAyB;IACnB,UAAU,CAAC,SAAS,EAAE,MAAM;;;IAQlC,oDAAoD;IAC9C,aAAa,CAAC,SAAS,EAAE,MAAM;;;CAOtC"}
|