prostgles-client 4.0.125 → 4.0.126

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,4 +1,4 @@
1
- import { type DBSchema, type DBSchemaTable, type MethodHandler, type AnyObject } from "prostgles-types";
1
+ import { type DBSchema, type DBSchemaTable, type MethodHandler } from "prostgles-types";
2
2
  import type { ManagerOptions, SocketOptions } from "socket.io-client";
3
3
  import { type Auth, type DBHandlerClient, type InitOptions } from "./prostgles";
4
4
  type OnReadyParams<DBSchema> = {
@@ -22,7 +22,7 @@ type ProstglesClientState<PGC> = {
22
22
  error?: undefined;
23
23
  } & PGC | {
24
24
  isLoading: false;
25
- error: AnyObject | string;
25
+ error: Error | string;
26
26
  };
27
27
  export declare const useProstglesClient: <DBSchema_1>({ skip, socketOptions, ...initOpts }?: HookInitOpts) => ProstglesClientState<OnReadyParams<DBSchema_1>>;
28
28
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useProstglesClient.d.ts","sourceRoot":"","sources":["../lib/useProstglesClient.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAU,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAa,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3F,KAAK,aAAa,CAAC,QAAQ,IAAI;IAC7B,GAAG,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAA;AACD,KAAK,YAAY,GAA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,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,GAAG;IACtE,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;KAAE,CAAC;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,KAAK,oBAAoB,CAAC,GAAG,IAC3B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAAE,GACvC;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAAE,GAAG,GAAG,GAC9C;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;CAAE,CAAC;AAE/C,eAAO,MAAM,kBAAkB,sDAAoD,YAAY,oDA4C9F,CAAA"}
@@ -44,7 +44,7 @@ const useProstglesClient = ({ skip, socketOptions, ...initOpts } = {}) => {
44
44
  .catch(error => {
45
45
  if (!getIsMounted())
46
46
  return;
47
- setOnReadyArgs({ isLoading: false, error });
47
+ setOnReadyArgs({ isLoading: false, error: error instanceof Error ? error : new Error(error) });
48
48
  });
49
49
  return () => {
50
50
  socket.disconnect();
@@ -31,7 +31,7 @@ type HookInitOpts = Omit<InitOptions<DBSchema>, "onReady" | "socket"> & {
31
31
  type ProstglesClientState<PGC> =
32
32
  | { isLoading: true; error?: undefined; }
33
33
  | { isLoading: false; error?: undefined; } & PGC
34
- | { isLoading: false; error: AnyObject | string; };
34
+ | { isLoading: false; error: Error | string; };
35
35
 
36
36
  export const useProstglesClient = <DBSchema>({ skip, socketOptions, ...initOpts }: HookInitOpts = {}): ProstglesClientState<OnReadyParams<DBSchema>> => {
37
37
  const { useRef, useState } = getReact(true);
@@ -67,7 +67,7 @@ export const useProstglesClient = <DBSchema>({ skip, socketOptions, ...initOpts
67
67
  }, SyncedTable)
68
68
  .catch(error => {
69
69
  if (!getIsMounted()) return;
70
- setOnReadyArgs({ isLoading: false, error });
70
+ setOnReadyArgs({ isLoading: false, error: error instanceof Error ? error : new Error(error) });
71
71
  });
72
72
 
73
73
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-client",
3
- "version": "4.0.125",
3
+ "version": "4.0.126",
4
4
  "description": "Reactive client for Postgres",
5
5
  "main": "dist/prostgles-full.js",
6
6
  "types": "dist/prostgles-full.d.ts",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "..": {
19
19
  "name": "prostgles-client",
20
- "version": "4.0.124",
20
+ "version": "4.0.125",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "prostgles-types": "^4.0.85"