@opencrvs/toolkit 2.1.0 → 2.2.0-rc.ab91cce

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 (36) hide show
  1. package/build.sh +2 -2
  2. package/create-countryconfig/package.json +1 -1
  3. package/dist/cli.js +294 -1967
  4. package/dist/commons/events/ActionConfig.d.ts +79 -0
  5. package/dist/commons/events/EventConfig.d.ts +26 -6
  6. package/dist/commons/events/eventConfigValidation.d.ts +17 -1
  7. package/dist/commons/events/test.utils.d.ts +5 -0
  8. package/dist/commons/events/utils.d.ts +14 -14
  9. package/dist/environment/derived-variables.d.ts +18 -0
  10. package/dist/environment/derived-variables.d.ts.map +1 -1
  11. package/dist/environment/derived-variables.js +22 -1
  12. package/dist/environment/setup-environment.d.ts.map +1 -1
  13. package/dist/environment/setup-environment.js +29 -10
  14. package/dist/events/index.js +171 -60
  15. package/dist/migrations/add-translations.d.ts +15 -0
  16. package/dist/migrations/add-translations.d.ts.map +1 -0
  17. package/dist/migrations/{v2.1/add-translations.js → add-translations.js} +16 -14
  18. package/dist/migrations/v2.1/index.js +35 -2155
  19. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +3 -0
  20. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -1
  21. package/dist/migrations/v2.1/upgrade-tilt.d.ts +3 -0
  22. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -1
  23. package/dist/migrations/v2.2/index.d.ts +6 -0
  24. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  25. package/dist/migrations/v2.2/index.js +456 -0
  26. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
  27. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
  28. package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
  29. package/dist/notification/index.js +191 -83
  30. package/dist/templates/charts-values/traefik/values.yaml +2 -3
  31. package/opencrvs-toolkit-2.2.0-rc.ab91cce.tgz +0 -0
  32. package/package.json +1 -1
  33. package/tsconfig.build.tsbuildinfo +1 -1
  34. package/dist/migrations/v2.1/add-translations.d.ts +0 -9
  35. package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
  36. package/opencrvs-toolkit-2.1.0.tgz +0 -0
@@ -482,6 +482,7 @@ __export(events_exports, {
482
482
  validateFieldInput: () => validateFieldInput,
483
483
  validateValue: () => validateValue,
484
484
  window: () => window2,
485
+ withDeclaration: () => withDeclaration,
485
486
  writeActions: () => writeActions
486
487
  });
487
488
  module.exports = __toCommonJS(events_exports);
