@mgarlik/datastore 0.1.4 → 0.1.8
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 +48 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -80
- package/dist/index.d.ts +130 -80
- package/dist/index.js +47 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,51 +1,137 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { D as DataStoreStorage } from './storage-D_xv8gFb.cjs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Definice zdroje popisující, odkud se mají data providera načítat.
|
|
10
|
-
*/
|
|
11
|
-
type ProviderDataSource = {
|
|
4
|
+
type ProviderDataSourceType = {
|
|
5
|
+
/**
|
|
6
|
+
* Adresa pro CRUD data
|
|
7
|
+
*/
|
|
12
8
|
uri?: string;
|
|
9
|
+
/**
|
|
10
|
+
* CRUD adresy - read, update, delete
|
|
11
|
+
*/
|
|
13
12
|
crud?: {
|
|
14
13
|
create?: string;
|
|
15
14
|
read?: string;
|
|
16
15
|
update?: string;
|
|
17
16
|
delete?: string;
|
|
18
|
-
updates?: {
|
|
19
|
-
[key: string]: string;
|
|
20
|
-
};
|
|
17
|
+
updates?: { [key: string]: string };
|
|
21
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Prime zadani pole dat
|
|
21
|
+
* */
|
|
22
22
|
data?: any[];
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Rozsireni dat - vsechny prijate polozky rozsiri o dane hodnoty
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
addData?: {}[];
|
|
28
|
+
/**
|
|
29
|
+
* Nacist vsechny pole bez ohledu na schema
|
|
30
|
+
*/
|
|
24
31
|
readAllFields?: boolean;
|
|
25
|
-
filter?:
|
|
32
|
+
filter?: FilterType$1;
|
|
33
|
+
/**
|
|
34
|
+
* Nazvy naslouchajicich socketu
|
|
35
|
+
*/
|
|
26
36
|
socketListeners?: string[];
|
|
27
|
-
params?: Record<string, any>;
|
|
28
|
-
select?: any;
|
|
29
|
-
file?: string;
|
|
30
37
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
type DataProviderActionType = "create" | "update" | "delete";
|
|
40
|
+
|
|
41
|
+
//TODO: Rule type
|
|
42
|
+
type RuleType = {};
|
|
43
|
+
|
|
44
|
+
//TODO: Filter type
|
|
45
|
+
type FilterType$1 = {};
|
|
46
|
+
|
|
47
|
+
type ProviderEditorType = {
|
|
48
|
+
title?: string;
|
|
49
|
+
/**
|
|
50
|
+
* TODO: Nevim k cemu to je
|
|
51
|
+
*/
|
|
52
|
+
edit?: {};
|
|
53
|
+
/**
|
|
54
|
+
* Seskupeni poli pri editaci
|
|
55
|
+
*/
|
|
56
|
+
groups?: { name?: string; items: string[]; description?: string }[];
|
|
57
|
+
summary?: {
|
|
58
|
+
icon: IconProps;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type ProviderSchemaItemType = {
|
|
63
|
+
/**
|
|
64
|
+
* Zdrojove pole pro hodnotu (např. "name" nebo "price"). Pokud není uvedeno, očekává se, že hodnota bude přímo v kořenovém objektu.
|
|
65
|
+
*/
|
|
66
|
+
source?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Výchozí hodnota pole, která se použije, pokud není poskytnuta žádná jiná hodnota. Může být typu string, number, boolean nebo jiného vhodného typu v závislosti na kontextu použití.
|
|
69
|
+
*/
|
|
70
|
+
default?: any;
|
|
71
|
+
/**
|
|
72
|
+
* Povolene hodnoty
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
enum?: any[];
|
|
76
|
+
/**
|
|
77
|
+
* Je pole vyžadováno pri editaci?
|
|
78
|
+
*/
|
|
79
|
+
required?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Je pole pri editaci viditelné?
|
|
82
|
+
*/
|
|
83
|
+
visibility?: "hidden" | "visible";
|
|
84
|
+
/**
|
|
85
|
+
* Polozku lze editovat
|
|
86
|
+
*/
|
|
87
|
+
editable?: boolean | RuleType;
|
|
88
|
+
type?: "string" | "number" | "date" | "boolean";
|
|
89
|
+
form?: "textInput" | "select" | "switch" | "dateTime" | "radio";
|
|
90
|
+
mode?: "screen";
|
|
91
|
+
title?: string;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
dataSource?: { dataProvider: ProviderTypes };
|
|
94
|
+
itemRules?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
/** TODO: Divna definice labelu */
|
|
97
|
+
optionKeys?: { value: string; label: LabelProps | { title: string; icon: string } };
|
|
98
|
+
validations?: ValidationType;
|
|
99
|
+
/**
|
|
100
|
+
* Text input nezobrazuje znaky
|
|
101
|
+
*/
|
|
102
|
+
secure?: boolean;
|
|
103
|
+
hidden?: boolean;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type DataProviderType = {
|
|
107
|
+
id: ProviderTypes; // Zrusit
|
|
108
|
+
dataSource?: ProviderDataSourceType;
|
|
109
|
+
/**
|
|
110
|
+
* Zustava v pameti i pokud ho nikdo nepouziva
|
|
111
|
+
*/
|
|
37
112
|
isPermanent?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Data se ukladaji do persistentni databaze. Nacitaji se pri inicializaci z persistentni databaze a ze serveru se zjistuji jen aktualizace
|
|
115
|
+
*/
|
|
38
116
|
isPersisting?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Provider na kterem zavisi prepocitani dat providera
|
|
119
|
+
*/
|
|
39
120
|
depend?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Vytvari polozky automaticky, nesynchronizuje (napr. pro docasne temp hodnoty)
|
|
123
|
+
*/
|
|
40
124
|
autoCreate?: boolean;
|
|
41
|
-
schema?:
|
|
42
|
-
editor?:
|
|
43
|
-
|
|
125
|
+
schema?: { [key: string]: ProviderSchemaItemType };
|
|
126
|
+
editor?: ProviderEditorType;
|
|
127
|
+
/**
|
|
128
|
+
* Jake akce jsou povolene pro dataSource. Pokud neni uvedeno, jsou povolene vsechny
|
|
129
|
+
*/
|
|
130
|
+
// actions?: string[]
|
|
131
|
+
actions?: DataProviderActionType[]; //
|
|
44
132
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
type DataProviders = Record<string, DataProvider>;
|
|
133
|
+
|
|
134
|
+
type DataProvidersType = Record<string, DataProviderType>;
|
|
49
135
|
|
|
50
136
|
/** Kanonický UUID řetězec používaný pro dokumenty a providery. */
|
|
51
137
|
type Uuid = string;
|
|
@@ -86,48 +172,6 @@ type DispatcherType = {
|
|
|
86
172
|
callback?: (data: JSONType) => void;
|
|
87
173
|
}[];
|
|
88
174
|
};
|
|
89
|
-
type SchemaTypeItem = {
|
|
90
|
-
/**
|
|
91
|
-
* Nazev zdrojoveho pole dat
|
|
92
|
-
*/
|
|
93
|
-
source?: string;
|
|
94
|
-
/**
|
|
95
|
-
* povolene hodnoty
|
|
96
|
-
*/
|
|
97
|
-
enum?: string[];
|
|
98
|
-
/**
|
|
99
|
-
* Je pole vyzadovano ?
|
|
100
|
-
*/
|
|
101
|
-
required?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Je pole vyditelne ?
|
|
104
|
-
*/
|
|
105
|
-
visibility?: "visible" | "hidden";
|
|
106
|
-
/**
|
|
107
|
-
* Lze pole editovat ?
|
|
108
|
-
*/
|
|
109
|
-
editable?: boolean;
|
|
110
|
-
type?: "string" | "number" | "boolean";
|
|
111
|
-
form?: "select" | "textInput" | "dateTime" | "radio";
|
|
112
|
-
mode?: "screen";
|
|
113
|
-
title?: string;
|
|
114
|
-
placeholder?: string;
|
|
115
|
-
description?: string;
|
|
116
|
-
dataSource?: {
|
|
117
|
-
dataProvider: string;
|
|
118
|
-
};
|
|
119
|
-
itemRules?: string;
|
|
120
|
-
options?: {
|
|
121
|
-
dataProvider: string;
|
|
122
|
-
};
|
|
123
|
-
validations?: {
|
|
124
|
-
required?: string;
|
|
125
|
-
pattern?: JSONType;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
type SchemaType = {
|
|
129
|
-
[key: string]: SchemaTypeItem;
|
|
130
|
-
};
|
|
131
175
|
/**
|
|
132
176
|
* Data Provider Filter
|
|
133
177
|
*/
|
|
@@ -158,7 +202,7 @@ type ProductFiltersType = {
|
|
|
158
202
|
};
|
|
159
203
|
interface DataStoreProps {
|
|
160
204
|
/** Předdefinovaní provideři dostupní pro registraci a hooky. */
|
|
161
|
-
providers:
|
|
205
|
+
providers: DataProvidersType;
|
|
162
206
|
/** Adresa REST/CRUD serveru */
|
|
163
207
|
restServer: string;
|
|
164
208
|
/** Socket.IO server používaný pro live aktualizace. */
|
|
@@ -184,14 +228,14 @@ interface DataStore {
|
|
|
184
228
|
dispatch: (action: DispatcherActionType, data: any, callback?: (data: JSONType) => void) => void;
|
|
185
229
|
initProvider: (id: string, data?: any) => Promise<any>;
|
|
186
230
|
/** Smaze data providera z databaze */
|
|
187
|
-
resetProvider: (id:
|
|
188
|
-
registerProvider: (provider:
|
|
231
|
+
resetProvider: (id: string) => Promise<void>;
|
|
232
|
+
registerProvider: (provider: DataProviderType) => Promise<any>;
|
|
189
233
|
unregisterProvider: (id: string) => Promise<void>;
|
|
190
234
|
updateProviderListeners: (id: string, val: number) => Promise<void>;
|
|
191
235
|
resetDataStore: () => Promise<void>;
|
|
192
236
|
counterProviders: Record<string, number>;
|
|
193
237
|
counterDocuments: Record<string, number>;
|
|
194
|
-
presetProviders: Record<
|
|
238
|
+
presetProviders: Record<string, DataProviderType>;
|
|
195
239
|
sockets: Record<string, SocketItem>;
|
|
196
240
|
isLive: boolean;
|
|
197
241
|
isSynchronizing: boolean;
|
|
@@ -251,7 +295,7 @@ declare const useDocuments: () => {
|
|
|
251
295
|
* @param {*} provider
|
|
252
296
|
* @returns
|
|
253
297
|
*/
|
|
254
|
-
declare const useProviderDocuments: (provider:
|
|
298
|
+
declare const useProviderDocuments: (provider: string, settings?: {
|
|
255
299
|
filter?: Record<string, any>;
|
|
256
300
|
documentId?: Uuid;
|
|
257
301
|
document?: Record<string, any>;
|
|
@@ -259,7 +303,7 @@ declare const useProviderDocuments: (provider: ProviderTypes, settings?: {
|
|
|
259
303
|
[key: string]: any;
|
|
260
304
|
};
|
|
261
305
|
/** Vrací surový stav providera podle provider id. */
|
|
262
|
-
declare const useProvider: (val:
|
|
306
|
+
declare const useProvider: (val: string) => any;
|
|
263
307
|
/** Kompletní DataStore - spojuje všechny sub-contexty. Komponenty s tímto hookem se přerenderují při jakékoliv změně stavu. */
|
|
264
308
|
declare const useDataStore: () => DataStore;
|
|
265
309
|
/**
|
|
@@ -332,9 +376,9 @@ declare const useDataProvider: (
|
|
|
332
376
|
/**
|
|
333
377
|
* Provider id nebo objekt data {key: value}
|
|
334
378
|
*/
|
|
335
|
-
id:
|
|
379
|
+
id: string | {
|
|
336
380
|
[key: string]: any;
|
|
337
|
-
},
|
|
381
|
+
} | false,
|
|
338
382
|
/**
|
|
339
383
|
* Parametry pro prerenderovani providera (profiles/<%= profileId %>)
|
|
340
384
|
*/
|
|
@@ -467,4 +511,10 @@ declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
|
467
511
|
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
468
512
|
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
469
513
|
|
|
470
|
-
|
|
514
|
+
/**
|
|
515
|
+
* Zobrazí obsah celé databáze v console.log
|
|
516
|
+
* Používá se pro debugging storage
|
|
517
|
+
*/
|
|
518
|
+
declare function logStorageContent(storage: DataStoreStorage): Promise<void>;
|
|
519
|
+
|
|
520
|
+
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, 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
|
@@ -1,51 +1,137 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { D as DataStoreStorage } from './storage-D_xv8gFb.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Definice zdroje popisující, odkud se mají data providera načítat.
|
|
10
|
-
*/
|
|
11
|
-
type ProviderDataSource = {
|
|
4
|
+
type ProviderDataSourceType = {
|
|
5
|
+
/**
|
|
6
|
+
* Adresa pro CRUD data
|
|
7
|
+
*/
|
|
12
8
|
uri?: string;
|
|
9
|
+
/**
|
|
10
|
+
* CRUD adresy - read, update, delete
|
|
11
|
+
*/
|
|
13
12
|
crud?: {
|
|
14
13
|
create?: string;
|
|
15
14
|
read?: string;
|
|
16
15
|
update?: string;
|
|
17
16
|
delete?: string;
|
|
18
|
-
updates?: {
|
|
19
|
-
[key: string]: string;
|
|
20
|
-
};
|
|
17
|
+
updates?: { [key: string]: string };
|
|
21
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Prime zadani pole dat
|
|
21
|
+
* */
|
|
22
22
|
data?: any[];
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Rozsireni dat - vsechny prijate polozky rozsiri o dane hodnoty
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
addData?: {}[];
|
|
28
|
+
/**
|
|
29
|
+
* Nacist vsechny pole bez ohledu na schema
|
|
30
|
+
*/
|
|
24
31
|
readAllFields?: boolean;
|
|
25
|
-
filter?:
|
|
32
|
+
filter?: FilterType$1;
|
|
33
|
+
/**
|
|
34
|
+
* Nazvy naslouchajicich socketu
|
|
35
|
+
*/
|
|
26
36
|
socketListeners?: string[];
|
|
27
|
-
params?: Record<string, any>;
|
|
28
|
-
select?: any;
|
|
29
|
-
file?: string;
|
|
30
37
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
type DataProviderActionType = "create" | "update" | "delete";
|
|
40
|
+
|
|
41
|
+
//TODO: Rule type
|
|
42
|
+
type RuleType = {};
|
|
43
|
+
|
|
44
|
+
//TODO: Filter type
|
|
45
|
+
type FilterType$1 = {};
|
|
46
|
+
|
|
47
|
+
type ProviderEditorType = {
|
|
48
|
+
title?: string;
|
|
49
|
+
/**
|
|
50
|
+
* TODO: Nevim k cemu to je
|
|
51
|
+
*/
|
|
52
|
+
edit?: {};
|
|
53
|
+
/**
|
|
54
|
+
* Seskupeni poli pri editaci
|
|
55
|
+
*/
|
|
56
|
+
groups?: { name?: string; items: string[]; description?: string }[];
|
|
57
|
+
summary?: {
|
|
58
|
+
icon: IconProps;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type ProviderSchemaItemType = {
|
|
63
|
+
/**
|
|
64
|
+
* Zdrojove pole pro hodnotu (např. "name" nebo "price"). Pokud není uvedeno, očekává se, že hodnota bude přímo v kořenovém objektu.
|
|
65
|
+
*/
|
|
66
|
+
source?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Výchozí hodnota pole, která se použije, pokud není poskytnuta žádná jiná hodnota. Může být typu string, number, boolean nebo jiného vhodného typu v závislosti na kontextu použití.
|
|
69
|
+
*/
|
|
70
|
+
default?: any;
|
|
71
|
+
/**
|
|
72
|
+
* Povolene hodnoty
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
enum?: any[];
|
|
76
|
+
/**
|
|
77
|
+
* Je pole vyžadováno pri editaci?
|
|
78
|
+
*/
|
|
79
|
+
required?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Je pole pri editaci viditelné?
|
|
82
|
+
*/
|
|
83
|
+
visibility?: "hidden" | "visible";
|
|
84
|
+
/**
|
|
85
|
+
* Polozku lze editovat
|
|
86
|
+
*/
|
|
87
|
+
editable?: boolean | RuleType;
|
|
88
|
+
type?: "string" | "number" | "date" | "boolean";
|
|
89
|
+
form?: "textInput" | "select" | "switch" | "dateTime" | "radio";
|
|
90
|
+
mode?: "screen";
|
|
91
|
+
title?: string;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
dataSource?: { dataProvider: ProviderTypes };
|
|
94
|
+
itemRules?: string;
|
|
95
|
+
description?: string;
|
|
96
|
+
/** TODO: Divna definice labelu */
|
|
97
|
+
optionKeys?: { value: string; label: LabelProps | { title: string; icon: string } };
|
|
98
|
+
validations?: ValidationType;
|
|
99
|
+
/**
|
|
100
|
+
* Text input nezobrazuje znaky
|
|
101
|
+
*/
|
|
102
|
+
secure?: boolean;
|
|
103
|
+
hidden?: boolean;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type DataProviderType = {
|
|
107
|
+
id: ProviderTypes; // Zrusit
|
|
108
|
+
dataSource?: ProviderDataSourceType;
|
|
109
|
+
/**
|
|
110
|
+
* Zustava v pameti i pokud ho nikdo nepouziva
|
|
111
|
+
*/
|
|
37
112
|
isPermanent?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Data se ukladaji do persistentni databaze. Nacitaji se pri inicializaci z persistentni databaze a ze serveru se zjistuji jen aktualizace
|
|
115
|
+
*/
|
|
38
116
|
isPersisting?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Provider na kterem zavisi prepocitani dat providera
|
|
119
|
+
*/
|
|
39
120
|
depend?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Vytvari polozky automaticky, nesynchronizuje (napr. pro docasne temp hodnoty)
|
|
123
|
+
*/
|
|
40
124
|
autoCreate?: boolean;
|
|
41
|
-
schema?:
|
|
42
|
-
editor?:
|
|
43
|
-
|
|
125
|
+
schema?: { [key: string]: ProviderSchemaItemType };
|
|
126
|
+
editor?: ProviderEditorType;
|
|
127
|
+
/**
|
|
128
|
+
* Jake akce jsou povolene pro dataSource. Pokud neni uvedeno, jsou povolene vsechny
|
|
129
|
+
*/
|
|
130
|
+
// actions?: string[]
|
|
131
|
+
actions?: DataProviderActionType[]; //
|
|
44
132
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
type DataProviders = Record<string, DataProvider>;
|
|
133
|
+
|
|
134
|
+
type DataProvidersType = Record<string, DataProviderType>;
|
|
49
135
|
|
|
50
136
|
/** Kanonický UUID řetězec používaný pro dokumenty a providery. */
|
|
51
137
|
type Uuid = string;
|
|
@@ -86,48 +172,6 @@ type DispatcherType = {
|
|
|
86
172
|
callback?: (data: JSONType) => void;
|
|
87
173
|
}[];
|
|
88
174
|
};
|
|
89
|
-
type SchemaTypeItem = {
|
|
90
|
-
/**
|
|
91
|
-
* Nazev zdrojoveho pole dat
|
|
92
|
-
*/
|
|
93
|
-
source?: string;
|
|
94
|
-
/**
|
|
95
|
-
* povolene hodnoty
|
|
96
|
-
*/
|
|
97
|
-
enum?: string[];
|
|
98
|
-
/**
|
|
99
|
-
* Je pole vyzadovano ?
|
|
100
|
-
*/
|
|
101
|
-
required?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Je pole vyditelne ?
|
|
104
|
-
*/
|
|
105
|
-
visibility?: "visible" | "hidden";
|
|
106
|
-
/**
|
|
107
|
-
* Lze pole editovat ?
|
|
108
|
-
*/
|
|
109
|
-
editable?: boolean;
|
|
110
|
-
type?: "string" | "number" | "boolean";
|
|
111
|
-
form?: "select" | "textInput" | "dateTime" | "radio";
|
|
112
|
-
mode?: "screen";
|
|
113
|
-
title?: string;
|
|
114
|
-
placeholder?: string;
|
|
115
|
-
description?: string;
|
|
116
|
-
dataSource?: {
|
|
117
|
-
dataProvider: string;
|
|
118
|
-
};
|
|
119
|
-
itemRules?: string;
|
|
120
|
-
options?: {
|
|
121
|
-
dataProvider: string;
|
|
122
|
-
};
|
|
123
|
-
validations?: {
|
|
124
|
-
required?: string;
|
|
125
|
-
pattern?: JSONType;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
type SchemaType = {
|
|
129
|
-
[key: string]: SchemaTypeItem;
|
|
130
|
-
};
|
|
131
175
|
/**
|
|
132
176
|
* Data Provider Filter
|
|
133
177
|
*/
|
|
@@ -158,7 +202,7 @@ type ProductFiltersType = {
|
|
|
158
202
|
};
|
|
159
203
|
interface DataStoreProps {
|
|
160
204
|
/** Předdefinovaní provideři dostupní pro registraci a hooky. */
|
|
161
|
-
providers:
|
|
205
|
+
providers: DataProvidersType;
|
|
162
206
|
/** Adresa REST/CRUD serveru */
|
|
163
207
|
restServer: string;
|
|
164
208
|
/** Socket.IO server používaný pro live aktualizace. */
|
|
@@ -184,14 +228,14 @@ interface DataStore {
|
|
|
184
228
|
dispatch: (action: DispatcherActionType, data: any, callback?: (data: JSONType) => void) => void;
|
|
185
229
|
initProvider: (id: string, data?: any) => Promise<any>;
|
|
186
230
|
/** Smaze data providera z databaze */
|
|
187
|
-
resetProvider: (id:
|
|
188
|
-
registerProvider: (provider:
|
|
231
|
+
resetProvider: (id: string) => Promise<void>;
|
|
232
|
+
registerProvider: (provider: DataProviderType) => Promise<any>;
|
|
189
233
|
unregisterProvider: (id: string) => Promise<void>;
|
|
190
234
|
updateProviderListeners: (id: string, val: number) => Promise<void>;
|
|
191
235
|
resetDataStore: () => Promise<void>;
|
|
192
236
|
counterProviders: Record<string, number>;
|
|
193
237
|
counterDocuments: Record<string, number>;
|
|
194
|
-
presetProviders: Record<
|
|
238
|
+
presetProviders: Record<string, DataProviderType>;
|
|
195
239
|
sockets: Record<string, SocketItem>;
|
|
196
240
|
isLive: boolean;
|
|
197
241
|
isSynchronizing: boolean;
|
|
@@ -251,7 +295,7 @@ declare const useDocuments: () => {
|
|
|
251
295
|
* @param {*} provider
|
|
252
296
|
* @returns
|
|
253
297
|
*/
|
|
254
|
-
declare const useProviderDocuments: (provider:
|
|
298
|
+
declare const useProviderDocuments: (provider: string, settings?: {
|
|
255
299
|
filter?: Record<string, any>;
|
|
256
300
|
documentId?: Uuid;
|
|
257
301
|
document?: Record<string, any>;
|
|
@@ -259,7 +303,7 @@ declare const useProviderDocuments: (provider: ProviderTypes, settings?: {
|
|
|
259
303
|
[key: string]: any;
|
|
260
304
|
};
|
|
261
305
|
/** Vrací surový stav providera podle provider id. */
|
|
262
|
-
declare const useProvider: (val:
|
|
306
|
+
declare const useProvider: (val: string) => any;
|
|
263
307
|
/** Kompletní DataStore - spojuje všechny sub-contexty. Komponenty s tímto hookem se přerenderují při jakékoliv změně stavu. */
|
|
264
308
|
declare const useDataStore: () => DataStore;
|
|
265
309
|
/**
|
|
@@ -332,9 +376,9 @@ declare const useDataProvider: (
|
|
|
332
376
|
/**
|
|
333
377
|
* Provider id nebo objekt data {key: value}
|
|
334
378
|
*/
|
|
335
|
-
id:
|
|
379
|
+
id: string | {
|
|
336
380
|
[key: string]: any;
|
|
337
|
-
},
|
|
381
|
+
} | false,
|
|
338
382
|
/**
|
|
339
383
|
* Parametry pro prerenderovani providera (profiles/<%= profileId %>)
|
|
340
384
|
*/
|
|
@@ -467,4 +511,10 @@ declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
|
467
511
|
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
468
512
|
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
469
513
|
|
|
470
|
-
|
|
514
|
+
/**
|
|
515
|
+
* Zobrazí obsah celé databáze v console.log
|
|
516
|
+
* Používá se pro debugging storage
|
|
517
|
+
*/
|
|
518
|
+
declare function logStorageContent(storage: DataStoreStorage): Promise<void>;
|
|
519
|
+
|
|
520
|
+
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, 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 };
|