prostgles-client 4.0.97 → 4.0.99
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/index.js +1 -1
- package/dist/index.no-sync.js +1 -1
- package/dist/prostgles.js +1 -1
- package/dist/react-hooks.d.ts +1 -1
- package/dist/react-hooks.d.ts.map +1 -1
- package/dist/react-hooks.js +4 -2
- package/lib/prostgles.ts +1 -1
- package/lib/react-hooks.ts +7 -5
- package/package.json +1 -1
- package/tests/package-lock.json +1 -1
package/dist/prostgles.js
CHANGED
|
@@ -50,7 +50,7 @@ const useProstglesClient = ({ skip, socketOptions, ...initOpts } = {}) => {
|
|
|
50
50
|
reconnection: true,
|
|
51
51
|
...(0, prostgles_types_1.omitKeys)(socketOptions !== null && socketOptions !== void 0 ? socketOptions : {}, ["uri"]),
|
|
52
52
|
};
|
|
53
|
-
socket.current =
|
|
53
|
+
socket.current = typeof (socketOptions === null || socketOptions === void 0 ? void 0 : socketOptions.uri) === "string" ? io(socketOptions.uri, opts) : io(opts);
|
|
54
54
|
}, [socketOptions === null || socketOptions === void 0 ? void 0 : socketOptions.path]);
|
|
55
55
|
(0, react_hooks_1.useAsyncEffectQueue)(async () => {
|
|
56
56
|
if (!socket || skip)
|
package/dist/react-hooks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SubscriptionHandler } from "prostgles-types";
|
|
2
2
|
import { TableHandlerClient } from "./prostgles";
|
|
3
3
|
export declare const getReact: (throwError?: boolean) => typeof import("react");
|
|
4
|
-
export declare const getIO: () =>
|
|
4
|
+
export declare const getIO: (throwError?: boolean) => typeof import("socket.io-client").io;
|
|
5
5
|
export declare const isEqual: (x: any, y: any) => boolean;
|
|
6
6
|
export declare const useDeepCompareMemoize: (value: any) => undefined;
|
|
7
7
|
export declare const useEffectDeep: (callback: any, deps: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-hooks.d.ts","sourceRoot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AC,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,eAAiC,CAAC"}
|
package/dist/react-hooks.js
CHANGED
|
@@ -19,14 +19,16 @@ const getReact = (throwError) => {
|
|
|
19
19
|
exports.getReact = getReact;
|
|
20
20
|
(0, exports.getReact)();
|
|
21
21
|
const { useEffect = alertNoReact, useCallback = alertNoReact, useRef, useState = alertNoReactT } = (_a = React) !== null && _a !== void 0 ? _a : {};
|
|
22
|
-
const getIO = () => {
|
|
22
|
+
const getIO = (throwError = false) => {
|
|
23
23
|
try {
|
|
24
24
|
const io = require("socket.io-client");
|
|
25
25
|
return io;
|
|
26
26
|
}
|
|
27
27
|
catch (err) {
|
|
28
|
-
return null;
|
|
29
28
|
}
|
|
29
|
+
if (throwError)
|
|
30
|
+
throw new Error("Must install socket.io-client");
|
|
31
|
+
return ({});
|
|
30
32
|
};
|
|
31
33
|
exports.getIO = getIO;
|
|
32
34
|
const isEqual = function (x, y) {
|
package/lib/prostgles.ts
CHANGED
|
@@ -88,7 +88,7 @@ export const useProstglesClient = <DBSchema>({ skip, socketOptions, ...initOpts
|
|
|
88
88
|
reconnection: true,
|
|
89
89
|
...omitKeys(socketOptions ?? {}, ["uri"]),
|
|
90
90
|
}
|
|
91
|
-
socket.current =
|
|
91
|
+
socket.current = typeof socketOptions?.uri === "string" ? io(socketOptions.uri, opts) : io(opts);
|
|
92
92
|
}, [socketOptions?.path]);
|
|
93
93
|
|
|
94
94
|
useAsyncEffectQueue(async () => {
|
package/lib/react-hooks.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { SubscriptionHandler, getKeys, isObject } from "prostgles-types";
|
|
|
2
2
|
import { TableHandlerClient } from "./prostgles";
|
|
3
3
|
let React: typeof import("react") | undefined;
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
const alertNoReact = (...args: any[]): any => { throw "Must install react" }
|
|
7
6
|
const alertNoReactT = <T>(...args: any[]): any => { throw "Must install react" }
|
|
8
7
|
export const getReact = (throwError?: boolean): typeof import("react") => {
|
|
@@ -16,13 +15,16 @@ export const getReact = (throwError?: boolean): typeof import("react") => {
|
|
|
16
15
|
};
|
|
17
16
|
getReact();
|
|
18
17
|
const { useEffect = alertNoReact, useCallback = alertNoReact, useRef, useState = alertNoReactT } = React! ?? {};
|
|
19
|
-
|
|
18
|
+
|
|
19
|
+
type IO = typeof import("socket.io-client").default;
|
|
20
|
+
export const getIO = (throwError = false) => {
|
|
20
21
|
try {
|
|
21
|
-
const io = require("socket.io-client") as
|
|
22
|
-
return io
|
|
22
|
+
const io = require("socket.io-client") as IO;
|
|
23
|
+
return io;
|
|
23
24
|
} catch(err){
|
|
24
|
-
return null as any;
|
|
25
25
|
}
|
|
26
|
+
if(throwError) throw new Error("Must install socket.io-client");
|
|
27
|
+
return ({}) as IO;
|
|
26
28
|
}
|
|
27
29
|
export const isEqual = function (x, y) {
|
|
28
30
|
if (x === y) {
|
package/package.json
CHANGED