@opencrvs/toolkit 2.2.0-rc.1a111f2 → 2.2.0-rc.25c3c81

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 (118) hide show
  1. package/build.sh +15 -2
  2. package/dist/application-config/index.js +16 -5
  3. package/dist/authentication/index.d.ts +1 -1
  4. package/dist/authentication/index.js +4 -8
  5. package/dist/cli.js +1109 -25
  6. package/dist/commons/api/router.d.ts +13 -0
  7. package/dist/commons/application-config/index.d.ts +1 -1
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/validate.d.ts +1 -1
  10. package/dist/commons/events/ActionStatus.d.ts +2 -2
  11. package/dist/commons/events/EventConfig.d.ts +66 -5
  12. package/dist/commons/events/EventDocument.d.ts +2 -0
  13. package/dist/commons/events/EventIndex.d.ts +1 -0
  14. package/dist/commons/events/EventInput.d.ts +1 -0
  15. package/dist/commons/events/EventMetadata.d.ts +1 -0
  16. package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
  17. package/dist/commons/events/PlainDate.d.ts +5 -0
  18. package/dist/commons/events/defineConfig.d.ts +1 -1
  19. package/dist/commons/events/locations.d.ts +1 -1
  20. package/dist/commons/events/scopes.d.ts +1 -1
  21. package/dist/commons/events/state/index.d.ts +1 -0
  22. package/dist/commons/events/test.utils.d.ts +2 -1
  23. package/dist/commons/events/utils.d.ts +15 -2
  24. package/dist/commons/users/Role.d.ts +23 -0
  25. package/dist/commons/users/User.d.ts +263 -0
  26. package/dist/commons/users/authentication.d.ts +67 -0
  27. package/dist/commons/users/index.d.ts +5 -0
  28. package/dist/commons/users/roleValidations.d.ts +15 -0
  29. package/dist/commons/users/scopes.d.ts +1402 -0
  30. package/dist/commons/users/userReferences.d.ts +176 -0
  31. package/dist/conditionals/index.js +3 -3
  32. package/dist/configurator/index.d.ts +24 -0
  33. package/dist/configurator/index.d.ts.map +1 -0
  34. package/dist/configurator/index.js +161 -0
  35. package/dist/configurator/layout.d.ts +28 -0
  36. package/dist/configurator/layout.d.ts.map +1 -0
  37. package/dist/configurator/layout.js +78 -0
  38. package/dist/configurator/paths.d.ts +13 -0
  39. package/dist/configurator/paths.d.ts.map +1 -0
  40. package/dist/configurator/paths.js +48 -0
  41. package/dist/configurator/server/environments.d.ts +20 -0
  42. package/dist/configurator/server/environments.d.ts.map +1 -0
  43. package/dist/configurator/server/environments.js +143 -0
  44. package/dist/configurator/server/files.d.ts +11 -0
  45. package/dist/configurator/server/files.d.ts.map +1 -0
  46. package/dist/configurator/server/files.js +67 -0
  47. package/dist/configurator/server/github.d.ts +56 -0
  48. package/dist/configurator/server/github.d.ts.map +1 -0
  49. package/dist/configurator/server/github.js +239 -0
  50. package/dist/configurator/server/plugin.d.ts +39 -0
  51. package/dist/configurator/server/plugin.d.ts.map +1 -0
  52. package/dist/configurator/server/plugin.js +298 -0
  53. package/dist/configurator/server/seal.d.ts +2 -0
  54. package/dist/configurator/server/seal.d.ts.map +1 -0
  55. package/dist/configurator/server/seal.js +36 -0
  56. package/dist/configurator/server/sshKeys.d.ts +5 -0
  57. package/dist/configurator/server/sshKeys.d.ts.map +1 -0
  58. package/dist/configurator/server/sshKeys.js +28 -0
  59. package/dist/configurator/server/start.d.ts +12 -0
  60. package/dist/configurator/server/start.d.ts.map +1 -0
  61. package/dist/configurator/server/start.js +91 -0
  62. package/dist/configurator/testing.d.ts +11 -0
  63. package/dist/configurator/testing.d.ts.map +1 -0
  64. package/dist/configurator/testing.js +74 -0
  65. package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
  66. package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
  67. package/dist/configurator/ui/bindings/bindings.js +5 -0
  68. package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
  69. package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
  70. package/dist/configurator/ui/bindings/parsers.js +85 -0
  71. package/dist/configurator/ui/form/users.d.ts +11 -0
  72. package/dist/configurator/ui/form/users.d.ts.map +1 -0
  73. package/dist/configurator/ui/form/users.js +33 -0
  74. package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
  75. package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
  76. package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
  77. package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
  78. package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
  79. package/dist/configurator/ui/plan/templateValues.js +70 -0
  80. package/dist/configurator/workflows.d.ts +53 -0
  81. package/dist/configurator/workflows.d.ts.map +1 -0
  82. package/dist/configurator/workflows.js +161 -0
  83. package/dist/configurator-assets/forms/bindings.yml +263 -0
  84. package/dist/configurator-assets/templates/README.md +18 -0
  85. package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
  86. package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +99 -0
  87. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  88. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
  89. package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
  90. package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
  91. package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
  92. package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
  93. package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
  94. package/dist/configurator-assets/ui/assets/index-Bf3eC7uO.js +169 -0
  95. package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
  96. package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
  97. package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
  98. package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
  99. package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
  100. package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
  101. package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
  102. package/dist/configurator-assets/ui/index.html +25 -0
  103. package/dist/environment/setup-environment.d.ts.map +1 -1
  104. package/dist/environment/setup-environment.js +6 -0
  105. package/dist/events/index.js +188 -65
  106. package/dist/notification/index.js +124 -48
  107. package/dist/roles/index.d.ts +2 -0
  108. package/dist/roles/index.d.ts.map +1 -0
  109. package/dist/roles/index.js +730 -0
  110. package/dist/scopes/index.d.ts +0 -10
  111. package/dist/scopes/index.js +3 -7
  112. package/dist/templates/charts-values/dependencies/values.yaml +2 -0
  113. package/opencrvs-toolkit-2.2.0-rc.25c3c81.tgz +0 -0
  114. package/package.json +15 -3
  115. package/tsconfig.build.json +11 -1
  116. package/tsconfig.build.tsbuildinfo +1 -1
  117. package/tsconfig.json +15 -6
  118. package/opencrvs-toolkit-2.2.0-rc.1a111f2.tgz +0 -0
