@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b263ac1

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.
Files changed (95) hide show
  1. package/README.md +1 -0
  2. package/build.sh +2 -2
  3. package/dist/application-config/index.js +244 -197
  4. package/dist/cli.js +347 -5220
  5. package/dist/commons/api/router.d.ts +3730 -2896
  6. package/dist/commons/application-config/index.d.ts +6 -6
  7. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  8. package/dist/commons/conditionals/validate.d.ts +11 -4
  9. package/dist/commons/events/ActionConfig.d.ts +279 -70
  10. package/dist/commons/events/ActionDocument.d.ts +153 -115
  11. package/dist/commons/events/ActionInput.d.ts +26 -6
  12. package/dist/commons/events/ActionStatus.d.ts +14 -0
  13. package/dist/commons/events/ActionType.d.ts +63 -58
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -501
  15. package/dist/commons/events/AuditLog.d.ts +189 -40
  16. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  17. package/dist/commons/events/Conditional.d.ts +3 -3
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  19. package/dist/commons/events/Draft.d.ts +37 -35
  20. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  21. package/dist/commons/events/EventConfig.d.ts +8 -5
  22. package/dist/commons/events/EventDocument.d.ts +66 -44
  23. package/dist/commons/events/EventIndex.d.ts +49 -72
  24. package/dist/commons/events/EventMetadata.d.ts +40 -40
  25. package/dist/commons/events/FieldConfig.d.ts +411 -384
  26. package/dist/commons/events/FieldType.d.ts +51 -51
  27. package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
  28. package/dist/commons/events/FieldValue.d.ts +14 -14
  29. package/dist/commons/events/Flag.d.ts +57 -15
  30. package/dist/commons/events/PlainDate.d.ts +8 -0
  31. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  32. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  34. package/dist/commons/events/WorkqueueConfig.d.ts +822 -816
  35. package/dist/commons/events/deduplication.d.ts +1 -1
  36. package/dist/commons/events/event.d.ts +14 -2
  37. package/dist/commons/events/field.d.ts +69 -198
  38. package/dist/commons/events/index.d.ts +1 -0
  39. package/dist/commons/events/locationPayloads.d.ts +95 -0
  40. package/dist/commons/events/locations.d.ts +192 -12
  41. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  42. package/dist/commons/events/scopes.d.ts +5 -4
  43. package/dist/commons/events/state/index.d.ts +17 -17
  44. package/dist/commons/events/state/utils.d.ts +7 -7
  45. package/dist/commons/events/test.utils.d.ts +44 -39
  46. package/dist/commons/events/utils.d.ts +127 -105
  47. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  48. package/dist/conditionals/index.js +309 -57
  49. package/dist/environment/derived-variables.d.ts +119 -131
  50. package/dist/environment/derived-variables.d.ts.map +1 -1
  51. package/dist/environment/derived-variables.js +0 -14
  52. package/dist/environment/index.d.ts +1 -0
  53. package/dist/environment/index.d.ts.map +1 -1
  54. package/dist/environment/index.js +10 -0
  55. package/dist/environment/logger.d.ts +3 -3
  56. package/dist/environment/manage-users.js +17 -7
  57. package/dist/environment/paths.d.ts +7 -0
  58. package/dist/environment/paths.d.ts.map +1 -0
  59. package/dist/environment/paths.js +72 -0
  60. package/dist/environment/questions.d.ts +75 -74
  61. package/dist/environment/questions.d.ts.map +1 -1
  62. package/dist/environment/setup-environment.js +10 -29
  63. package/dist/environment/swarm-to-k8s.js +17 -7
  64. package/dist/environment/templates.d.ts.map +1 -1
  65. package/dist/environment/templates.js +2 -1
  66. package/dist/environment/update-workflows.d.ts.map +1 -1
  67. package/dist/environment/update-workflows.js +34 -12
  68. package/dist/environment/upgrade.d.ts +2 -0
  69. package/dist/environment/upgrade.d.ts.map +1 -0
  70. package/dist/environment/upgrade.js +82 -0
  71. package/dist/environment/users.js +28 -20
  72. package/dist/environment/utils.d.ts +1 -1
  73. package/dist/environment/utils.js +17 -7
  74. package/dist/events/deduplication.d.ts +1 -1
  75. package/dist/events/index.js +3650 -3145
  76. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  77. package/dist/migrations/v2.0/index.js +88 -5144
  78. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  79. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  80. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  81. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  82. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  83. package/dist/migrations/v2.1/index.d.ts +6 -0
  84. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  85. package/dist/migrations/v2.1/index.js +218 -0
  86. package/dist/notification/index.js +2019 -1072
  87. package/dist/scopes/index.d.ts +437 -163
  88. package/dist/scopes/index.js +310 -57
  89. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  90. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
  91. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  92. package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
  93. package/package.json +7 -7
  94. package/tsconfig.tsbuildinfo +1 -1
  95. package/opencrvs-toolkit-2.1.0-rc.b0003b1.tgz +0 -0
