@opencrvs/toolkit 2.0.0-rc.2acb3d5 → 2.0.0-rc.2b511b7
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/create-countryconfig/index.js +50 -20
- package/dist/application-config/index.js +2 -1
- package/dist/commons/api/router.d.ts +66 -0
- package/dist/commons/conditionals/conditionals.d.ts +6 -0
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +6 -0
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/state/flags.d.ts +16 -0
- package/dist/commons/events/state/utils.d.ts +3 -0
- package/dist/commons/events/utils.d.ts +11 -0
- package/dist/conditionals/index.js +4 -0
- package/dist/events/index.js +451 -27
- package/dist/notification/index.js +367 -2
- package/opencrvs-toolkit-2.0.0-rc.2b511b7.tgz +0 -0
- package/package.json +2 -2
- package/opencrvs-toolkit-2.0.0-rc.2acb3d5.tgz +0 -0
|
@@ -15,7 +15,10 @@ const { execSync } = require('child_process')
|
|
|
15
15
|
const path = require('path')
|
|
16
16
|
const fs = require('fs')
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const COUNTRYCONFIG_REPO_URL =
|
|
19
|
+
'https://github.com/opencrvs/opencrvs-countryconfig.git'
|
|
20
|
+
const INFRASTRUCTURE_REPO_URL =
|
|
21
|
+
'https://github.com/opencrvs/infrastructure.git'
|
|
19
22
|
|
|
20
23
|
const projectName = process.argv[2]
|
|
21
24
|
|
|
@@ -26,48 +29,75 @@ if (!projectName) {
|
|
|
26
29
|
process.exit(1)
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
const
|
|
32
|
+
const countryconfigDirName = projectName + '-countryconfig'
|
|
33
|
+
const infrastructureDirName = projectName + '-infrastructure'
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const countryconfigTargetDir = path.resolve(process.cwd(), countryconfigDirName)
|
|
36
|
+
const infrastructureTargetDir = path.resolve(process.cwd(), infrastructureDirName)
|
|
37
|
+
|
|
38
|
+
if (fs.existsSync(countryconfigTargetDir)) {
|
|
39
|
+
console.error('Error: Directory "' + countryconfigDirName + '" already exists.')
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(infrastructureTargetDir)) {
|
|
44
|
+
console.error('Error: Directory "' + infrastructureDirName + '" already exists.')
|
|
33
45
|
process.exit(1)
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
console.log(
|
|
48
|
+
console.log('\nScaffolding OpenCRVS country config in ./' + countryconfigDirName + '...\n')
|
|
37
49
|
|
|
38
50
|
try {
|
|
39
|
-
execSync(
|
|
40
|
-
stdio: 'inherit'
|
|
41
|
-
})
|
|
51
|
+
execSync('git clone --depth 1 ' + COUNTRYCONFIG_REPO_URL + ' ' + countryconfigDirName, { stdio: 'inherit' })
|
|
42
52
|
} catch (err) {
|
|
43
|
-
console.error('Failed to clone the repository:', err.message)
|
|
53
|
+
console.error('Failed to clone the country config repository:', err.message)
|
|
44
54
|
process.exit(1)
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
try {
|
|
48
|
-
fs.rmSync(path.join(
|
|
58
|
+
fs.rmSync(path.join(countryconfigTargetDir, '.git'), { recursive: true, force: true })
|
|
49
59
|
} catch (err) {
|
|
50
|
-
console.error('Failed to remove .git directory:', err.message)
|
|
60
|
+
console.error('Failed to remove .git directory from country config:', err.message)
|
|
51
61
|
process.exit(1)
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
const pkgPath = path.join(
|
|
64
|
+
const pkgPath = path.join(countryconfigTargetDir, 'package.json')
|
|
55
65
|
if (fs.existsSync(pkgPath)) {
|
|
56
66
|
try {
|
|
57
67
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
|
58
|
-
pkg.name =
|
|
68
|
+
pkg.name = countryconfigDirName
|
|
59
69
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
60
70
|
} catch (err) {
|
|
61
71
|
console.error('Failed to update package.json:', err.message)
|
|
62
72
|
process.exit(1)
|
|
63
73
|
}
|
|
64
74
|
} else {
|
|
65
|
-
console.warn(
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
console.warn('Warning: No package.json found in the cloned country config repository. Project name was not updated.')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log('\nScaffolding OpenCRVS infrastructure in ./' + infrastructureDirName + '...\n')
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
execSync('git clone --depth 1 ' + INFRASTRUCTURE_REPO_URL + ' ' + infrastructureDirName, { stdio: 'inherit' })
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.error('Failed to clone the infrastructure repository:', err.message)
|
|
84
|
+
process.exit(1)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
fs.rmSync(path.join(infrastructureTargetDir, '.git'), { recursive: true, force: true })
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.error('Failed to remove .git directory from infrastructure:', err.message)
|
|
91
|
+
process.exit(1)
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
console.log(
|
|
71
|
-
console.log(
|
|
72
|
-
console.log(
|
|
73
|
-
console.log(
|
|
94
|
+
console.log('\nDone! Your project has been set up in two directories:\n')
|
|
95
|
+
console.log(' ./' + countryconfigDirName + ' -- country configuration')
|
|
96
|
+
console.log(' ./' + infrastructureDirName + ' -- server infrastructure\n')
|
|
97
|
+
console.log('To get started with the country config:\n')
|
|
98
|
+
console.log(' cd ' + countryconfigDirName)
|
|
99
|
+
console.log(' git init')
|
|
100
|
+
console.log(' npm install\n')
|
|
101
|
+
console.log('To get started with the infrastructure:\n')
|
|
102
|
+
console.log(' cd ' + infrastructureDirName)
|
|
103
|
+
console.log(' git init\n')
|
|
@@ -989,8 +989,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
989
989
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
990
990
|
z13.object({
|
|
991
991
|
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
992
|
-
requestId: z13.string()
|
|
992
|
+
requestId: z13.string(),
|
|
993
993
|
// TODO move into 'content' property
|
|
994
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
994
995
|
}).shape
|
|
995
996
|
);
|
|
996
997
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -313,6 +313,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
313
313
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
314
314
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
315
315
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
316
|
+
content?: {
|
|
317
|
+
immediateCorrection?: boolean | undefined;
|
|
318
|
+
} | undefined;
|
|
316
319
|
} | {
|
|
317
320
|
id: string & import("zod").$brand<"UUID">;
|
|
318
321
|
transactionId: string;
|
|
@@ -622,6 +625,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
622
625
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
623
626
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
624
627
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
628
|
+
content?: {
|
|
629
|
+
immediateCorrection?: boolean | undefined;
|
|
630
|
+
} | undefined;
|
|
625
631
|
} | {
|
|
626
632
|
id: string & import("zod").$brand<"UUID">;
|
|
627
633
|
transactionId: string;
|
|
@@ -930,6 +936,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
930
936
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
931
937
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
932
938
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
939
|
+
content?: {
|
|
940
|
+
immediateCorrection?: boolean | undefined;
|
|
941
|
+
} | undefined;
|
|
933
942
|
} | {
|
|
934
943
|
id: string & import("zod").$brand<"UUID">;
|
|
935
944
|
transactionId: string;
|
|
@@ -1388,6 +1397,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1388
1397
|
waitFor?: boolean | undefined;
|
|
1389
1398
|
createdAtLocation?: string | null | undefined;
|
|
1390
1399
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
1400
|
+
content?: {
|
|
1401
|
+
immediateCorrection?: boolean | undefined;
|
|
1402
|
+
} | undefined;
|
|
1391
1403
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
1392
1404
|
eventId: string;
|
|
1393
1405
|
transactionId: string;
|
|
@@ -1672,6 +1684,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
1672
1684
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1673
1685
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
1674
1686
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
1687
|
+
content?: {
|
|
1688
|
+
immediateCorrection?: boolean | undefined;
|
|
1689
|
+
} | undefined;
|
|
1675
1690
|
} | {
|
|
1676
1691
|
id: string & import("zod").$brand<"UUID">;
|
|
1677
1692
|
transactionId: string;
|
|
@@ -2012,6 +2027,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2012
2027
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
2013
2028
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
2014
2029
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
2030
|
+
content?: {
|
|
2031
|
+
immediateCorrection?: boolean | undefined;
|
|
2032
|
+
} | undefined;
|
|
2015
2033
|
} | {
|
|
2016
2034
|
id: string & import("zod").$brand<"UUID">;
|
|
2017
2035
|
transactionId: string;
|
|
@@ -2331,6 +2349,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2331
2349
|
waitFor?: boolean | undefined;
|
|
2332
2350
|
createdAtLocation?: string | null | undefined;
|
|
2333
2351
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
2352
|
+
content?: {
|
|
2353
|
+
immediateCorrection?: boolean | undefined;
|
|
2354
|
+
} | undefined;
|
|
2334
2355
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
2335
2356
|
eventId: string;
|
|
2336
2357
|
transactionId: string;
|
|
@@ -2623,6 +2644,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2623
2644
|
waitFor?: boolean | undefined;
|
|
2624
2645
|
createdAtLocation?: string | null | undefined;
|
|
2625
2646
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
2647
|
+
content?: {
|
|
2648
|
+
immediateCorrection?: boolean | undefined;
|
|
2649
|
+
} | undefined;
|
|
2626
2650
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
2627
2651
|
eventId: string;
|
|
2628
2652
|
transactionId: string;
|
|
@@ -2915,6 +2939,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2915
2939
|
waitFor?: boolean | undefined;
|
|
2916
2940
|
createdAtLocation?: string | null | undefined;
|
|
2917
2941
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
2942
|
+
content?: {
|
|
2943
|
+
immediateCorrection?: boolean | undefined;
|
|
2944
|
+
} | undefined;
|
|
2918
2945
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
2919
2946
|
eventId: string;
|
|
2920
2947
|
transactionId: string;
|
|
@@ -3207,6 +3234,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3207
3234
|
waitFor?: boolean | undefined;
|
|
3208
3235
|
createdAtLocation?: string | null | undefined;
|
|
3209
3236
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
3237
|
+
content?: {
|
|
3238
|
+
immediateCorrection?: boolean | undefined;
|
|
3239
|
+
} | undefined;
|
|
3210
3240
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
3211
3241
|
eventId: string;
|
|
3212
3242
|
transactionId: string;
|
|
@@ -3499,6 +3529,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3499
3529
|
waitFor?: boolean | undefined;
|
|
3500
3530
|
createdAtLocation?: string | null | undefined;
|
|
3501
3531
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
3532
|
+
content?: {
|
|
3533
|
+
immediateCorrection?: boolean | undefined;
|
|
3534
|
+
} | undefined;
|
|
3502
3535
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
3503
3536
|
eventId: string;
|
|
3504
3537
|
transactionId: string;
|
|
@@ -3791,6 +3824,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
3791
3824
|
waitFor?: boolean | undefined;
|
|
3792
3825
|
createdAtLocation?: string | null | undefined;
|
|
3793
3826
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
3827
|
+
content?: {
|
|
3828
|
+
immediateCorrection?: boolean | undefined;
|
|
3829
|
+
} | undefined;
|
|
3794
3830
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
3795
3831
|
eventId: string;
|
|
3796
3832
|
transactionId: string;
|
|
@@ -4077,6 +4113,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4077
4113
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4078
4114
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
4079
4115
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4116
|
+
content?: {
|
|
4117
|
+
immediateCorrection?: boolean | undefined;
|
|
4118
|
+
} | undefined;
|
|
4080
4119
|
} | {
|
|
4081
4120
|
id: string & import("zod").$brand<"UUID">;
|
|
4082
4121
|
transactionId: string;
|
|
@@ -4396,6 +4435,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4396
4435
|
waitFor?: boolean | undefined;
|
|
4397
4436
|
createdAtLocation?: string | null | undefined;
|
|
4398
4437
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
4438
|
+
content?: {
|
|
4439
|
+
immediateCorrection?: boolean | undefined;
|
|
4440
|
+
} | undefined;
|
|
4399
4441
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
4400
4442
|
eventId: string;
|
|
4401
4443
|
transactionId: string;
|
|
@@ -4682,6 +4724,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4682
4724
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4683
4725
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
4684
4726
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
4727
|
+
content?: {
|
|
4728
|
+
immediateCorrection?: boolean | undefined;
|
|
4729
|
+
} | undefined;
|
|
4685
4730
|
} | {
|
|
4686
4731
|
id: string & import("zod").$brand<"UUID">;
|
|
4687
4732
|
transactionId: string;
|
|
@@ -5000,6 +5045,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5000
5045
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
5001
5046
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
5002
5047
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
5048
|
+
content?: {
|
|
5049
|
+
immediateCorrection?: boolean | undefined;
|
|
5050
|
+
} | undefined;
|
|
5003
5051
|
} | {
|
|
5004
5052
|
id: string & import("zod").$brand<"UUID">;
|
|
5005
5053
|
transactionId: string;
|
|
@@ -5369,6 +5417,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5369
5417
|
waitFor?: boolean | undefined;
|
|
5370
5418
|
createdAtLocation?: string | null | undefined;
|
|
5371
5419
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
5420
|
+
content?: {
|
|
5421
|
+
immediateCorrection?: boolean | undefined;
|
|
5422
|
+
} | undefined;
|
|
5372
5423
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
5373
5424
|
eventId: string;
|
|
5374
5425
|
transactionId: string;
|
|
@@ -5661,6 +5712,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5661
5712
|
waitFor?: boolean | undefined;
|
|
5662
5713
|
createdAtLocation?: string | null | undefined;
|
|
5663
5714
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
5715
|
+
content?: {
|
|
5716
|
+
immediateCorrection?: boolean | undefined;
|
|
5717
|
+
} | undefined;
|
|
5664
5718
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
5665
5719
|
eventId: string;
|
|
5666
5720
|
transactionId: string;
|
|
@@ -5953,6 +6007,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5953
6007
|
waitFor?: boolean | undefined;
|
|
5954
6008
|
createdAtLocation?: string | null | undefined;
|
|
5955
6009
|
type?: "APPROVE_CORRECTION" | undefined;
|
|
6010
|
+
content?: {
|
|
6011
|
+
immediateCorrection?: boolean | undefined;
|
|
6012
|
+
} | undefined;
|
|
5956
6013
|
}, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
|
|
5957
6014
|
eventId: string;
|
|
5958
6015
|
transactionId: string;
|
|
@@ -6242,6 +6299,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6242
6299
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6243
6300
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
6244
6301
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6302
|
+
content?: {
|
|
6303
|
+
immediateCorrection?: boolean | undefined;
|
|
6304
|
+
} | undefined;
|
|
6245
6305
|
} | {
|
|
6246
6306
|
id: string & import("zod").$brand<"UUID">;
|
|
6247
6307
|
transactionId: string;
|
|
@@ -6559,6 +6619,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6559
6619
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6560
6620
|
annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
|
|
6561
6621
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
6622
|
+
content?: {
|
|
6623
|
+
immediateCorrection?: boolean | undefined;
|
|
6624
|
+
} | undefined;
|
|
6562
6625
|
} | {
|
|
6563
6626
|
id: string & import("zod").$brand<"UUID">;
|
|
6564
6627
|
transactionId: string;
|
|
@@ -6919,6 +6982,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
6919
6982
|
createdAtLocation?: string | null | undefined;
|
|
6920
6983
|
annotation?: Record<string, unknown> | null | undefined;
|
|
6921
6984
|
originalActionId?: string | null | undefined;
|
|
6985
|
+
content?: {
|
|
6986
|
+
immediateCorrection?: boolean | undefined;
|
|
6987
|
+
} | undefined;
|
|
6922
6988
|
} | {
|
|
6923
6989
|
id: string;
|
|
6924
6990
|
transactionId: string;
|
|
@@ -67,6 +67,12 @@ export declare function not(condition: AjvJSONSchema): JSONSchema;
|
|
|
67
67
|
* @returns {JSONSchema} An schema object that always evaluates to false.
|
|
68
68
|
*/
|
|
69
69
|
export declare function never(): JSONSchema;
|
|
70
|
+
/**
|
|
71
|
+
* Returns an JSON Schema object, which is treated as always valid.
|
|
72
|
+
*
|
|
73
|
+
* @returns {JSONSchema} An schema object that always evaluates to true.
|
|
74
|
+
*/
|
|
75
|
+
export declare function always(): JSONSchema;
|
|
70
76
|
/**
|
|
71
77
|
* Generate conditional rules for current date
|
|
72
78
|
*/
|
|
@@ -517,6 +517,9 @@ export declare const ActionDocument: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
517
517
|
originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
518
518
|
type: z.ZodLiteral<"APPROVE_CORRECTION">;
|
|
519
519
|
requestId: z.ZodString;
|
|
520
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
521
|
+
immediateCorrection: z.ZodOptional<z.ZodBoolean>;
|
|
522
|
+
}, z.core.$strip>>;
|
|
520
523
|
}, z.core.$strip>, z.ZodObject<{
|
|
521
524
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
522
525
|
transactionId: z.ZodString;
|
|
@@ -955,6 +958,9 @@ export declare const Action: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.Zod
|
|
|
955
958
|
originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
956
959
|
type: z.ZodLiteral<"APPROVE_CORRECTION">;
|
|
957
960
|
requestId: z.ZodString;
|
|
961
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
962
|
+
immediateCorrection: z.ZodOptional<z.ZodBoolean>;
|
|
963
|
+
}, z.core.$strip>>;
|
|
958
964
|
}, z.core.$strip>, z.ZodObject<{
|
|
959
965
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
960
966
|
transactionId: z.ZodString;
|
|
@@ -246,6 +246,9 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
|
|
|
246
246
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
247
247
|
requestId: z.ZodString;
|
|
248
248
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
249
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
250
|
+
immediateCorrection: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
249
252
|
}, z.core.$strip>;
|
|
250
253
|
export type ApproveCorrectionActionInput = z.infer<typeof ApproveCorrectionActionInput>;
|
|
251
254
|
export declare const ReadActionInput: z.ZodObject<{
|
|
@@ -495,6 +498,9 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
495
498
|
createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
496
499
|
requestId: z.ZodString;
|
|
497
500
|
type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
|
|
501
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
502
|
+
immediateCorrection: z.ZodOptional<z.ZodBoolean>;
|
|
503
|
+
}, z.core.$strip>>;
|
|
498
504
|
}, z.core.$strip>, z.ZodObject<{
|
|
499
505
|
eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
500
506
|
transactionId: z.ZodString;
|
|
@@ -274,6 +274,9 @@ export declare const EventDocument: z.ZodObject<{
|
|
|
274
274
|
originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
275
275
|
type: z.ZodLiteral<"APPROVE_CORRECTION">;
|
|
276
276
|
requestId: z.ZodString;
|
|
277
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
278
|
+
immediateCorrection: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
+
}, z.core.$strip>>;
|
|
277
280
|
}, z.core.$strip>, z.ZodObject<{
|
|
278
281
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
279
282
|
transactionId: z.ZodString;
|
|
@@ -22,6 +22,7 @@ export * from './FieldValue';
|
|
|
22
22
|
export * from './FormConfig';
|
|
23
23
|
export * from './CompositeFieldValue';
|
|
24
24
|
export * from './state';
|
|
25
|
+
export * from './state/flags';
|
|
25
26
|
export * from './utils';
|
|
26
27
|
export * from './defineConfig';
|
|
27
28
|
export * from './DeduplicationConfig';
|
|
@@ -37,6 +38,7 @@ export * from './scopes';
|
|
|
37
38
|
export * from './serializer';
|
|
38
39
|
export * from './state/availableActions';
|
|
39
40
|
export * from './FileUtils';
|
|
41
|
+
export * from './mocks.test.utils';
|
|
40
42
|
export * from '../conditionals/conditionals';
|
|
41
43
|
export * from '../conditionals/validate';
|
|
42
44
|
export * from './field';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { Action, RequestedCorrectionAction } from '../ActionDocument';
|
|
1
2
|
import { Flag, CustomFlag } from '../Flag';
|
|
2
3
|
import { EventConfig } from '../EventConfig';
|
|
3
4
|
import { EventDocument } from '../EventDocument';
|
|
5
|
+
export declare function findPendingCorrectionAction(writeActions: Action[]): RequestedCorrectionAction | undefined;
|
|
6
|
+
export declare function isPotentialDuplicate(actions: Action[]): boolean;
|
|
4
7
|
/**
|
|
5
8
|
* This function resolves custom flags for an event based on its actions.
|
|
6
9
|
* Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
|
|
@@ -18,5 +21,18 @@ import { EventDocument } from '../EventDocument';
|
|
|
18
21
|
* // Returns: ['flag-1', 'flag-3']
|
|
19
22
|
*/
|
|
20
23
|
export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
|
|
24
|
+
/**
|
|
25
|
+
* Computes all flags (inherent, action status, and custom) that should be attached to the given event,
|
|
26
|
+
* based on its actions and event-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* Flags are determined by combining:
|
|
29
|
+
* - Action status flags (format 'ActionType:ActionStatus')
|
|
30
|
+
* - Inherent flags (e.g. incomplete, rejected, correction requested, potential duplicate, edit in progress)
|
|
31
|
+
* - Event type-specific custom flags defined in the event configuration
|
|
32
|
+
*
|
|
33
|
+
* @param event - The EventDocument containing the action history and payload
|
|
34
|
+
* @param config - The EventConfig providing rules for custom flag evaluation
|
|
35
|
+
* @returns An array of flags currently relevant/applicable to the event
|
|
36
|
+
*/
|
|
21
37
|
export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
|
|
22
38
|
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -241,6 +241,9 @@ export declare function getActionUpdateMetadata(actions: Action[]): Partial<{
|
|
|
241
241
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
242
242
|
annotation?: Record<string, import("..").FieldUpdateValue> | null | undefined;
|
|
243
243
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
244
|
+
content?: {
|
|
245
|
+
immediateCorrection?: boolean | undefined;
|
|
246
|
+
} | undefined;
|
|
244
247
|
} | {
|
|
245
248
|
id: string & import("zod").$brand<"UUID">;
|
|
246
249
|
transactionId: string;
|
|
@@ -386,6 +386,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
386
386
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
387
387
|
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
388
388
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
389
|
+
content?: {
|
|
390
|
+
immediateCorrection?: boolean | undefined;
|
|
391
|
+
} | undefined;
|
|
389
392
|
} | {
|
|
390
393
|
id: string & import("zod").$brand<"UUID">;
|
|
391
394
|
transactionId: string;
|
|
@@ -560,6 +563,14 @@ export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
|
|
|
560
563
|
export declare function mergeDrafts(currentDraft: Draft, incomingDraft: Draft): Draft;
|
|
561
564
|
export declare function getPendingAction(actions: Action[]): ActionDocument;
|
|
562
565
|
export declare function getCompleteActionAnnotation(annotation: ActionUpdate, event: EventDocument, action: ActionDocument): ActionUpdate;
|
|
566
|
+
/**
|
|
567
|
+
* Resolves the complete content for an action, inheriting from its original
|
|
568
|
+
* Requested action when the Accepted action carries no content of its own.
|
|
569
|
+
*
|
|
570
|
+
* Mirrors the same "originalActionId → merge from Requested" pattern used by
|
|
571
|
+
* getCompleteActionAnnotation and getCompleteActionDeclaration.
|
|
572
|
+
*/
|
|
573
|
+
export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
|
|
563
574
|
export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
|
|
564
575
|
export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
|
|
565
576
|
export declare function aggregateActionDeclarations(event: EventDocument): EventState;
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/conditionals/index.ts
|
|
31
31
|
var conditionals_exports = {};
|
|
32
32
|
__export(conditionals_exports, {
|
|
33
|
+
always: () => always,
|
|
33
34
|
alwaysTrue: () => alwaysTrue,
|
|
34
35
|
and: () => and,
|
|
35
36
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -454,6 +455,9 @@ function not(condition) {
|
|
|
454
455
|
function never() {
|
|
455
456
|
return not(alwaysTrue());
|
|
456
457
|
}
|
|
458
|
+
function always() {
|
|
459
|
+
return defineConditional(alwaysTrue());
|
|
460
|
+
}
|
|
457
461
|
function jsonFieldPath(field) {
|
|
458
462
|
return [field.$$field, ...field.$$subfield].join("/");
|
|
459
463
|
}
|