qortex-react 0.1.8 → 0.2.0
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/index.js +11 -66
- package/index.mjs +5 -40
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,70 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
__export(src_exports, {
|
|
24
|
-
useQuery: () => useQuery,
|
|
25
|
-
useQueryData: () => useQueryData
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(src_exports);
|
|
28
|
-
__reExport(src_exports, require("qortex-core"), module.exports);
|
|
3
|
+
var qortexCore = require('qortex-core');
|
|
4
|
+
var react = require('react');
|
|
29
5
|
|
|
30
|
-
|
|
31
|
-
var import_react = require("react");
|
|
32
|
-
var import_qortex_core = require("qortex-core");
|
|
33
|
-
function useQuery(key, opts) {
|
|
34
|
-
const serializedKey = (0, import_qortex_core.serializeKey)(key);
|
|
35
|
-
const getSnapshot = (0, import_react.useCallback)(() => {
|
|
36
|
-
return (0, import_qortex_core.getQueryState)(key, opts);
|
|
37
|
-
}, [serializedKey]);
|
|
38
|
-
const subscribe = (0, import_react.useCallback)((callback) => {
|
|
39
|
-
return (0, import_qortex_core.subscribeQuery)(key, callback, opts);
|
|
40
|
-
}, [serializedKey]);
|
|
41
|
-
const state = (0, import_react.useSyncExternalStore)(
|
|
42
|
-
subscribe,
|
|
43
|
-
getSnapshot
|
|
44
|
-
);
|
|
45
|
-
return state;
|
|
46
|
-
}
|
|
6
|
+
function O(e,t){let r=qortexCore.serializeKey(e),u=react.useCallback(()=>qortexCore.getQueryState(e,t),[r]),n=react.useCallback(s=>qortexCore.subscribeQuery(e,s,t),[r]);return react.useSyncExternalStore(n,u)}function C(e,t){let r=qortexCore.serializeKey(e),u=react.useCallback(()=>qortexCore.getQueryData(e,t),[r]),n=react.useCallback(s=>qortexCore.subscribeQuery(e,s,t),[r]);return react.useSyncExternalStore(n,u)}
|
|
47
7
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, [serializedKey]);
|
|
56
|
-
const subscribe = (0, import_react2.useCallback)((callback) => {
|
|
57
|
-
return (0, import_qortex_core2.subscribeQuery)(key, callback, opts);
|
|
58
|
-
}, [serializedKey]);
|
|
59
|
-
const data = (0, import_react2.useSyncExternalStore)(
|
|
60
|
-
subscribe,
|
|
61
|
-
getSnapshot
|
|
62
|
-
);
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
-
0 && (module.exports = {
|
|
67
|
-
useQuery,
|
|
68
|
-
useQueryData,
|
|
69
|
-
...require("qortex-core")
|
|
8
|
+
exports.useQuery = O;
|
|
9
|
+
exports.useQueryData = C;
|
|
10
|
+
Object.keys(qortexCore).forEach(function (k) {
|
|
11
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return qortexCore[k]; }
|
|
14
|
+
});
|
|
70
15
|
});
|
package/index.mjs
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export * from
|
|
1
|
+
import { serializeKey, getQueryState, subscribeQuery, getQueryData } from 'qortex-core';
|
|
2
|
+
export * from 'qortex-core';
|
|
3
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
import { useSyncExternalStore, useCallback } from "react";
|
|
6
|
-
import { subscribeQuery, getQueryState, serializeKey } from "qortex-core";
|
|
7
|
-
function useQuery(key, opts) {
|
|
8
|
-
const serializedKey = serializeKey(key);
|
|
9
|
-
const getSnapshot = useCallback(() => {
|
|
10
|
-
return getQueryState(key, opts);
|
|
11
|
-
}, [serializedKey]);
|
|
12
|
-
const subscribe = useCallback((callback) => {
|
|
13
|
-
return subscribeQuery(key, callback, opts);
|
|
14
|
-
}, [serializedKey]);
|
|
15
|
-
const state = useSyncExternalStore(
|
|
16
|
-
subscribe,
|
|
17
|
-
getSnapshot
|
|
18
|
-
);
|
|
19
|
-
return state;
|
|
20
|
-
}
|
|
5
|
+
function O(e,t){let r=serializeKey(e),u=useCallback(()=>getQueryState(e,t),[r]),n=useCallback(s=>subscribeQuery(e,s,t),[r]);return useSyncExternalStore(n,u)}function C(e,t){let r=serializeKey(e),u=useCallback(()=>getQueryData(e,t),[r]),n=useCallback(s=>subscribeQuery(e,s,t),[r]);return useSyncExternalStore(n,u)}
|
|
21
6
|
|
|
22
|
-
|
|
23
|
-
import { useSyncExternalStore as useSyncExternalStore2, useCallback as useCallback2 } from "react";
|
|
24
|
-
import { getQueryData, subscribeQuery as subscribeQuery2, serializeKey as serializeKey2 } from "qortex-core";
|
|
25
|
-
function useQueryData(key, opts) {
|
|
26
|
-
const serializedKey = serializeKey2(key);
|
|
27
|
-
const getSnapshot = useCallback2(() => {
|
|
28
|
-
return getQueryData(key, opts);
|
|
29
|
-
}, [serializedKey]);
|
|
30
|
-
const subscribe = useCallback2((callback) => {
|
|
31
|
-
return subscribeQuery2(key, callback, opts);
|
|
32
|
-
}, [serializedKey]);
|
|
33
|
-
const data = useSyncExternalStore2(
|
|
34
|
-
subscribe,
|
|
35
|
-
getSnapshot
|
|
36
|
-
);
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
useQuery,
|
|
41
|
-
useQueryData
|
|
42
|
-
};
|
|
7
|
+
export { O as useQuery, C as useQueryData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qortex-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React hook bridge for qortex runtime",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"author": "Darshan Naik",
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"qortex-core": "0.
|
|
45
|
+
"qortex-core": "0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=18"
|