@@ -1,5 +1,6 @@
1
1
  import { UUID } from '../uuid';
2
2
  import * as z from 'zod/v4';
3
+ import { PlainDate } from './PlainDate';
3
4
  import { EventIndex } from './EventIndex';
4
5
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
5
6
  import { RecordScopeV2, UserScopeV2 } from '../scopes';
@@ -7,16 +8,50 @@ import { SystemContext, UserContext } from '../users/User';
7
8
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
8
9
  export declare const LocationTypeV1: z.ZodEnum<{
9
10
  ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
10
- HEALTH_FACILITY: "HEALTH_FACILITY";
11
11
  CRVS_OFFICE: "CRVS_OFFICE";
12
+ HEALTH_FACILITY: "HEALTH_FACILITY";
12
13
  }>;
13
14
  export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
15
+ export declare const LocationStatus: z.ZodEnum<{
16
+ active: "active";
17
+ inactive: "inactive";
18
+ }>;
19
+ export type LocationStatus = z.infer<typeof LocationStatus>;
20
+ /**
21
+ * A single element of the append-only `versions` history of a location or
22
+ * administrative area. Versions are sorted ascending by `effectiveFrom`
23
+ * ('0001-01-01' is used as the beginning-of-time sentinel).
24
+ */
25
+ export declare const LocationVersion: z.ZodObject<{
26
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
27
+ effectiveFrom: z.ZodISODate;
28
+ name: z.ZodString;
29
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ status: z.ZodEnum<{
31
+ active: "active";
32
+ inactive: "inactive";
33
+ }>;
34
+ }, z.core.$strip>;
35
+ export type LocationVersion = z.infer<typeof LocationVersion>;
14
36
  export declare const AdministrativeArea: z.ZodObject<{
15
37
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
16
38
  name: z.ZodString;
17
39
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
40
  parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
19
- validUntil: z.ZodNullable<z.ZodISODateTime>;
41
+ status: z.ZodEnum<{
42
+ active: "active";
43
+ inactive: "inactive";
44
+ }>;
45
+ versions: z.ZodArray<z.ZodObject<{
46
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
47
+ effectiveFrom: z.ZodISODate;
48
+ name: z.ZodString;
49
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ status: z.ZodEnum<{
51
+ active: "active";
52
+ inactive: "inactive";
53
+ }>;
54
+ }, z.core.$strip>>;
20
55
  }, z.core.$strip>;
21
56
  export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
