@dhis2/app-service-data 3.15.0 → 3.16.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/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +24 -4
- package/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.test.js +34 -0
- package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +20 -2
- package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.test.js +35 -1
- package/build/types/links/RestAPILink/queryToRequestOptions/textPlainMatchers.d.ts +2 -0
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isUpdateInterpretation = exports.isReplyToMessageConversation = exports.isMetadataPackageInstallation = exports.isInterpretationCommentUpdate = exports.isFilterDescriptionValidation = exports.isExpressionDescriptionValidation = exports.isCreateInterpretation = exports.isCreateFeedbackMessage = exports.isCommentOnInterpretation = exports.isAddOrUpdateSystemOrUserSetting = exports.addOrUpdateConfigurationProperty = void 0;
|
|
6
|
+
exports.isUpdateInterpretation = exports.isSkipTestDescriptionValid = exports.isReplyToMessageConversation = exports.isMetadataPackageInstallation = exports.isInterpretationCommentUpdate = exports.isFilterDescriptionValidation = exports.isExpressionDescriptionValidation = exports.isCreateInterpretation = exports.isCreateFeedbackMessage = exports.isConditionDescriptionValidation = exports.isCommentOnInterpretation = exports.isAddOrUpdateSystemOrUserSetting = exports.addOrUpdateConfigurationProperty = void 0;
|
|
7
7
|
/*
|
|
8
8
|
* Requests that expect a "text/plain" Content-Type have been collected by scanning
|
|
9
9
|
* the developer documentation:
|
|
@@ -128,13 +128,13 @@ const isMetadataPackageInstallation = (type, _ref9) => {
|
|
|
128
128
|
return type === 'create' && resource === 'synchronization/metadataPull';
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
// POST to '
|
|
131
|
+
// POST to '*/expression/description', (indicators,programIndicators,validationRules,predictors) (validate an expression)
|
|
132
132
|
exports.isMetadataPackageInstallation = isMetadataPackageInstallation;
|
|
133
133
|
const isExpressionDescriptionValidation = (type, _ref0) => {
|
|
134
134
|
let {
|
|
135
135
|
resource
|
|
136
136
|
} = _ref0;
|
|
137
|
-
const pattern = /^(indicators|programIndicators|validationRules)\/expression\/description$/;
|
|
137
|
+
const pattern = /^(indicators|programIndicators|validationRules|predictors)\/expression\/description$/;
|
|
138
138
|
return type === 'create' && pattern.test(resource);
|
|
139
139
|
};
|
|
140
140
|
|
|
@@ -147,4 +147,24 @@ const isFilterDescriptionValidation = (type, _ref1) => {
|
|
|
147
147
|
const pattern = /^programIndicators\/filter\/description$/;
|
|
148
148
|
return type === 'create' && pattern.test(resource);
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
|
|
151
|
+
// POST to 'predictors/skipTest/description' (validate a filter)
|
|
152
|
+
exports.isFilterDescriptionValidation = isFilterDescriptionValidation;
|
|
153
|
+
const isSkipTestDescriptionValid = (type, _ref10) => {
|
|
154
|
+
let {
|
|
155
|
+
resource
|
|
156
|
+
} = _ref10;
|
|
157
|
+
const pattern = /^predictors\/skipTest\/description$/;
|
|
158
|
+
return type === 'create' && pattern.test(resource);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// POST to 'programRules/condition/description' (validate a program rule condition)
|
|
162
|
+
exports.isSkipTestDescriptionValid = isSkipTestDescriptionValid;
|
|
163
|
+
const isConditionDescriptionValidation = (type, _ref11) => {
|
|
164
|
+
let {
|
|
165
|
+
resource
|
|
166
|
+
} = _ref11;
|
|
167
|
+
const pattern = /^programRules\/condition\/description$/;
|
|
168
|
+
return type === 'create' && pattern.test(resource);
|
|
169
|
+
};
|
|
170
|
+
exports.isConditionDescriptionValidation = isConditionDescriptionValidation;
|
|
@@ -197,6 +197,16 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
197
197
|
resource: 'validationRules/expression/somethingelse'
|
|
198
198
|
})).toBe(false);
|
|
199
199
|
});
|
|
200
|
+
it('returns true for a POST to "predictors/expression/description"', () => {
|
|
201
|
+
expect((0, _textPlainMatchers.isExpressionDescriptionValidation)('create', {
|
|
202
|
+
resource: 'predictors/expression/description'
|
|
203
|
+
})).toBe(true);
|
|
204
|
+
});
|
|
205
|
+
it('retuns false for a POST to a different predictors resource', () => {
|
|
206
|
+
expect((0, _textPlainMatchers.isExpressionDescriptionValidation)('create', {
|
|
207
|
+
resource: 'predictors/expression/somethingelse'
|
|
208
|
+
})).toBe(false);
|
|
209
|
+
});
|
|
200
210
|
});
|
|
201
211
|
describe('isFilterDescriptionValidation', () => {
|
|
202
212
|
it('returns true for a POST to "programIndicators/filter/description"', () => {
|
|
@@ -209,4 +219,28 @@ describe('isFilterDescriptionValidation', () => {
|
|
|
209
219
|
resource: 'programIndicators/filter/somethingelse'
|
|
210
220
|
})).toBe(false);
|
|
211
221
|
});
|
|
222
|
+
});
|
|
223
|
+
describe('isSkipTestDescriptionValid', () => {
|
|
224
|
+
it('returns true for a POST to "predictors/skipTest/description"', () => {
|
|
225
|
+
expect((0, _textPlainMatchers.isSkipTestDescriptionValid)('create', {
|
|
226
|
+
resource: 'predictors/skipTest/description'
|
|
227
|
+
})).toBe(true);
|
|
228
|
+
});
|
|
229
|
+
it('retuns false for a POST to a different resource', () => {
|
|
230
|
+
expect((0, _textPlainMatchers.isSkipTestDescriptionValid)('create', {
|
|
231
|
+
resource: 'predictors/skipTest/somethingelse'
|
|
232
|
+
})).toBe(false);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
describe('isConditionDescriptionValidation', () => {
|
|
236
|
+
it('returns true for a POST to "programRules/condition/description"', () => {
|
|
237
|
+
expect((0, _textPlainMatchers.isConditionDescriptionValidation)('create', {
|
|
238
|
+
resource: 'programRules/condition/description'
|
|
239
|
+
})).toBe(true);
|
|
240
|
+
});
|
|
241
|
+
it('retuns false for a POST to a different resource', () => {
|
|
242
|
+
expect((0, _textPlainMatchers.isConditionDescriptionValidation)('create', {
|
|
243
|
+
resource: 'programRules/condition/somethingelse'
|
|
244
|
+
})).toBe(false);
|
|
245
|
+
});
|
|
212
246
|
});
|
|
@@ -114,12 +114,12 @@ export const isMetadataPackageInstallation = (type, _ref9) => {
|
|
|
114
114
|
return type === 'create' && resource === 'synchronization/metadataPull';
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
// POST to '
|
|
117
|
+
// POST to '*/expression/description', (indicators,programIndicators,validationRules,predictors) (validate an expression)
|
|
118
118
|
export const isExpressionDescriptionValidation = (type, _ref0) => {
|
|
119
119
|
let {
|
|
120
120
|
resource
|
|
121
121
|
} = _ref0;
|
|
122
|
-
const pattern = /^(indicators|programIndicators|validationRules)\/expression\/description$/;
|
|
122
|
+
const pattern = /^(indicators|programIndicators|validationRules|predictors)\/expression\/description$/;
|
|
123
123
|
return type === 'create' && pattern.test(resource);
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -130,4 +130,22 @@ export const isFilterDescriptionValidation = (type, _ref1) => {
|
|
|
130
130
|
} = _ref1;
|
|
131
131
|
const pattern = /^programIndicators\/filter\/description$/;
|
|
132
132
|
return type === 'create' && pattern.test(resource);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// POST to 'predictors/skipTest/description' (validate a filter)
|
|
136
|
+
export const isSkipTestDescriptionValid = (type, _ref10) => {
|
|
137
|
+
let {
|
|
138
|
+
resource
|
|
139
|
+
} = _ref10;
|
|
140
|
+
const pattern = /^predictors\/skipTest\/description$/;
|
|
141
|
+
return type === 'create' && pattern.test(resource);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// POST to 'programRules/condition/description' (validate a program rule condition)
|
|
145
|
+
export const isConditionDescriptionValidation = (type, _ref11) => {
|
|
146
|
+
let {
|
|
147
|
+
resource
|
|
148
|
+
} = _ref11;
|
|
149
|
+
const pattern = /^programRules\/condition\/description$/;
|
|
150
|
+
return type === 'create' && pattern.test(resource);
|
|
133
151
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isReplyToMessageConversation, isCreateFeedbackMessage, isCreateInterpretation, isUpdateInterpretation, isCommentOnInterpretation, isInterpretationCommentUpdate, isAddOrUpdateSystemOrUserSetting, addOrUpdateConfigurationProperty, isMetadataPackageInstallation, isExpressionDescriptionValidation, isFilterDescriptionValidation } from './textPlainMatchers';
|
|
1
|
+
import { isReplyToMessageConversation, isCreateFeedbackMessage, isCreateInterpretation, isUpdateInterpretation, isCommentOnInterpretation, isInterpretationCommentUpdate, isAddOrUpdateSystemOrUserSetting, addOrUpdateConfigurationProperty, isMetadataPackageInstallation, isExpressionDescriptionValidation, isFilterDescriptionValidation, isSkipTestDescriptionValid, isConditionDescriptionValidation } from './textPlainMatchers';
|
|
2
2
|
describe('isReplyToMessageConversation', () => {
|
|
3
3
|
it('retuns true for POST to `messageConversations/${id}`', () => {
|
|
4
4
|
expect(isReplyToMessageConversation('create', {
|
|
@@ -195,6 +195,16 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
195
195
|
resource: 'validationRules/expression/somethingelse'
|
|
196
196
|
})).toBe(false);
|
|
197
197
|
});
|
|
198
|
+
it('returns true for a POST to "predictors/expression/description"', () => {
|
|
199
|
+
expect(isExpressionDescriptionValidation('create', {
|
|
200
|
+
resource: 'predictors/expression/description'
|
|
201
|
+
})).toBe(true);
|
|
202
|
+
});
|
|
203
|
+
it('retuns false for a POST to a different predictors resource', () => {
|
|
204
|
+
expect(isExpressionDescriptionValidation('create', {
|
|
205
|
+
resource: 'predictors/expression/somethingelse'
|
|
206
|
+
})).toBe(false);
|
|
207
|
+
});
|
|
198
208
|
});
|
|
199
209
|
describe('isFilterDescriptionValidation', () => {
|
|
200
210
|
it('returns true for a POST to "programIndicators/filter/description"', () => {
|
|
@@ -207,4 +217,28 @@ describe('isFilterDescriptionValidation', () => {
|
|
|
207
217
|
resource: 'programIndicators/filter/somethingelse'
|
|
208
218
|
})).toBe(false);
|
|
209
219
|
});
|
|
220
|
+
});
|
|
221
|
+
describe('isSkipTestDescriptionValid', () => {
|
|
222
|
+
it('returns true for a POST to "predictors/skipTest/description"', () => {
|
|
223
|
+
expect(isSkipTestDescriptionValid('create', {
|
|
224
|
+
resource: 'predictors/skipTest/description'
|
|
225
|
+
})).toBe(true);
|
|
226
|
+
});
|
|
227
|
+
it('retuns false for a POST to a different resource', () => {
|
|
228
|
+
expect(isSkipTestDescriptionValid('create', {
|
|
229
|
+
resource: 'predictors/skipTest/somethingelse'
|
|
230
|
+
})).toBe(false);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
describe('isConditionDescriptionValidation', () => {
|
|
234
|
+
it('returns true for a POST to "programRules/condition/description"', () => {
|
|
235
|
+
expect(isConditionDescriptionValidation('create', {
|
|
236
|
+
resource: 'programRules/condition/description'
|
|
237
|
+
})).toBe(true);
|
|
238
|
+
});
|
|
239
|
+
it('retuns false for a POST to a different resource', () => {
|
|
240
|
+
expect(isConditionDescriptionValidation('create', {
|
|
241
|
+
resource: 'programRules/condition/somethingelse'
|
|
242
|
+
})).toBe(false);
|
|
243
|
+
});
|
|
210
244
|
});
|
|
@@ -10,3 +10,5 @@ export declare const addOrUpdateConfigurationProperty: (type: FetchType, { resou
|
|
|
10
10
|
export declare const isMetadataPackageInstallation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
11
11
|
export declare const isExpressionDescriptionValidation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
12
12
|
export declare const isFilterDescriptionValidation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
13
|
+
export declare const isSkipTestDescriptionValid: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
14
|
+
export declare const isConditionDescriptionValidation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/app-service-data",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"types": "build/types/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"prop-types": "^15.7.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@dhis2/app-service-config": "3.
|
|
40
|
+
"@dhis2/app-service-config": "3.16.0",
|
|
41
41
|
"react": "^16.8.6 || ^18",
|
|
42
42
|
"react-dom": "^16.8.6 || ^18"
|
|
43
43
|
}
|