@dhis2/app-service-data 3.14.0 → 3.14.2
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/index.js +23 -1
- package/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +12 -2
- package/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.test.js +14 -2
- package/build/es/index.js +2 -1
- package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +9 -0
- package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.test.js +15 -3
- package/build/types/index.d.ts +1 -0
- package/build/types/links/RestAPILink/queryToRequestOptions/requestContentType.d.ts +1 -1
- package/build/types/links/RestAPILink/queryToRequestOptions/textPlainMatchers.d.ts +1 -0
- package/build/types/react/hooks/useDataQuery.d.ts +2 -2
- package/build/types/react/hooks/useQueryExecutor.d.ts +1 -1
- package/package.json +2 -2
package/build/cjs/index.js
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
DataQuery: true,
|
|
8
|
+
DataMutation: true,
|
|
9
|
+
DataProvider: true,
|
|
10
|
+
CustomDataProvider: true,
|
|
11
|
+
useDataEngine: true,
|
|
12
|
+
useDataQuery: true,
|
|
13
|
+
useDataMutation: true,
|
|
14
|
+
FetchError: true
|
|
15
|
+
};
|
|
6
16
|
Object.defineProperty(exports, "CustomDataProvider", {
|
|
7
17
|
enumerable: true,
|
|
8
18
|
get: function () {
|
|
@@ -52,4 +62,16 @@ Object.defineProperty(exports, "useDataQuery", {
|
|
|
52
62
|
}
|
|
53
63
|
});
|
|
54
64
|
var _react = require("./react");
|
|
55
|
-
var _engine = require("./engine");
|
|
65
|
+
var _engine = require("./engine");
|
|
66
|
+
var _types = require("./types");
|
|
67
|
+
Object.keys(_types).forEach(function (key) {
|
|
68
|
+
if (key === "default" || key === "__esModule") return;
|
|
69
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
70
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
71
|
+
Object.defineProperty(exports, key, {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () {
|
|
74
|
+
return _types[key];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -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.isExpressionDescriptionValidation = exports.isCreateInterpretation = exports.isCreateFeedbackMessage = exports.isCommentOnInterpretation = exports.isAddOrUpdateSystemOrUserSetting = exports.addOrUpdateConfigurationProperty = void 0;
|
|
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;
|
|
7
7
|
/*
|
|
8
8
|
* Requests that expect a "text/plain" Content-Type have been collected by scanning
|
|
9
9
|
* the developer documentation:
|
|
@@ -137,4 +137,14 @@ const isExpressionDescriptionValidation = (type, _ref10) => {
|
|
|
137
137
|
const pattern = /^(indicators|programIndicators)\/expression\/description$/;
|
|
138
138
|
return type === 'create' && pattern.test(resource);
|
|
139
139
|
};
|
|
140
|
-
|
|
140
|
+
|
|
141
|
+
// POST to 'programIndicator/filter/description' (validate a filter)
|
|
142
|
+
exports.isExpressionDescriptionValidation = isExpressionDescriptionValidation;
|
|
143
|
+
const isFilterDescriptionValidation = (type, _ref11) => {
|
|
144
|
+
let {
|
|
145
|
+
resource
|
|
146
|
+
} = _ref11;
|
|
147
|
+
const pattern = /^programIndicators\/filter\/description$/;
|
|
148
|
+
return type === 'create' && pattern.test(resource);
|
|
149
|
+
};
|
|
150
|
+
exports.isFilterDescriptionValidation = isFilterDescriptionValidation;
|
|
@@ -173,7 +173,7 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
173
173
|
})).toBe(true);
|
|
174
174
|
});
|
|
175
175
|
it('retuns false for a POST to a different resource', () => {
|
|
176
|
-
expect((0, _textPlainMatchers.
|
|
176
|
+
expect((0, _textPlainMatchers.isExpressionDescriptionValidation)('create', {
|
|
177
177
|
resource: 'indicators/expression/somethingelse'
|
|
178
178
|
})).toBe(false);
|
|
179
179
|
});
|
|
@@ -183,8 +183,20 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
183
183
|
})).toBe(true);
|
|
184
184
|
});
|
|
185
185
|
it('retuns false for a POST to a different resource', () => {
|
|
186
|
-
expect((0, _textPlainMatchers.
|
|
186
|
+
expect((0, _textPlainMatchers.isExpressionDescriptionValidation)('create', {
|
|
187
187
|
resource: 'programIndicators/expression/somethingelse'
|
|
188
188
|
})).toBe(false);
|
|
189
189
|
});
|
|
190
|
+
});
|
|
191
|
+
describe('isFilterDescriptionValidation', () => {
|
|
192
|
+
it('returns true for a POST to "programIndicators/filter/description"', () => {
|
|
193
|
+
expect((0, _textPlainMatchers.isFilterDescriptionValidation)('create', {
|
|
194
|
+
resource: 'programIndicators/filter/description'
|
|
195
|
+
})).toBe(true);
|
|
196
|
+
});
|
|
197
|
+
it('retuns false for a POST to a different resource', () => {
|
|
198
|
+
expect((0, _textPlainMatchers.isFilterDescriptionValidation)('create', {
|
|
199
|
+
resource: 'programIndicators/filter/somethingelse'
|
|
200
|
+
})).toBe(false);
|
|
201
|
+
});
|
|
190
202
|
});
|
package/build/es/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DataQuery, DataMutation, DataProvider, CustomDataProvider } from './react';
|
|
2
2
|
export { useDataEngine, useDataQuery, useDataMutation } from './react';
|
|
3
|
-
export { FetchError } from './engine';
|
|
3
|
+
export { FetchError } from './engine';
|
|
4
|
+
export type * from './types';
|
|
@@ -121,4 +121,13 @@ export const isExpressionDescriptionValidation = (type, _ref10) => {
|
|
|
121
121
|
} = _ref10;
|
|
122
122
|
const pattern = /^(indicators|programIndicators)\/expression\/description$/;
|
|
123
123
|
return type === 'create' && pattern.test(resource);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// POST to 'programIndicator/filter/description' (validate a filter)
|
|
127
|
+
export const isFilterDescriptionValidation = (type, _ref11) => {
|
|
128
|
+
let {
|
|
129
|
+
resource
|
|
130
|
+
} = _ref11;
|
|
131
|
+
const pattern = /^programIndicators\/filter\/description$/;
|
|
132
|
+
return type === 'create' && pattern.test(resource);
|
|
124
133
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isReplyToMessageConversation, isCreateFeedbackMessage, isCreateInterpretation, isUpdateInterpretation, isCommentOnInterpretation, isInterpretationCommentUpdate, isAddOrUpdateSystemOrUserSetting, addOrUpdateConfigurationProperty, isMetadataPackageInstallation, isExpressionDescriptionValidation } from './textPlainMatchers';
|
|
1
|
+
import { isReplyToMessageConversation, isCreateFeedbackMessage, isCreateInterpretation, isUpdateInterpretation, isCommentOnInterpretation, isInterpretationCommentUpdate, isAddOrUpdateSystemOrUserSetting, addOrUpdateConfigurationProperty, isMetadataPackageInstallation, isExpressionDescriptionValidation, isFilterDescriptionValidation } from './textPlainMatchers';
|
|
2
2
|
describe('isReplyToMessageConversation', () => {
|
|
3
3
|
it('retuns true for POST to `messageConversations/${id}`', () => {
|
|
4
4
|
expect(isReplyToMessageConversation('create', {
|
|
@@ -171,7 +171,7 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
171
171
|
})).toBe(true);
|
|
172
172
|
});
|
|
173
173
|
it('retuns false for a POST to a different resource', () => {
|
|
174
|
-
expect(
|
|
174
|
+
expect(isExpressionDescriptionValidation('create', {
|
|
175
175
|
resource: 'indicators/expression/somethingelse'
|
|
176
176
|
})).toBe(false);
|
|
177
177
|
});
|
|
@@ -181,8 +181,20 @@ describe('isExpressionDescriptionValidation', () => {
|
|
|
181
181
|
})).toBe(true);
|
|
182
182
|
});
|
|
183
183
|
it('retuns false for a POST to a different resource', () => {
|
|
184
|
-
expect(
|
|
184
|
+
expect(isExpressionDescriptionValidation('create', {
|
|
185
185
|
resource: 'programIndicators/expression/somethingelse'
|
|
186
186
|
})).toBe(false);
|
|
187
187
|
});
|
|
188
|
+
});
|
|
189
|
+
describe('isFilterDescriptionValidation', () => {
|
|
190
|
+
it('returns true for a POST to "programIndicators/filter/description"', () => {
|
|
191
|
+
expect(isFilterDescriptionValidation('create', {
|
|
192
|
+
resource: 'programIndicators/filter/description'
|
|
193
|
+
})).toBe(true);
|
|
194
|
+
});
|
|
195
|
+
it('retuns false for a POST to a different resource', () => {
|
|
196
|
+
expect(isFilterDescriptionValidation('create', {
|
|
197
|
+
resource: 'programIndicators/filter/somethingelse'
|
|
198
|
+
})).toBe(false);
|
|
199
|
+
});
|
|
188
200
|
});
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedResourceQuery, FetchType } from '../../../engine';
|
|
2
2
|
type RequestContentType = 'application/json' | 'application/json-patch+json' | 'text/plain' | 'multipart/form-data' | 'application/x-www-form-urlencoded' | null;
|
|
3
3
|
export declare const requestContentType: (type: FetchType, query: ResolvedResourceQuery) => null | RequestContentType;
|
|
4
|
-
export declare const requestHeadersForContentType: (contentType: RequestContentType) => undefined | Record<
|
|
4
|
+
export declare const requestHeadersForContentType: (contentType: RequestContentType) => undefined | Record<"Content-Type", string>;
|
|
5
5
|
export declare const requestBodyForContentType: (contentType: RequestContentType, { data }: ResolvedResourceQuery) => undefined | string | FormData | URLSearchParams;
|
|
6
6
|
export {};
|
|
@@ -9,3 +9,4 @@ export declare const isAddOrUpdateSystemOrUserSetting: (type: FetchType, { resou
|
|
|
9
9
|
export declare const addOrUpdateConfigurationProperty: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
10
10
|
export declare const isMetadataPackageInstallation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
11
11
|
export declare const isExpressionDescriptionValidation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
12
|
+
export declare const isFilterDescriptionValidation: (type: FetchType, { resource }: ResolvedResourceQuery) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Query, QueryOptions } from '../../engine';
|
|
1
|
+
import type { Query, QueryOptions, QueryResult } from '../../engine';
|
|
2
2
|
import type { QueryRenderInput } from '../../types';
|
|
3
|
-
export declare const useDataQuery: <TQueryResult =
|
|
3
|
+
export declare const useDataQuery: <TQueryResult = QueryResult>(query: Query, { onComplete: userOnSuccess, onError: userOnError, variables: initialVariables, lazy: initialLazy, }?: QueryOptions<TQueryResult>) => QueryRenderInput<TQueryResult>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ExecuteHookInput, ExecuteHookResult } from '../../types';
|
|
2
|
-
export declare const useQueryExecutor: <
|
|
2
|
+
export declare const useQueryExecutor: <ReturnType>({ execute, variables: initialVariables, singular, immediate, onComplete, onError, }: ExecuteHookInput<ReturnType>) => ExecuteHookResult<ReturnType>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/app-service-data",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.2",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"types": "build/types/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@tanstack/react-query": "^4.36.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@dhis2/app-service-config": "3.14.
|
|
39
|
+
"@dhis2/app-service-config": "3.14.2",
|
|
40
40
|
"prop-types": "^15.7.2",
|
|
41
41
|
"react": "^16.8 || ^18",
|
|
42
42
|
"react-dom": "^16.8 || ^18"
|