prostgles-client 4.0.188 → 4.0.190
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 -5
- 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;;CA6NN,CAAC"}
|
package/dist/getDbHandler.js
CHANGED
|
@@ -15,14 +15,14 @@ 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
|
-
const dboTable =
|
|
23
|
+
const dboTable = {};
|
|
24
24
|
allowedCommands
|
|
25
|
-
.sort((a, b) =>
|
|
25
|
+
.sort((a, b) => subscribeCommands.includes(a) - subscribeCommands.includes(b))
|
|
26
26
|
.forEach((command) => {
|
|
27
27
|
if (command === "sync") {
|
|
28
28
|
dboTable._syncInfo = { ...methods[command] };
|
|
@@ -96,7 +96,7 @@ const getDBO = ({ schema, tableSchema, onDebug, syncedTable, syncHandler, subscr
|
|
|
96
96
|
return syncHandler.addSync({ tableName, command, param1, param2 }, syncHandles);
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
else if (
|
|
99
|
+
else if (subscribeCommands.includes(command)) {
|
|
100
100
|
const subFunc = async function (param1 = {}, param2 = {}, onChange, onError) {
|
|
101
101
|
await (onDebug === null || onDebug === void 0 ? void 0 : onDebug({
|
|
102
102
|
type: "table",
|
|
@@ -120,7 +120,7 @@ const getDBO = ({ schema, tableSchema, onDebug, syncedTable, syncHandler, subscr
|
|
|
120
120
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
121
121
|
(0, prostgles_1.useSubscribe)(subFunc, command === SUBONE, filter, options);
|
|
122
122
|
}
|
|
123
|
-
if (command === SUBONE || !
|
|
123
|
+
if (command === SUBONE || !subscribeCommands.includes(SUBONE)) {
|
|
124
124
|
dboTable[SUBONE] = async function (param1, param2, onChange, onError) {
|
|
125
125
|
await (onDebug === null || onDebug === void 0 ? void 0 : onDebug({
|
|
126
126
|
type: "table",
|