prostgles-client 4.0.159 → 4.0.161

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.
@@ -1 +1 @@
1
- {"version":3,"file":"react-hooks.d.ts","sourceRoot":"","sources":["../lib/react-hooks.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,KAAK,MAAM,GAAG,cAAc,OAAO,CAAC,CAAC;AAKrC,eAAO,MAAM,QAAQ,gBAAiB,OAAO,KAAG,MAU/C,CAAC;AAMF,eAAO,MAAM,KAAK,gEAQjB,CAAA;AACD,eAAO,MAAM,OAAO,6BAsBnB,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,GAAG,cAQ/C,CAAA;AAED,eAAO,MAAM,WAAW,gCAMD,CAAC;AAExB,eAAO,MAAM,aAAa,kCAMD,CAAC;AAiB1B,KAAK,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAA;AAgBpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAY,UAAU,QAAQ,GAAG,EAAE,SAyClE,CAAA;AACD,eAAO,MAAM,cAAc,WAAY,MAAM,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,UAAU,GAAG,EAAE,SAsBvF,CAAA;AAED,wBAAgB,YAAY,QAa3B;AAED,KAAK,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;AACrC,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE/C,eAAO,MAAM,UAAU,qDAAqD,GAAG,EAAE,wJA6ChF,CAAA;AAOD,eAAO,MAAM,YAAY,qBACL,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,QAAQ,mBAAmB,CAA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AAC,CAAC,UAAU,GAAG,EAAE,SAsBvF,CAAA;AAED,wBAAgB,YAAY,QAa3B;AAED,KAAK,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;AACrC,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE/C,eAAO,MAAM,UAAU,qDAAqD,GAAG,EAAE,wJAsDhF,CAAA;AAOD,eAAO,MAAM,YAAY,qBACL,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,QAAQ,mBAAmB,CAAC,cACnF,OAAO,UACX,GAAG,WACF,GAAG;;;;CA8Bb,CAAA;AAED,eAAO,MAAM,OAAO,aACR,SAAS,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,kBAAkB,CAAC,CAAC,SAAS,CAAC,eAC3E,WAAW,SAAS,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,eACnD,WAAW,SAAS,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;;;;CA2BjE,CAAA;AAED,eAAO,MAAM,QAAQ,wBAAyB,GAAG,KAAK,QAAQ,GAAG,CAAC,SAAQ,GAAG,EAAE;;;;CAiB9E,CAAA;AAED,eAAO,MAAM,oBAAoB,eAAwC,CAAC"}
@@ -100,7 +100,7 @@ const useAsyncEffectQueue = (effect, deps) => {
100
100
  history: []
101
101
  });