@@ -123,6 +123,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
123
123
  transactionId: string;
124
124
  type: string;
125
125
  createdAtLocation?: string | null | undefined;
126
+ configVersionId?: string | undefined;
126
127
  };
127
128
  output: {
128
129
  id: string & import("zod").$brand<"UUID">;
@@ -469,6 +470,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
469
470
  status: "Rejected";
470
471
  })[];
471
472
  trackingId: string;
473
+ configVersionId: string;
472
474
  };
473
475
  meta: import("trpc-to-openapi").OpenApiMeta;
474
476
  }>;
@@ -822,6 +824,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
822
824
  status: "Rejected";
823
825
  })[];
824
826
  trackingId: string;
827
+ configVersionId: string;
825
828
  };
826
829
  meta: import("trpc-to-openapi").OpenApiMeta;
827
830
  }>;
@@ -1175,6 +1178,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1175
1178
  status: "Rejected";
1176
1179
  })[];
1177
1180
  trackingId: string;
1181
+ configVersionId: string;
1178
1182
  }[];
1179
1183
  meta: import("trpc-to-openapi").OpenApiMeta;
1180
1184
  }>;
@@ -2030,6 +2034,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2030
2034
  status: "Rejected";
2031
2035
  })[];
2032
2036
  trackingId: string;
2037
+ configVersionId: string;
2033
2038
  };
2034
2039
  meta: import("trpc-to-openapi").OpenApiMeta;
2035
2040
  }>;
