@mgarlik/datastore 0.1.5 → 0.1.9
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.cjs +88 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -36
- package/dist/index.d.ts +11 -36
- package/dist/index.js +87 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -355,14 +355,14 @@ interface UseDataProviderResult {
|
|
|
355
355
|
data?: JSONType;
|
|
356
356
|
variant?: string;
|
|
357
357
|
documentId?: string;
|
|
358
|
-
}, callback?: (resp: JSONType) => void) =>
|
|
358
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
359
359
|
/** Smaže položku/položky providera. */
|
|
360
360
|
deleteItem: (args: {
|
|
361
361
|
params?: JSONType;
|
|
362
362
|
data?: JSONType;
|
|
363
|
-
}, callback?: (resp: JSONType) => void) =>
|
|
363
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
364
364
|
/** Vytvoří novou položku providera. */
|
|
365
|
-
createItem: (data: JSONType, callback?: () => void) =>
|
|
365
|
+
createItem: (data: JSONType, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Zaregistruje/zpřístupní providera a vrátí normalizované dokumenty spolu s CRUD helpery.
|
|
@@ -378,7 +378,7 @@ declare const useDataProvider: (
|
|
|
378
378
|
*/
|
|
379
379
|
id: string | {
|
|
380
380
|
[key: string]: any;
|
|
381
|
-
},
|
|
381
|
+
} | false,
|
|
382
382
|
/**
|
|
383
383
|
* Parametry pro prerenderovani providera (profiles/<%= profileId %>)
|
|
384
384
|
*/
|
|
@@ -439,14 +439,14 @@ interface UseProviderActionsResult {
|
|
|
439
439
|
data?: any;
|
|
440
440
|
variant?: string;
|
|
441
441
|
documentId?: Uuid;
|
|
442
|
-
}, callback?: (value: JSONType) => void) =>
|
|
442
|
+
}, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
443
443
|
/** Smaže položku/položky providera. */
|
|
444
444
|
deleteItem: (args: {
|
|
445
445
|
params: JSONType;
|
|
446
446
|
data?: JSONType;
|
|
447
|
-
}, callback?: () => void) =>
|
|
447
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
448
448
|
/** Vytvoří novou položku providera. */
|
|
449
|
-
createItem: (data: JSONType, callback?: (value: JSONType) => void) =>
|
|
449
|
+
createItem: (data: JSONType, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* Vrací action helpery pro známé provider id.
|
|
@@ -481,34 +481,9 @@ declare function uuid(): string;
|
|
|
481
481
|
declare function isUuid(val: string): boolean;
|
|
482
482
|
|
|
483
483
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* Green: \x1b[32m
|
|
487
|
-
*Yellow: \x1b[33m
|
|
488
|
-
* Blue: \x1b[34m
|
|
489
|
-
* Magenta: \x1b[35m
|
|
490
|
-
* Cyan: \x1b[36m
|
|
491
|
-
* White: \x1b[37m
|
|
484
|
+
* Zobrazí obsah celé databáze v console.log
|
|
485
|
+
* Používá se pro debugging storage
|
|
492
486
|
*/
|
|
493
|
-
declare
|
|
494
|
-
declare const COLOR_MAGENTA = "\u001B[35m%s\u001B[0m";
|
|
495
|
-
declare const COLOR_BLUE = "\u001B[34m%s\u001B[0m";
|
|
496
|
-
declare const COLOR_CYAN = "\u001B[36m%s\u001B[0m";
|
|
497
|
-
declare const COLOR_GREEN = "\u001B[32m%s\u001B[0m";
|
|
498
|
-
declare const COLOR_RED = "\u001B[31m%s\u001B[0m";
|
|
499
|
-
declare const COLOR_ERROR = "\u001B[31m%s\u001B[0m";
|
|
500
|
-
declare const COLOR_YELLOW = "\u001B[33m%s\u001B[0m";
|
|
501
|
-
declare const COLOR_ORANGE = "\u001B[38;5;208m%s\u001B[0m";
|
|
502
|
-
declare const COLOR_WARNING = "\u001B[33m%s\u001B[0m";
|
|
503
|
-
declare const COLOR_PROVIDER = "\u001B[35m%s\u001B[0m";
|
|
504
|
-
declare const COLOR_CONTEXT = "\u001B[35m%s\u001B[0m";
|
|
505
|
-
declare const COLOR_RENDER = "\u001B[34m%s\u001B[0m";
|
|
506
|
-
declare const COLOR_FUNCTION = "\u001B[36m%s\u001B[0m";
|
|
507
|
-
declare const COLOR_SCREEN = "\u001B[32m%s\u001B[0m";
|
|
508
|
-
declare const COLOR_SOCKET = "\u001B[36m%s\u001B[0m";
|
|
509
|
-
declare const COLOR_SOCKETS = "\u001B[33m%s\u001B[0m";
|
|
510
|
-
declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
511
|
-
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
512
|
-
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
487
|
+
declare function logStorageContent(storage: DataStoreStorage): Promise<void>;
|
|
513
488
|
|
|
514
|
-
export {
|
|
489
|
+
export { type DataProviderType, type DataProvidersType, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, type DataStoreRef, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderSchemaItemType, type SocketFilterItem, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, logStorageContent, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -355,14 +355,14 @@ interface UseDataProviderResult {
|
|
|
355
355
|
data?: JSONType;
|
|
356
356
|
variant?: string;
|
|
357
357
|
documentId?: string;
|
|
358
|
-
}, callback?: (resp: JSONType) => void) =>
|
|
358
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
359
359
|
/** Smaže položku/položky providera. */
|
|
360
360
|
deleteItem: (args: {
|
|
361
361
|
params?: JSONType;
|
|
362
362
|
data?: JSONType;
|
|
363
|
-
}, callback?: (resp: JSONType) => void) =>
|
|
363
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
364
364
|
/** Vytvoří novou položku providera. */
|
|
365
|
-
createItem: (data: JSONType, callback?: () => void) =>
|
|
365
|
+
createItem: (data: JSONType, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
368
368
|
* Zaregistruje/zpřístupní providera a vrátí normalizované dokumenty spolu s CRUD helpery.
|
|
@@ -378,7 +378,7 @@ declare const useDataProvider: (
|
|
|
378
378
|
*/
|
|
379
379
|
id: string | {
|
|
380
380
|
[key: string]: any;
|
|
381
|
-
},
|
|
381
|
+
} | false,
|
|
382
382
|
/**
|
|
383
383
|
* Parametry pro prerenderovani providera (profiles/<%= profileId %>)
|
|
384
384
|
*/
|
|
@@ -439,14 +439,14 @@ interface UseProviderActionsResult {
|
|
|
439
439
|
data?: any;
|
|
440
440
|
variant?: string;
|
|
441
441
|
documentId?: Uuid;
|
|
442
|
-
}, callback?: (value: JSONType) => void) =>
|
|
442
|
+
}, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
443
443
|
/** Smaže položku/položky providera. */
|
|
444
444
|
deleteItem: (args: {
|
|
445
445
|
params: JSONType;
|
|
446
446
|
data?: JSONType;
|
|
447
|
-
}, callback?: () => void) =>
|
|
447
|
+
}, callback?: (resp: JSONType) => void) => Promise<JSONType>;
|
|
448
448
|
/** Vytvoří novou položku providera. */
|
|
449
|
-
createItem: (data: JSONType, callback?: (value: JSONType) => void) =>
|
|
449
|
+
createItem: (data: JSONType, callback?: (value: JSONType) => void) => Promise<JSONType>;
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* Vrací action helpery pro známé provider id.
|
|
@@ -481,34 +481,9 @@ declare function uuid(): string;
|
|
|
481
481
|
declare function isUuid(val: string): boolean;
|
|
482
482
|
|
|
483
483
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* Green: \x1b[32m
|
|
487
|
-
*Yellow: \x1b[33m
|
|
488
|
-
* Blue: \x1b[34m
|
|
489
|
-
* Magenta: \x1b[35m
|
|
490
|
-
* Cyan: \x1b[36m
|
|
491
|
-
* White: \x1b[37m
|
|
484
|
+
* Zobrazí obsah celé databáze v console.log
|
|
485
|
+
* Používá se pro debugging storage
|
|
492
486
|
*/
|
|
493
|
-
declare
|
|
494
|
-
declare const COLOR_MAGENTA = "\u001B[35m%s\u001B[0m";
|
|
495
|
-
declare const COLOR_BLUE = "\u001B[34m%s\u001B[0m";
|
|
496
|
-
declare const COLOR_CYAN = "\u001B[36m%s\u001B[0m";
|
|
497
|
-
declare const COLOR_GREEN = "\u001B[32m%s\u001B[0m";
|
|
498
|
-
declare const COLOR_RED = "\u001B[31m%s\u001B[0m";
|
|
499
|
-
declare const COLOR_ERROR = "\u001B[31m%s\u001B[0m";
|
|
500
|
-
declare const COLOR_YELLOW = "\u001B[33m%s\u001B[0m";
|
|
501
|
-
declare const COLOR_ORANGE = "\u001B[38;5;208m%s\u001B[0m";
|
|
502
|
-
declare const COLOR_WARNING = "\u001B[33m%s\u001B[0m";
|
|
503
|
-
declare const COLOR_PROVIDER = "\u001B[35m%s\u001B[0m";
|
|
504
|
-
declare const COLOR_CONTEXT = "\u001B[35m%s\u001B[0m";
|
|
505
|
-
declare const COLOR_RENDER = "\u001B[34m%s\u001B[0m";
|
|
506
|
-
declare const COLOR_FUNCTION = "\u001B[36m%s\u001B[0m";
|
|
507
|
-
declare const COLOR_SCREEN = "\u001B[32m%s\u001B[0m";
|
|
508
|
-
declare const COLOR_SOCKET = "\u001B[36m%s\u001B[0m";
|
|
509
|
-
declare const COLOR_SOCKETS = "\u001B[33m%s\u001B[0m";
|
|
510
|
-
declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
511
|
-
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
512
|
-
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
487
|
+
declare function logStorageContent(storage: DataStoreStorage): Promise<void>;
|
|
513
488
|
|
|
514
|
-
export {
|
|
489
|
+
export { type DataProviderType, type DataProvidersType, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, type DataStoreRef, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderSchemaItemType, type SocketFilterItem, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, logStorageContent, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|
package/dist/index.js
CHANGED
|
@@ -755,7 +755,7 @@ var postData = async ({ dataSource, variant, schema, val }) => {
|
|
|
755
755
|
};
|
|
756
756
|
var patchData = async ({ dataSource, variant, data }) => {
|
|
757
757
|
try {
|
|
758
|
-
|
|
758
|
+
console.log("PATCH: ", buildUri({ dataSource, variant, method: "update" }), ", Data: ", JSON.stringify(data, null, 2));
|
|
759
759
|
const response = await axios.patch(buildUri({ dataSource, variant, method: "update" }), data);
|
|
760
760
|
response.data?.queryTime && systemLog("axios", "PATCH Server Query Time: ", response.data.queryTime);
|
|
761
761
|
systemLog("axios", "PATCH Response Data: ", response.data.data.length, " Bytes");
|
|
@@ -1106,7 +1106,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1106
1106
|
...socketServer?.params?.auth || {},
|
|
1107
1107
|
token: getSocketAuthToken()
|
|
1108
1108
|
};
|
|
1109
|
-
|
|
1109
|
+
console.log("PRIPOJUJI LIVE SOCKETS");
|
|
1110
1110
|
socket.connect();
|
|
1111
1111
|
}, [socket, socketServer?.params?.auth, getSocketAuthToken]);
|
|
1112
1112
|
const stopSockets = useCallback(() => {
|
|
@@ -1163,6 +1163,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1163
1163
|
const item = dispatcher.actions[0];
|
|
1164
1164
|
switch (item.action) {
|
|
1165
1165
|
case "registerProvider":
|
|
1166
|
+
console.log("[DSP] Dispatcher registerProvider", item.data);
|
|
1166
1167
|
await registerProvider(item.data);
|
|
1167
1168
|
break;
|
|
1168
1169
|
case "unregisterProvider":
|
|
@@ -1322,6 +1323,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1322
1323
|
systemLog("dsp", "[updateDocument]:", documentId, ", model:", model);
|
|
1323
1324
|
let data = pData;
|
|
1324
1325
|
if (typeof pData === "function") data = pData(documents[documentId]);
|
|
1326
|
+
const dataWithDocumentId = data && typeof data === "object" && !Array.isArray(data) ? { ...data, id: data.id ?? documentId } : { id: documentId };
|
|
1325
1327
|
if (fields) {
|
|
1326
1328
|
systemLog("dsp", "[updateDocument] Stahovani ", model, ", document: ", documentId, ", fields: ", fields);
|
|
1327
1329
|
systemLog("dsp", "[updateDocument] Providers: ", Object.keys(providers));
|
|
@@ -1341,6 +1343,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1341
1343
|
}
|
|
1342
1344
|
}
|
|
1343
1345
|
if (data) {
|
|
1346
|
+
console.log("[updateDocument]:", documentId, ", model:", model);
|
|
1344
1347
|
var listeningProviders = 0;
|
|
1345
1348
|
var isProvidersUpdated = false;
|
|
1346
1349
|
const rand = uuid();
|
|
@@ -1357,7 +1360,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1357
1360
|
var socketListeners = providerNext.dataSource?.socketListeners || [];
|
|
1358
1361
|
if (socketListeners.length === 0) {
|
|
1359
1362
|
if (providerNext.data.includes(documentId)) {
|
|
1360
|
-
if (!providerNext.dataSource?.filter || filterDocuments(
|
|
1363
|
+
if (!providerNext.dataSource?.filter || filterDocuments(dataWithDocumentId, providerNext.dataSource?.filter)) {
|
|
1361
1364
|
systemLog("dsp", "[updateDocument] - zustava v Provider bez Listeners:", key);
|
|
1362
1365
|
listeningProviders++;
|
|
1363
1366
|
providerNext.lastUpdate = {
|
|
@@ -1377,7 +1380,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1377
1380
|
}
|
|
1378
1381
|
} else if (socketListeners.includes(model) || // socketListeners.includes(documentId) ||
|
|
1379
1382
|
key === model) {
|
|
1380
|
-
if (!providerNext.dataSource.filter || filterDocuments(
|
|
1383
|
+
if (!providerNext.dataSource.filter || filterDocuments(dataWithDocumentId, providerNext.dataSource.filter)) {
|
|
1381
1384
|
listeningProviders++;
|
|
1382
1385
|
providerNext.lastUpdate = {
|
|
1383
1386
|
id: uuid(),
|
|
@@ -1417,12 +1420,12 @@ var DataStoreProvider = forwardRef(
|
|
|
1417
1420
|
console.timeEnd("[DSP UPDATE DOCUMENTS INSIDE]");
|
|
1418
1421
|
return {
|
|
1419
1422
|
...prev2,
|
|
1420
|
-
[documentId]: { ...prev2[documentId], ...
|
|
1423
|
+
[documentId]: { ...prev2[documentId], ...dataWithDocumentId }
|
|
1421
1424
|
};
|
|
1422
1425
|
}
|
|
1423
1426
|
} else if (listeningProviders > 0) {
|
|
1424
1427
|
console.timeEnd("[DSP UPDATE DOCUMENTS INSIDE]");
|
|
1425
|
-
return { ...prev2, [documentId]:
|
|
1428
|
+
return { ...prev2, [documentId]: dataWithDocumentId };
|
|
1426
1429
|
}
|
|
1427
1430
|
console.timeEnd("[DSP UPDATE DOCUMENTS INSIDE]");
|
|
1428
1431
|
return prev2;
|
|
@@ -1451,7 +1454,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1451
1454
|
await persistDocument({
|
|
1452
1455
|
documentId,
|
|
1453
1456
|
model,
|
|
1454
|
-
data: { ...documents[documentId], ...
|
|
1457
|
+
data: { ...documents[documentId], ...dataWithDocumentId }
|
|
1455
1458
|
});
|
|
1456
1459
|
} else {
|
|
1457
1460
|
await removePersistedDocument(documentId);
|
|
@@ -1505,13 +1508,13 @@ var DataStoreProvider = forwardRef(
|
|
|
1505
1508
|
}, [dispatch, updateDocument]);
|
|
1506
1509
|
const createDocument = useCallback(
|
|
1507
1510
|
async ({ model, documentId, data }) => {
|
|
1508
|
-
const newDocument = data;
|
|
1511
|
+
const newDocument = data && typeof data === "object" && !Array.isArray(data) ? { ...data, id: data.id ?? documentId } : { id: documentId };
|
|
1509
1512
|
console.log(`Registruji model ${model}, documentId ${documentId}, data: ${JSON.stringify(data)}`);
|
|
1510
1513
|
var providerListenersCount = 0;
|
|
1511
1514
|
Object.keys(providers).forEach((key) => {
|
|
1512
1515
|
const provider = providers[key];
|
|
1513
1516
|
var socketListeners = provider.dataSource?.socketListeners;
|
|
1514
|
-
if ((socketListeners?.includes(model) || key === model) && (!provider.dataSource?.filter || filterDocuments(
|
|
1517
|
+
if ((socketListeners?.includes(model) || key === model) && (!provider.dataSource?.filter || filterDocuments(newDocument, provider.dataSource?.filter))) {
|
|
1515
1518
|
if (!provider.data.includes(documentId)) {
|
|
1516
1519
|
setCounterDocuments((prev) => {
|
|
1517
1520
|
const newC = { ...prev };
|
|
@@ -1834,6 +1837,7 @@ var DataStoreProvider = forwardRef(
|
|
|
1834
1837
|
[id]: 1
|
|
1835
1838
|
}));
|
|
1836
1839
|
if (provider.dataSource?.socketListeners) {
|
|
1840
|
+
console.log("TATATATA");
|
|
1837
1841
|
registerProviderSockets(provider.dataSource.socketListeners, provider.dataSource.filter);
|
|
1838
1842
|
}
|
|
1839
1843
|
console.timeEnd(`[DSP] VYTVARENI PROVIDERA ${id}`);
|
|
@@ -1999,6 +2003,7 @@ var useDataProvider = (id, params, dataFilter, settings) => {
|
|
|
1999
2003
|
const prov = renderJSONTemplate(id, params ?? void 0);
|
|
2000
2004
|
setProviderId(prov.id);
|
|
2001
2005
|
retId = prov.id;
|
|
2006
|
+
console.log("Registruji z useDataProvider 1", prov.id);
|
|
2002
2007
|
dispatch("registerProvider", prov);
|
|
2003
2008
|
} else {
|
|
2004
2009
|
if (presetProviders[id]) {
|
|
@@ -2009,7 +2014,9 @@ var useDataProvider = (id, params, dataFilter, settings) => {
|
|
|
2009
2014
|
systemLog("usedp", "Provider:", prov.id, "existuje");
|
|
2010
2015
|
if (!currentProviders[prov.id]?.isPermanent) updateProviderListeners(prov.id, 1);
|
|
2011
2016
|
} else {
|
|
2012
|
-
|
|
2017
|
+
console.log("Params: ", params);
|
|
2018
|
+
console.log("Registruji z useDataProvider 2 - novy provider", prov.id);
|
|
2019
|
+
console.log(JSON.stringify(prov, null, 2));
|
|
2013
2020
|
dispatch("registerProvider", prov);
|
|
2014
2021
|
}
|
|
2015
2022
|
} else {
|
|
@@ -2031,14 +2038,32 @@ var useDataProvider = (id, params, dataFilter, settings) => {
|
|
|
2031
2038
|
};
|
|
2032
2039
|
const updateItem = ({ params: params2, data, variant, documentId = void 0 }, callback) => {
|
|
2033
2040
|
systemLog("usedp", "UPDATUJI:", providerId, ", variant:", variant, ", documentId: ", documentId, ", params:", params2, ", data:", data);
|
|
2034
|
-
|
|
2041
|
+
return new Promise((resolve, reject) => {
|
|
2042
|
+
const wrappedCallback = (result) => {
|
|
2043
|
+
callback?.(result);
|
|
2044
|
+
resolve(result);
|
|
2045
|
+
};
|
|
2046
|
+
dispatch("updateDataStore", { id: providerId, variant, params: params2, data, documentId }, wrappedCallback);
|
|
2047
|
+
});
|
|
2035
2048
|
};
|
|
2036
2049
|
const deleteItem = ({ params: params2, data }, callback) => {
|
|
2037
2050
|
systemLog("usedp", "DELETE FROM:", providerId, ", params:", params2, "data:", data);
|
|
2038
|
-
|
|
2051
|
+
return new Promise((resolve, reject) => {
|
|
2052
|
+
const wrappedCallback = (result) => {
|
|
2053
|
+
callback?.(result);
|
|
2054
|
+
resolve(result);
|
|
2055
|
+
};
|
|
2056
|
+
dispatch("deleteProviderItem", { providerId, data, params: params2 }, wrappedCallback);
|
|
2057
|
+
});
|
|
2039
2058
|
};
|
|
2040
2059
|
const createItem = (data, callback) => {
|
|
2041
|
-
|
|
2060
|
+
return new Promise((resolve, reject) => {
|
|
2061
|
+
const wrappedCallback = (result) => {
|
|
2062
|
+
callback?.(result);
|
|
2063
|
+
resolve(result);
|
|
2064
|
+
};
|
|
2065
|
+
dispatch("createProviderItem", { id, data }, wrappedCallback);
|
|
2066
|
+
});
|
|
2042
2067
|
};
|
|
2043
2068
|
const provider = useMemo2(() => {
|
|
2044
2069
|
systemLog("usedp", "Vytvoreni dat: ", filter);
|
|
@@ -2160,14 +2185,32 @@ var useProviderActions = (providerId, data) => {
|
|
|
2160
2185
|
dispatch("updateDataStore", { id: providerId, data: val });
|
|
2161
2186
|
};
|
|
2162
2187
|
const updateItem = ({ params, data: data2, variant, documentId = void 0 }, callback) => {
|
|
2163
|
-
|
|
2188
|
+
return new Promise((resolve, reject) => {
|
|
2189
|
+
const wrappedCallback = (result) => {
|
|
2190
|
+
callback?.(result);
|
|
2191
|
+
resolve(result);
|
|
2192
|
+
};
|
|
2193
|
+
dispatch("updateDataStore", { id: providerId, variant, params, data: data2, documentId }, wrappedCallback);
|
|
2194
|
+
});
|
|
2164
2195
|
};
|
|
2165
2196
|
const deleteItem = ({ params, data: data2 }, callback) => {
|
|
2166
|
-
|
|
2197
|
+
return new Promise((resolve, reject) => {
|
|
2198
|
+
const wrappedCallback = (result) => {
|
|
2199
|
+
callback?.(result);
|
|
2200
|
+
resolve(result);
|
|
2201
|
+
};
|
|
2202
|
+
dispatch("deleteProviderItem", { providerId, data: data2, params }, wrappedCallback);
|
|
2203
|
+
});
|
|
2167
2204
|
};
|
|
2168
2205
|
const createItem = (data2, callback) => {
|
|
2169
2206
|
systemLog("usedp", "createItem Prov. id:", providerId);
|
|
2170
|
-
|
|
2207
|
+
return new Promise((resolve, reject) => {
|
|
2208
|
+
const wrappedCallback = (result) => {
|
|
2209
|
+
callback?.(result);
|
|
2210
|
+
resolve(result);
|
|
2211
|
+
};
|
|
2212
|
+
dispatch("createProviderItem", { id: providerId, data: data2 }, wrappedCallback);
|
|
2213
|
+
});
|
|
2171
2214
|
};
|
|
2172
2215
|
return {
|
|
2173
2216
|
schema: providers[providerId]?.schema,
|
|
@@ -2178,48 +2221,34 @@ var useProviderActions = (providerId, data) => {
|
|
|
2178
2221
|
};
|
|
2179
2222
|
};
|
|
2180
2223
|
|
|
2181
|
-
// src/
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2224
|
+
// src/debugStorage.ts
|
|
2225
|
+
async function logStorageContent(storage) {
|
|
2226
|
+
try {
|
|
2227
|
+
systemLog("debug", "=== STORAGE CONTENT ===");
|
|
2228
|
+
if ("getTables" in storage) {
|
|
2229
|
+
const tablesResult = await storage.getTables();
|
|
2230
|
+
console.log("\u{1F4CA} TABULKY V DATAB\xC1ZI:", tablesResult);
|
|
2231
|
+
for (const table of tablesResult) {
|
|
2232
|
+
const tableName = table.name;
|
|
2233
|
+
try {
|
|
2234
|
+
const content = await storage.read(`SELECT * FROM '${tableName}'`);
|
|
2235
|
+
console.log(`
|
|
2236
|
+
\u{1F4CB} TABULKA: ${tableName}`);
|
|
2237
|
+
console.log(` Po\u010Det \u0159\xE1dk\u016F: ${content.length}`);
|
|
2238
|
+
console.log(content);
|
|
2239
|
+
} catch (error) {
|
|
2240
|
+
console.error(` Chyba p\u0159i \u010Dten\xED tabulky ${tableName}:`, error);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
} else {
|
|
2244
|
+
console.log("Storage neimplementuje getTables()");
|
|
2245
|
+
}
|
|
2246
|
+
systemLog("debug", "=== KONEC STORAGE CONTENT ===");
|
|
2247
|
+
} catch (error) {
|
|
2248
|
+
console.error("Chyba p\u0159i loggingu storage obsahu:", error);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2202
2251
|
export {
|
|
2203
|
-
COLOR_APP,
|
|
2204
|
-
COLOR_AXIOS,
|
|
2205
|
-
COLOR_BLUE,
|
|
2206
|
-
COLOR_CONTEXT,
|
|
2207
|
-
COLOR_CYAN,
|
|
2208
|
-
COLOR_DS,
|
|
2209
|
-
COLOR_ERROR,
|
|
2210
|
-
COLOR_FUNCTION,
|
|
2211
|
-
COLOR_GREEN,
|
|
2212
|
-
COLOR_MAGENTA,
|
|
2213
|
-
COLOR_ORANGE,
|
|
2214
|
-
COLOR_PROVIDER,
|
|
2215
|
-
COLOR_RED,
|
|
2216
|
-
COLOR_RENDER,
|
|
2217
|
-
COLOR_SCREEN,
|
|
2218
|
-
COLOR_SOCKET,
|
|
2219
|
-
COLOR_SOCKETS,
|
|
2220
|
-
COLOR_WARNING,
|
|
2221
|
-
COLOR_WHITE,
|
|
2222
|
-
COLOR_YELLOW,
|
|
2223
2252
|
DataStoreActionsContext,
|
|
2224
2253
|
DataStoreContext,
|
|
2225
2254
|
DataStoreDocumentsContext,
|
|
@@ -2233,6 +2262,7 @@ export {
|
|
|
2233
2262
|
filterDocumentsAsync,
|
|
2234
2263
|
getValueByRules,
|
|
2235
2264
|
isUuid,
|
|
2265
|
+
logStorageContent,
|
|
2236
2266
|
recalculateObjectWithDocument,
|
|
2237
2267
|
useDataProvider,
|
|
2238
2268
|
useDataStore,
|