@updraft-solutions/mcrit-sdk 0.18.7 → 0.19.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/dist/{conversation-WwfMCoZ6.d.cts → conversation-CWH383yh.d.cts} +12102 -11970
- package/dist/{conversation-WwfMCoZ6.d.ts → conversation-CWH383yh.d.ts} +12102 -11970
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/schemas/index.d.cts +247 -337
- package/dist/schemas/index.d.ts +247 -337
- package/dist/types/index.d.cts +3 -134
- package/dist/types/index.d.ts +3 -134
- package/package.json +1 -1
- package/src/schemas/report.ts +127 -260
package/src/schemas/report.ts
CHANGED
|
@@ -1,306 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
export type ReportStatus = "pending" | "processing" | "completed" | "failed";
|
|
1
|
+
import type { Media } from "../types/models";
|
|
3
2
|
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// Company reports (Berichte) — section-document contract.
|
|
5
|
+
// A report is compiled server-side into an ordered list of typed sections;
|
|
6
|
+
// the same JSON drives the PDF and the in-app viewer. Values are raw numbers
|
|
7
|
+
// with a `format`; `label`-format values and every `*Key`/`label`/`title`
|
|
8
|
+
// string are translation keys resolved through `ReportDetail.labels`.
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
export type ReportGranularity =
|
|
13
|
-
| "total"
|
|
14
|
-
| "yearly"
|
|
15
|
-
| "quarterly"
|
|
16
|
-
| "monthly"
|
|
17
|
-
| "weekly"
|
|
18
|
-
| "daily";
|
|
11
|
+
export type ReportStatus = "queued" | "processing" | "completed" | "failed";
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
export interface Media {
|
|
22
|
-
type: "media";
|
|
23
|
-
id: number;
|
|
24
|
-
description?: string;
|
|
25
|
-
url: string | null;
|
|
26
|
-
mime_type: string;
|
|
27
|
-
file_name: string;
|
|
28
|
-
size: number;
|
|
29
|
-
collection_name: string;
|
|
30
|
-
created_at: string;
|
|
31
|
-
updated_at: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Media Collection (for reports - only PDF)
|
|
35
|
-
export interface ReportMedia {
|
|
36
|
-
pdf?: Media | null;
|
|
37
|
-
}
|
|
13
|
+
export type ReportType = "financial" | "operations" | "training" | "development";
|
|
38
14
|
|
|
39
|
-
|
|
40
|
-
export interface Report {
|
|
41
|
-
id: number;
|
|
42
|
-
reportable_type: string;
|
|
43
|
-
reportable_id: number;
|
|
44
|
-
report_type: ReportType;
|
|
45
|
-
parameters: ReportParameters;
|
|
46
|
-
data: ReportData;
|
|
47
|
-
metadata: ReportMetadata;
|
|
48
|
-
status: ReportStatus;
|
|
49
|
-
generated_at: string | null;
|
|
50
|
-
expires_at: string | null;
|
|
51
|
-
created_at: string;
|
|
52
|
-
updated_at: string;
|
|
53
|
-
media?: ReportMedia;
|
|
54
|
-
}
|
|
15
|
+
export type ReportGranularity = "total" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
55
16
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
17
|
+
export type ReportValueFormat =
|
|
18
|
+
| "number"
|
|
19
|
+
| "currency"
|
|
20
|
+
| "percent"
|
|
21
|
+
| "hours"
|
|
22
|
+
| "date"
|
|
23
|
+
| "text"
|
|
24
|
+
| "label";
|
|
62
25
|
|
|
63
|
-
|
|
64
|
-
export interface ReportGenerationParams {
|
|
65
|
-
type: ReportType;
|
|
66
|
-
start_date?: string | null;
|
|
67
|
-
end_date?: string | null;
|
|
68
|
-
granularity?: ReportGranularity;
|
|
69
|
-
}
|
|
26
|
+
export type ReportChartKind = "line" | "bar" | "horizontal_bar" | "stacked_bar" | "donut";
|
|
70
27
|
|
|
71
|
-
|
|
72
|
-
export interface ReportMetadata {
|
|
73
|
-
requested_by?: number;
|
|
74
|
-
requested_at?: string;
|
|
75
|
-
started_at?: string;
|
|
76
|
-
completed_at?: string;
|
|
77
|
-
duration_seconds?: number;
|
|
78
|
-
attempt?: number;
|
|
79
|
-
error?: string;
|
|
80
|
-
batch?: boolean;
|
|
81
|
-
}
|
|
28
|
+
export type ReportCellValue = string | number | null;
|
|
82
29
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
30
|
+
export interface ReportComparison {
|
|
31
|
+
current: number | null;
|
|
32
|
+
previous: number | null;
|
|
33
|
+
previous_year: number | null;
|
|
34
|
+
/** Percent delta vs the previous period; null without a usable baseline. */
|
|
35
|
+
delta_previous: number | null;
|
|
36
|
+
delta_previous_year: number | null;
|
|
87
37
|
}
|
|
88
38
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
96
|
-
// =====================
|
|
97
|
-
// Financial Report Types
|
|
98
|
-
// =====================
|
|
99
|
-
|
|
100
|
-
export interface FinancialReportData {
|
|
101
|
-
revenue: PeriodData<RevenueData>;
|
|
102
|
-
expenses: PeriodData<ExpenseData>;
|
|
103
|
-
invoices: PeriodData<InvoiceData>;
|
|
104
|
-
prepaid_packages: PeriodData<PrepaidPackageData>;
|
|
105
|
-
summary: PeriodData<FinancialSummaryData>;
|
|
39
|
+
export interface ReportKpi {
|
|
40
|
+
/** Translation key (see `ReportDetail.labels`). */
|
|
41
|
+
label: string;
|
|
42
|
+
value: number | null;
|
|
43
|
+
format: ReportValueFormat;
|
|
44
|
+
comparison: ReportComparison | null;
|
|
106
45
|
}
|
|
107
46
|
|
|
108
|
-
export interface
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
count?: number;
|
|
47
|
+
export interface ReportKpiGridSection {
|
|
48
|
+
kind: "kpi_grid";
|
|
49
|
+
title: string;
|
|
50
|
+
items: ReportKpi[];
|
|
113
51
|
}
|
|
114
52
|
|
|
115
|
-
export interface
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
53
|
+
export interface ReportColumn {
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
format: ReportValueFormat;
|
|
57
|
+
align: "left" | "right";
|
|
120
58
|
}
|
|
121
59
|
|
|
122
|
-
export interface
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
60
|
+
export interface ReportDataTableSection {
|
|
61
|
+
kind: "data_table";
|
|
62
|
+
title: string;
|
|
63
|
+
columns: ReportColumn[];
|
|
64
|
+
rows: Record<string, ReportCellValue>[];
|
|
65
|
+
totals: Record<string, ReportCellValue> | null;
|
|
66
|
+
/** Translation key shown when `rows` is empty. */
|
|
67
|
+
empty: string | null;
|
|
127
68
|
}
|
|
128
69
|
|
|
129
|
-
export interface
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
total_remaining_value: number;
|
|
133
|
-
total_used_value: number;
|
|
134
|
-
usage_percentage: number;
|
|
70
|
+
export interface ReportSeries {
|
|
71
|
+
label: string;
|
|
72
|
+
data: (number | null)[];
|
|
135
73
|
}
|
|
136
74
|
|
|
137
|
-
export interface
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
75
|
+
export interface ReportChartSection {
|
|
76
|
+
kind: "chart";
|
|
77
|
+
title: string;
|
|
78
|
+
chart: ReportChartKind;
|
|
79
|
+
/** Axis labels, or slice labels for a donut; may be translation keys. */
|
|
80
|
+
categories: string[];
|
|
81
|
+
series: ReportSeries[];
|
|
82
|
+
format: ReportValueFormat;
|
|
142
83
|
}
|
|
143
84
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
flight_hours: FlightHoursData;
|
|
150
|
-
bookings: BookingsData;
|
|
151
|
-
landings: LandingsData;
|
|
152
|
-
aircraft_utilization: AircraftUtilization[];
|
|
153
|
-
member_activity: MemberActivityData;
|
|
85
|
+
export interface ReportCalloutSection {
|
|
86
|
+
kind: "callout";
|
|
87
|
+
text: string;
|
|
88
|
+
params: Record<string, string | number | boolean>;
|
|
89
|
+
tone: "info" | "warning";
|
|
154
90
|
}
|
|
155
91
|
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
by_period?: Record<
|
|
162
|
-
string,
|
|
163
|
-
{
|
|
164
|
-
hours: number;
|
|
165
|
-
flights: number;
|
|
166
|
-
average: number;
|
|
167
|
-
}
|
|
168
|
-
>;
|
|
169
|
-
}
|
|
92
|
+
export type ReportSection =
|
|
93
|
+
| ReportKpiGridSection
|
|
94
|
+
| ReportDataTableSection
|
|
95
|
+
| ReportChartSection
|
|
96
|
+
| ReportCalloutSection;
|
|
170
97
|
|
|
171
|
-
export interface
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
string,
|
|
178
|
-
{
|
|
179
|
-
total: number;
|
|
180
|
-
completed: number;
|
|
181
|
-
cancelled: number;
|
|
182
|
-
}
|
|
183
|
-
>;
|
|
98
|
+
export interface ReportParameters {
|
|
99
|
+
/** Local calendar date (Y-m-d) in `timezone`. */
|
|
100
|
+
start_date: string;
|
|
101
|
+
end_date: string;
|
|
102
|
+
granularity: ReportGranularity;
|
|
103
|
+
timezone: string;
|
|
184
104
|
}
|
|
185
105
|
|
|
186
|
-
export interface
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
count: number;
|
|
194
|
-
}>;
|
|
106
|
+
export interface ReportDocument {
|
|
107
|
+
version: number;
|
|
108
|
+
type: ReportType;
|
|
109
|
+
company_id: number;
|
|
110
|
+
period: ReportParameters;
|
|
111
|
+
locale: string;
|
|
112
|
+
sections: ReportSection[];
|
|
195
113
|
}
|
|
196
114
|
|
|
197
|
-
export interface
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
aircraft_name: string;
|
|
201
|
-
total_hours: number;
|
|
202
|
-
total_bookings: number;
|
|
203
|
-
utilization_rate: number;
|
|
115
|
+
export interface ReportRequester {
|
|
116
|
+
id: number;
|
|
117
|
+
name: string;
|
|
204
118
|
}
|
|
205
119
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
120
|
+
/** Identity tier — what the list shows; never carries the section document. */
|
|
121
|
+
export interface Report {
|
|
122
|
+
type: "report";
|
|
123
|
+
id: number;
|
|
124
|
+
report_type: ReportType;
|
|
125
|
+
status: ReportStatus;
|
|
126
|
+
parameters: ReportParameters;
|
|
127
|
+
locale: string;
|
|
128
|
+
error: string | null;
|
|
129
|
+
generated_at: string | null;
|
|
130
|
+
created_at: string | null;
|
|
131
|
+
requested_by?: ReportRequester | null;
|
|
132
|
+
background_task_uuid?: string | null;
|
|
133
|
+
media?: { pdf: Media | null };
|
|
134
|
+
can?: Record<string, boolean | null>;
|
|
214
135
|
}
|
|
215
136
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
export interface InstructorEfficiencyReportData {
|
|
221
|
-
instructors: InstructorData[];
|
|
222
|
-
summary: InstructorSummaryData;
|
|
223
|
-
period: {
|
|
224
|
-
start_date: string;
|
|
225
|
-
end_date: string;
|
|
226
|
-
};
|
|
137
|
+
export interface ReportDetail extends Report {
|
|
138
|
+
data: ReportDocument | null;
|
|
139
|
+
/** Translation key → text in the report's locale, for every key the document uses. */
|
|
140
|
+
labels: Record<string, string>;
|
|
227
141
|
}
|
|
228
142
|
|
|
229
|
-
export interface
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
total_bookings: number;
|
|
234
|
-
average_efficiency: number;
|
|
235
|
-
average_delay_minutes: number;
|
|
236
|
-
total_flight_hours: number;
|
|
237
|
-
bookings_with_efficiency: number;
|
|
238
|
-
by_period?: Record<
|
|
239
|
-
string,
|
|
240
|
-
{
|
|
241
|
-
bookings: number;
|
|
242
|
-
efficiency: number;
|
|
243
|
-
delay: number;
|
|
244
|
-
hours: number;
|
|
245
|
-
}
|
|
246
|
-
>;
|
|
143
|
+
export interface ReportTypeMeta {
|
|
144
|
+
type: ReportType;
|
|
145
|
+
title: string;
|
|
146
|
+
description: string;
|
|
247
147
|
}
|
|
248
148
|
|
|
249
|
-
export interface
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
average_delay_overall: number;
|
|
253
|
-
total_bookings_overall: number;
|
|
254
|
-
total_flight_hours_overall: number;
|
|
255
|
-
best_performer: {
|
|
256
|
-
name: string;
|
|
257
|
-
efficiency: number;
|
|
258
|
-
};
|
|
149
|
+
export interface ReportGranularityMeta {
|
|
150
|
+
value: ReportGranularity;
|
|
151
|
+
label: string;
|
|
259
152
|
}
|
|
260
153
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
summary?: Record<string, any>;
|
|
267
|
-
metrics?: Record<string, any>;
|
|
268
|
-
by_period?: Record<string, any>;
|
|
154
|
+
/** `GET companies/{company}/meta/reports` */
|
|
155
|
+
export interface ReportMeta {
|
|
156
|
+
types: ReportTypeMeta[];
|
|
157
|
+
granularities: ReportGranularityMeta[];
|
|
158
|
+
max_buckets: number;
|
|
269
159
|
}
|
|
270
160
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
// =====================
|
|
274
|
-
|
|
275
|
-
// Report list item for display in tables/lists
|
|
276
|
-
export interface ReportListItem {
|
|
277
|
-
id: number;
|
|
161
|
+
/** `POST companies/{company}/reports` */
|
|
162
|
+
export interface StoreReportInput {
|
|
278
163
|
type: ReportType;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
parameters: ReportParameters;
|
|
164
|
+
start_date: string;
|
|
165
|
+
end_date: string;
|
|
166
|
+
granularity?: ReportGranularity;
|
|
283
167
|
}
|
|
284
168
|
|
|
285
|
-
|
|
286
|
-
export interface
|
|
169
|
+
/** 409 body when an identical report is already queued or processing. */
|
|
170
|
+
export interface ReportConflictResponse {
|
|
287
171
|
message: string;
|
|
288
|
-
data
|
|
289
|
-
skipped?: Array<{
|
|
290
|
-
type: ReportType;
|
|
291
|
-
message: string;
|
|
292
|
-
report: Report;
|
|
293
|
-
}>;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// Report status response
|
|
297
|
-
export interface ReportStatusResponse {
|
|
298
|
-
data: {
|
|
299
|
-
id: number;
|
|
300
|
-
status: ReportStatus;
|
|
301
|
-
report_type: ReportType;
|
|
302
|
-
created_at: string;
|
|
303
|
-
generated_at: string | null;
|
|
304
|
-
metadata: ReportMetadata;
|
|
305
|
-
};
|
|
172
|
+
data: Report;
|
|
306
173
|
}
|