@@ -2715,6 +2720,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2715
2720
  status: "Rejected";
2716
2721
  })[];
2717
2722
  trackingId: string;
2723
+ configVersionId: string;
2718
2724
  };
2719
2725
  meta: import("trpc-to-openapi").OpenApiMeta;
2720
2726
  }>;
@@ -5369,6 +5375,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5369
5375
  status: "Rejected";
5370
5376
  })[];
5371
5377
  trackingId: string;
5378
+ configVersionId: string;
5372
5379
  };
5373
5380
  meta: import("trpc-to-openapi").OpenApiMeta;
5374
5381
  }>;
@@ -5416,6 +5423,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5416
5423
  createdAt: string;
5417
5424
  updatedAt: string;
5418
5425
  trackingId: string;
5426
+ configVersionId: string;
5419
5427
  actions: ({
5420
5428
  id: string & import("zod").$brand<"UUID">;
5421
5429
  transactionId: string;
@@ -5779,6 +5787,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5779
5787
  createdAt: string;
5780
5788
  updatedAt: string;
5781
5789
  trackingId: string;
5790
+ configVersionId: string;
5782
5791
  actions: ({
5783
5792
  id: string & import("zod").$brand<"UUID">;
5784
5793
  transactionId: string;
@@ -8192,6 +8201,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8192
8201
  status: "Rejected";
8193
8202
  })[];
8194
8203
  trackingId: string;
8204
+ configVersionId: string;
8195
8205
  };
8196
8206
  meta: import("trpc-to-openapi").OpenApiMeta;
8197
8207
  }>;
@@ -8554,6 +8564,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8554
8564
  status: "Rejected";
8555
8565
  })[];
8556
8566
  trackingId: string;
8567
+ configVersionId: string;
8557
8568
  };
8558
8569
  meta: import("trpc-to-openapi").OpenApiMeta;
8559
8570
  }>;
@@ -8570,6 +8581,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8570
8581
  results: {
8571
8582
  id: string & import("zod").$brand<"UUID">;
8572
8583
  type: string;
8584
+ configVersionId: string;
8573
8585
  status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
8574
8586
  legalStatuses: {
8575
8587
  NOTIFIED?: {
@@ -8975,6 +8987,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8975
8987
  status: "Rejected";
8976
8988
  })[];
8977
8989
  trackingId: string;
8990
+ configVersionId: string;
8978
8991
  }[];
8979
8992
  output: any;
8980
8993
  meta: import("trpc-to-openapi").OpenApiMeta;
@@ -87,7 +87,7 @@ export declare const ClientConfig: z.ZodObject<{
87
87
  }, z.core.$strip>>;
88
88
  }, z.core.$strip>>;
89
89
  FEATURES: z.ZodDefault<z.ZodOptional<z.ZodObject<{
90
- V2_EVENTS: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
90
+ _EXPERIMENTAL_LEGACY_RECORDS: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
91
91
  }, z.core.$strip>>>;
92
92
  }, z.core.$strip>;
93
93
  export type ClientConfig = z.infer<typeof ClientConfig>;
@@ -1,6 +1,6 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
2
  import { ActionUpdate, EventState } from '../events/ActionDocument';
3
- import { ITokenPayload as TokenPayload } from '../authentication';
3
+ import { ITokenPayload as TokenPayload } from '../users/authentication';
4
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
5
  import { userSerializer } from '../events/serializers/user/serializer';
6
6
  import { UUID } from '../uuid';
@@ -83,13 +83,13 @@ export declare const now: typeof todayDateTimeValueSerializer;
83
83
  * Generate conditional rules for user.
84
84
  */