22
57
  export declare const Location: z.ZodObject<{
@@ -24,10 +59,121 @@ export declare const Location: z.ZodObject<{
24
59
  name: z.ZodString;
25
60
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
61
  administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
27
- validUntil: z.ZodNullable<z.ZodISODateTime>;
28
62
  locationType: z.ZodNullable<z.ZodString>;
63
+ status: z.ZodEnum<{
64
+ active: "active";
65
+ inactive: "inactive";
66
+ }>;
67
+ versions: z.ZodArray<z.ZodObject<{
68
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
69
+ effectiveFrom: z.ZodISODate;
70
+ name: z.ZodString;
71
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ status: z.ZodEnum<{
73
+ active: "active";
74
+ inactive: "inactive";
75
+ }>;
76
+ }, z.core.$strip>>;
29
77
  }, z.core.$strip>;
30
78
  export type Location = z.infer<typeof Location>;
79
+ /**
80
+ * TEMPORARY — client-side view of {@link AdministrativeArea} with the
81
+ * server-flattened `name`, `status` and `externalId` removed, leaving exactly
82
+ * identity + versions. Every name/status read is thereby forced through the
83
+ * anchored resolution utilities ({@link resolveVersion}, {@link resolvePath})
84
+ * at compile time. Delete this type when the contract migration removes the
85
+ * flat fields from the server schema, at which point the wire type itself
86
+ * becomes identity + versions.
87
+ */
88
+ export declare const ClientAdministrativeArea: z.ZodObject<{
89
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
90
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
91
+ versions: z.ZodArray<z.ZodObject<{
92
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
93
+ effectiveFrom: z.ZodISODate;
94
+ name: z.ZodString;
95
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ status: z.ZodEnum<{
97
+ active: "active";
98
+ inactive: "inactive";
99
+ }>;
100
+ }, z.core.$strip>>;
101
+ }, z.core.$strip>;
102
+ export type ClientAdministrativeArea = z.infer<typeof ClientAdministrativeArea>;
103
+ /**
104
+ * TEMPORARY — client-side view of {@link Location} with the server-flattened
105
+ * `name`, `status` and `externalId` removed, leaving exactly identity +
106
+ * versions. See {@link ClientAdministrativeArea} for the full rationale and
107
+ * deletion condition.
108
+ */
109
+ export declare const ClientLocation: z.ZodObject<{
110
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
111
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
112
+ locationType: z.ZodNullable<z.ZodString>;
113
+ versions: z.ZodArray<z.ZodObject<{
114
+ versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
115
+ effectiveFrom: z.ZodISODate;
116
+ name: z.ZodString;
117
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ status: z.ZodEnum<{
119
+ active: "active";
120
+ inactive: "inactive";
121
+ }>;
122
+ }, z.core.$strip>>;
123
+ }, z.core.$strip>;
124
+ export type ClientLocation = z.infer<typeof ClientLocation>;
125
+ /**
126
+ * Strips the server-flattened fields from a location as it enters the
127
+ * client's cached maps. The wire format keeps the flat fields for
128
+ * compatibility; the cache must not, or devices would keep rendering names
129
+ * flattened before a future-dated version takes effect.
130
+ */
131
+ export declare function toClientLocation(location: Location): ClientLocation;
132
+ /** See {@link toClientLocation}. */
133
+ export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
134
+ /**
135
+ * Input payload for the locations `set` mutation. Carries only the seedable
136
+ * identity and hierarchy fields — version history is managed by the server.
137
+ */
138
+ export declare const SetLocationPayload: z.ZodObject<{
139
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
140
+ name: z.ZodString;
141
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
143
+ locationType: z.ZodNullable<z.ZodString>;
144
+ }, z.core.$strip>;
145
+ export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
146
+ /**
147
+ * Input payload for the administrative areas `set` mutation. Carries only the
148
+ * seedable identity and hierarchy fields — version history is managed by the
149
+ * server.
150
+ */
151
+ export declare const SetAdministrativeAreaPayload: z.ZodObject<{
152
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
153
+ name: z.ZodString;
154
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
155
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
156
+ }, z.core.$strip>;
157
+ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
158
+ /**
159
+ * Resolves the version in effect at the given anchor date.
160
+ *
161
+ * Returns the element with the greatest `effectiveFrom` that is less than or
162
+ * equal to `anchor`, falling back to the earliest element when the anchor
163
+ * precedes all versions. Assumes `versions` is sorted ascending by
164
+ * `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
165
+ * so plain string comparison is correct.
166
+ */
167
+ export declare function resolveVersion<T extends {
168
+ effectiveFrom: string;
169
+ }>(versions: T[], anchor: string): T;
170
+ /**
171
+ * Whether the entity holds the given externalId with active status at the
172
+ * anchor date or at any point after it. Used for point-in-time uniqueness of
173
+ * external codes: a new holder starting at `anchor` collides when an existing
174
+ * holder is (or is scheduled to be) active with the code from then on.
175
+ */
176
+ export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
31
177
  type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
32
178
  /**
33
179
  * For type T, convert fields K to arrays. If field is string, convert to string[].
@@ -74,13 +220,10 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
74
220
  * One of the scopes must allow access for the event to be accessible.
75
221
  */
76
222
  export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
77
- export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
78
- id: string & z.core.$brand<"UUID">;
79
- name: string;
80
- parentId: (string & z.core.$brand<"UUID">) | null;
81
- validUntil: string | null;
82
- externalId?: string | null | undefined;
83
- }[];
223
+ export declare function getAdministrativeAreaHierarchy<A extends {
224
+ id: UUID;
225
+ parentId: UUID | null;
226
+ }>(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, A>): A[];
84
227
  /**
85
228
  * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
86
229
  *
@@ -92,8 +235,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
92
235
  * so the result is reversed to match the root-first convention used by the server.
93
236
  */