102
102
  const onCleanup = async (effectFunc) => {
103
- var _a, _b, _c, _d;
103
+ var _a, _b, _c, _d, _e;
104
104
  /** New effect did not start. Just remove */
105
105
  if (((_a = queue.current.newEffect) === null || _a === void 0 ? void 0 : _a.effect) === effectFunc) {
106
106
  queue.current.newEffect = undefined;
@@ -109,16 +109,16 @@ const useAsyncEffectQueue = (effect, deps) => {
109
109
  else if (((_b = queue.current.activeEffect) === null || _b === void 0 ? void 0 : _b.effect) === effectFunc) {
110
110
  queue.current.activeEffect.didCleanup = true;
111
111
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
112
- await ((_d = (_c = (await queue.current.activeEffect.resolvedCleanup)) === null || _c === void 0 ? void 0 : _c.run) === null || _d === void 0 ? void 0 : _d.call(_c));
112
+ await ((_e = (_d = (_c = (await queue.current.activeEffect.resolvedCleanup)) === null || _c === void 0 ? void 0 : _c.run) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.catch(console.error));
113
113
  }
114
114
  };
115
115
  const onRender = async (newEffect) => {
116
- var _a, _b, _c;
116
+ var _a, _b, _c, _d;
117
117
  queue.current.newEffect = newEffect;
118
118
  queue.current.history.push(newEffect);
119
119
  /** Need to wait to ensure activeEffect cleanup finished */
120
120
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
121
- await ((_c = (_b = (await ((_a = queue.current.activeEffect) === null || _a === void 0 ? void 0 : _a.resolvedCleanup))) === null || _b === void 0 ? void 0 : _b.run) === null || _c === void 0 ? void 0 : _c.call(_b));
121
+ await ((_d = (_c = (_b = (await ((_a = queue.current.activeEffect) === null || _a === void 0 ? void 0 : _a.resolvedCleanup))) === null || _b === void 0 ? void 0 : _b.run) === null || _c === void 0 ? void 0 : _c.call(_b)) === null || _d === void 0 ? void 0 : _d.catch(console.error));
122
122
  queue.current.activeEffect = newEffect;
123
123
  queue.current.activeEffect.resolvedCleanup = queue.current.activeEffect.effect().then(run => ({ run }));
124
124
  };
@@ -193,7 +193,12 @@ const usePromise = (f, deps = []) => {
193
193
  const keys = (0, prostgles_types_1.getKeys)(val);
194
194
  for await (const key of keys) {
195
195
  const prop = val[key];
196
- data[key] = typeof prop === "function" ? await prop() : await prop;
196
+ try {
197
+ data[key] = typeof prop === "function" ? await prop() : await prop;
198
+ }
199
+ catch (e) {
200
+ console.error(e);
201
+ }
197
202
  }
198
203
  return data;
199
204
  };
@@ -201,13 +206,18 @@ const usePromise = (f, deps = []) => {
201
206
  const getIsMounted = useIsMounted();
202
207
  (0, exports.useAsyncEffectQueue)(async () => {
203
208
  let promiseResult;
204
- if (isNamedObj(f)) {
205
- promiseResult = await getNamedObjResults(f);
209
+ try {
210
+ if (isNamedObj(f)) {
211
+ promiseResult = await getNamedObjResults(f);
212
+ }
213
+ else {
214
+ const funcRes = await f();
215
+ const isNObj = isNamedObj(funcRes);
216
+ promiseResult = isNObj ? await getNamedObjResults(funcRes) : isPromiseFunc(funcRes) ? await funcRes() : funcRes;
217
+ }
206
218
  }
207
- else {
208
- const funcRes = await f();
209
- const isNObj = isNamedObj(funcRes);
210
- promiseResult = isNObj ? await getNamedObjResults(funcRes) : isPromiseFunc(funcRes) ? await funcRes() : funcRes;
219
+ catch (e) {
220
+ console.error(e);
211
221
  }
212
222
  if (!getIsMounted())
213
223
  return;
@@ -133,7 +133,7 @@ export const useAsyncEffectQueue = (effect: EffectFunc, deps: any[]) => {
133
133
 
134
134
  queue.current.activeEffect.didCleanup = true;
135
135
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
136
- await (await queue.current.activeEffect.resolvedCleanup)?.run?.();
136
+ await (await queue.current.activeEffect.resolvedCleanup)?.run?.()?.catch(console.error);
137
137
  }
138
138
  }
139
139
 
@@ -143,7 +143,7 @@ export const useAsyncEffectQueue = (effect: EffectFunc, deps: any[]) => {
143
143
 
144
144
  /** Need to wait to ensure activeEffect cleanup finished */
145
145
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
146
- await (await queue.current.activeEffect?.resolvedCleanup)?.run?.();
146
+ await (await queue.current.activeEffect?.resolvedCleanup)?.run?.()?.catch(console.error);
147
147
 
148
148
  queue.current.activeEffect = newEffect;
149
149
  queue.current.activeEffect.resolvedCleanup = queue.current.activeEffect.effect().then(run => ({ run }));
@@ -224,7 +224,11 @@ export const usePromise = <F extends PromiseFunc | NamedResult>(f: F, deps: any[
224
224
  const keys = getKeys(val);
225
225
  for await (const key of keys) {
226
226
  const prop = val[key] as string | Function | Promise<any>;
227
- data[key] = typeof prop === "function" ? await prop() : await prop
227
+ try {
228
+ data[key] = typeof prop === "function" ? await prop() : await prop
229
+ } catch (e) {
230
+ console.error(e);
231
+ }
228
232
  }
229
233
  return data;
230
234
  }
@@ -232,12 +236,17 @@ export const usePromise = <F extends PromiseFunc | NamedResult>(f: F, deps: any[
232
236
  const getIsMounted = useIsMounted();
233
237
  useAsyncEffectQueue(async () => {
234
238
  let promiseResult
235
- if (isNamedObj(f)) {
236
- promiseResult = await getNamedObjResults(f);
237
- } else {
238
- const funcRes = await f();
239
- const isNObj = isNamedObj(funcRes);
240
- promiseResult = isNObj ? await getNamedObjResults(funcRes) : isPromiseFunc(funcRes) ? await funcRes() : funcRes;
239
+
240
+ try {
241
+ if (isNamedObj(f)) {
242
+ promiseResult = await getNamedObjResults(f);
243
+ } else {
244
+ const funcRes = await f();
245
+ const isNObj = isNamedObj(funcRes);
246
+ promiseResult = isNObj ? await getNamedObjResults(funcRes) : isPromiseFunc(funcRes) ? await funcRes() : funcRes;
247
+ }
248
+ } catch (e) {
249
+ console.error(e);
241
250
  }
242
251
  if (!getIsMounted()) return;
243
252
  setResult(promiseResult);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-client",
3
- "version": "4.0.159",
3
+ "version": "4.0.161",
4
4
  "description": "Reactive client for Postgres",
5
5
  "main": "dist/prostgles-full.js",
6
6
  "types": "dist/prostgles-full.d.ts",
@@ -28,7 +28,7 @@
28
28
  "pushpublish": "npm version patch --git-tag-version false && git push && npm publish"
29
29
  },
30
30
  "dependencies": {
31
- "prostgles-types": "^4.0.107"
31
+ "prostgles-types": "^4.0.111"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^14.14.14",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "..": {
19
19
  "name": "prostgles-client",
20
- "version": "4.0.158",
20
+ "version": "4.0.160",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "prostgles-types": "^4.0.107"
23
+ "prostgles-types": "^4.0.111"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^14.14.14",