cht-conf 3.21.5 → 3.22.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.22.0](https://github.com/medic/cht-conf/compare/v3.21.5...v3.22.0) (2024-04-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * **#615:** add support for `assetlinks.json` when compiling app settings ([#616](https://github.com/medic/cht-conf/issues/616)) ([f39d22a](https://github.com/medic/cht-conf/commit/f39d22a59816a18e9b2777067330193ce336b7a0)), closes [#615](https://github.com/medic/cht-conf/issues/615)
7
+
1
8
  ## [3.21.5](https://github.com/medic/cht-conf/compare/v3.21.4...v3.21.5) (2024-02-05)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "3.21.5",
3
+ "version": "3.22.0",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
@@ -95,6 +95,15 @@ const compileAppSettingsForProject = async (projectDir, options) => {
95
95
  }
96
96
  appSettings.schedules = scheduleSettings;
97
97
  }
98
+
99
+ const assetlinks = readOptionalJson(path.join(projectDir, 'app_settings/assetlinks.json'));
100
+ if (assetlinks) {
101
+ const validate = validateAppSettings.validateAssetlinks(assetlinks);
102
+ if (!validate.valid) {
103
+ throw new Error(`Invalid assetlinks: ${validate.error}`);
104
+ }
105
+ appSettings.assetlinks = assetlinks;
106
+ }
98
107
  } else {
99
108
  warn(`app_settings.json file should not be edited directly.
100
109
  Please create a base_settings.json file in app_settings folder and move any manually defined configurations there.`);
@@ -64,6 +64,19 @@ const ScheduleSchema = joi.array().items(
64
64
  })
65
65
  );
66
66
 
67
+ const AssetlinksSchema = joi.array().items(
68
+ joi.object({
69
+ relation: joi.array().items(
70
+ joi.string().valid('delegate_permission/common.handle_all_urls').required()
71
+ ).length(1).required(),
72
+ target: joi.object({
73
+ namespace: joi.string().valid('android_app').required(),
74
+ package_name: joi.string().required(),
75
+ sha256_cert_fingerprints: joi.array().items(joi.string().required()).min(1).required(),
76
+ }).required(),
77
+ }),
78
+ ).min(1);
79
+
67
80
  module.exports = {
68
81
  validateFormsSchema: (formsObject) => {
69
82
  const { error } = FormsSchema.validate(formsObject);
@@ -72,5 +85,9 @@ module.exports = {
72
85
  validateScheduleSchema: (scheduleObject) => {
73
86
  const { error } = ScheduleSchema.validate(scheduleObject);
74
87
  return error ? { valid: false, error } : { valid: true };
88
+ },
89
+ validateAssetlinks: (assetlinksObject) => {
90
+ const { error } = AssetlinksSchema.validate(assetlinksObject);
91
+ return error ? { valid: false, error } : { valid: true };
75
92
  }
76
93
  };