94
237
  export declare function getLocationHierarchy(selectedId: UUID, context: {
95
- administrativeAreas: Map<UUID, AdministrativeArea>;
96
- locations: Map<UUID, Location>;
238
+ administrativeAreas: Map<UUID, {
239
+ id: UUID;
240
+ parentId: UUID | null;
241
+ }>;
242
+ locations: Map<UUID, {
243
+ id: UUID;
244
+ administrativeAreaId: UUID | null;
245
+ }>;
97
246
  }): UUID[];
247
+ /**
248
+ * A node of an anchored hierarchy path: the identity id plus the name and
249
+ * status in effect at the anchor date.
250
+ */
251
+ export type ResolvedPathNode = {
252
+ id: UUID;
253
+ name: string;
254
+ status: LocationStatus;
255
+ };
256
+ /**
257
+ * Resolves a location or administrative area id into its root-first
258
+ * hierarchy path — leaf included — with every node's name and status
259
+ * resolved at the anchor date.
260
+ *
261
+ * The parent chain is identity-level and fixed for life, so the chain is
262
+ * constant and only each node's name/status varies with the anchor. Status is
263
+ * returned for callers that filter on it; an inactive node still resolves to
264
+ * its name. Returns an empty array for an unknown id.
265
+ */
266
+ export declare function resolvePath(locationId: UUID, anchor: PlainDate, context: {
267
+ administrativeAreas: Map<UUID, {
268
+ id: UUID;
269
+ parentId: UUID | null;
270
+ versions: LocationVersion[];
271
+ }>;
272
+ locations: Map<UUID, {
273
+ id: UUID;
274
+ administrativeAreaId: UUID | null;
275
+ versions: LocationVersion[];
276
+ }>;
277
+ }): ResolvedPathNode[];
98
278
  export {};
99
279
  //# sourceMappingURL=locations.d.ts.map
@@ -4,16 +4,60 @@ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
4
4
  export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
5
5
  id: string & import("zod").$brand<"UUID">;
6
6
  name: string;
7
+ externalId?: string | null | undefined;
7
8
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8
- validUntil: string | null;
9
9
  locationType: string | null;
10
- externalId?: string | null | undefined;
10
+ status: "active" | "inactive";
11
+ versions: {
12
+ versionId: string & import("zod").$brand<"UUID">;
13
+ effectiveFrom: string;
14
+ name: string;
15
+ externalId?: string | null | undefined;
16
+ status: "active" | "inactive";
17
+ }[];
11
18
  }>;
12
19
  export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
20
  id: string & import("zod").$brand<"UUID">;
14
21
  name: string;
15
- parentId: (string & import("zod").$brand<"UUID">) | null;
16
- validUntil: string | null;
17
22
  externalId?: string | null | undefined;
