@opencrvs/toolkit 2.1.0-rc.1bd2a41 → 2.1.0-rc.271c769

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 (44) hide show
  1. package/README.md +0 -1
  2. package/dist/application-config/index.js +200 -189
  3. package/dist/cli.js +57 -164
  4. package/dist/commons/api/router.d.ts +7 -26
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/conditionals/validate.d.ts +2 -1
  7. package/dist/commons/events/ActionConfig.d.ts +21 -0
  8. package/dist/commons/events/ActionDocument.d.ts +1 -7
  9. package/dist/commons/events/ActionStatus.d.ts +14 -0
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +18 -0
  12. package/dist/commons/events/EventIndex.d.ts +5 -24
  13. package/dist/commons/events/EventMetadata.d.ts +1 -0
  14. package/dist/commons/events/FieldConfig.d.ts +5 -0
  15. package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
  16. package/dist/commons/events/Flag.d.ts +48 -0
  17. package/dist/commons/events/WorkqueueConfig.d.ts +27 -12
  18. package/dist/commons/events/locations.d.ts +3 -93
  19. package/dist/commons/events/mocks.test.utils.d.ts +2 -16
  20. package/dist/commons/events/test.utils.d.ts +5 -5
  21. package/dist/conditionals/index.js +303 -55
  22. package/dist/environment/index.d.ts +0 -1
  23. package/dist/environment/index.d.ts.map +1 -1
  24. package/dist/environment/index.js +0 -10
  25. package/dist/environment/setup-environment.js +1 -2
  26. package/dist/environment/templates.d.ts.map +1 -1
  27. package/dist/environment/templates.js +1 -2
  28. package/dist/environment/update-workflows.d.ts.map +1 -1
  29. package/dist/environment/update-workflows.js +3 -4
  30. package/dist/environment/users.js +13 -11
  31. package/dist/events/index.js +3255 -3222
  32. package/dist/notification/index.js +1477 -907
  33. package/dist/scopes/index.d.ts +250 -0
  34. package/dist/scopes/index.js +304 -55
  35. package/opencrvs-toolkit-2.1.0-rc.271c769.tgz +0 -0
  36. package/package.json +1 -1
  37. package/tsconfig.tsbuildinfo +1 -1
  38. package/dist/environment/paths.d.ts +0 -7
  39. package/dist/environment/paths.d.ts.map +0 -1
  40. package/dist/environment/paths.js +0 -72
  41. package/dist/environment/upgrade.d.ts +0 -2
  42. package/dist/environment/upgrade.d.ts.map +0 -1
  43. package/dist/environment/upgrade.js +0 -80
  44. package/opencrvs-toolkit-2.1.0-rc.1bd2a41.tgz +0 -0
package/dist/cli.js CHANGED
@@ -30,42 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // src/environment/paths.ts
34
- function getEnvironmentInventoryPath(environment) {
35
- return (0, import_path2.join)("environments", environment, INVENTORY_FILE_NAME);
36
- }
37
- function findOldInventoryFiles() {
38
- return glob.sync((0, import_path2.join)(OLD_INVENTORY_DIR, "*.yml")).sort();
39
- }
40
- function getEnvironmentNameFromOldInventoryPath(filePath) {
41
- return (0, import_path2.basename)(filePath, ".yml");
42
- }
43
- function assertNoOldInventoryLayout() {
44
- if (findOldInventoryFiles().length === 0) {
45
- return;
46
- }
47
- throw new Error(
48
- [
49
- `Old inventory layout detected at ${OLD_INVENTORY_DIR}.`,
50
- "Please run `yarn environment:upgrade` before running `yarn environment:init`."
51
- ].join(" ")
52
- );
53
- }
54
- var import_path2, glob, OLD_INVENTORY_DIR, INVENTORY_FILE_NAME;
55
- var init_paths = __esm({
56
- "src/environment/paths.ts"() {
57
- "use strict";
58
- import_path2 = require("path");
59
- glob = __toESM(require("glob"));
60
- OLD_INVENTORY_DIR = (0, import_path2.join)(
61
- "infrastructure",
62
- "server-setup",
63
- "inventory"
64
- );
65
- INVENTORY_FILE_NAME = "inventory.yml";
66
- }
67
- });
68
-
69
33
  // src/environment/logger.ts
