on-zero 0.4.13 → 0.4.15
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/dist/cjs/helpers/useMutation.cjs +114 -0
- package/dist/cjs/helpers/useMutation.native.js +166 -0
- package/dist/cjs/helpers/useMutation.native.js.map +1 -0
- package/dist/cjs/helpers/useMutation.test.cjs +139 -0
- package/dist/cjs/helpers/useMutation.test.native.js +156 -0
- package/dist/cjs/helpers/useMutation.test.native.js.map +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.native.js +1 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/helpers/useMutation.mjs +87 -0
- package/dist/esm/helpers/useMutation.mjs.map +1 -0
- package/dist/esm/helpers/useMutation.native.js +136 -0
- package/dist/esm/helpers/useMutation.native.js.map +1 -0
- package/dist/esm/helpers/useMutation.test.mjs +140 -0
- package/dist/esm/helpers/useMutation.test.mjs.map +1 -0
- package/dist/esm/helpers/useMutation.test.native.js +154 -0
- package/dist/esm/helpers/useMutation.test.native.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -0
- package/dist/esm/index.native.js.map +1 -1
- package/package.json +2 -2
- package/src/helpers/useMutation.test.ts +122 -0
- package/src/helpers/useMutation.tsx +170 -0
- package/src/index.ts +1 -0
- package/types/helpers/useMutation.d.ts +47 -0
- package/types/helpers/useMutation.d.ts.map +1 -0
- package/types/helpers/useMutation.test.d.ts +2 -0
- package/types/helpers/useMutation.test.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useMutation_exports = {};
|
|
24
|
+
__export(useMutation_exports, {
|
|
25
|
+
observeMutation: () => observeMutation,
|
|
26
|
+
onMutationError: () => onMutationError,
|
|
27
|
+
useMutation: () => useMutation
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useMutation_exports);
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
const mutationErrorListeners = /* @__PURE__ */new Set();
|
|
32
|
+
function onMutationError(cb) {
|
|
33
|
+
mutationErrorListeners.add(cb);
|
|
34
|
+
return () => {
|
|
35
|
+
mutationErrorListeners.delete(cb);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function emitMutationError(error) {
|
|
39
|
+
if (mutationErrorListeners.size === 0) {
|
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
|
41
|
+
console.error("[on-zero] unhandled mutation error", error);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const cb of mutationErrorListeners) cb(error);
|
|
46
|
+
}
|
|
47
|
+
function toMutationError(scope, details) {
|
|
48
|
+
if (!details || typeof details !== "object") return null;
|
|
49
|
+
const d = details;
|
|
50
|
+
if (d.type !== "error") return null;
|
|
51
|
+
return {
|
|
52
|
+
scope,
|
|
53
|
+
kind: d.error?.type === "app" ? "app" : "zero",
|
|
54
|
+
message: d.error?.message || "Mutation failed",
|
|
55
|
+
details: d.error?.details
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function rejectionToError(scope, e) {
|
|
59
|
+
return {
|
|
60
|
+
scope,
|
|
61
|
+
kind: "zero",
|
|
62
|
+
message: e instanceof Error ? e.message : String(e)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function observeMutation(result, onError) {
|
|
66
|
+
let reportedGlobal = false;
|
|
67
|
+
const report = err => {
|
|
68
|
+
if (!err) return;
|
|
69
|
+
onError?.(err);
|
|
70
|
+
if (!reportedGlobal) {
|
|
71
|
+
reportedGlobal = true;
|
|
72
|
+
emitMutationError(err);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const client = result.client.then(d => report(toMutationError("client", d))).catch(e => report(rejectionToError("client", e)));
|
|
76
|
+
const server = result.server.then(d => report(toMutationError("server", d))).catch(e => report(rejectionToError("server", e)));
|
|
77
|
+
return Promise.all([client, server]).then(() => void 0);
|
|
78
|
+
}
|
|
79
|
+
function useMutation(mutator) {
|
|
80
|
+
const [pending, setPending] = (0, import_react.useState)(false);
|
|
81
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
82
|
+
const seqRef = (0, import_react.useRef)(0);
|
|
83
|
+
const mountedRef = (0, import_react.useRef)(true);
|
|
84
|
+
const mutatorRef = (0, import_react.useRef)(mutator);
|
|
85
|
+
mutatorRef.current = mutator;
|
|
86
|
+
(0, import_react.useEffect)(() => {
|
|
87
|
+
mountedRef.current = true;
|
|
88
|
+
return () => {
|
|
89
|
+
mountedRef.current = false;
|
|
90
|
+
};
|
|
91
|
+
}, []);
|
|
92
|
+
const reset = (0, import_react.useCallback)(() => {
|
|
93
|
+
setError(null);
|
|
94
|
+
setPending(false);
|
|
95
|
+
}, []);
|
|
96
|
+
const run = (0, import_react.useCallback)((...args) => {
|
|
97
|
+
const result = mutatorRef.current(...args);
|
|
98
|
+
const seq = ++seqRef.current;
|
|
99
|
+
setPending(true);
|
|
100
|
+
setError(null);
|
|
101
|
+
const isCurrent = () => mountedRef.current && seq === seqRef.current;
|
|
102
|
+
observeMutation(result, err => {
|
|
103
|
+
if (isCurrent()) setError(err);
|
|
104
|
+
}).finally(() => {
|
|
105
|
+
if (isCurrent()) setPending(false);
|
|
106
|
+
});
|
|
107
|
+
return result;
|
|
108
|
+
}, []);
|
|
109
|
+
return [run, {
|
|
110
|
+
pending,
|
|
111
|
+
error,
|
|
112
|
+
reset
|
|
113
|
+
}];
|
|
114
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useMutation_exports = {};
|
|
26
|
+
__export(useMutation_exports, {
|
|
27
|
+
observeMutation: () => observeMutation,
|
|
28
|
+
onMutationError: () => onMutationError,
|
|
29
|
+
useMutation: () => useMutation
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(useMutation_exports);
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
function _instanceof(left, right) {
|
|
34
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
35
|
+
return !!right[Symbol.hasInstance](left);
|
|
36
|
+
} else {
|
|
37
|
+
return left instanceof right;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function _type_of(obj) {
|
|
41
|
+
"@swc/helpers - typeof";
|
|
42
|
+
|
|
43
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
44
|
+
}
|
|
45
|
+
var mutationErrorListeners = /* @__PURE__ */new Set();
|
|
46
|
+
function onMutationError(cb) {
|
|
47
|
+
mutationErrorListeners.add(cb);
|
|
48
|
+
return function () {
|
|
49
|
+
mutationErrorListeners.delete(cb);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function emitMutationError(error) {
|
|
53
|
+
if (mutationErrorListeners.size === 0) {
|
|
54
|
+
if (process.env.NODE_ENV !== "production") {
|
|
55
|
+
console.error("[on-zero] unhandled mutation error", error);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var _iteratorNormalCompletion = true,
|
|
60
|
+
_didIteratorError = false,
|
|
61
|
+
_iteratorError = void 0;
|
|
62
|
+
try {
|
|
63
|
+
for (var _iterator = mutationErrorListeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
64
|
+
var cb = _step.value;
|
|
65
|
+
cb(error);
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_didIteratorError = true;
|
|
69
|
+
_iteratorError = err;
|
|
70
|
+
} finally {
|
|
71
|
+
try {
|
|
72
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
73
|
+
_iterator.return();
|
|
74
|
+
}
|
|
75
|
+
} finally {
|
|
76
|
+
if (_didIteratorError) {
|
|
77
|
+
throw _iteratorError;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function toMutationError(scope, details) {
|
|
83
|
+
var _d_error, _d_error1, _d_error2;
|
|
84
|
+
if (!details || (typeof details === "undefined" ? "undefined" : _type_of(details)) !== "object") return null;
|
|
85
|
+
var d = details;
|
|
86
|
+
if (d.type !== "error") return null;
|
|
87
|
+
return {
|
|
88
|
+
scope,
|
|
89
|
+
kind: ((_d_error = d.error) === null || _d_error === void 0 ? void 0 : _d_error.type) === "app" ? "app" : "zero",
|
|
90
|
+
message: ((_d_error1 = d.error) === null || _d_error1 === void 0 ? void 0 : _d_error1.message) || "Mutation failed",
|
|
91
|
+
details: (_d_error2 = d.error) === null || _d_error2 === void 0 ? void 0 : _d_error2.details
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function rejectionToError(scope, e) {
|
|
95
|
+
return {
|
|
96
|
+
scope,
|
|
97
|
+
kind: "zero",
|
|
98
|
+
message: _instanceof(e, Error) ? e.message : String(e)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function observeMutation(result, onError) {
|
|
102
|
+
var reportedGlobal = false;
|
|
103
|
+
var report = function (err) {
|
|
104
|
+
if (!err) return;
|
|
105
|
+
onError === null || onError === void 0 ? void 0 : onError(err);
|
|
106
|
+
if (!reportedGlobal) {
|
|
107
|
+
reportedGlobal = true;
|
|
108
|
+
emitMutationError(err);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var client = result.client.then(function (d) {
|
|
112
|
+
return report(toMutationError("client", d));
|
|
113
|
+
}).catch(function (e) {
|
|
114
|
+
return report(rejectionToError("client", e));
|
|
115
|
+
});
|
|
116
|
+
var server = result.server.then(function (d) {
|
|
117
|
+
return report(toMutationError("server", d));
|
|
118
|
+
}).catch(function (e) {
|
|
119
|
+
return report(rejectionToError("server", e));
|
|
120
|
+
});
|
|
121
|
+
return Promise.all([client, server]).then(function () {
|
|
122
|
+
return void 0;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function useMutation(mutator) {
|
|
126
|
+
var [pending, setPending] = (0, import_react.useState)(false);
|
|
127
|
+
var [error, setError] = (0, import_react.useState)(null);
|
|
128
|
+
var seqRef = (0, import_react.useRef)(0);
|
|
129
|
+
var mountedRef = (0, import_react.useRef)(true);
|
|
130
|
+
var mutatorRef = (0, import_react.useRef)(mutator);
|
|
131
|
+
mutatorRef.current = mutator;
|
|
132
|
+
(0, import_react.useEffect)(function () {
|
|
133
|
+
mountedRef.current = true;
|
|
134
|
+
return function () {
|
|
135
|
+
mountedRef.current = false;
|
|
136
|
+
};
|
|
137
|
+
}, []);
|
|
138
|
+
var reset = (0, import_react.useCallback)(function () {
|
|
139
|
+
setError(null);
|
|
140
|
+
setPending(false);
|
|
141
|
+
}, []);
|
|
142
|
+
var run = (0, import_react.useCallback)(function () {
|
|
143
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
144
|
+
args[_key] = arguments[_key];
|
|
145
|
+
}
|
|
146
|
+
var result = mutatorRef.current(...args);
|
|
147
|
+
var seq = ++seqRef.current;
|
|
148
|
+
setPending(true);
|
|
149
|
+
setError(null);
|
|
150
|
+
var isCurrent = function () {
|
|
151
|
+
return mountedRef.current && seq === seqRef.current;
|
|
152
|
+
};
|
|
153
|
+
observeMutation(result, function (err) {
|
|
154
|
+
if (isCurrent()) setError(err);
|
|
155
|
+
}).finally(function () {
|
|
156
|
+
if (isCurrent()) setPending(false);
|
|
157
|
+
});
|
|
158
|
+
return result;
|
|
159
|
+
}, []);
|
|
160
|
+
return [run, {
|
|
161
|
+
pending,
|
|
162
|
+
error,
|
|
163
|
+
reset
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=useMutation.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useMutation_exports","__export","observeMutation","onMutationError","useMutation","module","exports","import_react","require","_instanceof","left","right","Symbol","hasInstance","_type_of","obj","constructor","mutationErrorListeners","Set","cb","add","delete","emitMutationError","error","size","process","env","NODE_ENV","console","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","err","return","toMutationError","scope","details","_d_error","_d_error1","_d_error2","d","type","kind","message","rejectionToError","e","Error","String","result","onError","reportedGlobal","report","client","then","catch"],"sources":["../../../src/helpers/useMutation.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAAyD,CAAAK,mBAAA;AAkCzD,IAAAO,YAAM,GAAAC,OAAA,QAAyB;AAExB,SAASC,YAAAC,IAAgB,EAAAC,KAAgD;EAC9E,IAAAA,KAAA,mBAA2BC,MAAE,oBAAAD,KAAA,CAAAC,MAAA,CAAAC,WAAA;IAC7B,OAAO,EAAAF,KAAM,CAAAC,MAAA,CAAAC,WAAA,EAAAH,IAAA;EACX;IACF,OAAAA,IAAA,YAAAC,KAAA;EACF;AAEA;AACE,SAAIG,SAAAC,GAAA;EACF,uBAAgB;;EACd,OAAAA,GAAA,IAAQ,OAAMH,MAAA,oBAAAG,GAAA,CAAAC,WAA2C,KAAAJ,MAAA,qBAAAG,GAAA;AAAA;AAE3D,IAAAE,sBAAA,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AAE,CAAA,CAAAtB,KAAU,MAAM,QAAAoB,SAAA,uBAAAA,SAAA,CAAAK,OAAA;IACdP,OAAA,GAAAG,SAAW,GAAUC,CAAA,CAAAtB,KAAA,cAAAqB,SAAA,uBAAAA,SAAA,CAAAH;EACrB;AACE;AAAqB,SACvBQ,iBAAAT,KAAA,EAAAU,CAAA;EACF,OAAK;IAELV,KAAM;IACJO,IAAA,QAAS;IACTC,OAAA,EAAAvC,WAAgB,CAAAyC,CAAA,EAAAC,KAAA,IAAAD,CAAA,CAAAF,OAAA,GAAAI,MAAA,CAAAF,CAAA;EAClB;AAEA;AACE,SAAAhD,eAAeA,CAAAmD,MAAW,EAAAC,OAAQ,EAAG;EACrC,IAAAC,cAAc,QAAO;EACrB,IAAAC,MAAA,GAAW,SAAAA,CAAInB,GAAA;IACf,KAAAA,GAAA,EAAS;IAGTiB,OAAM,aAAYA,OAAM,UAAW,SAAW,IAAAA,OAAQ,CAAAjB,GAAO;IAC7D,KAAAkB,cAAgB;MACdA,cAAc,GAAG;MAClBjC,iBAAgB,CAAAe,GAAA;IACf;EAAiC;EAGnC,IAAAoB,MAAO,GAAAJ,MAAA,CAAAI,MAAA,CAAAC,IAAA,WAAAb,CAAA;IACT,OAAKW,MAAA,CAAAjB,eAAA,WAAAM,CAAA;EAEL,GAAAc,KAAQ,WAAOT,CAAA;IACjB,OAAAM,MAAA,CAAAP,gBAAA,WAAAC,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var import_vitest = require("vitest");
|
|
2
|
+
var import_useMutation = require("./useMutation.cjs");
|
|
3
|
+
function deferred() {
|
|
4
|
+
let resolve;
|
|
5
|
+
let reject;
|
|
6
|
+
const promise = new Promise((res, rej) => {
|
|
7
|
+
resolve = res;
|
|
8
|
+
reject = rej;
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
promise,
|
|
12
|
+
resolve,
|
|
13
|
+
reject
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function fakeResult() {
|
|
17
|
+
const client = deferred();
|
|
18
|
+
const server = deferred();
|
|
19
|
+
return {
|
|
20
|
+
result: {
|
|
21
|
+
client: client.promise,
|
|
22
|
+
server: server.promise
|
|
23
|
+
},
|
|
24
|
+
client,
|
|
25
|
+
server
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const SUCCESS = {
|
|
29
|
+
type: "success"
|
|
30
|
+
};
|
|
31
|
+
const appError = message => ({
|
|
32
|
+
type: "error",
|
|
33
|
+
error: {
|
|
34
|
+
type: "app",
|
|
35
|
+
message
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
(0, import_vitest.afterEach)(() => {
|
|
39
|
+
import_vitest.vi.restoreAllMocks();
|
|
40
|
+
});
|
|
41
|
+
(0, import_vitest.describe)("observeMutation", () => {
|
|
42
|
+
(0, import_vitest.test)("success on both phases reports nothing", async () => {
|
|
43
|
+
const {
|
|
44
|
+
result,
|
|
45
|
+
client,
|
|
46
|
+
server
|
|
47
|
+
} = fakeResult();
|
|
48
|
+
const errors = [];
|
|
49
|
+
const dispose = (0, import_useMutation.onMutationError)(e => errors.push(e));
|
|
50
|
+
const done = (0, import_useMutation.observeMutation)(result, e => errors.push(e));
|
|
51
|
+
client.resolve(SUCCESS);
|
|
52
|
+
server.resolve(SUCCESS);
|
|
53
|
+
await done;
|
|
54
|
+
(0, import_vitest.expect)(errors).toEqual([]);
|
|
55
|
+
dispose();
|
|
56
|
+
});
|
|
57
|
+
(0, import_vitest.test)("a server rejection surfaces a normalized error locally and globally", async () => {
|
|
58
|
+
const {
|
|
59
|
+
result,
|
|
60
|
+
client,
|
|
61
|
+
server
|
|
62
|
+
} = fakeResult();
|
|
63
|
+
const local = [];
|
|
64
|
+
const global = [];
|
|
65
|
+
const dispose = (0, import_useMutation.onMutationError)(e => global.push(e));
|
|
66
|
+
const done = (0, import_useMutation.observeMutation)(result, e => local.push(e));
|
|
67
|
+
client.resolve(SUCCESS);
|
|
68
|
+
server.resolve(appError("Could not create post."));
|
|
69
|
+
await done;
|
|
70
|
+
(0, import_vitest.expect)(local).toEqual([{
|
|
71
|
+
scope: "server",
|
|
72
|
+
kind: "app",
|
|
73
|
+
message: "Could not create post.",
|
|
74
|
+
details: void 0
|
|
75
|
+
}]);
|
|
76
|
+
(0, import_vitest.expect)(global).toEqual(local);
|
|
77
|
+
dispose();
|
|
78
|
+
});
|
|
79
|
+
(0, import_vitest.test)("client + server both failing emits to the global catch only once", async () => {
|
|
80
|
+
const {
|
|
81
|
+
result,
|
|
82
|
+
client,
|
|
83
|
+
server
|
|
84
|
+
} = fakeResult();
|
|
85
|
+
const global = [];
|
|
86
|
+
const dispose = (0, import_useMutation.onMutationError)(e => global.push(e));
|
|
87
|
+
const done = (0, import_useMutation.observeMutation)(result);
|
|
88
|
+
client.reject(new Error("boom"));
|
|
89
|
+
server.reject(new Error("boom"));
|
|
90
|
+
await done;
|
|
91
|
+
(0, import_vitest.expect)(global).toHaveLength(1);
|
|
92
|
+
(0, import_vitest.expect)(global[0]).toMatchObject({
|
|
93
|
+
scope: "client",
|
|
94
|
+
kind: "zero",
|
|
95
|
+
message: "boom"
|
|
96
|
+
});
|
|
97
|
+
dispose();
|
|
98
|
+
});
|
|
99
|
+
(0, import_vitest.test)("never rejects even when both phases reject", async () => {
|
|
100
|
+
const {
|
|
101
|
+
result,
|
|
102
|
+
client,
|
|
103
|
+
server
|
|
104
|
+
} = fakeResult();
|
|
105
|
+
client.reject(new Error("x"));
|
|
106
|
+
server.reject(new Error("x"));
|
|
107
|
+
await (0, import_vitest.expect)((0, import_useMutation.observeMutation)(result)).resolves.toBeUndefined();
|
|
108
|
+
});
|
|
109
|
+
(0, import_vitest.test)("with no listener registered it falls back to console.error in dev", async () => {
|
|
110
|
+
const spy = import_vitest.vi.spyOn(console, "error").mockImplementation(() => {});
|
|
111
|
+
const {
|
|
112
|
+
result,
|
|
113
|
+
client,
|
|
114
|
+
server
|
|
115
|
+
} = fakeResult();
|
|
116
|
+
const done = (0, import_useMutation.observeMutation)(result);
|
|
117
|
+
client.resolve(SUCCESS);
|
|
118
|
+
server.resolve(appError("denied"));
|
|
119
|
+
await done;
|
|
120
|
+
(0, import_vitest.expect)(spy).toHaveBeenCalledTimes(1);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
(0, import_vitest.describe)("onMutationError", () => {
|
|
124
|
+
(0, import_vitest.test)("dispose stops delivery", async () => {
|
|
125
|
+
const seen = [];
|
|
126
|
+
const dispose = (0, import_useMutation.onMutationError)(e => seen.push(e));
|
|
127
|
+
dispose();
|
|
128
|
+
const {
|
|
129
|
+
result,
|
|
130
|
+
client,
|
|
131
|
+
server
|
|
132
|
+
} = fakeResult();
|
|
133
|
+
const done = (0, import_useMutation.observeMutation)(result);
|
|
134
|
+
client.resolve(SUCCESS);
|
|
135
|
+
server.resolve(appError("denied"));
|
|
136
|
+
await done;
|
|
137
|
+
(0, import_vitest.expect)(seen).toEqual([]);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var import_vitest = require("vitest");
|
|
4
|
+
var import_useMutation = require("./useMutation.native.js");
|
|
5
|
+
function deferred() {
|
|
6
|
+
var resolve;
|
|
7
|
+
var reject;
|
|
8
|
+
var promise = new Promise(function (res, rej) {
|
|
9
|
+
resolve = res;
|
|
10
|
+
reject = rej;
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
promise,
|
|
14
|
+
resolve,
|
|
15
|
+
reject
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function fakeResult() {
|
|
19
|
+
var client = deferred();
|
|
20
|
+
var server = deferred();
|
|
21
|
+
return {
|
|
22
|
+
result: {
|
|
23
|
+
client: client.promise,
|
|
24
|
+
server: server.promise
|
|
25
|
+
},
|
|
26
|
+
client,
|
|
27
|
+
server
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var SUCCESS = {
|
|
31
|
+
type: "success"
|
|
32
|
+
};
|
|
33
|
+
var appError = function (message) {
|
|
34
|
+
return {
|
|
35
|
+
type: "error",
|
|
36
|
+
error: {
|
|
37
|
+
type: "app",
|
|
38
|
+
message
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
(0, import_vitest.afterEach)(function () {
|
|
43
|
+
import_vitest.vi.restoreAllMocks();
|
|
44
|
+
});
|
|
45
|
+
(0, import_vitest.describe)("observeMutation", function () {
|
|
46
|
+
(0, import_vitest.test)("success on both phases reports nothing", async function () {
|
|
47
|
+
var {
|
|
48
|
+
result,
|
|
49
|
+
client,
|
|
50
|
+
server
|
|
51
|
+
} = fakeResult();
|
|
52
|
+
var errors = [];
|
|
53
|
+
var dispose = (0, import_useMutation.onMutationError)(function (e) {
|
|
54
|
+
return errors.push(e);
|
|
55
|
+
});
|
|
56
|
+
var done = (0, import_useMutation.observeMutation)(result, function (e) {
|
|
57
|
+
return errors.push(e);
|
|
58
|
+
});
|
|
59
|
+
client.resolve(SUCCESS);
|
|
60
|
+
server.resolve(SUCCESS);
|
|
61
|
+
await done;
|
|
62
|
+
(0, import_vitest.expect)(errors).toEqual([]);
|
|
63
|
+
dispose();
|
|
64
|
+
});
|
|
65
|
+
(0, import_vitest.test)("a server rejection surfaces a normalized error locally and globally", async function () {
|
|
66
|
+
var {
|
|
67
|
+
result,
|
|
68
|
+
client,
|
|
69
|
+
server
|
|
70
|
+
} = fakeResult();
|
|
71
|
+
var local = [];
|
|
72
|
+
var global = [];
|
|
73
|
+
var dispose = (0, import_useMutation.onMutationError)(function (e) {
|
|
74
|
+
return global.push(e);
|
|
75
|
+
});
|
|
76
|
+
var done = (0, import_useMutation.observeMutation)(result, function (e) {
|
|
77
|
+
return local.push(e);
|
|
78
|
+
});
|
|
79
|
+
client.resolve(SUCCESS);
|
|
80
|
+
server.resolve(appError("Could not create post."));
|
|
81
|
+
await done;
|
|
82
|
+
(0, import_vitest.expect)(local).toEqual([{
|
|
83
|
+
scope: "server",
|
|
84
|
+
kind: "app",
|
|
85
|
+
message: "Could not create post.",
|
|
86
|
+
details: void 0
|
|
87
|
+
}]);
|
|
88
|
+
(0, import_vitest.expect)(global).toEqual(local);
|
|
89
|
+
dispose();
|
|
90
|
+
});
|
|
91
|
+
(0, import_vitest.test)("client + server both failing emits to the global catch only once", async function () {
|
|
92
|
+
var {
|
|
93
|
+
result,
|
|
94
|
+
client,
|
|
95
|
+
server
|
|
96
|
+
} = fakeResult();
|
|
97
|
+
var global = [];
|
|
98
|
+
var dispose = (0, import_useMutation.onMutationError)(function (e) {
|
|
99
|
+
return global.push(e);
|
|
100
|
+
});
|
|
101
|
+
var done = (0, import_useMutation.observeMutation)(result);
|
|
102
|
+
client.reject(new Error("boom"));
|
|
103
|
+
server.reject(new Error("boom"));
|
|
104
|
+
await done;
|
|
105
|
+
(0, import_vitest.expect)(global).toHaveLength(1);
|
|
106
|
+
(0, import_vitest.expect)(global[0]).toMatchObject({
|
|
107
|
+
scope: "client",
|
|
108
|
+
kind: "zero",
|
|
109
|
+
message: "boom"
|
|
110
|
+
});
|
|
111
|
+
dispose();
|
|
112
|
+
});
|
|
113
|
+
(0, import_vitest.test)("never rejects even when both phases reject", async function () {
|
|
114
|
+
var {
|
|
115
|
+
result,
|
|
116
|
+
client,
|
|
117
|
+
server
|
|
118
|
+
} = fakeResult();
|
|
119
|
+
client.reject(new Error("x"));
|
|
120
|
+
server.reject(new Error("x"));
|
|
121
|
+
await (0, import_vitest.expect)((0, import_useMutation.observeMutation)(result)).resolves.toBeUndefined();
|
|
122
|
+
});
|
|
123
|
+
(0, import_vitest.test)("with no listener registered it falls back to console.error in dev", async function () {
|
|
124
|
+
var spy = import_vitest.vi.spyOn(console, "error").mockImplementation(function () {});
|
|
125
|
+
var {
|
|
126
|
+
result,
|
|
127
|
+
client,
|
|
128
|
+
server
|
|
129
|
+
} = fakeResult();
|
|
130
|
+
var done = (0, import_useMutation.observeMutation)(result);
|
|
131
|
+
client.resolve(SUCCESS);
|
|
132
|
+
server.resolve(appError("denied"));
|
|
133
|
+
await done;
|
|
134
|
+
(0, import_vitest.expect)(spy).toHaveBeenCalledTimes(1);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
(0, import_vitest.describe)("onMutationError", function () {
|
|
138
|
+
(0, import_vitest.test)("dispose stops delivery", async function () {
|
|
139
|
+
var seen = [];
|
|
140
|
+
var dispose = (0, import_useMutation.onMutationError)(function (e) {
|
|
141
|
+
return seen.push(e);
|
|
142
|
+
});
|
|
143
|
+
dispose();
|
|
144
|
+
var {
|
|
145
|
+
result,
|
|
146
|
+
client,
|
|
147
|
+
server
|
|
148
|
+
} = fakeResult();
|
|
149
|
+
var done = (0, import_useMutation.observeMutation)(result);
|
|
150
|
+
client.resolve(SUCCESS);
|
|
151
|
+
server.resolve(appError("denied"));
|
|
152
|
+
await done;
|
|
153
|
+
(0, import_vitest.expect)(seen).toEqual([]);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=useMutation.test.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["import_vitest","require","import_useMutation","deferred","resolve","reject","promise","Promise","res","rej","fakeResult","client","server","result","SUCCESS","type","appError","message","error","afterEach","vi","restoreAllMocks","describe","test","errors","dispose","onMutationError","e","push","done","observeMutation","expect","toEqual","local","global","scope","kind","details","Error","toHaveLength","toMatchObject"],"sources":["../../../src/helpers/useMutation.test.ts"],"sourcesContent":[null],"mappings":"AAAA;;AAEA,IAAAA,aAAA,GAAAC,OAAqE;AAGrE,IAAAC,kBAAuB,GAAAD,OAAA;AACrB,SAAIE,SAAA;EACJ,IAAIC,OAAA;EACJ,IAAAC,MAAM;EACJ,IAAAC,OAAA,GAAU,IAAAC,OAAA,WAAAC,GAAA,EAAAC,GAAA;IACVL,OAAA,GAASI,GAAA;IACVH,MAAA,GAAAI,GAAA;EACD;EACF;IAEAH,OAAS;IACPF,OAAM;IACNC;EAC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ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __reExport(index_exports, require("./helpers/batchQuery.cjs"), module.exports);
|
|
|
41
41
|
__reExport(index_exports, require("./helpers/createMutators.cjs"), module.exports);
|
|
42
42
|
__reExport(index_exports, require("./helpers/ensureLoggedIn.cjs"), module.exports);
|
|
43
43
|
__reExport(index_exports, require("./helpers/mutatorContext.cjs"), module.exports);
|
|
44
|
+
__reExport(index_exports, require("./helpers/useMutation.cjs"), module.exports);
|
|
44
45
|
var import_getAuth = require("./helpers/getAuth.cjs");
|
|
45
46
|
var import_state = require("./state.cjs");
|
|
46
47
|
__reExport(index_exports, require("./createZeroClient.cjs"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -43,6 +43,7 @@ __reExport(index_exports, require("./helpers/batchQuery.native.js"), module.expo
|
|
|
43
43
|
__reExport(index_exports, require("./helpers/createMutators.native.js"), module.exports);
|
|
44
44
|
__reExport(index_exports, require("./helpers/ensureLoggedIn.native.js"), module.exports);
|
|
45
45
|
__reExport(index_exports, require("./helpers/mutatorContext.native.js"), module.exports);
|
|
46
|
+
__reExport(index_exports, require("./helpers/useMutation.native.js"), module.exports);
|
|
46
47
|
var import_getAuth = require("./helpers/getAuth.native.js");
|
|
47
48
|
var import_state = require("./state.native.js");
|
|
48
49
|
__reExport(index_exports, require("./createZeroClient.native.js"), module.exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","clearZeroClientData","import_clearZeroClientData","defineQueries","import_zero","defineQuery","ensureAuth","import_getAuth","getAuth","resetShownZeroClientError","import_showZeroClientError","setAuthData","import_state","setEnvironment","setRunner","import_zeroRunner","showZeroClientErrorOnce","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,mBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAC,WAAA,CAAAD,aAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAD,WAAA,CAAAC,WAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD,UAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAD,cAAA,CAAAC,OAAA;EAAAC,yBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,yBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAC,YAAA,CAAAD,WAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAD,YAAA,CAAAC,cAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAC,iBAAA,CAAAD,SAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAN,0BAAA,CAAAM;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAxB,YAAc,CAAAK,aAAA;AACdoB,UAAA,CAAApB,aAAA,EAAcqB,OAAA,gCADd,GAAAH,MAAA,CAAAC,OAAA;AAEAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,+BAAAH,MAFd,CAAAC,OAAA;AAGAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,oCAAAH,MAHd,CAAAC,OAAA;AAIAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,wCAJdH,MAAA,CAAAC,OAAA;AAKAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,wCALdH,MAAA,CAAAC,OAAA;AAMAC,UAAA,CAAApB,aAAoC,EAAAqB,OAAA,
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","clearZeroClientData","import_clearZeroClientData","defineQueries","import_zero","defineQuery","ensureAuth","import_getAuth","getAuth","resetShownZeroClientError","import_showZeroClientError","setAuthData","import_state","setEnvironment","setRunner","import_zeroRunner","showZeroClientErrorOnce","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,mBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAC,WAAA,CAAAD,aAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAD,WAAA,CAAAC,WAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD,UAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAD,cAAA,CAAAC,OAAA;EAAAC,yBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,yBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAC,YAAA,CAAAD,WAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAD,YAAA,CAAAC,cAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAC,iBAAA,CAAAD,SAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAN,0BAAA,CAAAM;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAxB,YAAc,CAAAK,aAAA;AACdoB,UAAA,CAAApB,aAAA,EAAcqB,OAAA,gCADd,GAAAH,MAAA,CAAAC,OAAA;AAEAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,+BAAAH,MAFd,CAAAC,OAAA;AAGAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,oCAAAH,MAHd,CAAAC,OAAA;AAIAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,wCAJdH,MAAA,CAAAC,OAAA;AAKAC,UAAA,CAAApB,aAAA,EAAcqB,OAAA,wCALdH,MAAA,CAAAC,OAAA;AAMAC,UAAA,CAAApB,aAAA,EAAc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