23
+ parentId: (string & import("zod").$brand<"UUID">) | null;
24
+ status: "active" | "inactive";
25
+ versions: {
26
+ versionId: string & import("zod").$brand<"UUID">;
27
+ effectiveFrom: string;
28
+ name: string;
29
+ externalId?: string | null | undefined;
30
+ status: "active" | "inactive";
31
+ }[];
32
+ }>;
33
+ /**
34
+ * Stripped view of {@link V2_DEFAULT_MOCK_LOCATIONS_MAP} matching what the
35
+ * client's cached location map actually holds at runtime (identity +
36
+ * versions only). Use this — not the wire-format map above — wherever a test
37
+ * stands in for `useLocations().getLocations.useSuspenseQuery()`.
38
+ */
39
+ export declare const V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
40
+ id: string & import("zod").$brand<"UUID">;
41
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
42
+ locationType: string | null;
43
+ versions: {
44
+ versionId: string & import("zod").$brand<"UUID">;
45
+ effectiveFrom: string;
46
+ name: string;
47
+ externalId?: string | null | undefined;
48
+ status: "active" | "inactive";
49
+ }[];
50
+ }>;
51
+ /** See {@link V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP}. */
52
+ export declare const V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
53
+ id: string & import("zod").$brand<"UUID">;
54
+ parentId: (string & import("zod").$brand<"UUID">) | null;
55
+ versions: {
56
+ versionId: string & import("zod").$brand<"UUID">;
57
+ effectiveFrom: string;
58
+ name: string;
59
+ externalId?: string | null | undefined;
60
+ status: "active" | "inactive";
61
+ }[];
18
62
  }>;
19
63
  //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -13,13 +13,14 @@ export declare const ACTION_SCOPE_MAP: {
13
13
  DELETE: ("record.declare" | "record.notify")[];
14
14
  REGISTER: "record.register"[];
15
15
  PRINT_CERTIFICATE: "record.print-certified-copies"[];
16
- REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
16
+ REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
17
17
  REVIEW_CORRECTION_REQUEST: "record.correct"[];
18
18
  REJECT_CORRECTION: "record.correct"[];
19
19
  APPROVE_CORRECTION: "record.correct"[];
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;
@@ -28,9 +29,9 @@ export declare const ACTION_SCOPE_MAP: {
28
29
  };
29
30
  export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
30
31
  export declare const AssignmentStatus: {
31
- readonly ASSIGNED_TO_SELF: "ASSIGNED_TO_SELF";
32
- readonly ASSIGNED_TO_OTHERS: "ASSIGNED_TO_OTHERS";
33
- readonly UNASSIGNED: "UNASSIGNED";
32
+ readonly ASSIGNED_TO_SELF: 'ASSIGNED_TO_SELF';
33
+ readonly ASSIGNED_TO_OTHERS: 'ASSIGNED_TO_OTHERS';
34
+ readonly UNASSIGNED: 'UNASSIGNED';
34
35
  };
35
36
  export type AssignmentStatus = (typeof AssignmentStatus)[keyof typeof AssignmentStatus];
36
37
  export declare function getAssignmentStatus(eventState: EventIndex | EventIndexWithAdministrativeHierarchy, userId: string): AssignmentStatus;
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
9
  import { DocumentPath } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
10
+ export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
12
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
13
13
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
@@ -63,37 +63,45 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
63
63
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
64
64
  id: string & import("zod").$brand<"UUID">;
65
65
  type: string;
66
- status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
66
+ status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
67
67
  legalStatuses: {
68
68
  NOTIFIED?: {
69
69
  createdAt: string;
70
70
  createdBy: string;
71
- acceptedAt: string;
72
71
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
73
- createdByUserType?: "user" | "system" | null | undefined;
72
+ createdByUserType?: "system" | "user" | null | undefined;
73
+ acceptedAt: string;
74
74
  createdByRole?: string | undefined;
75
75
  } | null | undefined;
76
76
  DECLARED?: {
77
77
  createdAt: string;
78
78
  createdBy: string;
79
- acceptedAt: string;
80
79
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
81
- createdByUserType?: "user" | "system" | null | undefined;
80
+ createdByUserType?: "system" | "user" | null | undefined;
81
+ acceptedAt: string;
82
82
  createdByRole?: string | undefined;
83
83
  } | null | undefined;
84
84
  REGISTERED?: {
85
85
  createdAt: string;
86
86
  createdBy: string;
87
- acceptedAt: string;
88
- registrationNumber: string;
89
87
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
90
- createdByUserType?: "user" | "system" | null | undefined;
88
+ createdByUserType?: "system" | "user" | null | undefined;
89
+ acceptedAt: string;
91
90
  createdByRole?: string | undefined;
91
+ registrationNumber: string;
92
92
  } | null | undefined;
93
93
  };
