@dhis2/app-service-data 3.11.2 → 3.11.3

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.
@@ -141,7 +141,7 @@ const isMetadataPackageInstallation = (type, _ref9) => {
141
141
  resource
142
142
  } = _ref9;
143
143
  return type === 'create' && resource === 'synchronization/metadataPull';
144
- }; // POST to 'indicaators/expression/description' (validate an expression)
144
+ }; // POST to 'indicators/expression/description' or 'programIndicator/expression/description' (validate an expression)
145
145
 
146
146
 
147
147
  exports.isMetadataPackageInstallation = isMetadataPackageInstallation;
@@ -150,7 +150,8 @@ const isExpressionDescriptionValidation = (type, _ref10) => {
150
150
  let {
151
151
  resource
152
152
  } = _ref10;
153
- return type === 'create' && resource === 'indicators/expression/description';
153
+ const pattern = /^(indicators|programIndicators)\/expression\/description$/;
154
+ return type === 'create' && pattern.test(resource);
154
155
  };
155
156
 
156
157
  exports.isExpressionDescriptionValidation = isExpressionDescriptionValidation;
@@ -178,4 +178,14 @@ describe('isExpressionDescriptionValidation', () => {
178
178
  resource: 'indicators/expression/somethingelse'
179
179
  })).toBe(false);
180
180
  });
181
+ it('returns true for a POST to "programIndicators/expression/description"', () => {
182
+ expect((0, _textPlainMatchers.isExpressionDescriptionValidation)('create', {
183
+ resource: 'programIndicators/expression/description'
184
+ })).toBe(true);
185
+ });
186
+ it('retuns false for a POST to a different resource', () => {
187
+ expect((0, _textPlainMatchers.isMetadataPackageInstallation)('create', {
188
+ resource: 'programIndicators/expression/somethingelse'
189
+ })).toBe(false);
190
+ });
181
191
  });
@@ -110,11 +110,12 @@ export const isMetadataPackageInstallation = (type, _ref9) => {
110
110
  resource
111
111
  } = _ref9;
112
112
  return type === 'create' && resource === 'synchronization/metadataPull';
113
- }; // POST to 'indicaators/expression/description' (validate an expression)
113
+ }; // POST to 'indicators/expression/description' or 'programIndicator/expression/description' (validate an expression)
114
114
 
115
115
  export const isExpressionDescriptionValidation = (type, _ref10) => {
116
116
  let {
117
117
  resource
118
118
  } = _ref10;
119
- return type === 'create' && resource === 'indicators/expression/description';
119
+ const pattern = /^(indicators|programIndicators)\/expression\/description$/;
120
+ return type === 'create' && pattern.test(resource);
120
121
  };
@@ -175,4 +175,14 @@ describe('isExpressionDescriptionValidation', () => {
175
175
  resource: 'indicators/expression/somethingelse'
176
176
  })).toBe(false);
177
177
  });
178
+ it('returns true for a POST to "programIndicators/expression/description"', () => {
179
+ expect(isExpressionDescriptionValidation('create', {
180
+ resource: 'programIndicators/expression/description'
181
+ })).toBe(true);
182
+ });
183
+ it('retuns false for a POST to a different resource', () => {
184
+ expect(isMetadataPackageInstallation('create', {
185
+ resource: 'programIndicators/expression/somethingelse'
186
+ })).toBe(false);
187
+ });
178
188
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/app-service-data",
3
- "version": "3.11.2",
3
+ "version": "3.11.3",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "types": "build/types/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-query": "^3.13.11"
36
36
  },
37
37
  "peerDependencies": {
38
- "@dhis2/app-service-config": "3.11.2",
38
+ "@dhis2/app-service-config": "3.11.3",
39
39
  "prop-types": "^15.7.2",
40
40
  "react": "^16.8",
41
41
  "react-dom": "^16.8"