prostgles-client 4.0.126 → 4.0.128
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-full.d.ts +1 -1
- package/dist/prostgles-full.d.ts.map +1 -1
- package/dist/useProstglesClient.d.ts +2 -1
- package/dist/useProstglesClient.d.ts.map +1 -1
- package/dist/useProstglesClient.js +4 -4
- package/lib/prostgles-full.ts +1 -1
- package/lib/useProstglesClient.ts +8 -8
- package/package.json +2 -2
- package/tests/package-lock.json +2 -2
package/dist/prostgles-full.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitOptions } from "./prostgles";
|
|
1
|
+
import { type InitOptions } from "./prostgles";
|
|
2
2
|
declare function prostgles<DBSchema = void>(params: InitOptions<DBSchema>): Promise<unknown>;
|
|
3
3
|
declare namespace prostgles {
|
|
4
4
|
var SyncedTable: typeof import("./SyncedTable/SyncedTable").SyncedTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prostgles-full.d.ts","sourceRoot":"","sources":["../lib/prostgles-full.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prostgles-full.d.ts","sourceRoot":"","sources":["../lib/prostgles-full.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,iBAAS,SAAS,CAAC,QAAQ,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,oBAEhE;kBAFQ,SAAS;;;AAKlB,SAAS,SAAS,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DBSchema, type DBSchemaTable, type MethodHandler } from "prostgles-types";
|
|
2
|
-
import type { ManagerOptions, SocketOptions } from "socket.io-client";
|
|
2
|
+
import type { ManagerOptions, Socket, SocketOptions } from "socket.io-client";
|
|
3
3
|
import { type Auth, type DBHandlerClient, type InitOptions } from "./prostgles";
|
|
4
4
|
type OnReadyParams<DBSchema> = {
|
|
5
5
|
dbo: DBHandlerClient<DBSchema>;
|
|
@@ -7,6 +7,7 @@ type OnReadyParams<DBSchema> = {
|
|
|
7
7
|
tableSchema: DBSchemaTable[] | undefined;
|
|
8
8
|
auth: Auth | undefined;
|
|
9
9
|
isReconnect: boolean;
|
|
10
|
+
socket: Socket;
|
|
10
11
|
};
|
|
11
12
|
type HookInitOpts = Omit<InitOptions<DBSchema>, "onReady" | "socket"> & {
|
|
12
13
|
socketOptions?: Partial<ManagerOptions & SocketOptions> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProstglesClient.d.ts","sourceRoot":"","sources":["../lib/useProstglesClient.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"useProstglesClient.d.ts","sourceRoot":"","sources":["../lib/useProstglesClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,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;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAA;AACD,KAAK,YAAY,GAAG,IAAI,CAAC,WAAW,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"}
|
|
@@ -29,7 +29,6 @@ const useProstglesClient = ({ skip, socketOptions, ...initOpts } = {}) => {
|
|
|
29
29
|
};
|
|
30
30
|
const socket = typeof (socketOptions === null || socketOptions === void 0 ? void 0 : socketOptions.uri) === "string" ? io(socketOptions.uri, opts) : io(opts);
|
|
31
31
|
socketRef.current = socket;
|
|
32
|
-
//@ts-ignore
|
|
33
32
|
await (0, prostgles_1.prostgles)({
|
|
34
33
|
socket,
|
|
35
34
|
...initOpts,
|
|
@@ -37,14 +36,15 @@ const useProstglesClient = ({ skip, socketOptions, ...initOpts } = {}) => {
|
|
|
37
36
|
if (!getIsMounted())
|
|
38
37
|
return;
|
|
39
38
|
const [dbo, methods, tableSchema, auth, isReconnect] = args;
|
|
40
|
-
const onReadyArgs = { dbo, methods, tableSchema, auth, isReconnect };
|
|
39
|
+
const onReadyArgs = { dbo, methods, tableSchema, auth, isReconnect, socket };
|
|
41
40
|
setOnReadyArgs({ ...onReadyArgs, isLoading: false });
|
|
42
41
|
}
|
|
43
42
|
}, SyncedTable_1.SyncedTable)
|
|
44
|
-
.catch(
|
|
43
|
+
.catch(err => {
|
|
45
44
|
if (!getIsMounted())
|
|
46
45
|
return;
|
|
47
|
-
|
|
46
|
+
const error = err instanceof Error ? err : new Error(err);
|
|
47
|
+
setOnReadyArgs({ isLoading: false, error });
|
|
48
48
|
});
|
|
49
49
|
return () => {
|
|
50
50
|
socket.disconnect();
|
package/lib/prostgles-full.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { prostgles as pgls, InitOptions } from "./prostgles";
|
|
1
|
+
import { prostgles as pgls, type InitOptions } from "./prostgles";
|
|
2
2
|
import { SyncedTable } from "./SyncedTable/SyncedTable";
|
|
3
3
|
function prostgles<DBSchema = void>(params: InitOptions<DBSchema>) {
|
|
4
4
|
return pgls(params as any, SyncedTable);
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
omitKeys,
|
|
8
9
|
type DBSchema,
|
|
9
10
|
type DBSchemaTable,
|
|
10
|
-
type MethodHandler
|
|
11
|
-
omitKeys,
|
|
12
|
-
type AnyObject
|
|
11
|
+
type MethodHandler
|
|
13
12
|
} from "prostgles-types";
|
|
14
13
|
|
|
15
14
|
import type { ManagerOptions, Socket, SocketOptions } from "socket.io-client";
|
|
@@ -23,6 +22,7 @@ type OnReadyParams<DBSchema> = {
|
|
|
23
22
|
tableSchema: DBSchemaTable[] | undefined;
|
|
24
23
|
auth: Auth | undefined;
|
|
25
24
|
isReconnect: boolean;
|
|
25
|
+
socket: Socket;
|
|
26
26
|
}
|
|
27
27
|
type HookInitOpts = Omit<InitOptions<DBSchema>, "onReady" | "socket"> & {
|
|
28
28
|
socketOptions?: Partial<ManagerOptions & SocketOptions> & { uri?: string; };
|
|
@@ -54,20 +54,20 @@ export const useProstglesClient = <DBSchema>({ skip, socketOptions, ...initOpts
|
|
|
54
54
|
}
|
|
55
55
|
const socket = typeof socketOptions?.uri === "string" ? io(socketOptions.uri, opts) : io(opts);
|
|
56
56
|
socketRef.current = socket;
|
|
57
|
-
|
|
58
|
-
await prostgles({
|
|
57
|
+
await prostgles<DBSchema>({
|
|
59
58
|
socket,
|
|
60
59
|
...initOpts,
|
|
61
60
|
onReady: (...args) => {
|
|
62
61
|
if (!getIsMounted()) return;
|
|
63
62
|
const [dbo, methods, tableSchema, auth, isReconnect] = args;
|
|
64
|
-
const onReadyArgs = { dbo, methods,tableSchema, auth, isReconnect }
|
|
63
|
+
const onReadyArgs = { dbo, methods,tableSchema, auth, isReconnect, socket } satisfies OnReadyParams<DBSchema>;
|
|
65
64
|
setOnReadyArgs({ ...onReadyArgs, isLoading: false } satisfies ProstglesClientState<OnReadyParams<DBSchema>>);
|
|
66
65
|
}
|
|
67
66
|
}, SyncedTable)
|
|
68
|
-
.catch(
|
|
67
|
+
.catch(err => {
|
|
69
68
|
if (!getIsMounted()) return;
|
|
70
|
-
|
|
69
|
+
const error = err instanceof Error ? err : new Error(err);
|
|
70
|
+
setOnReadyArgs({ isLoading: false, 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.
|
|
3
|
+
"version": "4.0.128",
|
|
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.
|
|
31
|
+
"prostgles-types": "^4.0.86"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^14.14.14",
|
package/tests/package-lock.json
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"..": {
|
|
19
19
|
"name": "prostgles-client",
|
|
20
|
-
"version": "4.0.
|
|
20
|
+
"version": "4.0.127",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"prostgles-types": "^4.0.
|
|
23
|
+
"prostgles-types": "^4.0.86"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^14.14.14",
|