@hyperscale0/udl 3.1.0 → 3.2.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,478 @@
1
+ import * as z from "zod";
2
+ export declare const reportTypeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ kind: z.ZodLiteral<"money">;
4
+ currency: z.ZodString;
5
+ }, z.core.$strict>, z.ZodObject<{
6
+ kind: z.ZodEnum<{
7
+ boolean: "boolean";
8
+ date: "date";
9
+ integer: "integer";
10
+ text: "text";
11
+ }>;
12
+ }, z.core.$strict>], "kind">;
13
+ export type ReportType = z.infer<typeof reportTypeSchema>;
14
+ /** Ordered expressions form a finite typed graph. References only point backwards. */
15
+ export declare const reportExpressionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ id: z.ZodString;
17
+ op: z.ZodLiteral<"field">;
18
+ path: z.ZodString;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ id: z.ZodString;
21
+ op: z.ZodLiteral<"literal">;
22
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
23
+ kind: z.ZodLiteral<"money">;
24
+ currency: z.ZodString;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodEnum<{
27
+ boolean: "boolean";
28
+ date: "date";
29
+ integer: "integer";
30
+ text: "text";
31
+ }>;
32
+ }, z.core.$strict>], "kind">;
33
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ id: z.ZodString;
36
+ op: z.ZodLiteral<"parameter">;
37
+ name: z.ZodEnum<{
38
+ observationAt: "observationAt";
39
+ periodEnd: "periodEnd";
40
+ periodStart: "periodStart";
41
+ }>;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ id: z.ZodString;
44
+ op: z.ZodEnum<{
45
+ and: "and";
46
+ atMost: "atMost";
47
+ daysBetween: "daysBetween";
48
+ equal: "equal";
49
+ less: "less";
50
+ maximum: "maximum";
51
+ minimum: "minimum";
52
+ or: "or";
53
+ subtract: "subtract";
54
+ sum: "sum";
55
+ }>;
56
+ left: z.ZodString;
57
+ right: z.ZodString;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ id: z.ZodString;
60
+ op: z.ZodLiteral<"not">;
61
+ value: z.ZodString;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ id: z.ZodString;
64
+ op: z.ZodLiteral<"choose">;
65
+ condition: z.ZodString;
66
+ yes: z.ZodString;
67
+ no: z.ZodString;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ id: z.ZodString;
70
+ op: z.ZodLiteral<"bucket">;
71
+ value: z.ZodString;
72
+ unit: z.ZodEnum<{
73
+ month: "month";
74
+ quarter: "quarter";
75
+ }>;
76
+ }, z.core.$strict>, z.ZodObject<{
77
+ id: z.ZodString;
78
+ op: z.ZodLiteral<"ratio">;
79
+ numerator: z.ZodString;
80
+ denominator: z.ZodString;
81
+ scale: z.ZodNumber;
82
+ rounding: z.ZodEnum<{
83
+ floor: "floor";
84
+ halfUp: "halfUp";
85
+ }>;
86
+ zero: z.ZodEnum<{
87
+ null: "null";
88
+ refuse: "refuse";
89
+ }>;
90
+ }, z.core.$strict>], "op">;
91
+ export declare const reportDefinitionSchema: z.ZodObject<{
92
+ identity: z.ZodObject<{
93
+ id: z.ZodString;
94
+ version: z.ZodNumber;
95
+ description: z.ZodString;
96
+ }, z.core.$strict>;
97
+ scope: z.ZodObject<{
98
+ kind: z.ZodEnum<{
99
+ company: "company";
100
+ product: "product";
101
+ }>;
102
+ classification: z.ZodEnum<{
103
+ internal: "internal";
104
+ personal: "personal";
105
+ restricted: "restricted";
106
+ }>;
107
+ currency: z.ZodString;
108
+ }, z.core.$strict>;
109
+ datasets: z.ZodArray<z.ZodObject<{
110
+ id: z.ZodString;
111
+ source: z.ZodEnum<{
112
+ account: "account";
113
+ identity: "identity";
114
+ instrument: "instrument";
115
+ operation: "operation";
116
+ }>;
117
+ instruments: z.ZodArray<z.ZodString>;
118
+ rowKey: z.ZodString;
119
+ columns: z.ZodArray<z.ZodObject<{
120
+ name: z.ZodString;
121
+ field: z.ZodString;
122
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
123
+ kind: z.ZodLiteral<"money">;
124
+ currency: z.ZodString;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ kind: z.ZodEnum<{
127
+ boolean: "boolean";
128
+ date: "date";
129
+ integer: "integer";
130
+ text: "text";
131
+ }>;
132
+ }, z.core.$strict>], "kind">;
133
+ required: z.ZodBoolean;
134
+ }, z.core.$strict>>;
135
+ expressions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ id: z.ZodString;
137
+ op: z.ZodLiteral<"field">;
138
+ path: z.ZodString;
139
+ }, z.core.$strict>, z.ZodObject<{
140
+ id: z.ZodString;
141
+ op: z.ZodLiteral<"literal">;
142
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
143
+ kind: z.ZodLiteral<"money">;
144
+ currency: z.ZodString;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ kind: z.ZodEnum<{
147
+ boolean: "boolean";
148
+ date: "date";
149
+ integer: "integer";
150
+ text: "text";
151
+ }>;
152
+ }, z.core.$strict>], "kind">;
153
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ id: z.ZodString;
156
+ op: z.ZodLiteral<"parameter">;
157
+ name: z.ZodEnum<{
158
+ observationAt: "observationAt";
159
+ periodEnd: "periodEnd";
160
+ periodStart: "periodStart";
161
+ }>;
162
+ }, z.core.$strict>, z.ZodObject<{
163
+ id: z.ZodString;
164
+ op: z.ZodEnum<{
165
+ and: "and";
166
+ atMost: "atMost";
167
+ daysBetween: "daysBetween";
168
+ equal: "equal";
169
+ less: "less";
170
+ maximum: "maximum";
171
+ minimum: "minimum";
172
+ or: "or";
173
+ subtract: "subtract";
174
+ sum: "sum";
175
+ }>;
176
+ left: z.ZodString;
177
+ right: z.ZodString;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ id: z.ZodString;
180
+ op: z.ZodLiteral<"not">;
181
+ value: z.ZodString;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ id: z.ZodString;
184
+ op: z.ZodLiteral<"choose">;
185
+ condition: z.ZodString;
186
+ yes: z.ZodString;
187
+ no: z.ZodString;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ id: z.ZodString;
190
+ op: z.ZodLiteral<"bucket">;
191
+ value: z.ZodString;
192
+ unit: z.ZodEnum<{
193
+ month: "month";
194
+ quarter: "quarter";
195
+ }>;
196
+ }, z.core.$strict>, z.ZodObject<{
197
+ id: z.ZodString;
198
+ op: z.ZodLiteral<"ratio">;
199
+ numerator: z.ZodString;
200
+ denominator: z.ZodString;
201
+ scale: z.ZodNumber;
202
+ rounding: z.ZodEnum<{
203
+ floor: "floor";
204
+ halfUp: "halfUp";
205
+ }>;
206
+ zero: z.ZodEnum<{
207
+ null: "null";
208
+ refuse: "refuse";
209
+ }>;
210
+ }, z.core.$strict>], "op">>;
211
+ selection: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>>;
213
+ time: z.ZodObject<{
214
+ timezone: z.ZodLiteral<"Asia/Riyadh">;
215
+ boundary: z.ZodLiteral<"startInclusiveEndExclusive">;
216
+ observation: z.ZodLiteral<"periodEnd">;
217
+ history: z.ZodLiteral<"retainedOnly">;
218
+ }, z.core.$strict>;
219
+ selection: z.ZodObject<{
220
+ dataset: z.ZodString;
221
+ predicate: z.ZodOptional<z.ZodString>;
222
+ }, z.core.$strict>;
223
+ calculation: z.ZodObject<{
224
+ joins: z.ZodArray<z.ZodObject<{
225
+ dataset: z.ZodString;
226
+ local: z.ZodString;
227
+ foreign: z.ZodString;
228
+ cardinality: z.ZodEnum<{
229
+ many: "many";
230
+ one: "one";
231
+ }>;
232
+ missing: z.ZodEnum<{
233
+ allow: "allow";
234
+ refuse: "refuse";
235
+ }>;
236
+ aggregates: z.ZodArray<z.ZodObject<{
237
+ name: z.ZodString;
238
+ op: z.ZodEnum<{
239
+ average: "average";
240
+ count: "count";
241
+ maximum: "maximum";
242
+ minimum: "minimum";
243
+ sum: "sum";
244
+ }>;
245
+ rounding: z.ZodOptional<z.ZodEnum<{
246
+ floor: "floor";
247
+ halfUp: "halfUp";
248
+ }>>;
249
+ value: z.ZodOptional<z.ZodString>;
250
+ }, z.core.$strict>>;
251
+ }, z.core.$strict>>;
252
+ expressions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
253
+ id: z.ZodString;
254
+ op: z.ZodLiteral<"field">;
255
+ path: z.ZodString;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ id: z.ZodString;
258
+ op: z.ZodLiteral<"literal">;
259
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ kind: z.ZodLiteral<"money">;
261
+ currency: z.ZodString;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ kind: z.ZodEnum<{
264
+ boolean: "boolean";
265
+ date: "date";
266
+ integer: "integer";
267
+ text: "text";
268
+ }>;
269
+ }, z.core.$strict>], "kind">;
270
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
271
+ }, z.core.$strict>, z.ZodObject<{
272
+ id: z.ZodString;
273
+ op: z.ZodLiteral<"parameter">;
274
+ name: z.ZodEnum<{
275
+ observationAt: "observationAt";
276
+ periodEnd: "periodEnd";
277
+ periodStart: "periodStart";
278
+ }>;
279
+ }, z.core.$strict>, z.ZodObject<{
280
+ id: z.ZodString;
281
+ op: z.ZodEnum<{
282
+ and: "and";
283
+ atMost: "atMost";
284
+ daysBetween: "daysBetween";
285
+ equal: "equal";
286
+ less: "less";
287
+ maximum: "maximum";
288
+ minimum: "minimum";
289
+ or: "or";
290
+ subtract: "subtract";
291
+ sum: "sum";
292
+ }>;
293
+ left: z.ZodString;
294
+ right: z.ZodString;
295
+ }, z.core.$strict>, z.ZodObject<{
296
+ id: z.ZodString;
297
+ op: z.ZodLiteral<"not">;
298
+ value: z.ZodString;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ id: z.ZodString;
301
+ op: z.ZodLiteral<"choose">;
302
+ condition: z.ZodString;
303
+ yes: z.ZodString;
304
+ no: z.ZodString;
305
+ }, z.core.$strict>, z.ZodObject<{
306
+ id: z.ZodString;
307
+ op: z.ZodLiteral<"bucket">;
308
+ value: z.ZodString;
309
+ unit: z.ZodEnum<{
310
+ month: "month";
311
+ quarter: "quarter";
312
+ }>;
313
+ }, z.core.$strict>, z.ZodObject<{
314
+ id: z.ZodString;
315
+ op: z.ZodLiteral<"ratio">;
316
+ numerator: z.ZodString;
317
+ denominator: z.ZodString;
318
+ scale: z.ZodNumber;
319
+ rounding: z.ZodEnum<{
320
+ floor: "floor";
321
+ halfUp: "halfUp";
322
+ }>;
323
+ zero: z.ZodEnum<{
324
+ null: "null";
325
+ refuse: "refuse";
326
+ }>;
327
+ }, z.core.$strict>], "op">>;
328
+ groupBy: z.ZodArray<z.ZodString>;
329
+ aggregates: z.ZodArray<z.ZodObject<{
330
+ name: z.ZodString;
331
+ op: z.ZodEnum<{
332
+ average: "average";
333
+ count: "count";
334
+ maximum: "maximum";
335
+ minimum: "minimum";
336
+ sum: "sum";
337
+ }>;
338
+ rounding: z.ZodOptional<z.ZodEnum<{
339
+ floor: "floor";
340
+ halfUp: "halfUp";
341
+ }>>;
342
+ value: z.ZodOptional<z.ZodString>;
343
+ }, z.core.$strict>>;
344
+ resultExpressions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
345
+ id: z.ZodString;
346
+ op: z.ZodLiteral<"field">;
347
+ path: z.ZodString;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ id: z.ZodString;
350
+ op: z.ZodLiteral<"literal">;
351
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
352
+ kind: z.ZodLiteral<"money">;
353
+ currency: z.ZodString;
354
+ }, z.core.$strict>, z.ZodObject<{
355
+ kind: z.ZodEnum<{
356
+ boolean: "boolean";
357
+ date: "date";
358
+ integer: "integer";
359
+ text: "text";
360
+ }>;
361
+ }, z.core.$strict>], "kind">;
362
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
363
+ }, z.core.$strict>, z.ZodObject<{
364
+ id: z.ZodString;
365
+ op: z.ZodLiteral<"parameter">;
366
+ name: z.ZodEnum<{
367
+ observationAt: "observationAt";
368
+ periodEnd: "periodEnd";
369
+ periodStart: "periodStart";
370
+ }>;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ id: z.ZodString;
373
+ op: z.ZodEnum<{
374
+ and: "and";
375
+ atMost: "atMost";
376
+ daysBetween: "daysBetween";
377
+ equal: "equal";
378
+ less: "less";
379
+ maximum: "maximum";
380
+ minimum: "minimum";
381
+ or: "or";
382
+ subtract: "subtract";
383
+ sum: "sum";
384
+ }>;
385
+ left: z.ZodString;
386
+ right: z.ZodString;
387
+ }, z.core.$strict>, z.ZodObject<{
388
+ id: z.ZodString;
389
+ op: z.ZodLiteral<"not">;
390
+ value: z.ZodString;
391
+ }, z.core.$strict>, z.ZodObject<{
392
+ id: z.ZodString;
393
+ op: z.ZodLiteral<"choose">;
394
+ condition: z.ZodString;
395
+ yes: z.ZodString;
396
+ no: z.ZodString;
397
+ }, z.core.$strict>, z.ZodObject<{
398
+ id: z.ZodString;
399
+ op: z.ZodLiteral<"bucket">;
400
+ value: z.ZodString;
401
+ unit: z.ZodEnum<{
402
+ month: "month";
403
+ quarter: "quarter";
404
+ }>;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ id: z.ZodString;
407
+ op: z.ZodLiteral<"ratio">;
408
+ numerator: z.ZodString;
409
+ denominator: z.ZodString;
410
+ scale: z.ZodNumber;
411
+ rounding: z.ZodEnum<{
412
+ floor: "floor";
413
+ halfUp: "halfUp";
414
+ }>;
415
+ zero: z.ZodEnum<{
416
+ null: "null";
417
+ refuse: "refuse";
418
+ }>;
419
+ }, z.core.$strict>], "op">>;
420
+ }, z.core.$strict>;
421
+ validation: z.ZodObject<{
422
+ empty: z.ZodEnum<{
423
+ noEligibleFacilities: "noEligibleFacilities";
424
+ refuse: "refuse";
425
+ }>;
426
+ required: z.ZodArray<z.ZodString>;
427
+ rowReconcile: z.ZodArray<z.ZodObject<{
428
+ left: z.ZodString;
429
+ right: z.ZodString;
430
+ }, z.core.$strict>>;
431
+ reconcile: z.ZodArray<z.ZodObject<{
432
+ left: z.ZodString;
433
+ right: z.ZodString;
434
+ }, z.core.$strict>>;
435
+ unavailableFacts: z.ZodArray<z.ZodString>;
436
+ lockTimeoutMs: z.ZodNumber;
437
+ captureTimeoutMs: z.ZodNumber;
438
+ maxRows: z.ZodNumber;
439
+ maxJoinRows: z.ZodNumber;
440
+ maxBytes: z.ZodNumber;
441
+ }, z.core.$strict>;
442
+ output: z.ZodObject<{
443
+ profile: z.ZodLiteral<"internal.v1">;
444
+ formats: z.ZodArray<z.ZodEnum<{
445
+ csv: "csv";
446
+ json: "json";
447
+ }>>;
448
+ columns: z.ZodArray<z.ZodObject<{
449
+ name: z.ZodString;
450
+ label: z.ZodString;
451
+ type: z.ZodDiscriminatedUnion<[z.ZodObject<{
452
+ kind: z.ZodLiteral<"money">;
453
+ currency: z.ZodString;
454
+ }, z.core.$strict>, z.ZodObject<{
455
+ kind: z.ZodEnum<{
456
+ boolean: "boolean";
457
+ date: "date";
458
+ integer: "integer";
459
+ text: "text";
460
+ }>;
461
+ }, z.core.$strict>], "kind">;
462
+ }, z.core.$strict>>;
463
+ sort: z.ZodArray<z.ZodString>;
464
+ }, z.core.$strict>;
465
+ authority: z.ZodObject<{
466
+ request: z.ZodArray<z.ZodString>;
467
+ read: z.ZodArray<z.ZodString>;
468
+ release: z.ZodArray<z.ZodString>;
469
+ independentApproval: z.ZodLiteral<true>;
470
+ retention: z.ZodObject<{
471
+ policy: z.ZodString;
472
+ years: z.ZodNumber;
473
+ }, z.core.$strict>;
474
+ }, z.core.$strict>;
475
+ }, z.core.$strict>;
476
+ export type ReportDefinition = z.infer<typeof reportDefinitionSchema>;
477
+ export type ReportExpression = z.infer<typeof reportExpressionSchema>;
478
+ //# sourceMappingURL=reporting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporting.d.ts","sourceRoot":"","sources":["../src/reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAWzB,eAAO,MAAM,gBAAgB;;;;;;;;;;4BAM3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,sFAAsF;AACtF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAqDjC,CAAC;AAaH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyFjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,170 @@
1
+ import * as z from "zod";
2
+ const name = z
3
+ .string()
4
+ .regex(/^[a-z][a-zA-Z0-9_]*$/)
5
+ .max(80);
6
+ const path = z
7
+ .string()
8
+ .regex(/^[a-z][a-zA-Z0-9_]*(\.[a-z][a-zA-Z0-9_]*)*$/)
9
+ .max(240);
10
+ const integer = z.number().int().safe();
11
+ export const reportTypeSchema = z.discriminatedUnion("kind", [
12
+ z.strictObject({
13
+ kind: z.literal("money"),
14
+ currency: z.string().regex(/^[A-Z]{3}$/),
15
+ }),
16
+ z.strictObject({ kind: z.enum(["text", "integer", "boolean", "date"]) }),
17
+ ]);
18
+ const literal = z.union([z.string().max(2048), integer, z.boolean()]);
19
+ /** Ordered expressions form a finite typed graph. References only point backwards. */
20
+ export const reportExpressionSchema = z.discriminatedUnion("op", [
21
+ z.strictObject({ id: name, op: z.literal("field"), path }),
22
+ z.strictObject({
23
+ id: name,
24
+ op: z.literal("literal"),
25
+ type: reportTypeSchema,
26
+ value: literal,
27
+ }),
28
+ z.strictObject({
29
+ id: name,
30
+ op: z.literal("parameter"),
31
+ name: z.enum(["periodStart", "periodEnd", "observationAt"]),
32
+ }),
33
+ z.strictObject({
34
+ id: name,
35
+ op: z.enum([
36
+ "sum",
37
+ "subtract",
38
+ "minimum",
39
+ "maximum",
40
+ "equal",
41
+ "less",
42
+ "atMost",
43
+ "and",
44
+ "or",
45
+ "daysBetween",
46
+ ]),
47
+ left: name,
48
+ right: name,
49
+ }),
50
+ z.strictObject({ id: name, op: z.literal("not"), value: name }),
51
+ z.strictObject({
52
+ id: name,
53
+ op: z.literal("choose"),
54
+ condition: name,
55
+ yes: name,
56
+ no: name,
57
+ }),
58
+ z.strictObject({
59
+ id: name,
60
+ op: z.literal("bucket"),
61
+ value: name,
62
+ unit: z.enum(["month", "quarter"]),
63
+ }),
64
+ z.strictObject({
65
+ id: name,
66
+ op: z.literal("ratio"),
67
+ numerator: name,
68
+ denominator: name,
69
+ scale: integer.min(1).max(1000000),
70
+ rounding: z.enum(["floor", "halfUp"]),
71
+ zero: z.enum(["refuse", "null"]),
72
+ }),
73
+ ]);
74
+ const column = z.strictObject({
75
+ name,
76
+ field: path,
77
+ type: reportTypeSchema,
78
+ required: z.boolean(),
79
+ });
80
+ const aggregate = z.strictObject({
81
+ name,
82
+ op: z.enum(["sum", "average", "count", "minimum", "maximum"]),
83
+ rounding: z.enum(["floor", "halfUp"]).optional(),
84
+ value: name.optional(),
85
+ });
86
+ export const reportDefinitionSchema = z.strictObject({
87
+ identity: z.strictObject({
88
+ id: name,
89
+ version: integer.positive(),
90
+ description: z.string().min(1).max(2048),
91
+ }),
92
+ scope: z.strictObject({
93
+ kind: z.enum(["product", "company"]),
94
+ classification: z.enum(["internal", "personal", "restricted"]),
95
+ currency: z.string().regex(/^[A-Z]{3}$/),
96
+ }),
97
+ datasets: z
98
+ .array(z.strictObject({
99
+ id: name,
100
+ source: z.enum(["instrument", "account", "identity", "operation"]),
101
+ instruments: z
102
+ .array(name.meta({ "x-udl-reference": "instrument" }))
103
+ .max(32),
104
+ rowKey: name,
105
+ columns: z.array(column).min(1).max(64),
106
+ expressions: z.array(reportExpressionSchema).max(128),
107
+ selection: name.optional(),
108
+ }))
109
+ .min(1)
110
+ .max(16),
111
+ time: z.strictObject({
112
+ timezone: z.literal("Asia/Riyadh"),
113
+ boundary: z.literal("startInclusiveEndExclusive"),
114
+ observation: z.literal("periodEnd"),
115
+ history: z.literal("retainedOnly"),
116
+ }),
117
+ selection: z.strictObject({ dataset: name, predicate: name.optional() }),
118
+ calculation: z.strictObject({
119
+ joins: z
120
+ .array(z.strictObject({
121
+ dataset: name,
122
+ local: name,
123
+ foreign: name,
124
+ cardinality: z.enum(["one", "many"]),
125
+ missing: z.enum(["refuse", "allow"]),
126
+ aggregates: z.array(aggregate).max(32),
127
+ }))
128
+ .max(16),
129
+ expressions: z.array(reportExpressionSchema).max(128),
130
+ groupBy: z.array(name).max(8),
131
+ aggregates: z.array(aggregate).max(64),
132
+ resultExpressions: z.array(reportExpressionSchema).max(64),
133
+ }),
134
+ validation: z.strictObject({
135
+ empty: z.enum(["refuse", "noEligibleFacilities"]),
136
+ required: z.array(name).max(64),
137
+ rowReconcile: z.array(z.strictObject({ left: name, right: name })).max(16),
138
+ reconcile: z.array(z.strictObject({ left: name, right: name })).max(16),
139
+ unavailableFacts: z.array(z.string().min(1).max(240)).max(32),
140
+ lockTimeoutMs: integer.min(1).max(2000),
141
+ captureTimeoutMs: integer.min(1).max(10000),
142
+ maxRows: integer.min(1).max(100000),
143
+ maxJoinRows: integer.min(1).max(1000000),
144
+ maxBytes: integer.min(1024).max(16777216),
145
+ }),
146
+ output: z.strictObject({
147
+ profile: z.literal("internal.v1"),
148
+ formats: z
149
+ .array(z.enum(["json", "csv"]))
150
+ .min(1)
151
+ .max(2),
152
+ columns: z
153
+ .array(z.strictObject({
154
+ name,
155
+ label: z.string().min(1).max(120),
156
+ type: reportTypeSchema,
157
+ }))
158
+ .min(1)
159
+ .max(64),
160
+ sort: z.array(name).min(1).max(8),
161
+ }),
162
+ authority: z.strictObject({
163
+ request: z.array(name).min(1).max(64),
164
+ read: z.array(name).min(1).max(64),
165
+ release: z.array(name).max(64),
166
+ independentApproval: z.literal(true),
167
+ retention: z.strictObject({ policy: name, years: integer.min(1).max(100) }),
168
+ }),
169
+ });
170
+ //# sourceMappingURL=reporting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reporting.js","sourceRoot":"","sources":["../src/reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,IAAI,GAAG,CAAC;KACX,MAAM,EAAE;KACR,KAAK,CAAC,sBAAsB,CAAC;KAC7B,GAAG,CAAC,EAAE,CAAC,CAAC;AACX,MAAM,IAAI,GAAG,CAAC;KACX,MAAM,EAAE;KACR,KAAK,CAAC,6CAA6C,CAAC;KACpD,GAAG,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,OAAO,GAAG,CAA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