70
34
  var import_kleur, log, warn, success, info, error;
71
35
  var init_logger = __esm({
@@ -509,7 +473,7 @@ function storeSecrets(environment, answers) {
509
473
  envConfig = import_dotenv.default.parse(
510
474
  (0, import_fs.readFileSync)(`${process.cwd()}/.env.${environment}`)
511
475
  );
512
- } catch (error3) {
476
+ } catch (error4) {
513
477
  envConfig = {};
514
478
  }
515
479
  const linesFromAnswers = answers.map(
@@ -534,8 +498,8 @@ function writeYamlFile(filePath, data) {
534
498
  sortKeys: false
535
499
  });
536
500
  import_fs.default.writeFileSync(filePath, yamlContent, "utf8");
537
- } catch (error3) {
538
- throw new Error(`Failed to write inventory file: ${error3}`);
501
+ } catch (error4) {
502
+ throw new Error(`Failed to write inventory file: ${error4}`);
539
503
  }
540
504
  }
541
505
  var import_fs, yaml, import_dotenv;
@@ -595,8 +559,8 @@ function extractWorkerNodes(data) {
595
559
  return worker_hosts;
596
560
  }
597
561
  function copyChartsValues(env, values) {
598
- const srcDir = import_path3.default.resolve(__dirname, "templates", "charts-values");
599
- const destDir = import_path3.default.resolve(process.cwd(), "environments", env);
562
+ const srcDir = import_path2.default.resolve(__dirname, "templates", "charts-values");
563
+ const destDir = import_path2.default.resolve(process.cwd(), "environments", env);
600
564
  import_fs2.default.mkdirSync(destDir, { recursive: true });
601
565
  values["lets_encrypt"] = values["traefik_mode"] === "lets_encrypt";
602
566
  values["static_ssl"] = values["traefik_mode"] === "static_ssl";
@@ -606,7 +570,7 @@ function copyChartsValues(env, values) {
606
570
  if (stat.isDirectory()) {
607
571
  import_fs2.default.mkdirSync(dest, { recursive: true });
608
572
  for (const item of import_fs2.default.readdirSync(src)) {
609
- copyRecursive(import_path3.default.join(src, item), import_path3.default.join(dest, item));
573
+ copyRecursive(import_path2.default.join(src, item), import_path2.default.join(dest, item));
610
574
  }
611
575
  } else {
612
576
  const content = import_fs2.default.readFileSync(src, "utf8");
@@ -628,31 +592,36 @@ function copyChartsValues(env, values) {
628
592
  `);
629
593
  }
630
594
  function generateInventory(env, values) {
631
- const templatePath = import_path3.default.join(
595
+ const templatePath = import_path2.default.join(
632
596
  __dirname,
633
597
  "templates",
634
598
  "inventory",
635
599
  "inventory.template.yml"
636
600
  );
637
- const outputPath = import_path3.default.resolve(process.cwd(), getEnvironmentInventoryPath(env));
601
+ const outputPath = import_path2.default.join(
602
+ process.cwd(),
603
+ "infrastructure",
604
+ "server-setup",
605
+ "inventory",
606
+ `${env}.yml`
607
+ );
638
608
  const templateFile = import_fs2.default.readFileSync(templatePath, "utf-8");
639
609
  const template = import_handlebars.default.compile(templateFile);
640
610
  values["single_node"] = values["kube_worker_nodes"].length > 0 || values["backup_host"] ? "false" : "true";
641
611
  const updated = template(values);
642
- import_fs2.default.mkdirSync(import_path3.default.dirname(outputPath), { recursive: true });
612
+ import_fs2.default.mkdirSync(import_path2.default.dirname(outputPath), { recursive: true });
643
613
  import_fs2.default.writeFileSync(outputPath, updated);
644
614
  log(`
645
615
  \u2705 Generated inventory file at ${outputPath}
646
616
  `);
647
617
  }
648
- var import_fs2, import_path3, import_handlebars;
618
+ var import_fs2, import_path2, import_handlebars;
649
619
  var init_templates = __esm({
650
620
  "src/environment/templates.ts"() {
651
621
  "use strict";
652
622
  import_fs2 = __toESM(require("fs"));
653
- import_path3 = __toESM(require("path"));
623
+ import_path2 = __toESM(require("path"));
654
624
  init_logger();
655
- init_paths();
656
625
  import_handlebars = __toESM(require("handlebars"));
657
626
  import_handlebars.default.registerHelper("data_label_idx", function(value) {
658
627
  return parseInt(value) + 2;
@@ -1268,7 +1237,7 @@ function getCurrentUserSSHKeys() {
1268
1237
  keys.push(keyContent);
1269
1238
  }
1270
1239
  }
1271
- } catch (error3) {
1240
+ } catch (error4) {
1272
1241
  continue;
1273
1242
  }
1274
1243
  }
@@ -1804,7 +1773,6 @@ var init_setup_environment = __esm({
1804
1773
  init_editor_questions();
1805
1774
  init_questions_helper();
1806
1775
  init_manage_users();
1807
- init_paths();
1808
1776
  ALL_QUESTIONS = [];
1809
1777
  ALL_ANSWERS = [];
1810
1778
  ALL_QUESTIONS.push(
@@ -1968,7 +1936,9 @@ var init_setup_environment = __esm({
1968
1936
  );
1969
1937
  const kubeWorkerNodes = infrastructure.kubeWorkerNodes ? infrastructure.kubeWorkerNodes.split(",").map((ip) => ip.trim()) : [];
1970
1938
  log("\n", import_kleur4.default.bold().underline("SSH Users"), "\n");
1971
- const users = await manageUsers(getEnvironmentInventoryPath(environment));
1939
+ const users = await manageUsers(
1940
+ `infrastructure/server-setup/inventory/${environment}.yml`
1941
+ );
1972
1942
  log("\n", import_kleur4.default.bold().underline("Traefik SSL Certificate"), "\n");
1973
1943
  const sslCertExists = findExistingValue(
1974
1944
  "SSL_CRT",
@@ -2782,11 +2752,11 @@ __export(update_workflows_exports, {
2782
2752
  updateWorkflowEnvironments: () => updateWorkflowEnvironments
2783
2753
  });
2784
2754
  async function extractInfrastructureNames() {
2785
- const files = glob2.sync((0, import_path4.join)("environments", "*", INVENTORY_FILE_NAME));
2786
- const infraEnvironments = files.map((file) => (0, import_path4.basename)((0, import_path4.dirname)(file)));
2755
+ const files = glob.sync("infrastructure/server-setup/inventory/*.yml");
2756
+ const infraEnvironments = files.map((file) => (0, import_path3.basename)(file, ".yml"));
2787
2757
  if (infraEnvironments.length === 0) {
2788
2758
  console.log(
2789
- `\u26A0\uFE0F Warning: No environment inventory files found at environments/*/${INVENTORY_FILE_NAME}`
2759
+ "\u26A0\uFE0F Warning: No environment directories found in infrastructure/server-setup/inventory/"
2790
2760
  );
2791
2761
  return [];
2792
2762
  }
@@ -2796,7 +2766,7 @@ async function extractInfrastructureNames() {
2796
2766
  async function extractEnvironmentNames() {
2797
2767
  const entries = await (0, import_promises.readdir)("environments");
2798
2768
  const environments = entries.filter((entry) => {
2799
- const fullPath = (0, import_path4.join)("environments", entry);
2769
+ const fullPath = (0, import_path3.join)("environments", entry);
2800
2770
  return (0, import_fs3.statSync)(fullPath).isDirectory();
2801
2771
  });
2802
2772
  if (environments.length === 0) {
@@ -2833,13 +2803,13 @@ async function updateWorkflows(envList, config) {
2833
2803
  const updatedContent = updateOptionsInYaml(fileContents, envList);
2834
2804
  (0, import_fs3.writeFileSync)(workflowPath, updatedContent, "utf8");
2835
2805
  log(` \u2713 Successfully updated ${workflowPath}`);
2836
- } catch (error3) {
2806
+ } catch (error4) {
2837
2807
  console.error(
2838
2808
  `
2839
2809
  \u26A0\uFE0F Error updating ${workflowPath} with environments: [${envList.join(", ")}]`
2840
2810
  );
2841
- console.error(`\u2717 Failed to update ${workflowPath}:`, error3);
2842
- throw error3;
2811
+ console.error(`\u2717 Failed to update ${workflowPath}:`, error4);
2812
+ throw error4;
2843
2813
  }
2844
2814
  }
2845
2815
  }
@@ -2880,89 +2850,21 @@ async function updateWorkflowEnvironments() {
2880
2850
  } else {
2881
2851
  log("\u2139\uFE0F No workflows were updated.");
2882
2852
  }
2883
- } catch (error3) {
2884
- console.error("\n\u274C Error updating workflows:", error3);
2853
+ } catch (error4) {
2854
+ console.error("\n\u274C Error updating workflows:", error4);
2885
2855
  process.exit(1);
2886
2856
  }
2887
2857
  }
2888
- var import_promises, import_fs3, import_path4, glob2, yaml2;
2858
+ var import_promises, import_fs3, import_path3, glob, yaml2;
2889
2859
  var init_update_workflows = __esm({
2890
2860
  "src/environment/update-workflows.ts"() {
2891
2861
  "use strict";
2892
2862
  import_promises = require("fs/promises");
2893
2863
  import_fs3 = require("fs");
2894
- import_path4 = require("path");
2895
- glob2 = __toESM(require("glob"));
2864
+ import_path3 = require("path");
2865
+ glob = __toESM(require("glob"));
2896
2866
  yaml2 = __toESM(require("js-yaml"));
2897
2867
  init_logger();
2898
- init_paths();
2899
- }
2900
- });
2901
-
2902
- // src/environment/upgrade.ts
2903
- var upgrade_exports = {};
2904
- __export(upgrade_exports, {
2905
- upgradeEnvironmentLayout: () => upgradeEnvironmentLayout
2906
- });
2907
- function moveFileIfDestinationMissing(sourcePath, destinationPath) {
2908
- if (!(0, import_fs4.existsSync)(sourcePath)) {
2909
- return false;
2910
- }
2911
- if ((0, import_fs4.existsSync)(destinationPath)) {
2912
- warn(
2913
- `\u26A0\uFE0F Skipped ${sourcePath}; destination already exists at ${destinationPath}`
2914
- );
2915
- return false;
2916
- }
2917
- (0, import_fs4.mkdirSync)((0, import_path5.dirname)(destinationPath), { recursive: true });
2918
- (0, import_fs4.renameSync)(sourcePath, destinationPath);
2919
- log(` \u2713 Moved ${sourcePath} -> ${destinationPath}`);
2920
- return true;
2921
- }
2922
- function migrateInventoryFiles() {
2923
- const oldInventoryFiles = findOldInventoryFiles();
2924
- if (oldInventoryFiles.length === 0) {
2925
- log(`\u2139\uFE0F No old inventory files found at ${OLD_INVENTORY_DIR}`);
2926
- return false;
2927
- }
2928
- log(import_kleur5.default.bold("\nMigrating Ansible inventory files"));
2929
- let didMoveInventory = false;
2930
- for (const oldInventoryFile of oldInventoryFiles) {
2931
- const environment = getEnvironmentNameFromOldInventoryPath(oldInventoryFile);
2932
- didMoveInventory = moveFileIfDestinationMissing(
2933
- oldInventoryFile,
2934
- getEnvironmentInventoryPath(environment)
2935
- ) || didMoveInventory;
2936
- }
2937
- try {
2938
- if ((0, import_fs4.existsSync)(OLD_INVENTORY_DIR) && (0, import_fs4.readdirSync)(OLD_INVENTORY_DIR).length === 0) {
2939
- (0, import_fs4.rmdirSync)(OLD_INVENTORY_DIR);
2940
- log(` \u2713 Removed empty ${OLD_INVENTORY_DIR}`);
2941
- }
2942
- } catch {
2943
- warn(`\u26A0\uFE0F Could not remove ${OLD_INVENTORY_DIR}; please review it manually`);
2944
- }
2945
- return didMoveInventory;
2946
- }
2947
- async function upgradeEnvironmentLayout() {
2948
- const didMoveInventory = migrateInventoryFiles();
2949
- await updateWorkflowEnvironments();
2950
- if (didMoveInventory) {
2951
- success("\n\u2705 Environment layout upgrade completed successfully.");
2952
- return;
2953
- }
2954
- success("\n\u2705 Environment layout already uses the current structure.");
2955
- }
2956
- var import_fs4, import_path5, import_kleur5;
2957
- var init_upgrade = __esm({
2958
- "src/environment/upgrade.ts"() {
2959
- "use strict";
2960
- import_fs4 = require("fs");
2961
- import_path5 = require("path");
2962
- import_kleur5 = __toESM(require("kleur"));
2963
- init_logger();
2964
- init_paths();
2965
- init_update_workflows();
2966
2868
  }
2967
2869
  });
2968
2870
 
@@ -2975,7 +2877,7 @@ async function select4(options) {
2975
2877
  const inquirer = await import("@inquirer/prompts");
2976
2878
  return inquirer.select(options);
2977
2879
  }
2978
- async function selectInventoryFile(dirPath = "./environments") {
2880
+ async function selectInventoryFile(dirPath = "./infrastructure/server-setup/inventory/") {
2979
2881
  if (!fs4.existsSync(dirPath)) {
2980
2882
  warn(`\u26A0\uFE0F No environment configuration directory found at ${dirPath}`);
2981
2883
  warn(
@@ -2983,20 +2885,22 @@ async function selectInventoryFile(dirPath = "./environments") {
2983
2885
  );
2984
2886
  return null;
2985
2887
  }
2986
- const environments = fs4.readdirSync(dirPath).filter((entry) => {
2987
- const filePath = path4.join(dirPath, entry);
2988
- return fs4.statSync(filePath).isDirectory() && fs4.existsSync(getEnvironmentInventoryPath(entry));
2888
+ const files = fs4.readdirSync(dirPath).filter((file) => {
2889
+ const filePath = path4.join(dirPath, file);
2890
+ const isFile = fs4.statSync(filePath).isFile();
2891
+ const ext = path4.extname(file).slice(1).toLowerCase();
2892
+ return isFile && (ext === "yml" || ext === "yaml");
2989
2893
  }).sort();
2990
- if (environments.length === 0) {
2894
+ if (files.length === 0) {
2991
2895
  warn(`\u26A0\uFE0F No environment configuration files found at ${dirPath}`);
2992
2896
  warn(
2993
2897
  "Hint: If this is a new infrastructure repository, run `opencrvs environment init` first."
2994
2898
  );
2995
2899
  return null;
2996
2900
  }
2997
- const choices = environments.map((environment) => ({
2998
- name: environment,
2999
- value: getEnvironmentInventoryPath(environment)
2901
+ const choices = files.map((file) => ({
2902
+ name: path4.basename(file, path4.extname(file)),
2903
+ value: path4.join(dirPath, file)
3000
2904
  }));
3001
2905
  const selectedFile = await select4({
3002
2906
  message: "Select environment (inventory file) to load users:",
@@ -3005,34 +2909,33 @@ async function selectInventoryFile(dirPath = "./environments") {
3005
2909
  return selectedFile;
3006
2910
  }
3007
2911
  async function manageEnvironmentUsers() {
3008
- console.log("\n", import_kleur6.default.bold().underline("Manage users"), "\n");
2912
+ console.log("\n", import_kleur5.default.bold().underline("Manage users"), "\n");
3009
2913
  const inventory_file = await selectInventoryFile();
3010
2914
  if (!inventory_file) {
3011
2915
  return;
3012
2916
  }
3013
2917
  await manageUsers(inventory_file);
3014
2918
  }
3015
- var fs4, path4, import_kleur6;
2919
+ var fs4, path4, import_kleur5;
3016
2920
  var init_users = __esm({
3017
2921
  "src/environment/users.ts"() {
3018
2922
  "use strict";
3019
2923
  fs4 = __toESM(require("fs"));
3020
2924
  path4 = __toESM(require("path"));
3021
- import_kleur6 = __toESM(require("kleur"));
2925
+ import_kleur5 = __toESM(require("kleur"));
3022
2926
  init_manage_users();
3023
2927
  init_logger();
3024
- init_paths();
3025
2928
  }
3026
2929
  });
3027
2930
 
3028
2931
  // src/environment/swarm-to-k8s.ts
3029
2932
  var swarm_to_k8s_exports = {};
3030
- var path5, import_kleur7, import_core2;
2933
+ var path5, import_kleur6, import_core2;
3031
2934
  var init_swarm_to_k8s = __esm({
3032
2935
  "src/environment/swarm-to-k8s.ts"() {
3033
2936
  "use strict";
3034
2937
  path5 = __toESM(require("path"));
3035
- import_kleur7 = __toESM(require("kleur"));
2938
+ import_kleur6 = __toESM(require("kleur"));
3036
2939
  init_logger();
3037
2940
  init_utils();
3038
2941
  init_templates();
@@ -3041,7 +2944,7 @@ var init_swarm_to_k8s = __esm({
3041
2944
  init_github();
3042
2945
  (async () => {
3043
2946
  log(
3044
- import_kleur7.default.bold(
2947
+ import_kleur6.default.bold(
3045
2948
  "------------------------------------------------\nOpenCRVS Infrastructure migration script: \nMigrating Swarm configurations to Kubernetes\n------------------------------------------------\n"
3046
2949
  )
3047
2950
  );
@@ -3072,7 +2975,7 @@ var init_swarm_to_k8s = __esm({
3072
2975
  );
3073
2976
  process.exit(0);
3074
2977
  }
3075
- log(import_kleur7.default.bold().underline("Migration properties:"));
2978
+ log(import_kleur6.default.bold().underline("Migration properties:"));
3076
2979
  log(` \u2713 Environment: ${environment}`);
3077
2980
  const old_inventory_path = process.env.OLD_INVENTORY_PATH || "";
3078
2981
  if (!old_inventory_path) {
@@ -3390,9 +3293,8 @@ async function runUpgrade(dockerSwarm) {
3390
3293
  }
3391
3294
 
3392
3295
  // src/environment/index.ts
3393
- var import_fs5 = require("fs");
3394
- var import_path6 = require("path");
3395
- init_paths();
3296
+ var import_fs4 = require("fs");
3297
+ var import_path4 = require("path");
3396
3298
  var REQUIRED_REPOSITORY_DIRECTORIES = [
3397
3299
  ".github/workflows",
3398
3300
  "environments",
@@ -3402,7 +3304,7 @@ function validateRepositoryStructure(repositoryRoot = process.cwd()) {
3402
3304
  const missingDirectories = REQUIRED_REPOSITORY_DIRECTORIES.filter(
3403
3305
  (directory) => {
3404
3306
  try {
3405
- return !(0, import_fs5.statSync)((0, import_path6.resolve)(repositoryRoot, directory)).isDirectory();
3307
+ return !(0, import_fs4.statSync)((0, import_path4.resolve)(repositoryRoot, directory)).isDirectory();
3406
3308
  } catch {
3407
3309
  return true;
3408
3310
  }
@@ -3416,14 +3318,8 @@ function validateRepositoryStructure(repositoryRoot = process.cwd()) {
3416
3318
  }
3417
3319
  async function runEnvironmentInit() {
3418
3320
  validateRepositoryStructure();
3419
- assertNoOldInventoryLayout();
3420
3321
  await Promise.resolve().then(() => (init_setup_environment(), setup_environment_exports));
3421
3322
  }
3422
- async function runEnvironmentUpgrade() {
3423
- validateRepositoryStructure();
3424
- const { upgradeEnvironmentLayout: upgradeEnvironmentLayout2 } = await Promise.resolve().then(() => (init_upgrade(), upgrade_exports));
3425
- await upgradeEnvironmentLayout2();
3426
- }
3427
3323
  async function runEnvironmentUpdateWorkflows() {
3428
3324
  validateRepositoryStructure();
3429
3325
  const { updateWorkflowEnvironments: updateWorkflowEnvironments2 } = await Promise.resolve().then(() => (init_update_workflows(), update_workflows_exports));
@@ -3493,7 +3389,6 @@ Usage: opencrvs environment <subcommand>
3493
3389
 
3494
3390
  Subcommands:
3495
3391
  init Initialise a new environment
3496
- upgrade Upgrade existing environment configuration
3497
3392
  update-workflows Update workflow environment options
3498
3393
  users Manage environment users
3499
3394
  swarm-to-k8s Migrate Docker Swarm configuration to Kubernetes
@@ -3504,8 +3399,6 @@ Subcommands:
3504
3399
  switch (subcommand) {
3505
3400
  case "init":
3506
3401
  return runEnvironmentCommand("initialisation", runEnvironmentInit);
3507
- case "upgrade":
3508
- return runEnvironmentCommand("environment upgrade", runEnvironmentUpgrade);
3509
3402
  case "update-workflows":
3510
3403
  return runEnvironmentCommand(
3511
3404
  "workflow update",
@@ -3526,10 +3419,10 @@ Subcommands:
3526
3419
  async function runEnvironmentCommand(operation, command) {
3527
3420
  try {
3528
3421
  await command();
3529
- } catch (error3) {
3422
+ } catch (error4) {
3530
3423
  console.error(
3531
3424
  `Environment ${operation} failed:`,
3532
- error3 instanceof Error ? error3.message : error3
3425
+ error4 instanceof Error ? error4.message : error4
3533
3426
  );
3534
3427
  process.exit(1);
3535
3428
  }
@@ -3555,8 +3448,8 @@ async function handleUpgrade() {
3555
3448
  try {
3556
3449
  await runUpgrade(dockerSwarm);
3557
3450
  console.log("Upgrade completed successfully!");
3558
- } catch (error3) {
3559
- console.error("Upgrade failed:", error3);
3451
+ } catch (error4) {
3452
+ console.error("Upgrade failed:", error4);
3560
3453
  process.exit(1);
3561
3454
  }
3562
3455
  }
@@ -7834,8 +7834,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7834
7834
  email?: string | undefined;
7835
7835
  status?: string | undefined;
7836
7836
  primaryOfficeId?: string | undefined;
7837
- count?: number | undefined;
7838
- skip?: number | undefined;
7837
+ count: number;
7838
+ skip: number;
7839
7839
  sortBy?: "createdAt" | "email" | "firstname" | "role" | "status" | "surname" | "username" | undefined;
7840
7840
  sortOrder: "asc" | "desc";
7841
7841
  };
@@ -8351,15 +8351,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8351
8351
  name: string;
8352
8352
  externalId?: string | null | undefined;
8353
8353
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8354
+ validUntil: string | null;
8354
8355
  locationType: string | null;
8355
- status: "active" | "inactive";
8356
- versions: {
8357
- versionId: string & import("zod").$brand<"UUID">;
8358
- effectiveFrom: string;
8359
- name: string;
8360
- externalId?: string | null | undefined;
8361
- status: "active" | "inactive";
8362
- }[];
8363
8356
  }[];
8364
8357
  meta: object;
8365
8358
  }>;
@@ -8369,6 +8362,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8369
8362
  name: string;
8370
8363
  externalId?: string | null | undefined;
8371
8364
  administrativeAreaId: string | null;
8365
+ validUntil: string | null;
8372
8366
  locationType: string | null;
8373
8367
  }[];
8374
8368
  output: void;
@@ -8383,15 +8377,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8383
8377
  name: string;
8384
8378
  externalId?: string | null | undefined;
8385
8379
  administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8380
+ validUntil: string | null;
8386
8381
  locationType: string | null;
8387
- status: "active" | "inactive";
8388
- versions: {
8389
- versionId: string & import("zod").$brand<"UUID">;
8390
- effectiveFrom: string;
8391
- name: string;
8392
- externalId?: string | null | undefined;
8393
- status: "active" | "inactive";
8394
- }[];
8395
8382
  };
8396
8383
  meta: import("trpc-to-openapi").OpenApiMeta;
8397
8384
  }>;
@@ -8799,14 +8786,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8799
8786
  name: string;
8800
8787
  externalId?: string | null | undefined;
8801
8788
  parentId: (string & import("zod").$brand<"UUID">) | null;
8802
- status: "active" | "inactive";
8803
- versions: {
8804
- versionId: string & import("zod").$brand<"UUID">;
8805
- effectiveFrom: string;
8806
- name: string;
8807
- externalId?: string | null | undefined;
8808
- status: "active" | "inactive";
8809
- }[];
8789
+ validUntil: string | null;
8810
8790
  }[];
8811
8791
  meta: import("trpc-to-openapi").OpenApiMeta;
8812
8792
  }>;
@@ -8816,6 +8796,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8816
8796
  name: string;
8817
8797
  externalId?: string | null | undefined;
8818
8798
  parentId: string | null;
8799
+ validUntil: string | null;
8819
8800
  }[];
8820
8801
  output: void;
8821
8802
  meta: object;
@@ -86,16 +86,16 @@ export declare const user: typeof userSerializer & {
86
86
  scope: (scope: import("../scopes").ScopeType) => {
87
87
  attribute: (option: import("../scopes").ScopeOptionKey) => {
88
88
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "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.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "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
- $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
89
+ $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
90
90
  };
91
91
  };
92
92
  jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
93
93
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "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.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "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
- $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
94
+ $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
95
95
  }) => {
96
96
  $jurisdiction: "administrativeArea" | "all" | "location" | {
97
97
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "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.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
98
- $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
98
+ $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
99
99
  };
100
100
  };
101
101
  hasScope: (scope: string) => JSONSchema;
@@ -69,13 +69,14 @@ export declare function validate(schema: JSONSchema, data: ConditionalParameters
69
69
  export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
70
70
  export declare function isOnline(): boolean;
71
71
  export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
72
- export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, _event: EventIndex): boolean;
72
+ export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, event: EventIndex): boolean;
73
73
  export type ValidatorContext = {
74
74
  user?: ITokenPayload;
75
75
  leafAdminStructureLocationIds?: Array<{
76
76
  id: UUID;
77
77
  }>;
78
78
  event?: EventDocument;
79
+ eventConfig?: EventConfig;
79
80
  baseFormState?: EventState;
80
81
  };
81
82
  export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;