@opencrvs/toolkit 2.1.0 → 2.2.0-rc.9042a13

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 (59) hide show
  1. package/build.sh +2 -2
  2. package/create-countryconfig/package.json +1 -1
  3. package/dist/application-config/index.js +29 -2
  4. package/dist/authentication/index.js +14 -1
  5. package/dist/cli.js +294 -1967
  6. package/dist/commons/api/router.d.ts +1370 -73
  7. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  8. package/dist/commons/events/ActionConfig.d.ts +133 -0
  9. package/dist/commons/events/ActionDocument.d.ts +88 -0
  10. package/dist/commons/events/ActionInput.d.ts +52 -0
  11. package/dist/commons/events/ActionType.d.ts +11 -1
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  13. package/dist/commons/events/AuditLog.d.ts +4 -0
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +132 -0
  15. package/dist/commons/events/Draft.d.ts +2 -0
  16. package/dist/commons/events/EventConfig.d.ts +26 -6
  17. package/dist/commons/events/EventDocument.d.ts +88 -0
  18. package/dist/commons/events/EventIndex.d.ts +20 -0
  19. package/dist/commons/events/EventMetadata.d.ts +23 -0
  20. package/dist/commons/events/EventStatus.d.ts +1 -0
  21. package/dist/commons/events/FieldConfig.d.ts +10 -0
  22. package/dist/commons/events/WorkqueueConfig.d.ts +154 -10
  23. package/dist/commons/events/eventConfigValidation.d.ts +17 -1
  24. package/dist/commons/events/scopes.d.ts +2 -0
  25. package/dist/commons/events/state/index.d.ts +10 -2
  26. package/dist/commons/events/state/utils.d.ts +11 -1
  27. package/dist/commons/events/test.utils.d.ts +28 -1
  28. package/dist/commons/events/utils.d.ts +43 -15
  29. package/dist/conditionals/index.js +14 -1
  30. package/dist/environment/derived-variables.d.ts +18 -0
  31. package/dist/environment/derived-variables.d.ts.map +1 -1
  32. package/dist/environment/derived-variables.js +22 -1
  33. package/dist/environment/setup-environment.d.ts.map +1 -1
  34. package/dist/environment/setup-environment.js +29 -10
  35. package/dist/events/index.js +293 -66
  36. package/dist/migrations/add-translations.d.ts +15 -0
  37. package/dist/migrations/add-translations.d.ts.map +1 -0
  38. package/dist/migrations/{v2.1/add-translations.js → add-translations.js} +16 -14
  39. package/dist/migrations/v2.1/index.js +35 -2155
  40. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +3 -0
  41. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -1
  42. package/dist/migrations/v2.1/upgrade-tilt.d.ts +3 -0
  43. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -1
  44. package/dist/migrations/v2.2/index.d.ts +6 -0
  45. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  46. package/dist/migrations/v2.2/index.js +456 -0
  47. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
  48. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
  49. package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
  50. package/dist/notification/index.js +271 -86
  51. package/dist/scopes/index.d.ts +29 -6
  52. package/dist/scopes/index.js +14 -1
  53. package/dist/templates/charts-values/traefik/values.yaml +2 -3
  54. package/opencrvs-toolkit-2.2.0-rc.9042a13.tgz +0 -0
  55. package/package.json +1 -1
  56. package/tsconfig.build.tsbuildinfo +1 -1
  57. package/dist/migrations/v2.1/add-translations.d.ts +0 -9
  58. package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
  59. package/opencrvs-toolkit-2.1.0.tgz +0 -0
@@ -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`);