@opencrvs/toolkit 2.1.0-rc.1bd2a41 → 2.1.0-rc.1f4b4ad

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 (35) hide show
  1. package/README.md +0 -1
  2. package/dist/application-config/index.js +1 -0
  3. package/dist/cli.js +57 -164
  4. package/dist/commons/api/router.d.ts +85 -0
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  7. package/dist/commons/events/AuditLog.d.ts +37 -0
  8. package/dist/commons/events/FieldConfig.d.ts +5 -0
  9. package/dist/commons/events/index.d.ts +1 -0
  10. package/dist/commons/events/locationPayloads.d.ts +95 -0
  11. package/dist/commons/events/locations.d.ts +7 -0
  12. package/dist/conditionals/index.js +1 -0
  13. package/dist/environment/index.d.ts +0 -1
  14. package/dist/environment/index.d.ts.map +1 -1
  15. package/dist/environment/index.js +0 -10
  16. package/dist/environment/setup-environment.js +1 -2
  17. package/dist/environment/templates.d.ts.map +1 -1
  18. package/dist/environment/templates.js +1 -2
  19. package/dist/environment/update-workflows.d.ts.map +1 -1
  20. package/dist/environment/update-workflows.js +3 -4
  21. package/dist/environment/users.js +13 -11
  22. package/dist/events/index.js +88 -0
  23. package/dist/notification/index.js +99 -25
  24. package/dist/scopes/index.d.ts +3 -1
  25. package/dist/scopes/index.js +1 -0
  26. package/opencrvs-toolkit-2.1.0-rc.1f4b4ad.tgz +0 -0
  27. package/package.json +3 -2
  28. package/tsconfig.tsbuildinfo +1 -1
  29. package/dist/environment/paths.d.ts +0 -7
  30. package/dist/environment/paths.d.ts.map +0 -1
  31. package/dist/environment/paths.js +0 -72
  32. package/dist/environment/upgrade.d.ts +0 -2
  33. package/dist/environment/upgrade.d.ts.map +0 -1
  34. package/dist/environment/upgrade.js +0 -80
  35. package/opencrvs-toolkit-2.1.0-rc.1bd2a41.tgz +0 -0
package/README.md CHANGED
@@ -25,7 +25,6 @@ Other environment operations are available as separate commands:
25
25
 
26
26
  ```sh
27
27
  opencrvs environment update-workflows
28
- opencrvs environment upgrade
29
28
  opencrvs environment users
30
29
  opencrvs environment swarm-to-k8s
31
30
  ```
@@ -647,6 +647,7 @@ var PlainScopeType = z11.enum([
647
647
  "integration.create",
648
648
  "record.import",
649
649
  "config.update-all",
650
+ "location.edit",
650
651
  "attachment.upload",
651
652
  "profile.electronic-signature",
652
653
  "user.read-only-my-audit",
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
  }
@@ -8242,6 +8242,37 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8242
8242
  responseSummary: {
8243
8243
  clientId: string;
8244
8244
  };
8245
+ } | {
8246
+ id: string;
8247
+ clientId: string;
8248
+ clientType: "system" | "user";
8249
+ createdAt: string;
8250
+ operation: "locations.create";
8251
+ requestData: {
8252
+ id: string;
8253
+ versionId: string;
8254
+ name: string;
8255
+ externalId?: string | null | undefined;
8256
+ effectiveFrom: string;
8257
+ status: string;
8258
+ administrativeAreaId?: string | null | undefined;
8259
+ locationType?: string | null | undefined;
8260
+ };
8261
+ } | {
8262
+ id: string;
8263
+ clientId: string;
8264
+ clientType: "system" | "user";
8265
+ createdAt: string;
8266
+ operation: "administrativeAreas.create";
8267
+ requestData: {
8268
+ id: string;
8269
+ versionId: string;
8270
+ name: string;
8271
+ externalId?: string | null | undefined;
8272
+ effectiveFrom: string;
8273
+ status: string;
8274
+ parentId?: string | null | undefined;
8275
+ };
8245
8276
  } | {
8246
8277
  id: string;
8247
8278
  clientId: string;
@@ -8374,6 +8405,34 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8374
8405
  output: void;
8375
8406
  meta: object;
8376
8407
  }>;