94
94
  createdAt: string;
95
+ dateOfEvent?: string | null | undefined;
96
+ placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
95
97
  createdBy: string;
98
+ createdByUserType?: "system" | "user" | null | undefined;
99
+ updatedByUserRole?: string | null | undefined;
100
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
101
+ updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
96
102
  updatedAt: string;
103
+ assignedTo?: string | null | undefined;
104
+ updatedBy?: string | null | undefined;
97
105
  trackingId: string;
98
106
  potentialDuplicates: {
99
107
  id: string & import("zod").$brand<"UUID">;
@@ -101,14 +109,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
101
109
  }[];
102
110
  flags: string[];
103
111
  declaration: Record<string, import("..").FieldValue>;
104
- dateOfEvent?: string | null | undefined;
105
- placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
106
- createdByUserType?: "user" | "system" | null | undefined;
107
- updatedByUserRole?: string | null | undefined;
108
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
109
- updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
110
- assignedTo?: string | null | undefined;
111
- updatedBy?: string | null | undefined;
112
112
  };
113
113
  /**
114
114
  * Annotation is always specific to the action. when action with annotation is triggered multiple times,
@@ -14,17 +14,17 @@ import { Action } from '../ActionDocument';
14
14
  export declare function getActionUpdateMetadata(actions: Action[]): Pick<{
15
15
  id: string & import("zod").$brand<"UUID">;
16
16
  transactionId: string;
17
- createdByUserType: "user" | "system";
17
+ createdByUserType: "system" | "user";
18
18
  createdAt: string;
19
19
  createdBy: string;
20
- declaration: Record<string, import("..").FieldUpdateValue>;
21
- status: "Requested" | "Accepted" | "Rejected";
22
20
  createdByRole?: string | undefined;
23
21
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
24
22
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
23
+ declaration: Record<string, import("..").FieldUpdateValue>;
25
24
  annotation?: Record<string, import("..").FieldUpdateValue> | null | undefined;
25
+ status: "Accepted" | "Rejected" | "Requested";
26
26
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
27
- }, "createdByUserType" | "createdAt" | "createdBy" | "createdByRole" | "createdAtLocation">;
27
+ }, "createdAt" | "createdAtLocation" | "createdBy" | "createdByRole" | "createdByUserType">;
28
28
  /**
29
29
  * @returns the legal statuses of the event. Event is considered legal if it has been accepted.
30
30
  * @see EventIndex for the description of the returned object.
@@ -33,7 +33,7 @@ export declare function getLegalStatuses(actions: Action[]): {
33
33
  NOTIFIED: {
34
34
  createdAt: string;
35
35
  createdBy: string;
36
- createdByUserType: "user" | "system";
36
+ createdByUserType: "system" | "user";
37
37
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
38
38
  acceptedAt: string;
39
39
  createdByRole: string | undefined;
@@ -42,7 +42,7 @@ export declare function getLegalStatuses(actions: Action[]): {
42
42
  DECLARED: {
43
43
  createdAt: string;
44
44
  createdBy: string;
45
- createdByUserType: "user" | "system";
45
+ createdByUserType: "system" | "user";
46
46
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
47
47
  acceptedAt: string;
48
48
  createdByRole: string | undefined;
@@ -51,7 +51,7 @@ export declare function getLegalStatuses(actions: Action[]): {
51
51
  REGISTERED: {
52
52
  createdAt: string;
53
53
  createdBy: string;
54
- createdByUserType: "user" | "system";
54
+ createdByUserType: "system" | "user";
55
55
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
56
56
  acceptedAt: string;
57
57
  createdByRole: string | undefined;