@dhis2/app-service-data 3.14.2 → 3.14.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.
- package/build/cjs/__tests__/integration.test.js +1 -2
- package/build/cjs/__tests__/mutations.test.js +1 -2
- package/build/cjs/index.js +1 -23
- package/build/cjs/links/RestAPILink/queryToRequestOptions/requestContentType.js +1 -2
- package/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +4 -4
- package/build/cjs/locales/en/translations.json +3 -0
- package/build/cjs/locales/index.js +21 -0
- package/build/cjs/react/hooks/useDataMutation.test.js +1 -2
- package/build/cjs/react/hooks/useDataQuery.test.js +49 -50
- package/build/es/engine/index.js +2 -1
- package/build/es/engine/types/DataEngineLink.js +1 -0
- package/build/es/engine/types/ExecuteOptions.js +1 -0
- package/build/es/engine/types/JsonValue.js +1 -0
- package/build/es/engine/types/Mutation.js +1 -0
- package/build/es/engine/types/PossiblyDynamic.js +1 -0
- package/build/es/engine/types/Query.js +1 -0
- package/build/es/engine/types/QueryParameters.js +1 -0
- package/build/es/index.js +1 -2
- package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +4 -4
- package/build/es/links/index.js +2 -1
- package/build/es/locales/en/translations.json +3 -0
- package/build/es/locales/index.js +13 -0
- package/build/es/react/hooks/useDataQuery.test.js +48 -48
- package/build/es/types.js +1 -0
- package/package.json +2 -2
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var React = _interopRequireWildcard(require("react"));
|
|
5
5
|
var _react3 = require("../react");
|
|
6
|
-
function
|
|
7
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
6
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
7
|
describe('<DataQuery />', () => {
|
|
9
8
|
it('should render without failing', async () => {
|
|
10
9
|
const data = {
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var React = _interopRequireWildcard(require("react"));
|
|
5
5
|
var _react3 = require("../react");
|
|
6
|
-
function
|
|
7
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
6
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
7
|
describe('<DataMutation />', () => {
|
|
9
8
|
it('should render without failing', async () => {
|
|
10
9
|
const endpointSpy = jest.fn(() => Promise.resolve(42));
|
package/build/cjs/index.js
CHANGED
|
@@ -3,16 +3,6 @@
|
|
|
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
|
-
};
|
|
16
6
|
Object.defineProperty(exports, "CustomDataProvider", {
|
|
17
7
|
enumerable: true,
|
|
18
8
|
get: function () {
|
|
@@ -62,16 +52,4 @@ Object.defineProperty(exports, "useDataQuery", {
|
|
|
62
52
|
}
|
|
63
53
|
});
|
|
64
54
|
var _react = require("./react");
|
|
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
|
-
});
|
|
55
|
+
var _engine = require("./engine");
|
|
@@ -7,8 +7,7 @@ exports.requestHeadersForContentType = exports.requestContentType = exports.requ
|
|
|
7
7
|
var multipartFormDataMatchers = _interopRequireWildcard(require("./multipartFormDataMatchers"));
|
|
8
8
|
var textPlainMatchers = _interopRequireWildcard(require("./textPlainMatchers"));
|
|
9
9
|
var xWwwFormUrlencodedMatchers = _interopRequireWildcard(require("./xWwwFormUrlencodedMatchers"));
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
11
|
const resourceExpectsTextPlain = (type, query) => Object.values(textPlainMatchers).some(textPlainMatcher => textPlainMatcher(type, query));
|
|
13
12
|
const resourceExpectsMultipartFormData = (type, query) => Object.values(multipartFormDataMatchers).some(multipartFormDataMatcher => multipartFormDataMatcher(type, query));
|
|
14
13
|
const resourceExpectsXWwwFormUrlencoded = (type, query) => Object.values(xWwwFormUrlencodedMatchers).some(xWwwFormUrlencodedMatcher => xWwwFormUrlencodedMatcher(type, query));
|
|
@@ -130,20 +130,20 @@ const isMetadataPackageInstallation = (type, _ref9) => {
|
|
|
130
130
|
|
|
131
131
|
// POST to 'indicators/expression/description' or 'programIndicator/expression/description' (validate an expression)
|
|
132
132
|
exports.isMetadataPackageInstallation = isMetadataPackageInstallation;
|
|
133
|
-
const isExpressionDescriptionValidation = (type,
|
|
133
|
+
const isExpressionDescriptionValidation = (type, _ref0) => {
|
|
134
134
|
let {
|
|
135
135
|
resource
|
|
136
|
-
} =
|
|
136
|
+
} = _ref0;
|
|
137
137
|
const pattern = /^(indicators|programIndicators)\/expression\/description$/;
|
|
138
138
|
return type === 'create' && pattern.test(resource);
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// POST to 'programIndicator/filter/description' (validate a filter)
|
|
142
142
|
exports.isExpressionDescriptionValidation = isExpressionDescriptionValidation;
|
|
143
|
-
const isFilterDescriptionValidation = (type,
|
|
143
|
+
const isFilterDescriptionValidation = (type, _ref1) => {
|
|
144
144
|
let {
|
|
145
145
|
resource
|
|
146
|
-
} =
|
|
146
|
+
} = _ref1;
|
|
147
147
|
const pattern = /^programIndicators\/filter\/description$/;
|
|
148
148
|
return type === 'create' && pattern.test(resource);
|
|
149
149
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
8
|
+
var _translations = _interopRequireDefault(require("./en/translations.json"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
//------------------------------------------------------------------------------
|
|
11
|
+
// <auto-generated>
|
|
12
|
+
// This code was generated by d2-i18n-generate.
|
|
13
|
+
//
|
|
14
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
15
|
+
// the code is regenerated.
|
|
16
|
+
// </auto-generated>
|
|
17
|
+
//------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const namespace = 'default';
|
|
20
|
+
_d2I18n.default.addResources('en', namespace, _translations.default);
|
|
21
|
+
var _default = exports.default = _d2I18n.default;
|
|
@@ -5,8 +5,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
5
5
|
var _CustomDataProvider = require("../components/CustomDataProvider");
|
|
6
6
|
var _useDataEngine = require("./useDataEngine");
|
|
7
7
|
var _useDataMutation = require("./useDataMutation");
|
|
8
|
-
function
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
9
|
describe('useDataMutation', () => {
|
|
11
10
|
it('should render without failing', async () => {
|
|
12
11
|
const mutation = {
|
|
@@ -4,8 +4,7 @@ var _react = require("@testing-library/react");
|
|
|
4
4
|
var React = _interopRequireWildcard(require("react"));
|
|
5
5
|
var _CustomDataProvider = require("../components/CustomDataProvider");
|
|
6
6
|
var _useDataQuery = require("./useDataQuery");
|
|
7
|
-
function
|
|
8
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
8
|
describe('useDataQuery', () => {
|
|
10
9
|
describe('parameters: onComplete', () => {
|
|
11
10
|
it('Should call onComplete with the data after a successful fetch', async () => {
|
|
@@ -406,10 +405,10 @@ describe('useDataQuery', () => {
|
|
|
406
405
|
answer: 42,
|
|
407
406
|
opposite: 24
|
|
408
407
|
};
|
|
409
|
-
const wrapper =
|
|
408
|
+
const wrapper = _ref0 => {
|
|
410
409
|
let {
|
|
411
410
|
children
|
|
412
|
-
} =
|
|
411
|
+
} = _ref0;
|
|
413
412
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
414
413
|
data: data
|
|
415
414
|
}, children);
|
|
@@ -448,10 +447,10 @@ describe('useDataQuery', () => {
|
|
|
448
447
|
throw expectedError;
|
|
449
448
|
}
|
|
450
449
|
};
|
|
451
|
-
const wrapper =
|
|
450
|
+
const wrapper = _ref1 => {
|
|
452
451
|
let {
|
|
453
452
|
children
|
|
454
|
-
} =
|
|
453
|
+
} = _ref1;
|
|
455
454
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
456
455
|
data: data
|
|
457
456
|
}, children);
|
|
@@ -489,10 +488,10 @@ describe('useDataQuery', () => {
|
|
|
489
488
|
},
|
|
490
489
|
opposite: 24
|
|
491
490
|
};
|
|
492
|
-
const wrapper =
|
|
491
|
+
const wrapper = _ref10 => {
|
|
493
492
|
let {
|
|
494
493
|
children
|
|
495
|
-
} =
|
|
494
|
+
} = _ref10;
|
|
496
495
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
497
496
|
data: data
|
|
498
497
|
}, children);
|
|
@@ -530,10 +529,10 @@ describe('useDataQuery', () => {
|
|
|
530
529
|
resource: 'answer'
|
|
531
530
|
}
|
|
532
531
|
};
|
|
533
|
-
const wrapper =
|
|
532
|
+
const wrapper = _ref11 => {
|
|
534
533
|
let {
|
|
535
534
|
children
|
|
536
|
-
} =
|
|
535
|
+
} = _ref11;
|
|
537
536
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
538
537
|
data: data
|
|
539
538
|
}, children);
|
|
@@ -588,18 +587,18 @@ describe('useDataQuery', () => {
|
|
|
588
587
|
const query = {
|
|
589
588
|
x: {
|
|
590
589
|
resource: 'answer',
|
|
591
|
-
id:
|
|
590
|
+
id: _ref12 => {
|
|
592
591
|
let {
|
|
593
592
|
id
|
|
594
|
-
} =
|
|
593
|
+
} = _ref12;
|
|
595
594
|
return id;
|
|
596
595
|
}
|
|
597
596
|
}
|
|
598
597
|
};
|
|
599
|
-
const wrapper =
|
|
598
|
+
const wrapper = _ref13 => {
|
|
600
599
|
let {
|
|
601
600
|
children
|
|
602
|
-
} =
|
|
601
|
+
} = _ref13;
|
|
603
602
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
604
603
|
data: data
|
|
605
604
|
}, children);
|
|
@@ -641,18 +640,18 @@ describe('useDataQuery', () => {
|
|
|
641
640
|
const query = {
|
|
642
641
|
x: {
|
|
643
642
|
resource: 'answer',
|
|
644
|
-
id:
|
|
643
|
+
id: _ref14 => {
|
|
645
644
|
let {
|
|
646
645
|
id
|
|
647
|
-
} =
|
|
646
|
+
} = _ref14;
|
|
648
647
|
return id;
|
|
649
648
|
}
|
|
650
649
|
}
|
|
651
650
|
};
|
|
652
|
-
const wrapper =
|
|
651
|
+
const wrapper = _ref15 => {
|
|
653
652
|
let {
|
|
654
653
|
children
|
|
655
|
-
} =
|
|
654
|
+
} = _ref15;
|
|
656
655
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
657
656
|
data: data
|
|
658
657
|
}, children);
|
|
@@ -693,10 +692,10 @@ describe('useDataQuery', () => {
|
|
|
693
692
|
resource: 'answer'
|
|
694
693
|
}
|
|
695
694
|
};
|
|
696
|
-
const wrapper =
|
|
695
|
+
const wrapper = _ref16 => {
|
|
697
696
|
let {
|
|
698
697
|
children
|
|
699
|
-
} =
|
|
698
|
+
} = _ref16;
|
|
700
699
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
701
700
|
data: data
|
|
702
701
|
}, children);
|
|
@@ -736,10 +735,10 @@ describe('useDataQuery', () => {
|
|
|
736
735
|
resource: 'answer'
|
|
737
736
|
}
|
|
738
737
|
};
|
|
739
|
-
const wrapper =
|
|
738
|
+
const wrapper = _ref17 => {
|
|
740
739
|
let {
|
|
741
740
|
children
|
|
742
|
-
} =
|
|
741
|
+
} = _ref17;
|
|
743
742
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
744
743
|
data: data
|
|
745
744
|
}, children);
|
|
@@ -805,10 +804,10 @@ describe('useDataQuery', () => {
|
|
|
805
804
|
const data = {
|
|
806
805
|
answer: mockSpy
|
|
807
806
|
};
|
|
808
|
-
const wrapper =
|
|
807
|
+
const wrapper = _ref18 => {
|
|
809
808
|
let {
|
|
810
809
|
children
|
|
811
|
-
} =
|
|
810
|
+
} = _ref18;
|
|
812
811
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
813
812
|
data: data
|
|
814
813
|
}, children);
|
|
@@ -852,10 +851,10 @@ describe('useDataQuery', () => {
|
|
|
852
851
|
const data = {
|
|
853
852
|
answer: 42
|
|
854
853
|
};
|
|
855
|
-
const wrapper =
|
|
854
|
+
const wrapper = _ref19 => {
|
|
856
855
|
let {
|
|
857
856
|
children
|
|
858
|
-
} =
|
|
857
|
+
} = _ref19;
|
|
859
858
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
860
859
|
data: data
|
|
861
860
|
}, children);
|
|
@@ -900,10 +899,10 @@ describe('useDataQuery', () => {
|
|
|
900
899
|
throw expectedError;
|
|
901
900
|
}
|
|
902
901
|
};
|
|
903
|
-
const wrapper =
|
|
902
|
+
const wrapper = _ref20 => {
|
|
904
903
|
let {
|
|
905
904
|
children
|
|
906
|
-
} =
|
|
905
|
+
} = _ref20;
|
|
907
906
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
908
907
|
data: data
|
|
909
908
|
}, children);
|
|
@@ -939,12 +938,12 @@ describe('useDataQuery', () => {
|
|
|
939
938
|
const query = {
|
|
940
939
|
x: {
|
|
941
940
|
resource: 'answer',
|
|
942
|
-
params:
|
|
941
|
+
params: _ref21 => {
|
|
943
942
|
let {
|
|
944
943
|
one,
|
|
945
944
|
two,
|
|
946
945
|
three
|
|
947
|
-
} =
|
|
946
|
+
} = _ref21;
|
|
948
947
|
return {
|
|
949
948
|
one,
|
|
950
949
|
two,
|
|
@@ -957,10 +956,10 @@ describe('useDataQuery', () => {
|
|
|
957
956
|
const data = {
|
|
958
957
|
answer: spy
|
|
959
958
|
};
|
|
960
|
-
const wrapper =
|
|
959
|
+
const wrapper = _ref22 => {
|
|
961
960
|
let {
|
|
962
961
|
children
|
|
963
|
-
} =
|
|
962
|
+
} = _ref22;
|
|
964
963
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
965
964
|
data: data
|
|
966
965
|
}, children);
|
|
@@ -1005,10 +1004,10 @@ describe('useDataQuery', () => {
|
|
|
1005
1004
|
const data = {
|
|
1006
1005
|
answer: 42
|
|
1007
1006
|
};
|
|
1008
|
-
const wrapper =
|
|
1007
|
+
const wrapper = _ref23 => {
|
|
1009
1008
|
let {
|
|
1010
1009
|
children
|
|
1011
|
-
} =
|
|
1010
|
+
} = _ref23;
|
|
1012
1011
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1013
1012
|
data: data
|
|
1014
1013
|
}, children);
|
|
@@ -1047,10 +1046,10 @@ describe('useDataQuery', () => {
|
|
|
1047
1046
|
const data = {
|
|
1048
1047
|
answer: 42
|
|
1049
1048
|
};
|
|
1050
|
-
const wrapper =
|
|
1049
|
+
const wrapper = _ref24 => {
|
|
1051
1050
|
let {
|
|
1052
1051
|
children
|
|
1053
|
-
} =
|
|
1052
|
+
} = _ref24;
|
|
1054
1053
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1055
1054
|
data: data
|
|
1056
1055
|
}, children);
|
|
@@ -1092,10 +1091,10 @@ describe('useDataQuery', () => {
|
|
|
1092
1091
|
throw expectedError;
|
|
1093
1092
|
}
|
|
1094
1093
|
};
|
|
1095
|
-
const wrapper =
|
|
1094
|
+
const wrapper = _ref25 => {
|
|
1096
1095
|
let {
|
|
1097
1096
|
children
|
|
1098
|
-
} =
|
|
1097
|
+
} = _ref25;
|
|
1099
1098
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1100
1099
|
data: data
|
|
1101
1100
|
}, children);
|
|
@@ -1131,10 +1130,10 @@ describe('useDataQuery', () => {
|
|
|
1131
1130
|
throw expectedError;
|
|
1132
1131
|
}
|
|
1133
1132
|
};
|
|
1134
|
-
const wrapper =
|
|
1133
|
+
const wrapper = _ref26 => {
|
|
1135
1134
|
let {
|
|
1136
1135
|
children
|
|
1137
|
-
} =
|
|
1136
|
+
} = _ref26;
|
|
1138
1137
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1139
1138
|
data: data
|
|
1140
1139
|
}, children);
|
|
@@ -1166,18 +1165,18 @@ describe('useDataQuery', () => {
|
|
|
1166
1165
|
const query = {
|
|
1167
1166
|
x: {
|
|
1168
1167
|
resource: 'answer',
|
|
1169
|
-
id:
|
|
1168
|
+
id: _ref27 => {
|
|
1170
1169
|
let {
|
|
1171
1170
|
id
|
|
1172
|
-
} =
|
|
1171
|
+
} = _ref27;
|
|
1173
1172
|
return id;
|
|
1174
1173
|
}
|
|
1175
1174
|
}
|
|
1176
1175
|
};
|
|
1177
|
-
const mockSpy = jest.fn((_,
|
|
1176
|
+
const mockSpy = jest.fn((_, _ref28) => {
|
|
1178
1177
|
let {
|
|
1179
1178
|
id
|
|
1180
|
-
} =
|
|
1179
|
+
} = _ref28;
|
|
1181
1180
|
switch (id) {
|
|
1182
1181
|
case one:
|
|
1183
1182
|
return Promise.resolve(resultOne);
|
|
@@ -1188,10 +1187,10 @@ describe('useDataQuery', () => {
|
|
|
1188
1187
|
const data = {
|
|
1189
1188
|
answer: mockSpy
|
|
1190
1189
|
};
|
|
1191
|
-
const wrapper =
|
|
1190
|
+
const wrapper = _ref29 => {
|
|
1192
1191
|
let {
|
|
1193
1192
|
children
|
|
1194
|
-
} =
|
|
1193
|
+
} = _ref29;
|
|
1195
1194
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1196
1195
|
data: data
|
|
1197
1196
|
}, children);
|
|
@@ -1244,12 +1243,12 @@ describe('useDataQuery', () => {
|
|
|
1244
1243
|
const query = {
|
|
1245
1244
|
x: {
|
|
1246
1245
|
resource: 'answer',
|
|
1247
|
-
params:
|
|
1246
|
+
params: _ref30 => {
|
|
1248
1247
|
let {
|
|
1249
1248
|
one,
|
|
1250
1249
|
two,
|
|
1251
1250
|
three
|
|
1252
|
-
} =
|
|
1251
|
+
} = _ref30;
|
|
1253
1252
|
return {
|
|
1254
1253
|
one,
|
|
1255
1254
|
two,
|
|
@@ -1262,10 +1261,10 @@ describe('useDataQuery', () => {
|
|
|
1262
1261
|
const data = {
|
|
1263
1262
|
answer: mockSpy
|
|
1264
1263
|
};
|
|
1265
|
-
const wrapper =
|
|
1264
|
+
const wrapper = _ref31 => {
|
|
1266
1265
|
let {
|
|
1267
1266
|
children
|
|
1268
|
-
} =
|
|
1267
|
+
} = _ref31;
|
|
1269
1268
|
return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
|
|
1270
1269
|
data: data
|
|
1271
1270
|
}, children);
|
package/build/es/engine/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { DataQuery, DataMutation, DataProvider, CustomDataProvider } from './react';
|
|
2
2
|
export { useDataEngine, useDataQuery, useDataMutation } from './react';
|
|
3
|
-
export { FetchError } from './engine';
|
|
4
|
-
export type * from './types';
|
|
3
|
+
export { FetchError } from './engine';
|
|
@@ -115,19 +115,19 @@ export const isMetadataPackageInstallation = (type, _ref9) => {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
// POST to 'indicators/expression/description' or 'programIndicator/expression/description' (validate an expression)
|
|
118
|
-
export const isExpressionDescriptionValidation = (type,
|
|
118
|
+
export const isExpressionDescriptionValidation = (type, _ref0) => {
|
|
119
119
|
let {
|
|
120
120
|
resource
|
|
121
|
-
} =
|
|
121
|
+
} = _ref0;
|
|
122
122
|
const pattern = /^(indicators|programIndicators)\/expression\/description$/;
|
|
123
123
|
return type === 'create' && pattern.test(resource);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// POST to 'programIndicator/filter/description' (validate a filter)
|
|
127
|
-
export const isFilterDescriptionValidation = (type,
|
|
127
|
+
export const isFilterDescriptionValidation = (type, _ref1) => {
|
|
128
128
|
let {
|
|
129
129
|
resource
|
|
130
|
-
} =
|
|
130
|
+
} = _ref1;
|
|
131
131
|
const pattern = /^programIndicators\/filter\/description$/;
|
|
132
132
|
return type === 'create' && pattern.test(resource);
|
|
133
133
|
};
|
package/build/es/links/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//------------------------------------------------------------------------------
|
|
2
|
+
// <auto-generated>
|
|
3
|
+
// This code was generated by d2-i18n-generate.
|
|
4
|
+
//
|
|
5
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
6
|
+
// the code is regenerated.
|
|
7
|
+
// </auto-generated>
|
|
8
|
+
//------------------------------------------------------------------------------
|
|
9
|
+
import i18n from '@dhis2/d2-i18n';
|
|
10
|
+
import enTranslations from './en/translations.json';
|
|
11
|
+
const namespace = 'default';
|
|
12
|
+
i18n.addResources('en', namespace, enTranslations);
|
|
13
|
+
export default i18n;
|
|
@@ -402,10 +402,10 @@ describe('useDataQuery', () => {
|
|
|
402
402
|
answer: 42,
|
|
403
403
|
opposite: 24
|
|
404
404
|
};
|
|
405
|
-
const wrapper =
|
|
405
|
+
const wrapper = _ref0 => {
|
|
406
406
|
let {
|
|
407
407
|
children
|
|
408
|
-
} =
|
|
408
|
+
} = _ref0;
|
|
409
409
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
410
410
|
data: data
|
|
411
411
|
}, children);
|
|
@@ -444,10 +444,10 @@ describe('useDataQuery', () => {
|
|
|
444
444
|
throw expectedError;
|
|
445
445
|
}
|
|
446
446
|
};
|
|
447
|
-
const wrapper =
|
|
447
|
+
const wrapper = _ref1 => {
|
|
448
448
|
let {
|
|
449
449
|
children
|
|
450
|
-
} =
|
|
450
|
+
} = _ref1;
|
|
451
451
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
452
452
|
data: data
|
|
453
453
|
}, children);
|
|
@@ -485,10 +485,10 @@ describe('useDataQuery', () => {
|
|
|
485
485
|
},
|
|
486
486
|
opposite: 24
|
|
487
487
|
};
|
|
488
|
-
const wrapper =
|
|
488
|
+
const wrapper = _ref10 => {
|
|
489
489
|
let {
|
|
490
490
|
children
|
|
491
|
-
} =
|
|
491
|
+
} = _ref10;
|
|
492
492
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
493
493
|
data: data
|
|
494
494
|
}, children);
|
|
@@ -526,10 +526,10 @@ describe('useDataQuery', () => {
|
|
|
526
526
|
resource: 'answer'
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
|
-
const wrapper =
|
|
529
|
+
const wrapper = _ref11 => {
|
|
530
530
|
let {
|
|
531
531
|
children
|
|
532
|
-
} =
|
|
532
|
+
} = _ref11;
|
|
533
533
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
534
534
|
data: data
|
|
535
535
|
}, children);
|
|
@@ -584,18 +584,18 @@ describe('useDataQuery', () => {
|
|
|
584
584
|
const query = {
|
|
585
585
|
x: {
|
|
586
586
|
resource: 'answer',
|
|
587
|
-
id:
|
|
587
|
+
id: _ref12 => {
|
|
588
588
|
let {
|
|
589
589
|
id
|
|
590
|
-
} =
|
|
590
|
+
} = _ref12;
|
|
591
591
|
return id;
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
|
-
const wrapper =
|
|
595
|
+
const wrapper = _ref13 => {
|
|
596
596
|
let {
|
|
597
597
|
children
|
|
598
|
-
} =
|
|
598
|
+
} = _ref13;
|
|
599
599
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
600
600
|
data: data
|
|
601
601
|
}, children);
|
|
@@ -637,18 +637,18 @@ describe('useDataQuery', () => {
|
|
|
637
637
|
const query = {
|
|
638
638
|
x: {
|
|
639
639
|
resource: 'answer',
|
|
640
|
-
id:
|
|
640
|
+
id: _ref14 => {
|
|
641
641
|
let {
|
|
642
642
|
id
|
|
643
|
-
} =
|
|
643
|
+
} = _ref14;
|
|
644
644
|
return id;
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
};
|
|
648
|
-
const wrapper =
|
|
648
|
+
const wrapper = _ref15 => {
|
|
649
649
|
let {
|
|
650
650
|
children
|
|
651
|
-
} =
|
|
651
|
+
} = _ref15;
|
|
652
652
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
653
653
|
data: data
|
|
654
654
|
}, children);
|
|
@@ -689,10 +689,10 @@ describe('useDataQuery', () => {
|
|
|
689
689
|
resource: 'answer'
|
|
690
690
|
}
|
|
691
691
|
};
|
|
692
|
-
const wrapper =
|
|
692
|
+
const wrapper = _ref16 => {
|
|
693
693
|
let {
|
|
694
694
|
children
|
|
695
|
-
} =
|
|
695
|
+
} = _ref16;
|
|
696
696
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
697
697
|
data: data
|
|
698
698
|
}, children);
|
|
@@ -732,10 +732,10 @@ describe('useDataQuery', () => {
|
|
|
732
732
|
resource: 'answer'
|
|
733
733
|
}
|
|
734
734
|
};
|
|
735
|
-
const wrapper =
|
|
735
|
+
const wrapper = _ref17 => {
|
|
736
736
|
let {
|
|
737
737
|
children
|
|
738
|
-
} =
|
|
738
|
+
} = _ref17;
|
|
739
739
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
740
740
|
data: data
|
|
741
741
|
}, children);
|
|
@@ -801,10 +801,10 @@ describe('useDataQuery', () => {
|
|
|
801
801
|
const data = {
|
|
802
802
|
answer: mockSpy
|
|
803
803
|
};
|
|
804
|
-
const wrapper =
|
|
804
|
+
const wrapper = _ref18 => {
|
|
805
805
|
let {
|
|
806
806
|
children
|
|
807
|
-
} =
|
|
807
|
+
} = _ref18;
|
|
808
808
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
809
809
|
data: data
|
|
810
810
|
}, children);
|
|
@@ -848,10 +848,10 @@ describe('useDataQuery', () => {
|
|
|
848
848
|
const data = {
|
|
849
849
|
answer: 42
|
|
850
850
|
};
|
|
851
|
-
const wrapper =
|
|
851
|
+
const wrapper = _ref19 => {
|
|
852
852
|
let {
|
|
853
853
|
children
|
|
854
|
-
} =
|
|
854
|
+
} = _ref19;
|
|
855
855
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
856
856
|
data: data
|
|
857
857
|
}, children);
|
|
@@ -896,10 +896,10 @@ describe('useDataQuery', () => {
|
|
|
896
896
|
throw expectedError;
|
|
897
897
|
}
|
|
898
898
|
};
|
|
899
|
-
const wrapper =
|
|
899
|
+
const wrapper = _ref20 => {
|
|
900
900
|
let {
|
|
901
901
|
children
|
|
902
|
-
} =
|
|
902
|
+
} = _ref20;
|
|
903
903
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
904
904
|
data: data
|
|
905
905
|
}, children);
|
|
@@ -935,12 +935,12 @@ describe('useDataQuery', () => {
|
|
|
935
935
|
const query = {
|
|
936
936
|
x: {
|
|
937
937
|
resource: 'answer',
|
|
938
|
-
params:
|
|
938
|
+
params: _ref21 => {
|
|
939
939
|
let {
|
|
940
940
|
one,
|
|
941
941
|
two,
|
|
942
942
|
three
|
|
943
|
-
} =
|
|
943
|
+
} = _ref21;
|
|
944
944
|
return {
|
|
945
945
|
one,
|
|
946
946
|
two,
|
|
@@ -953,10 +953,10 @@ describe('useDataQuery', () => {
|
|
|
953
953
|
const data = {
|
|
954
954
|
answer: spy
|
|
955
955
|
};
|
|
956
|
-
const wrapper =
|
|
956
|
+
const wrapper = _ref22 => {
|
|
957
957
|
let {
|
|
958
958
|
children
|
|
959
|
-
} =
|
|
959
|
+
} = _ref22;
|
|
960
960
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
961
961
|
data: data
|
|
962
962
|
}, children);
|
|
@@ -1001,10 +1001,10 @@ describe('useDataQuery', () => {
|
|
|
1001
1001
|
const data = {
|
|
1002
1002
|
answer: 42
|
|
1003
1003
|
};
|
|
1004
|
-
const wrapper =
|
|
1004
|
+
const wrapper = _ref23 => {
|
|
1005
1005
|
let {
|
|
1006
1006
|
children
|
|
1007
|
-
} =
|
|
1007
|
+
} = _ref23;
|
|
1008
1008
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1009
1009
|
data: data
|
|
1010
1010
|
}, children);
|
|
@@ -1043,10 +1043,10 @@ describe('useDataQuery', () => {
|
|
|
1043
1043
|
const data = {
|
|
1044
1044
|
answer: 42
|
|
1045
1045
|
};
|
|
1046
|
-
const wrapper =
|
|
1046
|
+
const wrapper = _ref24 => {
|
|
1047
1047
|
let {
|
|
1048
1048
|
children
|
|
1049
|
-
} =
|
|
1049
|
+
} = _ref24;
|
|
1050
1050
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1051
1051
|
data: data
|
|
1052
1052
|
}, children);
|
|
@@ -1088,10 +1088,10 @@ describe('useDataQuery', () => {
|
|
|
1088
1088
|
throw expectedError;
|
|
1089
1089
|
}
|
|
1090
1090
|
};
|
|
1091
|
-
const wrapper =
|
|
1091
|
+
const wrapper = _ref25 => {
|
|
1092
1092
|
let {
|
|
1093
1093
|
children
|
|
1094
|
-
} =
|
|
1094
|
+
} = _ref25;
|
|
1095
1095
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1096
1096
|
data: data
|
|
1097
1097
|
}, children);
|
|
@@ -1127,10 +1127,10 @@ describe('useDataQuery', () => {
|
|
|
1127
1127
|
throw expectedError;
|
|
1128
1128
|
}
|
|
1129
1129
|
};
|
|
1130
|
-
const wrapper =
|
|
1130
|
+
const wrapper = _ref26 => {
|
|
1131
1131
|
let {
|
|
1132
1132
|
children
|
|
1133
|
-
} =
|
|
1133
|
+
} = _ref26;
|
|
1134
1134
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1135
1135
|
data: data
|
|
1136
1136
|
}, children);
|
|
@@ -1162,18 +1162,18 @@ describe('useDataQuery', () => {
|
|
|
1162
1162
|
const query = {
|
|
1163
1163
|
x: {
|
|
1164
1164
|
resource: 'answer',
|
|
1165
|
-
id:
|
|
1165
|
+
id: _ref27 => {
|
|
1166
1166
|
let {
|
|
1167
1167
|
id
|
|
1168
|
-
} =
|
|
1168
|
+
} = _ref27;
|
|
1169
1169
|
return id;
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
1172
|
};
|
|
1173
|
-
const mockSpy = jest.fn((_,
|
|
1173
|
+
const mockSpy = jest.fn((_, _ref28) => {
|
|
1174
1174
|
let {
|
|
1175
1175
|
id
|
|
1176
|
-
} =
|
|
1176
|
+
} = _ref28;
|
|
1177
1177
|
switch (id) {
|
|
1178
1178
|
case one:
|
|
1179
1179
|
return Promise.resolve(resultOne);
|
|
@@ -1184,10 +1184,10 @@ describe('useDataQuery', () => {
|
|
|
1184
1184
|
const data = {
|
|
1185
1185
|
answer: mockSpy
|
|
1186
1186
|
};
|
|
1187
|
-
const wrapper =
|
|
1187
|
+
const wrapper = _ref29 => {
|
|
1188
1188
|
let {
|
|
1189
1189
|
children
|
|
1190
|
-
} =
|
|
1190
|
+
} = _ref29;
|
|
1191
1191
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1192
1192
|
data: data
|
|
1193
1193
|
}, children);
|
|
@@ -1240,12 +1240,12 @@ describe('useDataQuery', () => {
|
|
|
1240
1240
|
const query = {
|
|
1241
1241
|
x: {
|
|
1242
1242
|
resource: 'answer',
|
|
1243
|
-
params:
|
|
1243
|
+
params: _ref30 => {
|
|
1244
1244
|
let {
|
|
1245
1245
|
one,
|
|
1246
1246
|
two,
|
|
1247
1247
|
three
|
|
1248
|
-
} =
|
|
1248
|
+
} = _ref30;
|
|
1249
1249
|
return {
|
|
1250
1250
|
one,
|
|
1251
1251
|
two,
|
|
@@ -1258,10 +1258,10 @@ describe('useDataQuery', () => {
|
|
|
1258
1258
|
const data = {
|
|
1259
1259
|
answer: mockSpy
|
|
1260
1260
|
};
|
|
1261
|
-
const wrapper =
|
|
1261
|
+
const wrapper = _ref31 => {
|
|
1262
1262
|
let {
|
|
1263
1263
|
children
|
|
1264
|
-
} =
|
|
1264
|
+
} = _ref31;
|
|
1265
1265
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
1266
1266
|
data: data
|
|
1267
1267
|
}, children);
|
package/build/es/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.3",
|
|
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.3",
|
|
40
40
|
"prop-types": "^15.7.2",
|
|
41
41
|
"react": "^16.8 || ^18",
|
|
42
42
|
"react-dom": "^16.8 || ^18"
|