85
85
  export declare const user: typeof userSerializer & {
86
- scope: (scope: import("../scopes").ScopeType) => {
87
- attribute: (option: import("../scopes").ScopeOptionKey) => {
86
+ scope: (scope: import("../users/scopes").ScopeType) => {
87
+ attribute: (option: import("../users/scopes").ScopeOptionKey) => {
88
88
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
89
89
  $option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
90
90
  };
91
91
  };
92
- jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
92
+ jurisdiction: (jurisdiction: import("../users/scopes").JurisdictionFilter | {
93
93
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
94
94
  $option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
95
95
  }) => {
@@ -4,7 +4,7 @@ import { FieldConditional } from '../events/Conditional';
4
4
  import { FieldConfig } from '../events/FieldConfig';
5
5
  import { PlainDate, FieldUpdateValue, FieldValue } from '../events/FieldValue';
6
6
  import { TranslationConfig } from '../events/TranslationConfig';
7
- import { EncodedScope, TokenUserType } from '../authentication';
7
+ import { EncodedScope, TokenUserType } from '../users/authentication';
8
8
  import { UUID } from '../uuid';
9
9
  import { FormState } from '../events/utils';
10
10
  import { ActionConfig } from '../events/ActionConfig';
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Deliberately dependency-free (aside from language builtins) so that files
3
3
  * like Flag.ts can depend on ActionStatus without being pulled into the
4
- * commons/scopes.ts <-> commons/authentication.ts import cycle that
4
+ * commons/users/scopes.ts <-> commons/users/authentication.ts import cycle that
5
5
  * ActionDocument.ts participates in (it imports TokenUserType from
6
- * '../authentication').
6
+ * '../users/authentication').
7
7
  */
8
8
  export declare const ActionStatus: {
9
9
  readonly Requested: 'Requested';
@@ -9,6 +9,7 @@ import { FlagConfig } from './Flag';
9
9
  import type { JSONSchema } from '../conditionals/conditionals';
10
10
  import { AvailableIcons } from '../icons';
11
11
  import { ActionType } from './ActionType';
12
+ import { PlainDate } from './PlainDate';
12
13
  export declare const EventFieldReference: z.ZodObject<{
13
14
  $$event: z.ZodEnum<{
14
15
  createdAt: "createdAt";
@@ -72,6 +73,8 @@ export type EventConfigInput = Omit<EventConfigSchemaInput, 'actions'> & {
72
73
  export type EventConfigVersionInput = Omit<EventConfigSchemaInput, EventLevelField> & {
73
74
  /** Identifier of the version, unique within the event (e.g. "birth-v2"). */
74
75
  id: string;
76
+ /** Name of the version, which the UI shows wherever it names the version. For example, `{event.configVersionLabel}` in the event summary. */
77
+ label: TranslationConfig;
75
78
  /** Date (YYYY-MM-DD) from which this version is effective. Without one, effective from the beginning of time. */
76
79
  effectiveFrom?: string;
77
80
  };
@@ -415,13 +418,18 @@ declare const eventLevelFields: {
415
418
  export declare function validateEventConfig(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
416
419
  export declare const EventConfig: z.ZodType<EventConfig, EventConfigSchemaInput>;
417
420
  type EventLevelField = keyof typeof eventLevelFields;
418
- /** Id of the version of an event configured without `versions`. */
419
- export declare const DEFAULT_EVENT_CONFIG_VERSION_ID = "default";
421
+ /**
422
+ * Id of the version of an event configured without `versions`, i.e. the configuration
423
+ * before versioning. Records created before versioning are stamped with it.
424
+ */
425
+ export declare const INITIAL_EVENT_CONFIG_VERSION_ID = "initial";
420
426
  /** `effectiveFrom` of a version configured without one. */
421
427
  export declare const DEFAULT_EFFECTIVE_FROM = "0001-01-01";
422
428
  /** One version of an event: what the event looks like from `effectiveFrom` on. */
423
429
  export type EventConfigVersion = Omit<EventConfig, EventLevelField> & {
424
430
  id: string;
431
+ /** Name of the version. A version configured without `versions` has the label of the event. */
432
+ label: TranslationConfig;
425
433
  /** Date (YYYY-MM-DD) from which this version is effective. '0001-01-01' when configured without one. */
426
434
  effectiveFrom: string;
427
435
  };
@@ -437,10 +445,63 @@ export type VersionedEventConfig = Pick<EventConfig, EventLevelField> & {
437
445
  * version of the event. The same event and version give the same object, so caches
438
446
  * keyed on the configuration keep working.
439
447
  */
440
- export declare function getEventConfigOfVersion(config: VersionedEventConfig, version: EventConfigVersion): EventConfig;
448
+ export declare function toEventConfig(config: VersionedEventConfig, version: EventConfigVersion): EventConfig;
449
+ /** @returns the version with id `versionId`, or undefined when it is not configured. */
450
+ export declare function findConfigVersion(config: VersionedEventConfig, versionId: string): EventConfigVersion | undefined;
451
+ /**
452
+ * @returns the version with id `versionId`.
453
+ * @throws when that version is not configured.
454
+ */
455
+ export declare function getConfigVersion(config: VersionedEventConfig, versionId: string): EventConfigVersion;
456
+ /**
457
+ * @returns the configuration of the version with id `versionId`.
458
+ * @throws when the version is not configured.
459
+ */
460
+ export declare function getEventConfigOfVersion(config: VersionedEventConfig, versionId: string): EventConfig;
461
+ /** Orders versions by `effectiveFrom`, earliest first. */
462
+ export declare function byEffectiveFrom(a: EventConfigVersion, b: EventConfigVersion): number;
463
+ /**
464
+ * @returns the versions that took effect on or before the date of `now` in `timeZone`,
465
+ * the country's time zone.
466
+ * Earliest first, so the last one is the version in effect at `now`.
467
+ */
468
+ export declare function getVersionsInEffect(config: VersionedEventConfig, now: Date, timeZone: string): EventConfigVersion[];
469
+ /**
470
+ * @returns the version in effect at `now`: the one with the latest `effectiveFrom` not
471
+ * after the date of `now` in `timeZone`, the country's time zone, since versions take
472
+ * effect at its midnight. Undefined when every version takes effect later.
473
+ */
474
+ export declare function resolveEffectiveVersion(config: VersionedEventConfig, now: Date, timeZone: string): EventConfigVersion | undefined;
475
+ /**
476
+ * @returns the configuration of the version a record is stamped with, like
477
+ * `getEventConfigForRecord`, or undefined when that version is not configured.
478
+ */
479
+ export declare function findEventConfigForRecord(config: VersionedEventConfig, record: {
480
+ configVersionId: string;
481
+ }): EventConfig | undefined;
482
+ /**
483
+ * @returns the configuration of the version a record is stamped with.
484
+ * @throws when the record's version is no longer configured.
485
+ */
486
+ export declare function getEventConfigForRecord(config: VersionedEventConfig, record: {
487
+ configVersionId: string;
488
+ }): EventConfig;
489
+ /**
490
+ * @returns the configuration of the version in effect on `date`, a date in the
491
+ * country's time zone. For a record, use `getEventConfigForRecord` instead.
492
+ * @throws when no version is in effect on that date, which `defineConfig` rules out.
493
+ */
494
+ export declare function resolveEventConfigOnDate(config: VersionedEventConfig, date: PlainDate): EventConfig;
495
+ /**
496
+ * @returns the configuration of the version in effect on the date of `now` (today by
497
+ * default) in `timeZone`, the country's time zone. For a record, use
498
+ * `getEventConfigForRecord` instead.
499
+ * @throws when no version is in effect on that date, which `defineConfig` rules out.
500
+ */
501
+ export declare function resolveEventConfigInTimeZone(config: VersionedEventConfig, timeZone: string, now?: Date): EventConfig;
441
502
  /**
442
- * @returns the configuration of the version of the event that applies.
443
- * @TODO: always the first version until the version is resolved from the record (#13602).
503
+ * @returns the configuration of the version in effect today in UTC. For country config
504
+ * code with no time zone at hand; core code uses `resolveEventConfigInTimeZone`.
444
505
  */
445
506
  export declare function resolveEventConfig(config: VersionedEventConfig): EventConfig;
446
507
  /**
@@ -509,6 +509,7 @@ export declare const EventDocument: z.ZodObject<{
509
509
  status: z.ZodLiteral<"Rejected">;
510
510
  }, z.core.$strip>]>>;
511
511
  trackingId: z.ZodString;
512
+ configVersionId: z.ZodString;
512
513
  }, z.core.$strip>;
513
514
  export type EventDocument = z.infer<typeof EventDocument>;
514
515
  export declare const EventDocumentOnlyLastAction: z.core.$ZodBranded<z.ZodObject<{
@@ -517,6 +518,7 @@ export declare const EventDocumentOnlyLastAction: z.core.$ZodBranded<z.ZodObject
517
518
  createdAt: z.ZodString;
518
519
  updatedAt: z.ZodString;
519
520
  trackingId: z.ZodString;
521
+ configVersionId: z.ZodString;
520
522
  actions: z.ZodArray<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
521
523
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
522
524
  transactionId: z.ZodString;
@@ -3,6 +3,7 @@ export { ContainsFlags } from './Flag';
3
3
  export declare const EventIndex: z.ZodObject<{
4
4
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
5
5
  type: z.ZodString;
6
+ configVersionId: z.ZodString;
6
7
  status: z.ZodEnum<{
7
8
  ARCHIVED: "ARCHIVED";
8
9
  CREATED: "CREATED";
@@ -3,6 +3,7 @@ export declare const EventInput: z.ZodObject<{
3
3
  transactionId: z.ZodString;
4
4
  type: z.ZodString;
5
5
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
6
+ configVersionId: z.ZodOptional<z.ZodString>;
6
7
  }, z.core.$strip>;
7
8
  export type EventInput = z.infer<typeof EventInput>;
8
9
  //# sourceMappingURL=EventInput.d.ts.map
@@ -83,6 +83,7 @@ export declare const LegalStatuses: z.ZodObject<{
83
83
  export declare const EventMetadata: z.ZodObject<{
84
84
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
85
85
  type: z.ZodString;
86
+ configVersionId: z.ZodString;
86
87
  status: z.ZodEnum<{
87
88
  ARCHIVED: "ARCHIVED";
88
89
  CREATED: "CREATED";
@@ -32,8 +32,8 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
32
32
  age: z.ZodNumber;
33
33
  asOfDateRef: z.ZodString;
34
34
  }, z.core.$strip> | z.ZodObject<{
35
- label: z.ZodString;
36
- value: z.ZodString;
35
+ numericValue: z.ZodOptional<z.ZodNumber>;
36
+ unit: z.ZodOptional<z.ZodString>;
37
37
  }, z.core.$strip> | z.ZodObject<{
38
38
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
39
39
  originalFilename: z.ZodString;
@@ -44,8 +44,8 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
44
44
  numericValue: z.ZodNumber;
45
45
  unit: z.ZodString;
46
46
  }, z.core.$strip> | z.ZodObject<{
47
- numericValue: z.ZodOptional<z.ZodNumber>;
48
- unit: z.ZodOptional<z.ZodString>;
47
+ label: z.ZodString;
48
+ value: z.ZodString;
49
49
  }, z.core.$strip> | z.ZodObject<{
50
50
  data: z.ZodRecord<z.ZodString, z.ZodString>;
51
51
  }, z.core.$strip> | z.ZodObject<{
@@ -68,8 +68,8 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
68
68
  age: z.ZodNumber;
69
69
  asOfDateRef: z.ZodString;
70
70
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
- label: z.ZodString;
72
- value: z.ZodString;
71
+ numericValue: z.ZodOptional<z.ZodNumber>;
72
+ unit: z.ZodOptional<z.ZodString>;
73
73
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
74
74
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
75
75
  originalFilename: z.ZodString;
@@ -80,8 +80,8 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
80
80
  numericValue: z.ZodNumber;
81
81
  unit: z.ZodString;
82
82
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
83
- numericValue: z.ZodOptional<z.ZodNumber>;
84
- unit: z.ZodOptional<z.ZodString>;
83
+ label: z.ZodString;
84
+ value: z.ZodString;
85
85
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
86
86
  data: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
87
87
  country: z.ZodString;
@@ -243,15 +243,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
243
243
  }, z.core.$strip>>>;
244
244
  data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
245
245
  }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUnknown, "CustomFieldValue", "out">>> | z.ZodString | z.ZodType<{
246
- country: string;
247
- streetLevelDetails?: Record<string, string> | undefined;
248
- addressType: "DOMESTIC";
249
- administrativeArea: string;
250
- } | {
251
- country: string;
252
- streetLevelDetails?: Record<string, string> | undefined;
253
- addressType: "INTERNATIONAL";
254
- } | {
255
246
  country?: string | null | undefined;
256
247
  streetLevelDetails?: Record<string, string | null> | null | undefined;
257
248
  addressType: "DOMESTIC";
@@ -260,7 +251,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
260
251
  country?: string | null | undefined;
261
252
  streetLevelDetails?: Record<string, string | null> | null | undefined;
262
253
  addressType: "INTERNATIONAL";
263
- } | null | undefined, unknown, z.core.$ZodTypeInternals<{
254
+ } | {
264
255
  country: string;
265
256
  streetLevelDetails?: Record<string, string> | undefined;
266
257
  addressType: "DOMESTIC";
@@ -269,7 +260,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
269
260
  country: string;
270
261
  streetLevelDetails?: Record<string, string> | undefined;
271
262
  addressType: "INTERNATIONAL";
272
- } | {
263
+ } | null | undefined, unknown, z.core.$ZodTypeInternals<{
273
264
  country?: string | null | undefined;
274
265
  streetLevelDetails?: Record<string, string | null> | null | undefined;
275
266
  addressType: "DOMESTIC";
@@ -278,6 +269,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
278
269
  country?: string | null | undefined;
279
270
  streetLevelDetails?: Record<string, string | null> | null | undefined;
280
271
  addressType: "INTERNATIONAL";
272
+ } | {
273
+ country: string;
274
+ streetLevelDetails?: Record<string, string> | undefined;
275
+ addressType: "DOMESTIC";
276
+ administrativeArea: string;
277
+ } | {
278
+ country: string;
279
+ streetLevelDetails?: Record<string, string> | undefined;
280
+ addressType: "INTERNATIONAL";
281
281
  } | null | undefined, unknown>> | z.ZodUnion<[z.ZodObject<{
282
282
  start: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
283
283
  end: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
@@ -18,6 +18,11 @@ export declare const isPlainDate: (date: unknown) => date is PlainDate;
18
18
  * YYYY-MM-DD input, as produced by the event metadata and date fields.
19
19
  */
20
20
  export declare function toPlainDate(dateTime: string): PlainDate;
21
+ /**
22
+ * The calendar date of `date` in the IANA `timeZone` (e.g. 'Asia/Dhaka'), as a
23
+ * {@link PlainDate}. Unlike {@link toPlainDate}, which reads the UTC date.
24
+ */
25
+ export declare function toPlainDateInTimeZone(date: Date, timeZone: string): PlainDate;
21
26
  /**
22
27
  * Converts a {@link PlainDate} (YYYY-MM-DD) to a local `Date` at midnight.
23
28
  *
@@ -2,7 +2,7 @@ import { EventConfigInput, VersionedEventConfig, VersionedEventConfigInput } fro
2
2
  /**
3
3
  * Validates an event configuration. Accepts an event with `versions`, or, as before
4
4
  * versioning, an event without them, which is taken as a single version with id
5
- * `default`, effective from the beginning of time.
5
+ * `initial`, effective from the beginning of time.
6
6
  */
7
7
  export declare const defineConfig: (config: EventConfigInput | VersionedEventConfigInput) => VersionedEventConfig;
8
8
  //# sourceMappingURL=defineConfig.d.ts.map
@@ -3,7 +3,7 @@ import * as z from 'zod/v4';
3
3
  import { PlainDate } from './PlainDate';
4
4
  import { EventIndex } from './EventIndex';
5
5
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
6
- import { RecordScopeV2, UserScopeV2 } from '../scopes';
6
+ import { RecordScopeV2, UserScopeV2 } from '../users/scopes';
7
7
  import { SystemContext, UserContext } from '../users/User';
8
8
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
9
9
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -1,5 +1,5 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../scopes';
2
+ import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../users/scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
@@ -63,6 +63,7 @@ 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
+ configVersionId: string;
66
67
  status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
67
68
  legalStatuses: {
68
69
  NOTIFIED?: {
@@ -98,7 +98,8 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
98
98
  eventId: string;
99
99
  };
100
100
  /**
101
- * Notify allows sending incomplete data. Think it as 'partial declare' for now.
101
+ * NOTIFY submits the values of the notification form, and the record can stay incomplete.
102
+ * When `declaration` is not given, string values are left out of the generated declaration to make it incomplete.
102
103
  */
103
104
  notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
104
105
  type: "NOTIFY";
@@ -1,5 +1,5 @@
1
1
  import { ActionType, DeclarationActionType, DisplayableAction } from './ActionType';
2
- import { EventConfig } from './EventConfig';
2
+ import { EventConfig, VersionedEventConfig } from './EventConfig';
3
3
  import { FieldConfig, FieldReference } from './FieldConfig';
4
4
  import { Action, ActionDocument, ActionUpdate, EventState } from './ActionDocument';
5
5
  import { PageConfig, VerificationPageConfig } from './PageConfig';
@@ -46,6 +46,17 @@ export declare function getDeclarationPages(configuration: EventConfig): {
46
46
  type: "FORM";
47
47
  }[];
48
48
  export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
49
+ /**
50
+ * @returns the declaration fields of every version of the event, one per id: what any
51
+ * record of the event can hold, whichever version it was created under. Where versions
52
+ * define an id differently, the newest version's field is kept.
53
+ *
54
+ * Used to build the search index mapping: records of every version share one index per
55
+ * event, so its mapping must hold the fields of all of them. Goes away once each version
56
+ * gets its own index (#14335).
57
+ * Known limitation: a field id must keep its type in every version until #14335.
58
+ */
59
+ export declare function getDeclarationFieldsOfAllVersions(config: VersionedEventConfig): FieldConfig[];
49
60
  /**
50
61
  * @returns the notification form configured on the NOTIFY action.
51
62
  * @throws when the event has no NOTIFY action.
@@ -636,7 +647,9 @@ export declare const findAllFields: (config: EventConfig) => FieldConfig[];
636
647
  * @returns the value of the object at the given path.
637
648
  */
638
649
  export declare function getMixedPath<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T | undefined): T | undefined;
639
- export declare function getEventConfigById(eventConfigs: EventConfig[], id: string): EventConfig;
650
+ export declare function getEventConfigById<T extends {
651
+ id: string;
652
+ }>(eventConfigs: T[], id: string): T;
640
653
  export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
641
654
  startDate: string;
642
655
  endDate: string;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { VersionedEventConfig } from '../events/EventConfig';
3
+ export declare const Role: z.ZodObject<{
4
+ id: z.ZodString;
5
+ scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
6
+ }, z.core.$strip>;
7
+ export type Role = z.infer<typeof Role>;
8
+ export declare const Roles: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
11
+ }, z.core.$strip>>;
12
+ export type Roles = z.infer<typeof Roles>;
13
+ /**
14
+ * Helper for defining user roles. Should be used in country config.
15
+ *
16
+ * @param roles Array of roles in object format.
17
+ * @param eventConfigs Array of event configurations, which are needed to run validations for scopes.
18
+ */
19
+ export declare function defineRoles(roles: Roles, eventConfigs: VersionedEventConfig[]): {
20
+ id: string;
21
+ scopes: (string & z.$brand<"EncodedScope">)[];
22
+ }[];
23
+ //# sourceMappingURL=Role.d.ts.map