@@ -3529,6 +3530,9 @@ var DeleteConfig = ActionConfigBase.extend(
3529
3530
  var DeclareConfig = DeclarationActionBase.extend(
3530
3531
  z25.object({
3531
3532
  type: z25.literal(ActionType.DECLARE),
3533
+ declaration: DeclarationFormConfig.describe(
3534
+ "Configuration of the form used to gather event data."
3535
+ ),
3532
3536
  review: DeclarationReviewConfig.describe(
3533
3537
  "Configuration of the review page fields."
3534
3538
  ),
@@ -6209,14 +6213,22 @@ function ageToDate(age, asOfDate) {
6209
6213
  const date = plainDateToLocalDate(asOfDate);
6210
6214
  return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
6211
6215
  }
6212
- function getDeclarationFields(configuration) {
6213
- return configuration.declaration.pages.flatMap(({ fields }) => fields);
6216
+ function getDeclaration(configuration) {
6217
+ const declareAction = configuration.actions.find(
6218
+ (action) => action.type === ActionType.DECLARE
6219
+ );
6220
+ if (!declareAction) {
6221
+ throw new Error(
6222
+ `Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
6223
+ );
6224
+ }
6225
+ return declareAction.declaration;
6214
6226
  }
6215
6227
  function getDeclarationPages(configuration) {
6216
- return configuration.declaration.pages;
6228
+ return getDeclaration(configuration).pages;
6217
6229
  }
6218
- function getDeclaration(configuration) {
6219
- return configuration.declaration;
6230
+ function getDeclarationFields(configuration) {
6231
+ return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
6220
6232
  }
6221
6233
  function isActionConfigType(type) {
6222
6234
  return actionConfigTypes.has(type);
@@ -6837,6 +6849,43 @@ function validateActionOrder(event2, ctx) {
6837
6849
  }
6838
6850
  }
6839
6851
  }
6852
+ function validateExactlyOneDeclareAction(event2, ctx) {
6853
+ const declareActionCount = event2.actions.filter(
6854
+ (action) => action.type === ActionType.DECLARE
6855
+ ).length;
6856
+ if (declareActionCount !== 1) {
6857
+ ctx.addIssue({
6858
+ code: "custom",
6859
+ message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
6860
+ path: ["actions"]
6861
+ });
6862
+ return false;
6863
+ }
6864
+ return true;
6865
+ }
6866
+ function validateDeclarationGivenExactlyOnce(config, ctx) {
6867
+ const declareActionIndex = config.actions.findIndex(
6868
+ (action) => action.type === ActionType.DECLARE
6869
+ );
6870
+ const declareAction = config.actions[declareActionIndex];
6871
+ const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
6872
+ const onTopLevel = !!config.declaration;
6873
+ const declareActionPath = `actions[${declareActionIndex}].declaration`;
6874
+ if (onTopLevel && onDeclareAction) {
6875
+ ctx.addIssue({
6876
+ code: "custom",
6877
+ message: `Event '${config.id}' defines \`declaration\` both at the top level and on the ${ActionType.DECLARE} action (\`${declareActionPath}\`). Define it in only one of these places.`,
6878
+ path: ["declaration"]
6879
+ });
6880
+ }
6881
+ if (!onTopLevel && !onDeclareAction) {
6882
+ ctx.addIssue({
6883
+ code: "custom",
6884
+ message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
6885
+ path: ["declaration"]
6886
+ });
6887
+ }
6888
+ }
6840
6889
 
6841
6890
  // ../commons/src/events/EventConfig.ts
6842
6891
  var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
@@ -6861,16 +6910,15 @@ var _EventConfigBase = z35.object({
6861
6910
  summary: SummaryConfig.describe(
6862
6911
  "Summary information displayed in the event overview."
6863
6912
  ),
6864
- label: TranslationConfig.describe("Human-readable label for the event type."),
6913
+ label: TranslationConfig.describe(
6914
+ "Human-readable label for the event type."
6915
+ ),
6865
6916
  actions: z35.array(ActionConfig).describe(
6866
6917
  "Configuration of core and custom actions associated with the event."
6867
6918
  ),
6868
6919
  actionOrder: z35.array(z35.string()).optional().describe(
6869
6920
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
6870
6921
  ),
6871
- declaration: DeclarationFormConfig.describe(
6872
- "Configuration of the form used to gather event data."
6873
- ),
6874
6922
  advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
6875
6923
  "Configuration of fields available in the advanced search feature."
6876
6924
  ),
@@ -6885,6 +6933,9 @@ var _EventConfigBase = z35.object({
6885
6933
  )
6886
6934
  });
6887
6935
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
6936
+ if (!validateExactlyOneDeclareAction(event2, ctx)) {
6937
+ return;
6938
+ }
6888
6939
  validateAdvancedSearchConfig(event2, ctx);
6889
6940
  validateDateOfEvent(event2, ctx);
6890
6941
  validatePlaceOfEvent(event2, ctx);
@@ -7526,10 +7577,29 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
7526
7577
  }).brand("EventDocumentOnlyLastAction");
7527
7578
 
7528
7579
  // ../commons/src/events/defineConfig.ts
7529
- var defineConfig = (config) => {
7530
- const input = EventConfig.parse(config);
7531
- return input;
7532
- };
7580
+ var z43 = __toESM(require("zod/v4"));
7581
+ function moveDeclarationToDeclareAction({
7582
+ declaration,
7583
+ ...config
7584
+ }) {
7585
+ if (declaration) {
7586
+ console.warn(
7587
+ `Event '${config.id}' defines \`declaration\` at the top level, which is deprecated and will be removed in a future release. Define it on the ${ActionType.DECLARE} action instead.`
7588
+ );
7589
+ }
7590
+ return {
7591
+ ...config,
7592
+ actions: config.actions.map(
7593
+ (action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
7594
+ )
7595
+ };
7596
+ }
7597
+ var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
7598
+ if (validateExactlyOneDeclareAction(config, ctx)) {
7599
+ validateDeclarationGivenExactlyOnce(config, ctx);
7600
+ }
7601
+ }).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
7602
+ var defineConfig = (config) => EventConfigDefinition.parse(config);
7533
7603
 
7534
7604
  // ../commons/src/events/transactions.ts
7535
7605
  function generateTransactionId() {
@@ -9523,7 +9593,24 @@ var libraryMembershipEvent = defineConfig({
9523
9593
  id: "event.library-membership.title"
9524
9594
  },
9525
9595
  summary: { fields: [] },
9526
- actions: [],
9596
+ actions: [
9597
+ {
9598
+ type: ActionType.DECLARE,
9599
+ label: {
9600
+ defaultMessage: "Declare",
9601
+ description: "This is shown as the action name anywhere the user can trigger the action from",
9602
+ id: "event.library-membership.action.declare.label"
9603
+ },
9604
+ review: {
9605
+ title: {
9606
+ defaultMessage: "Library membership application",
9607
+ description: "Title of the review page",
9608
+ id: "event.library-membership.action.declare.form.review.title"
9609
+ },
9610
+ fields: []
9611
+ }
9612
+ }
9613
+ ],
9527
9614
  declaration: libraryMembershipForm
9528
9615
  });
9529
9616
 
@@ -9969,6 +10056,22 @@ var digitalIdentityEvent = defineConfig({
9969
10056
  },
9970
10057
  summary: { fields: [] },
9971
10058
  actions: [
10059
+ {
10060
+ type: ActionType.DECLARE,
10061
+ label: {
10062
+ defaultMessage: "Declare",
10063
+ description: "This is shown as the action name anywhere the user can trigger the action from",
10064
+ id: "event.digital-identity.action.declare.label"
10065
+ },
10066
+ review: {
10067
+ title: {
10068
+ defaultMessage: "Digital identity issuance",
10069
+ description: "Title of the review page",
10070
+ id: "event.digital-identity.action.declare.form.review.title"
10071
+ },
10072
+ fields: []
10073
+ }
10074
+ },
9972
10075
  {
9973
10076
  type: ActionType.PRINT_CERTIFICATE,
9974
10077
  label: {
@@ -9983,45 +10086,45 @@ var digitalIdentityEvent = defineConfig({
9983
10086
  });
9984
10087
 
9985
10088
  // ../commons/src/events/test.utils.ts
9986
- var z44 = __toESM(require("zod/v4"));
10089
+ var z45 = __toESM(require("zod/v4"));
9987
10090
 
9988
10091
  // ../commons/src/events/locations.ts
9989
- var z43 = __toESM(require("zod/v4"));
9990
- var LocationTypeV1 = z43.enum([
10092
+ var z44 = __toESM(require("zod/v4"));
10093
+ var LocationTypeV1 = z44.enum([
9991
10094
  "ADMIN_STRUCTURE",
9992
10095
  "CRVS_OFFICE",
9993
10096
  "HEALTH_FACILITY"
9994
10097
  ]);
9995
- var LocationStatus = z43.enum(["active", "inactive"]);
10098
+ var LocationStatus = z44.enum(["active", "inactive"]);
9996
10099
  var InactiveOfficeError = class extends Error {
9997
10100
  constructor(message = "Assigned office is inactive") {
9998
10101
  super(message);
9999
10102
  this.name = "InactiveOfficeError";
10000
10103
  }
10001
10104
  };
10002
- var LocationVersion = z43.object({
10105
+ var LocationVersion = z44.object({
10003
10106
  versionId: UUID,
10004
- effectiveFrom: z43.iso.date(),
10005
- name: z43.string(),
10006
- externalId: z43.string().nullish(),
10107
+ effectiveFrom: z44.iso.date(),
10108
+ name: z44.string(),
10109
+ externalId: z44.string().nullish(),
10007
10110
  status: LocationStatus
10008
10111
  });
10009
- var AdministrativeArea = z43.object({
10112
+ var AdministrativeArea = z44.object({
10010
10113
  id: UUID,
10011
- name: z43.string(),
10012
- externalId: z43.string().nullish(),
10114
+ name: z44.string(),
10115
+ externalId: z44.string().nullish(),
10013
10116
  parentId: UUID.nullable(),
10014
10117
  status: LocationStatus,
10015
- versions: z43.array(LocationVersion)
10118
+ versions: z44.array(LocationVersion)
10016
10119
  });
10017
- var Location = z43.object({
10120
+ var Location = z44.object({
10018
10121
  id: UUID,
10019
- name: z43.string(),
10020
- externalId: z43.string().nullish(),
10122
+ name: z44.string(),
10123
+ externalId: z44.string().nullish(),
10021
10124
  administrativeAreaId: UUID.nullable(),
10022
- locationType: z43.string().nullable(),
10125
+ locationType: z44.string().nullable(),
10023
10126
  status: LocationStatus,
10024
- versions: z43.array(LocationVersion)
10127
+ versions: z44.array(LocationVersion)
10025
10128
  });
10026
10129
  var ClientAdministrativeArea = AdministrativeArea.omit({
10027
10130
  name: true,
@@ -10062,22 +10165,22 @@ function validateUniqueIds(versions, ctx) {
10062
10165
  ctx.addIssue("versions must not repeat a versionId");
10063
10166
  }
10064
10167
  }
10065
- var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
10168
+ var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
10066
10169
  validateAscendingDates(versions, ctx);
10067
10170
  validateUniqueIds(versions, ctx);
10068
10171
  });
10069
- var SetLocationPayload = z43.object({
10172
+ var SetLocationPayload = z44.object({
10070
10173
  id: UUID,
10071
- name: z43.string(),
10072
- externalId: z43.string().nullish(),
10174
+ name: z44.string(),
10175
+ externalId: z44.string().nullish(),
10073
10176
  administrativeAreaId: UUID.nullable(),
10074
- locationType: z43.string().nullable(),
10177
+ locationType: z44.string().nullable(),
10075
10178
  versions: SeededLocationVersions.optional()
10076
10179
  });
10077
- var SetAdministrativeAreaPayload = z43.object({
10180
+ var SetAdministrativeAreaPayload = z44.object({
10078
10181
  id: UUID,
10079
- name: z43.string(),
10080
- externalId: z43.string().nullish(),
10182
+ name: z44.string(),
10183
+ externalId: z44.string().nullish(),
10081
10184
  parentId: UUID.nullable(),
10082
10185
  versions: SeededLocationVersions.optional()
10083
10186
  });
@@ -10666,7 +10769,7 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
10666
10769
 
10667
10770
  // ../commons/src/events/test.utils.ts
10668
10771
  var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
10669
- var TestUserRole = z44.enum([
10772
+ var TestUserRole = z45.enum([
10670
10773
  "FIELD_AGENT",
10671
10774
  "LOCAL_REGISTRAR",
10672
10775
  "LOCAL_SYSTEM_ADMIN",
@@ -11498,6 +11601,14 @@ var generateEventConfig = ({
11498
11601
  ]
11499
11602
  });
11500
11603
  };
11604
+ function withDeclaration(configuration, declaration) {
11605
+ return {
11606
+ ...configuration,
11607
+ actions: configuration.actions.map(
11608
+ (action) => action.type === ActionType.DECLARE ? { ...action, declaration } : action
11609
+ )
11610
+ };
11611
+ }
11501
11612
  function getLeafAdministrativeAreaIds(administrativeAreas) {
11502
11613
  const nonLeafAdministrativeAreaIds = /* @__PURE__ */ new Set();
11503
11614
  for (const [, location] of administrativeAreas) {
@@ -11908,49 +12019,49 @@ function getFilePathsFromEvent(event2) {
11908
12019
  }
11909
12020
 
11910
12021
  // ../commons/src/events/locationPayloads.ts
11911
- var z45 = __toESM(require("zod/v4"));
11912
- var CreateLocationPayload = z45.object({
12022
+ var z46 = __toESM(require("zod/v4"));
12023
+ var CreateLocationPayload = z46.object({
11913
12024
  id: UUID.optional(),
11914
12025
  versionId: UUID.optional(),
11915
- name: z45.string(),
11916
- externalId: z45.string().nullish(),
12026
+ name: z46.string(),
12027
+ externalId: z46.string().nullish(),
11917
12028
  administrativeAreaId: UUID.nullable(),
11918
- locationType: z45.string().nullable(),
11919
- effectiveFrom: z45.iso.date().optional(),
12029
+ locationType: z46.string().nullable(),
12030
+ effectiveFrom: z46.iso.date().optional(),
11920
12031
  status: LocationStatus.default("active")
11921
12032
  });
11922
- var UpdateLocationPayload = z45.strictObject({
12033
+ var UpdateLocationPayload = z46.strictObject({
11923
12034
  id: UUID,
11924
12035
  versionId: UUID.optional(),
11925
- name: z45.string(),
11926
- externalId: z45.string().nullish(),
12036
+ name: z46.string(),
12037
+ externalId: z46.string().nullish(),
11927
12038
  status: LocationStatus,
11928
- effectiveFrom: z45.iso.date().optional(),
12039
+ effectiveFrom: z46.iso.date().optional(),
11929
12040
  lastVersionId: UUID
11930
12041
  });
11931
- var WithdrawLocationVersionPayload = z45.object({
12042
+ var WithdrawLocationVersionPayload = z46.object({
11932
12043
  id: UUID,
11933
12044
  versionId: UUID
11934
12045
  });
11935
- var CreateAdministrativeAreaPayload = z45.object({
12046
+ var CreateAdministrativeAreaPayload = z46.object({
11936
12047
  id: UUID.optional(),
11937
12048
  versionId: UUID.optional(),
11938
- name: z45.string(),
11939
- externalId: z45.string().nullish(),
12049
+ name: z46.string(),
12050
+ externalId: z46.string().nullish(),
11940
12051
  parentId: UUID.nullable(),
11941
- effectiveFrom: z45.iso.date().optional(),
12052
+ effectiveFrom: z46.iso.date().optional(),
11942
12053
  status: LocationStatus.default("active")
11943
12054
  });
11944
- var UpdateAdministrativeAreaPayload = z45.strictObject({
12055
+ var UpdateAdministrativeAreaPayload = z46.strictObject({
11945
12056
  id: UUID,
11946
12057
  versionId: UUID.optional(),
11947
- name: z45.string(),
11948
- externalId: z45.string().nullish(),
12058
+ name: z46.string(),
12059
+ externalId: z46.string().nullish(),
11949
12060
  status: LocationStatus,
11950
- effectiveFrom: z45.iso.date().optional(),
12061
+ effectiveFrom: z46.iso.date().optional(),
11951
12062
  lastVersionId: UUID
11952
12063
  });
11953
- var WithdrawAdministrativeAreaVersionPayload = z45.object({
12064
+ var WithdrawAdministrativeAreaVersionPayload = z46.object({
11954
12065
  id: UUID,
11955
12066
  versionId: UUID
11956
12067
  });
@@ -0,0 +1,15 @@
1
+ import { CsvFile } from '../csv';
2
+ /**
3
+ * The rows of the template that the local file has no id for, expressed in the
4
+ * local file's columns.
5
+ */
6
+ export declare function rowsToAdd(local: CsvFile, template: CsvFile): string[];
7
+ /**
8
+ * @param targetVersion the major.minor the country config is upgraded to, e.g. `2.2`.
9
+ */
10
+ declare function main(targetVersion: string): Promise<void>;
11
+ /**
12
+ * @knipignore
13
+ */
14
+ export { main };
15
+ //# sourceMappingURL=add-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-translations.d.ts","sourceRoot":"","sources":["../../src/migrations/add-translations.ts"],"names":[],"mappings":"AAkCA,OAAO,EACL,OAAO,EAMR,MAAM,QAAQ,CAAA;AAYf;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAgBrE;AAqED;;GAEG;AACH,iBAAe,IAAI,CAAC,aAAa,EAAE,MAAM,iBA2BxC;AAED;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -29,8 +29,9 @@ exports.main = main;
29
29
  * config.
30
30
  *
31
31
  * Unlike every other codemod, this one carries no list of what it changes, and
32
- * should not need editing again. Its input is `client.csv` and `login.csv` from
33
- * the country config template of the version being upgraded to, fetched from
32
+ * should not need editing again: every version's upgrade runs it, passing the
33
+ * version it upgrades to. Its input is `client.csv` and `login.csv` from
34
+ * the country config template of that version, fetched from
34
35
  * GitHub; whatever rows those files have gained, this adds. A pull request that
35
36
  * introduces a translation key therefore only has to add it to the template —
36
37
  * `packages/countryconfig-template/src/translations/` — which the
@@ -45,11 +46,9 @@ exports.main = main;
45
46
  * empty cell for one it has nothing for.
46
47
  */
47
48
  const path_1 = __importDefault(require("path"));
48
- const csv_1 = require("../../csv");
49
- const template_1 = require("../../translations/template");
49
+ const csv_1 = require("../csv");
50
+ const template_1 = require("../translations/template");
50
51
  const APPLICATIONS = ['client', 'login'];
51
- /** The version this folder upgrades a country config to. */
52
- const TARGET_VERSION = '2.1';
53
52
  const skipped = [];
54
53
  function warnSkipped(message) {
55
54
  skipped.push(message);
@@ -73,7 +72,7 @@ function rowsToAdd(local, template) {
73
72
  }));
74
73
  });
75
74
  }
76
- function updateApplication(cwd, refs, application) {
75
+ function updateApplication(cwd, targetVersion, refs, application) {
77
76
  return __awaiter(this, void 0, void 0, function* () {
78
77
  const relativePath = `src/translations/${application}.csv`;
79
78
  const local = (0, csv_1.readCsvFile)(path_1.default.join(cwd, relativePath));
@@ -83,7 +82,7 @@ function updateApplication(cwd, refs, application) {
83
82
  }
84
83
  const fetched = yield (0, template_1.fetchTemplate)(refs, application);
85
84
  if (!fetched) {
86
- warnSkipped(`No ${application}.csv found in the ${TARGET_VERSION} country config template on GitHub; ${application}.csv not updated`);
85
+ warnSkipped(`No ${application}.csv found in the ${targetVersion} country config template on GitHub; ${application}.csv not updated`);
87
86
  return;
88
87
  }
89
88
  const template = readTemplate(fetched.contents);
@@ -113,26 +112,29 @@ function readTemplate(contents) {
113
112
  };
114
113
  }
115
114
  /** Refs to read the template from. Undefined when GitHub cannot be asked. */
116
- function listRefs() {
115
+ function listRefs(targetVersion) {
117
116
  return __awaiter(this, void 0, void 0, function* () {
118
117
  try {
119
- return yield (0, template_1.candidateRefs)(TARGET_VERSION);
118
+ return yield (0, template_1.candidateRefs)(targetVersion);
120
119
  }
121
120
  catch (error) {
122
- warnSkipped(`Could not list the ${TARGET_VERSION} refs on GitHub (${error.message}); translations not added`);
121
+ warnSkipped(`Could not list the ${targetVersion} refs on GitHub (${error.message}); translations not added`);
123
122
  return undefined;
124
123
  }
125
124
  });
126
125
  }
127
- function main() {
126
+ /**
127
+ * @param targetVersion the major.minor the country config is upgraded to, e.g. `2.2`.
128
+ */
129
+ function main(targetVersion) {
128
130
  return __awaiter(this, void 0, void 0, function* () {
129
131
  const cwd = process.cwd();
130
132
  console.log('Adding the translation keys core gained this version...\n');
131
- const refs = yield listRefs();
133
+ const refs = yield listRefs(targetVersion);
132
134
  if (refs) {
133
135
  for (const application of APPLICATIONS) {
134
136
  try {
135
- yield updateApplication(cwd, refs, application);
137
+ yield updateApplication(cwd, targetVersion, refs, application);
136
138
  }
137
139
  catch (error) {
138
140
  warnSkipped(`Could not read ${application}.csv from the country config template on GitHub (${error.message}); ${application}.csv not updated`);