prostgles-client 4.0.301 → 4.0.303
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ClientFunctionHandler } from "lib/getMethods";
|
|
4
|
+
import type { UserLike } from "prostgles-types";
|
|
5
|
+
import { type OnReadyParams, type UseProstglesClientProps, type ProstglesClientState } from "./useProstglesClient";
|
|
6
|
+
type ProstglesContextValue<DBSchema, FuncSchema extends ClientFunctionHandler = ClientFunctionHandler, U extends UserLike = UserLike> = ProstglesClientState<OnReadyParams<DBSchema, FuncSchema, U>>;
|
|
7
|
+
export declare const makeProstglesProvider: <DBSchema, FuncSchema extends Partial<Record<string, import("lib/getMethods").FunctionHandle>> = Partial<Record<string, import("lib/getMethods").FunctionHandle>>, U extends UserLike = UserLike>() => {
|
|
8
|
+
ProstglesProvider: ({ children, ...props }: Omit<import("../prostgles").InitOptions<import("prostgles-types").DBSchema>, "socket" | "onReady"> & {
|
|
9
|
+
token?: string | undefined;
|
|
10
|
+
socketOptions?: Partial<import("socket.io-client").ManagerOptions & import("socket.io-client").SocketOptions> | undefined;
|
|
11
|
+
skip?: boolean | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
useProstgles: () => ProstglesContextValue<DBSchema, FuncSchema, U>;
|
|
16
|
+
ProstglesContext: React.Context<ProstglesContextValue<DBSchema, FuncSchema, U> | undefined>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=makeProstglesProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeProstglesProvider.d.ts","sourceRoot":"","sources":["../../lib/hooks/makeProstglesProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,KAAK,qBAAqB,CACxB,QAAQ,EACR,UAAU,SAAS,qBAAqB,GAAG,qBAAqB,EAChE,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAC3B,oBAAoB,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjE,eAAO,MAAM,qBAAqB;;;;;;kBAcS,SAAS;;;;CAcnD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeProstglesProvider = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const reactImports_1 = require("./reactImports");
|
|
6
|
+
const useProstglesClient_1 = require("./useProstglesClient");
|
|
7
|
+
const makeProstglesProvider = () => {
|
|
8
|
+
const { createContext, useContext } = (0, reactImports_1.getReact)(true);
|
|
9
|
+
const ProstglesContext = createContext(undefined);
|
|
10
|
+
const ProstglesProvider = ({ children, ...props }) => {
|
|
11
|
+
const value = (0, useProstglesClient_1.useProstglesClient)(props);
|
|
12
|
+
return react_1.default.createElement(ProstglesContext.Provider, { value: value }, children);
|
|
13
|
+
};
|
|
14
|
+
const useProstgles = () => {
|
|
15
|
+
const ctx = useContext(ProstglesContext);
|
|
16
|
+
if (!ctx) {
|
|
17
|
+
throw new Error("useProstgles must be used within ProstglesProvider");
|
|
18
|
+
}
|
|
19
|
+
return ctx;
|
|
20
|
+
};
|
|
21
|
+
return { ProstglesProvider, useProstgles, ProstglesContext };
|
|
22
|
+
};
|
|
23
|
+
exports.makeProstglesProvider = makeProstglesProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prostgles-client",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.303",
|
|
4
4
|
"description": "Reactive client for Postgres",
|
|
5
5
|
"main": "dist/prostgles-full.js",
|
|
6
6
|
"types": "dist/prostgles-full.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"webpack-cli": "^5.1.4"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
49
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"react": {
|