8408
+ create: import("@trpc/server").TRPCMutationProcedure<{
8409
+ input: {
8410
+ id?: string | undefined;
8411
+ versionId?: string | undefined;
8412
+ name: string;
8413
+ externalId?: string | null | undefined;
8414
+ administrativeAreaId: string | null;
8415
+ locationType: string | null;
8416
+ effectiveFrom?: string | undefined;
8417
+ status?: "active" | "inactive" | undefined;
8418
+ };
8419
+ output: {
8420
+ id: string & import("zod").$brand<"UUID">;
8421
+ name: string;
8422
+ externalId?: string | null | undefined;
8423
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8424
+ locationType: string | null;
8425
+ status: "active" | "inactive";
8426
+ versions: {
8427
+ versionId: string & import("zod").$brand<"UUID">;
8428
+ effectiveFrom: string;
8429
+ name: string;
8430
+ externalId?: string | null | undefined;
8431
+ status: "active" | "inactive";
8432
+ }[];
8433
+ };
8434
+ meta: import("trpc-to-openapi").OpenApiMeta;
8435
+ }>;
8377
8436
  get: import("@trpc/server").TRPCQueryProcedure<{
8378
8437
  input: {
8379
8438
  id: string;
@@ -8820,6 +8879,32 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
8820
8879
  output: void;
8821
8880
  meta: object;
8822
8881
  }>;
8882
+ create: import("@trpc/server").TRPCMutationProcedure<{
8883
+ input: {
8884
+ id?: string | undefined;
8885
+ versionId?: string | undefined;
8886
+ name: string;
8887
+ externalId?: string | null | undefined;
8888
+ parentId: string | null;
8889
+ effectiveFrom?: string | undefined;
8890
+ status?: "active" | "inactive" | undefined;
8891
+ };
8892
+ output: {
8893
+ id: string & import("zod").$brand<"UUID">;
8894
+ name: string;
8895
+ externalId?: string | null | undefined;
8896
+ parentId: (string & import("zod").$brand<"UUID">) | null;
8897
+ status: "active" | "inactive";
8898
+ versions: {
8899
+ versionId: string & import("zod").$brand<"UUID">;
8900
+ effectiveFrom: string;
8901
+ name: string;
8902
+ externalId?: string | null | undefined;
8903
+ status: "active" | "inactive";
8904
+ }[];
8905
+ };
8906
+ meta: import("trpc-to-openapi").OpenApiMeta;
8907
+ }>;
8823
8908
  }>>;
8824
8909
  integrations: import("@trpc/server").TRPCBuiltRouter<{
8825
8910
  ctx: Partial<{
@@ -85,16 +85,16 @@ export declare const now: typeof todayDateTimeValueSerializer;
85
85
  export declare const user: typeof userSerializer & {
86
86
  scope: (scope: import("../scopes").ScopeType) => {
87
87
  attribute: (option: import("../scopes").ScopeOptionKey) => {
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";
88
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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
89
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
90
90
  };
91
91
  };
92
92
  jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
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";
93
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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
94
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
95
95
  }) => {
96
96
  $jurisdiction: "administrativeArea" | "all" | "location" | {
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";
97
+ $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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
98
  $option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
99
99
  };
100
100
  };
@@ -103,6 +103,7 @@ export declare const FieldConfigSchema: z.ZodObject<{
103
103
  "config.update-all": "config.update-all";
104
104
  "dashboard.view": "dashboard.view";
105
105
  "integration.create": "integration.create";
106
+ "location.edit": "location.edit";
106
107
  "organisation.read-locations": "organisation.read-locations";
107
108
  "performance.read": "performance.read";
108
109
  "performance.read-dashboards": "performance.read-dashboards";
@@ -283,6 +284,7 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
283
284
  "config.update-all": "config.update-all";
284
285
  "dashboard.view": "dashboard.view";
285
286
  "integration.create": "integration.create";
287
+ "location.edit": "location.edit";
286
288
  "organisation.read-locations": "organisation.read-locations";
287
289
  "performance.read": "performance.read";
288
290
  "performance.read-dashboards": "performance.read-dashboards";
@@ -439,6 +441,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
439
441
  "config.update-all": "config.update-all";
440
442
  "dashboard.view": "dashboard.view";
441
443
  "integration.create": "integration.create";
444
+ "location.edit": "location.edit";
442
445
  "organisation.read-locations": "organisation.read-locations";
443
446
  "performance.read": "performance.read";
444
447
  "performance.read-dashboards": "performance.read-dashboards";
@@ -587,6 +590,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
587
590
  "config.update-all": "config.update-all";
588
591
  "dashboard.view": "dashboard.view";
589
592
  "integration.create": "integration.create";
593
+ "location.edit": "location.edit";
590
594
  "organisation.read-locations": "organisation.read-locations";
591
595
  "performance.read": "performance.read";
592
596
  "performance.read-dashboards": "performance.read-dashboards";
@@ -746,6 +750,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
746
750
  "config.update-all": "config.update-all";
747
751
  "dashboard.view": "dashboard.view";
748
752
  "integration.create": "integration.create";
753
+ "location.edit": "location.edit";
749
754
  "organisation.read-locations": "organisation.read-locations";
750
755
  "performance.read": "performance.read";
751
756
  "performance.read-dashboards": "performance.read-dashboards";
@@ -894,6 +899,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
894
899
  "config.update-all": "config.update-all";
895
900
  "dashboard.view": "dashboard.view";
896
901
  "integration.create": "integration.create";
902
+ "location.edit": "location.edit";
897
903
  "organisation.read-locations": "organisation.read-locations";
898
904
  "performance.read": "performance.read";
899
905
  "performance.read-dashboards": "performance.read-dashboards";