prostgles-client 4.0.189 → 4.0.191
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/getDbHandler.d.ts.map +1 -1
- package/dist/getDbHandler.js +5 -4
- package/dist/index.js +1 -1
- package/dist/index.no-sync.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDbHandler.d.ts","sourceRoot":"","sources":["../lib/getDbHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAKlB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,eAAe,EAIrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACzC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACvC,WAAW,EAAE,OAAO,WAAW,GAAG,SAAS,CAAC;IAC5C,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC/C,mBAAmB,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;CAChE,CAAC;AAIF,eAAO,MAAM,MAAM,yGAShB,IAAI;;
|
|
1
|
+
{"version":3,"file":"getDbHandler.d.ts","sourceRoot":"","sources":["../lib/getDbHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAKlB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,eAAe,EAIrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACzC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACvC,WAAW,EAAE,OAAO,WAAW,GAAG,SAAS,CAAC;IAC5C,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC/C,mBAAmB,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;CAChE,CAAC;AAIF,eAAO,MAAM,MAAM,yGAShB,IAAI;;CA+NN,CAAC"}
|
package/dist/getDbHandler.js
CHANGED
|
@@ -15,14 +15,15 @@ const getDBO = ({ schema, tableSchema, onDebug, syncedTable, syncHandler, subscr
|
|
|
15
15
|
throw "Expecting: ( basicFilter<object>, options<object>, onChange<function> , onError?<function>) but got something else";
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const subscribeCommands = ["subscribe", "subscribeOne"];
|
|
19
19
|
const dbo = {};
|
|
20
20
|
const schemaClone = (0, SyncedTable_1.quickClone)(schema);
|
|
21
21
|
(0, prostgles_types_1.getObjectEntries)(schemaClone).forEach(([tableName, methods]) => {
|
|
22
22
|
const allowedCommands = (0, prostgles_types_1.getKeys)(methods);
|
|
23
|
+
dbo[tableName] = {};
|
|
23
24
|
const dboTable = dbo[tableName];
|
|
24
25
|
allowedCommands
|
|
25
|
-
.sort((a, b) =>
|
|
26
|
+
.sort((a, b) => subscribeCommands.includes(a) - subscribeCommands.includes(b))
|
|
26
27
|
.forEach((command) => {
|
|
27
28
|
if (command === "sync") {
|
|
28
29
|
dboTable._syncInfo = { ...methods[command] };
|
|
@@ -96,7 +97,7 @@ const getDBO = ({ schema, tableSchema, onDebug, syncedTable, syncHandler, subscr
|
|
|
96
97
|
return syncHandler.addSync({ tableName, command, param1, param2 }, syncHandles);
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
else if (
|
|
100
|
+
else if (subscribeCommands.includes(command)) {
|
|
100
101
|
const subFunc = async function (param1 = {}, param2 = {}, onChange, onError) {
|
|
101
102
|
await (onDebug === null || onDebug === void 0 ? void 0 : onDebug({
|
|
102
103
|
type: "table",
|
|
@@ -120,7 +121,7 @@ const getDBO = ({ schema, tableSchema, onDebug, syncedTable, syncHandler, subscr
|
|
|
120
121
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
121
122
|
(0, prostgles_1.useSubscribe)(subFunc, command === SUBONE, filter, options);
|
|
122
123
|
}
|
|
123
|
-
if (command === SUBONE || !
|
|
124
|
+
if (command === SUBONE || !subscribeCommands.includes(SUBONE)) {
|
|
124
125
|
dboTable[SUBONE] = async function (param1, param2, onChange, onError) {
|
|
125
126
|
await (onDebug === null || onDebug === void 0 ? void 0 : onDebug({
|
|
126
127
|
type: "table",
|