@opencrvs/toolkit 2.1.0-rc.4bddaf2 → 2.1.0-rc.7d9a8f9
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/build.sh +2 -2
- package/dist/application-config/index.js +12 -0
- package/dist/cli.js +165 -5106
- package/dist/commons/api/router.d.ts +723 -130
- package/dist/commons/conditionals/conditionals.d.ts +1589 -37
- package/dist/commons/events/ActionConfig.d.ts +202 -0
- package/dist/commons/events/ActionDocument.d.ts +44 -0
- package/dist/commons/events/ActionInput.d.ts +26 -0
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +22 -0
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +5 -2
- package/dist/commons/events/field.d.ts +722 -34
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +9 -1
- package/dist/commons/events/utils.d.ts +15 -1
- package/dist/conditionals/index.js +2 -0
- package/dist/environment/logger.d.ts +3 -12
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +17 -7
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/update-workflows.js +17 -7
- package/dist/environment/users.js +17 -7
- package/dist/environment/utils.js +17 -7
- package/dist/events/index.js +166 -18
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5144
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +131 -11
- package/dist/scopes/index.d.ts +7 -1
- package/dist/scopes/index.js +2 -0
- package/opencrvs-toolkit-2.1.0-rc.7d9a8f9.tgz +0 -0
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.4bddaf2.tgz +0 -0
|
@@ -20,6 +20,7 @@ export declare const ACTION_SCOPE_MAP: {
|
|
|
20
20
|
MARK_AS_DUPLICATE: "record.review-duplicates"[];
|
|
21
21
|
MARK_AS_NOT_DUPLICATE: "record.review-duplicates"[];
|
|
22
22
|
ARCHIVE: "record.archive"[];
|
|
23
|
+
UNARCHIVE: "record.unarchive"[];
|
|
23
24
|
REJECT: "record.reject"[];
|
|
24
25
|
ASSIGN: null;
|
|
25
26
|
UNASSIGN: null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
2
|
import { ActionDocument, ActionUpdate } from './ActionDocument';
|
|
3
|
-
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput } from './ActionInput';
|
|
3
|
+
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput } from './ActionInput';
|
|
4
4
|
import { ActionType } from './ActionType';
|
|
5
5
|
import { Draft } from './Draft';
|
|
6
6
|
import { EventConfig } from './EventConfig';
|
|
@@ -131,6 +131,14 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
131
131
|
reason: string;
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
|
+
unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
|
|
135
|
+
transactionId: string;
|
|
136
|
+
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
137
|
+
keepAssignment?: boolean | undefined;
|
|
138
|
+
type: "UNARCHIVE";
|
|
139
|
+
annotation: {};
|
|
140
|
+
eventId: string;
|
|
141
|
+
};
|
|
134
142
|
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
|
135
143
|
transactionId: string;
|
|
136
144
|
annotation: {};
|
|
@@ -328,6 +328,20 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
328
328
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
329
329
|
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
330
330
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
331
|
+
} | {
|
|
332
|
+
id: string & import("zod").$brand<"UUID">;
|
|
333
|
+
transactionId: string;
|
|
334
|
+
createdByUserType: "user" | "system";
|
|
335
|
+
createdAt: string;
|
|
336
|
+
createdBy: string;
|
|
337
|
+
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
338
|
+
status: "Requested" | "Accepted" | "Rejected";
|
|
339
|
+
type: "UNARCHIVE";
|
|
340
|
+
createdByRole?: string | undefined;
|
|
341
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
342
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
343
|
+
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
344
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
331
345
|
} | {
|
|
332
346
|
id: string & import("zod").$brand<"UUID">;
|
|
333
347
|
transactionId: string;
|
|
@@ -441,7 +455,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
441
455
|
createdByUserType: "user" | "system";
|
|
442
456
|
createdAt: string;
|
|
443
457
|
createdBy: string;
|
|
444
|
-
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
|
|
458
|
+
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "UNARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
|
|
445
459
|
status: "Rejected";
|
|
446
460
|
createdByRole?: string | undefined;
|
|
447
461
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
@@ -152,6 +152,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
152
152
|
"record.edit",
|
|
153
153
|
"record.reject",
|
|
154
154
|
"record.archive",
|
|
155
|
+
"record.unarchive",
|
|
155
156
|
"record.review-duplicates",
|
|
156
157
|
"record.register",
|
|
157
158
|
"record.print-certified-copies",
|
|
@@ -257,6 +258,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
257
258
|
"record.edit",
|
|
258
259
|
"record.reject",
|
|
259
260
|
"record.archive",
|
|
261
|
+
"record.unarchive",
|
|
260
262
|
"record.review-duplicates",
|
|
261
263
|
"record.register"
|
|
262
264
|
]);
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export declare const log:
|
|
2
|
-
|
|
3
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
4
|
-
};
|
|
5
|
-
export declare const warn: {
|
|
6
|
-
(...data: any[]): void;
|
|
7
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
8
|
-
};
|
|
1
|
+
export declare const log: (message?: any, ...optionalParams: any[]) => void;
|
|
2
|
+
export declare const warn: (message?: any, ...optionalParams: any[]) => void;
|
|
9
3
|
export declare const success: (...args: any[]) => void;
|
|
10
|
-
export declare const info:
|
|
11
|
-
(...data: any[]): void;
|
|
12
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
13
|
-
};
|
|
4
|
+
export declare const info: (message?: any, ...optionalParams: any[]) => void;
|
|
14
5
|
export declare const error: (...args: any[]) => void;
|
|
15
6
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG,mDAAc,CAAA;AAC9B,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,GAAG,EAAE,SACI,CAAA;AAC1C,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA2C,CAAA"}
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
46
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
46
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
46
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
46
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
47
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
25
25
|
}) : function(o, v) {
|
|
26
26
|
o["default"] = v;
|
|
27
27
|
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
35
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
47
|
};
|
package/dist/events/index.js
CHANGED
|
@@ -214,6 +214,7 @@ __export(events_exports, {
|
|
|
214
214
|
TimeValue: () => TimeValue,
|
|
215
215
|
TranslationConfig: () => TranslationConfig,
|
|
216
216
|
UUID: () => UUID,
|
|
217
|
+
UnarchiveActionInput: () => UnarchiveActionInput,
|
|
217
218
|
UnassignActionInput: () => UnassignActionInput,
|
|
218
219
|
UserAuditRecordInput: () => UserAuditRecordInput,
|
|
219
220
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
|
|
@@ -481,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
481
482
|
"record.edit",
|
|
482
483
|
"record.reject",
|
|
483
484
|
"record.archive",
|
|
485
|
+
"record.unarchive",
|
|
484
486
|
"record.review-duplicates",
|
|
485
487
|
"record.register",
|
|
486
488
|
"record.print-certified-copies",
|
|
@@ -586,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
586
588
|
"record.edit",
|
|
587
589
|
"record.reject",
|
|
588
590
|
"record.archive",
|
|
591
|
+
"record.unarchive",
|
|
589
592
|
"record.review-duplicates",
|
|
590
593
|
"record.register"
|
|
591
594
|
]);
|
|
@@ -772,6 +775,7 @@ var ActionType = {
|
|
|
772
775
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
773
776
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
774
777
|
ARCHIVE: "ARCHIVE",
|
|
778
|
+
UNARCHIVE: "UNARCHIVE",
|
|
775
779
|
// Record actions
|
|
776
780
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
777
781
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -791,6 +795,7 @@ var ConfirmableActions = [
|
|
|
791
795
|
ActionType.REGISTER,
|
|
792
796
|
ActionType.REJECT,
|
|
793
797
|
ActionType.ARCHIVE,
|
|
798
|
+
ActionType.UNARCHIVE,
|
|
794
799
|
ActionType.PRINT_CERTIFICATE,
|
|
795
800
|
ActionType.REQUEST_CORRECTION,
|
|
796
801
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -809,6 +814,7 @@ var ActionTypes = z4.enum([
|
|
|
809
814
|
"MARK_AS_DUPLICATE",
|
|
810
815
|
"MARK_AS_NOT_DUPLICATE",
|
|
811
816
|
"ARCHIVE",
|
|
817
|
+
"UNARCHIVE",
|
|
812
818
|
"PRINT_CERTIFICATE",
|
|
813
819
|
"REQUEST_CORRECTION",
|
|
814
820
|
"REJECT_CORRECTION",
|
|
@@ -852,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
852
858
|
ActionType.REJECT,
|
|
853
859
|
ActionType.MARK_AS_DUPLICATE,
|
|
854
860
|
ActionType.ARCHIVE,
|
|
861
|
+
ActionType.UNARCHIVE,
|
|
855
862
|
ActionType.PRINT_CERTIFICATE,
|
|
856
863
|
ActionType.REQUEST_CORRECTION
|
|
857
864
|
]);
|
|
@@ -916,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
916
923
|
"event.actions.unassign.request",
|
|
917
924
|
"event.actions.read.request",
|
|
918
925
|
"event.actions.archive.request",
|
|
926
|
+
"event.actions.unarchive.request",
|
|
919
927
|
"event.actions.reinstate.request",
|
|
920
928
|
"event.actions.print_certificate.request",
|
|
921
929
|
"event.actions.correction.request.request",
|
|
@@ -1649,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1649
1657
|
content: ReasonContent
|
|
1650
1658
|
}).shape
|
|
1651
1659
|
);
|
|
1660
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1661
|
+
z14.object({
|
|
1662
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1663
|
+
}).shape
|
|
1664
|
+
);
|
|
1652
1665
|
var CreatedAction = ActionBase.extend(
|
|
1653
1666
|
z14.object({
|
|
1654
1667
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1715,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1715
1728
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1716
1729
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1717
1730
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1731
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1718
1732
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1719
1733
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1720
1734
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -3238,6 +3252,52 @@ var NotifyConfig = ActionConfigBase.extend(
|
|
|
3238
3252
|
type: z24.literal(ActionType.NOTIFY)
|
|
3239
3253
|
}).shape
|
|
3240
3254
|
);
|
|
3255
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
3256
|
+
z24.object({
|
|
3257
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
3258
|
+
label: z24.never().optional().describe(
|
|
3259
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
3260
|
+
),
|
|
3261
|
+
supportingCopy: z24.never().optional(),
|
|
3262
|
+
icon: z24.never().optional().describe(
|
|
3263
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
3264
|
+
),
|
|
3265
|
+
conditionals: z24.never().optional().describe(
|
|
3266
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
3267
|
+
)
|
|
3268
|
+
}).shape
|
|
3269
|
+
);
|
|
3270
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
3271
|
+
z24.object({
|
|
3272
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
3273
|
+
}).shape
|
|
3274
|
+
);
|
|
3275
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
3276
|
+
z24.object({
|
|
3277
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
3278
|
+
}).shape
|
|
3279
|
+
);
|
|
3280
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
3281
|
+
z24.object({
|
|
3282
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
3283
|
+
flags: z24.never().optional().describe(
|
|
3284
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3285
|
+
)
|
|
3286
|
+
}).shape
|
|
3287
|
+
);
|
|
3288
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
3289
|
+
z24.object({
|
|
3290
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
3291
|
+
flags: z24.never().optional().describe(
|
|
3292
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3293
|
+
)
|
|
3294
|
+
}).shape
|
|
3295
|
+
);
|
|
3296
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
3297
|
+
z24.object({
|
|
3298
|
+
type: z24.literal(ActionType.DELETE)
|
|
3299
|
+
}).shape
|
|
3300
|
+
);
|
|
3241
3301
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3242
3302
|
z24.object({
|
|
3243
3303
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3262,6 +3322,11 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
3262
3322
|
type: z24.literal(ActionType.ARCHIVE)
|
|
3263
3323
|
}).shape
|
|
3264
3324
|
);
|
|
3325
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3326
|
+
z24.object({
|
|
3327
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
3328
|
+
}).shape
|
|
3329
|
+
);
|
|
3265
3330
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3266
3331
|
z24.object({
|
|
3267
3332
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -3300,7 +3365,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3300
3365
|
correctionForm: ActionFormConfig
|
|
3301
3366
|
}).shape
|
|
3302
3367
|
);
|
|
3303
|
-
var
|
|
3368
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
3369
|
+
z24.object({
|
|
3370
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
3371
|
+
}).shape
|
|
3372
|
+
);
|
|
3373
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
3374
|
+
z24.object({
|
|
3375
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
3376
|
+
}).shape
|
|
3377
|
+
);
|
|
3378
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
3304
3379
|
z24.object({
|
|
3305
3380
|
type: z24.literal(ActionType.CUSTOM),
|
|
3306
3381
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3311,7 +3386,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3311
3386
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3312
3387
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3313
3388
|
)
|
|
3314
|
-
})
|
|
3389
|
+
}).shape
|
|
3315
3390
|
);
|
|
3316
3391
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3317
3392
|
/*
|
|
@@ -3322,6 +3397,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3322
3397
|
id: "ReadActionConfig",
|
|
3323
3398
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3324
3399
|
}),
|
|
3400
|
+
AssignConfig.meta({
|
|
3401
|
+
id: "AssignActionConfig",
|
|
3402
|
+
description: "Configuration for assigning a record to the current user."
|
|
3403
|
+
}),
|
|
3404
|
+
UnassignConfig.meta({
|
|
3405
|
+
id: "UnassignActionConfig",
|
|
3406
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
3407
|
+
}),
|
|
3408
|
+
DeleteConfig.meta({
|
|
3409
|
+
id: "DeleteActionConfig",
|
|
3410
|
+
description: "Configuration for deleting a draft record."
|
|
3411
|
+
}),
|
|
3325
3412
|
NotifyConfig.meta({
|
|
3326
3413
|
id: "NotifyActionConfig",
|
|
3327
3414
|
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
@@ -3330,6 +3417,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3330
3417
|
id: "DeclareActionConfig",
|
|
3331
3418
|
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3332
3419
|
}),
|
|
3420
|
+
DuplicateDetectedConfig.meta({
|
|
3421
|
+
id: "DuplicateDetectedActionConfig",
|
|
3422
|
+
description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
|
|
3423
|
+
}),
|
|
3424
|
+
MarkAsDuplicateConfig.meta({
|
|
3425
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3426
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3427
|
+
}),
|
|
3428
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3429
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3430
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3431
|
+
}),
|
|
3333
3432
|
RejectConfig.meta({
|
|
3334
3433
|
id: "RejectActionConfig",
|
|
3335
3434
|
description: "Configuration for rejecting a record before registration."
|
|
@@ -3346,6 +3445,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3346
3445
|
id: "RequestCorrectionActionConfig",
|
|
3347
3446
|
description: "Configuration for requesting a correction on a registered record."
|
|
3348
3447
|
}),
|
|
3448
|
+
ApproveCorrectionConfig.meta({
|
|
3449
|
+
id: "ApproveCorrectionActionConfig",
|
|
3450
|
+
description: "Configuration for approving a requested correction."
|
|
3451
|
+
}),
|
|
3452
|
+
RejectCorrectionConfig.meta({
|
|
3453
|
+
id: "RejectCorrectionActionConfig",
|
|
3454
|
+
description: "Configuration for rejecting a requested correction."
|
|
3455
|
+
}),
|
|
3349
3456
|
EditActionConfig.meta({
|
|
3350
3457
|
id: "EditActionConfig",
|
|
3351
3458
|
description: "Configuration for editing a record before registration."
|
|
@@ -3354,6 +3461,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3354
3461
|
id: "ArchiveActionConfig",
|
|
3355
3462
|
description: "Configuration for archiving a record."
|
|
3356
3463
|
}),
|
|
3464
|
+
UnarchiveConfig.meta({
|
|
3465
|
+
id: "UnarchiveActionConfig",
|
|
3466
|
+
description: "Configuration for unarchiving a record."
|
|
3467
|
+
}),
|
|
3357
3468
|
CustomActionConfig.meta({
|
|
3358
3469
|
id: "CustomActionConfig",
|
|
3359
3470
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -4504,9 +4615,6 @@ function getActionConfig({
|
|
|
4504
4615
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4505
4616
|
return a.customActionType === customActionType;
|
|
4506
4617
|
}
|
|
4507
|
-
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
4508
|
-
return a.type === ActionType.REQUEST_CORRECTION;
|
|
4509
|
-
}
|
|
4510
4618
|
return a.type === actionType;
|
|
4511
4619
|
});
|
|
4512
4620
|
}
|
|
@@ -5660,7 +5768,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5660
5768
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5661
5769
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5662
5770
|
const actionFlagIds = event2.actions.flatMap(
|
|
5663
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
5771
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
5664
5772
|
);
|
|
5665
5773
|
for (const actionFlagId of actionFlagIds) {
|
|
5666
5774
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6335,6 +6443,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6335
6443
|
content: ReasonContent
|
|
6336
6444
|
}).shape
|
|
6337
6445
|
);
|
|
6446
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6447
|
+
z38.object({
|
|
6448
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6449
|
+
}).shape
|
|
6450
|
+
);
|
|
6338
6451
|
var AssignActionInput = BaseActionInput.extend(
|
|
6339
6452
|
z38.object({
|
|
6340
6453
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6396,6 +6509,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6396
6509
|
id: "MarkNotDuplicateActionInput"
|
|
6397
6510
|
}),
|
|
6398
6511
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6512
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6399
6513
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6400
6514
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6401
6515
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6510,6 +6624,7 @@ var updateActions = ActionTypes.extract([
|
|
|
6510
6624
|
ActionType.REGISTER,
|
|
6511
6625
|
ActionType.REJECT,
|
|
6512
6626
|
ActionType.ARCHIVE,
|
|
6627
|
+
ActionType.UNARCHIVE,
|
|
6513
6628
|
ActionType.PRINT_CERTIFICATE,
|
|
6514
6629
|
ActionType.REQUEST_CORRECTION,
|
|
6515
6630
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -6631,15 +6746,12 @@ var INHERENT_FLAG_RULES = [
|
|
|
6631
6746
|
},
|
|
6632
6747
|
{
|
|
6633
6748
|
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6634
|
-
// other status-changing action (see getStatusFromActions).
|
|
6749
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
6750
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
6751
|
+
// round trip and comes back exactly as it was.
|
|
6635
6752
|
flag: InherentFlags.INCOMPLETE,
|
|
6636
6753
|
setOn: [ActionType.NOTIFY],
|
|
6637
|
-
resetOn: [
|
|
6638
|
-
ActionType.CREATE,
|
|
6639
|
-
ActionType.DECLARE,
|
|
6640
|
-
ActionType.REGISTER,
|
|
6641
|
-
ActionType.ARCHIVE
|
|
6642
|
-
]
|
|
6754
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
6643
6755
|
},
|
|
6644
6756
|
{
|
|
6645
6757
|
flag: InherentFlags.REJECTED,
|
|
@@ -6703,7 +6815,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6703
6815
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6704
6816
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6705
6817
|
const form = { ...declaration, ...annotation };
|
|
6706
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6818
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
6707
6819
|
({ conditional }) => (
|
|
6708
6820
|
// If conditional is not provided, the flag is resolved
|
|
6709
6821
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6749,7 +6861,27 @@ function getEventFlags(event2, config) {
|
|
|
6749
6861
|
|
|
6750
6862
|
// ../commons/src/events/state/index.ts
|
|
6751
6863
|
function getStatusFromActions(actions) {
|
|
6752
|
-
|
|
6864
|
+
const acceptedActions = actions.filter(
|
|
6865
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6866
|
+
);
|
|
6867
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
6868
|
+
(archived, action) => {
|
|
6869
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
6870
|
+
return true;
|
|
6871
|
+
}
|
|
6872
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
6873
|
+
return false;
|
|
6874
|
+
}
|
|
6875
|
+
return archived;
|
|
6876
|
+
},
|
|
6877
|
+
false
|
|
6878
|
+
);
|
|
6879
|
+
if (isCurrentlyArchived) {
|
|
6880
|
+
return EventStatus.enum.ARCHIVED;
|
|
6881
|
+
}
|
|
6882
|
+
return acceptedActions.filter(
|
|
6883
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
6884
|
+
).reduce((status2, action) => {
|
|
6753
6885
|
switch (action.type) {
|
|
6754
6886
|
case ActionType.CREATE:
|
|
6755
6887
|
return EventStatus.enum.CREATED;
|
|
@@ -6757,10 +6889,11 @@ function getStatusFromActions(actions) {
|
|
|
6757
6889
|
return EventStatus.enum.DECLARED;
|
|
6758
6890
|
case ActionType.REGISTER:
|
|
6759
6891
|
return EventStatus.enum.REGISTERED;
|
|
6760
|
-
case ActionType.ARCHIVE:
|
|
6761
|
-
return EventStatus.enum.ARCHIVED;
|
|
6762
6892
|
case ActionType.NOTIFY:
|
|
6763
6893
|
return EventStatus.enum.NOTIFIED;
|
|
6894
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6895
|
+
case ActionType.ARCHIVE:
|
|
6896
|
+
case ActionType.UNARCHIVE:
|
|
6764
6897
|
case ActionType.CUSTOM:
|
|
6765
6898
|
case ActionType.PRINT_CERTIFICATE:
|
|
6766
6899
|
case ActionType.ASSIGN:
|
|
@@ -9845,6 +9978,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9845
9978
|
},
|
|
9846
9979
|
...input
|
|
9847
9980
|
}),
|
|
9981
|
+
unarchive: (eventId, input = {}) => ({
|
|
9982
|
+
type: ActionType.UNARCHIVE,
|
|
9983
|
+
transactionId: input.transactionId ?? getUUID(),
|
|
9984
|
+
declaration: {},
|
|
9985
|
+
annotation: {},
|
|
9986
|
+
eventId,
|
|
9987
|
+
...input
|
|
9988
|
+
}),
|
|
9848
9989
|
reject: (eventId, input = {}) => ({
|
|
9849
9990
|
type: ActionType.REJECT,
|
|
9850
9991
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -10003,6 +10144,7 @@ function generateActionDocument({
|
|
|
10003
10144
|
case ActionType.NOTIFY:
|
|
10004
10145
|
case ActionType.REGISTER:
|
|
10005
10146
|
case ActionType.REQUEST_CORRECTION:
|
|
10147
|
+
case ActionType.UNARCHIVE:
|
|
10006
10148
|
return { ...actionBase, type: action };
|
|
10007
10149
|
case ActionType.EDIT:
|
|
10008
10150
|
return {
|
|
@@ -10521,6 +10663,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10521
10663
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10522
10664
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10523
10665
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10666
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10524
10667
|
[ActionType.REJECT]: ["record.reject"],
|
|
10525
10668
|
[ActionType.ASSIGN]: null,
|
|
10526
10669
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10727,7 +10870,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10727
10870
|
ActionType.CUSTOM,
|
|
10728
10871
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10729
10872
|
],
|
|
10730
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10873
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
10874
|
+
ActionType.READ,
|
|
10875
|
+
ActionType.CUSTOM,
|
|
10876
|
+
ActionType.UNARCHIVE
|
|
10877
|
+
]
|
|
10731
10878
|
};
|
|
10732
10879
|
var ACTION_FILTERS = {
|
|
10733
10880
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10740,6 +10887,7 @@ var ACTION_FILTERS = {
|
|
|
10740
10887
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10741
10888
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10742
10889
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10890
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10743
10891
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10744
10892
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10745
10893
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|