@webiny/app-utils 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e
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/README.md +6 -13
- package/features/List/FilterFeature.d.ts +11 -0
- package/features/List/FilterFeature.js +26 -0
- package/features/List/FilterFeature.js.map +1 -0
- package/features/List/ListQueryParamsRepository.d.ts +18 -0
- package/features/List/ListQueryParamsRepository.js +68 -0
- package/features/List/ListQueryParamsRepository.js.map +1 -0
- package/features/List/LoadMoreFeature.d.ts +13 -0
- package/features/List/LoadMoreFeature.js +28 -0
- package/features/List/LoadMoreFeature.js.map +1 -0
- package/features/List/LoadingRepository.d.ts +15 -0
- package/features/List/LoadingRepository.js +48 -0
- package/features/List/LoadingRepository.js.map +1 -0
- package/features/List/SearchFeature.d.ts +10 -0
- package/features/List/SearchFeature.js +20 -0
- package/features/List/SearchFeature.js.map +1 -0
- package/features/List/SortFeature.d.ts +10 -0
- package/features/List/SortFeature.js +23 -0
- package/features/List/SortFeature.js.map +1 -0
- package/features/List/abstractions.d.ts +73 -0
- package/features/List/abstractions.js +11 -0
- package/features/List/abstractions.js.map +1 -0
- package/features/List/feature.d.ts +8 -0
- package/features/List/feature.js +30 -0
- package/features/List/feature.js.map +1 -0
- package/fta/Domain/Models/Meta/Meta.js +17 -16
- package/fta/Domain/Models/Meta/Meta.js.map +1 -1
- package/fta/Domain/Models/Meta/MetaMapper.d.ts +1 -1
- package/fta/Domain/Models/Meta/MetaMapper.js +9 -8
- package/fta/Domain/Models/Meta/MetaMapper.js.map +1 -1
- package/fta/Domain/Models/Meta/index.d.ts +2 -2
- package/fta/Domain/Models/Meta/index.js +2 -4
- package/fta/Domain/Models/Sorting/Sorting.js +9 -8
- package/fta/Domain/Models/Sorting/Sorting.js.map +1 -1
- package/fta/Domain/Models/Sorting/SortingMapper.d.ts +1 -1
- package/fta/Domain/Models/Sorting/SortingMapper.js +27 -40
- package/fta/Domain/Models/Sorting/SortingMapper.js.map +1 -1
- package/fta/Domain/Models/Sorting/index.d.ts +2 -2
- package/fta/Domain/Models/Sorting/index.js +2 -4
- package/fta/Domain/Models/index.d.ts +2 -2
- package/fta/Domain/Models/index.js +2 -4
- package/fta/Domain/Repositories/Loading/ILoadingRepository.d.ts +1 -0
- package/fta/Domain/Repositories/Loading/ILoadingRepository.js +0 -3
- package/fta/Domain/Repositories/Loading/LoadingRepository.d.ts +1 -1
- package/fta/Domain/Repositories/Loading/LoadingRepository.js +39 -29
- package/fta/Domain/Repositories/Loading/LoadingRepository.js.map +1 -1
- package/fta/Domain/Repositories/Loading/LoadingRepositoryFactory.d.ts +1 -1
- package/fta/Domain/Repositories/Loading/LoadingRepositoryFactory.js +14 -13
- package/fta/Domain/Repositories/Loading/LoadingRepositoryFactory.js.map +1 -1
- package/fta/Domain/Repositories/Loading/index.d.ts +3 -3
- package/fta/Domain/Repositories/Loading/index.js +2 -5
- package/fta/Domain/Repositories/Meta/IMetaRepository.d.ts +1 -1
- package/fta/Domain/Repositories/Meta/IMetaRepository.js +0 -3
- package/fta/Domain/Repositories/Meta/MetaRepository.d.ts +2 -2
- package/fta/Domain/Repositories/Meta/MetaRepository.js +33 -39
- package/fta/Domain/Repositories/Meta/MetaRepository.js.map +1 -1
- package/fta/Domain/Repositories/Meta/MetaRepositoryFactory.d.ts +1 -1
- package/fta/Domain/Repositories/Meta/MetaRepositoryFactory.js +14 -13
- package/fta/Domain/Repositories/Meta/MetaRepositoryFactory.js.map +1 -1
- package/fta/Domain/Repositories/Meta/index.d.ts +3 -3
- package/fta/Domain/Repositories/Meta/index.js +2 -5
- package/fta/Domain/Repositories/Sorting/ISortingRepository.d.ts +1 -1
- package/fta/Domain/Repositories/Sorting/ISortingRepository.js +0 -3
- package/fta/Domain/Repositories/Sorting/SortingRepository.d.ts +2 -2
- package/fta/Domain/Repositories/Sorting/SortingRepository.js +12 -11
- package/fta/Domain/Repositories/Sorting/SortingRepository.js.map +1 -1
- package/fta/Domain/Repositories/Sorting/SortingRepositoryFactory.d.ts +1 -1
- package/fta/Domain/Repositories/Sorting/SortingRepositoryFactory.js +14 -13
- package/fta/Domain/Repositories/Sorting/SortingRepositoryFactory.js.map +1 -1
- package/fta/Domain/Repositories/Sorting/index.d.ts +3 -3
- package/fta/Domain/Repositories/Sorting/index.js +2 -5
- package/fta/Domain/Repositories/index.d.ts +3 -3
- package/fta/Domain/Repositories/index.js +3 -5
- package/fta/Domain/index.d.ts +2 -2
- package/fta/Domain/index.js +2 -4
- package/fta/index.d.ts +1 -1
- package/fta/index.js +1 -3
- package/index.d.ts +1 -1
- package/index.js +1 -3
- package/package.json +15 -13
- package/fta/Domain/Models/Meta/index.js.map +0 -1
- package/fta/Domain/Models/Sorting/index.js.map +0 -1
- package/fta/Domain/Models/index.js.map +0 -1
- package/fta/Domain/Repositories/Loading/ILoadingRepository.js.map +0 -1
- package/fta/Domain/Repositories/Loading/index.js.map +0 -1
- package/fta/Domain/Repositories/Meta/IMetaRepository.js.map +0 -1
- package/fta/Domain/Repositories/Meta/index.js.map +0 -1
- package/fta/Domain/Repositories/Sorting/ISortingRepository.js.map +0 -1
- package/fta/Domain/Repositories/Sorting/index.js.map +0 -1
- package/fta/Domain/Repositories/index.js.map +0 -1
- package/fta/Domain/index.js.map +0 -1
- package/fta/index.js.map +0 -1
- package/index.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
class Sorting {
|
|
2
|
+
constructor(sorting){
|
|
3
|
+
this.field = sorting.field;
|
|
4
|
+
this.order = sorting.order;
|
|
5
|
+
}
|
|
6
|
+
static create(sorting) {
|
|
7
|
+
return new Sorting(sorting);
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
|
+
export { Sorting };
|
|
10
11
|
|
|
11
12
|
//# sourceMappingURL=Sorting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Models/Sorting/Sorting.js","sources":["../../../../../src/fta/Domain/Models/Sorting/Sorting.ts"],"sourcesContent":["export interface SortingDTO {\n field: string;\n order: \"asc\" | \"desc\";\n}\n\nexport class Sorting {\n public field: string;\n public order: \"asc\" | \"desc\";\n\n protected constructor(sorting: SortingDTO) {\n this.field = sorting.field;\n this.order = sorting.order;\n }\n\n static create(sorting: SortingDTO) {\n return new Sorting(sorting);\n }\n}\n"],"names":["Sorting","sorting"],"mappings":"AAKO,MAAMA;IAIT,YAAsBC,OAAmB,CAAE;QACvC,IAAI,CAAC,KAAK,GAAGA,QAAQ,KAAK;QAC1B,IAAI,CAAC,KAAK,GAAGA,QAAQ,KAAK;IAC9B;IAEA,OAAO,OAAOA,OAAmB,EAAE;QAC/B,OAAO,IAAID,QAAQC;IACvB;AACJ"}
|
|
@@ -1,44 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
id: field,
|
|
29
|
-
desc: order === "desc"
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
static fromDTOtoDb(data) {
|
|
33
|
-
const {
|
|
34
|
-
field,
|
|
35
|
-
order
|
|
36
|
-
} = data;
|
|
37
|
-
if (order === "asc") {
|
|
38
|
-
return `${field}_ASC`;
|
|
1
|
+
class SortingMapper {
|
|
2
|
+
static toDTO(data) {
|
|
3
|
+
const { field, order } = data;
|
|
4
|
+
return {
|
|
5
|
+
field,
|
|
6
|
+
order
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
static fromColumnToDTO(data) {
|
|
10
|
+
const { id, desc } = data;
|
|
11
|
+
return {
|
|
12
|
+
field: id,
|
|
13
|
+
order: desc ? "desc" : "asc"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static fromDTOtoColumn(data) {
|
|
17
|
+
const { field, order } = data;
|
|
18
|
+
return {
|
|
19
|
+
id: field,
|
|
20
|
+
desc: "desc" === order
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
static fromDTOtoDb(data) {
|
|
24
|
+
const { field, order } = data;
|
|
25
|
+
if ("asc" === order) return `${field}_ASC`;
|
|
26
|
+
return `${field}_DESC`;
|
|
39
27
|
}
|
|
40
|
-
return `${field}_DESC`;
|
|
41
|
-
}
|
|
42
28
|
}
|
|
29
|
+
export { SortingMapper };
|
|
43
30
|
|
|
44
31
|
//# sourceMappingURL=SortingMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Models/Sorting/SortingMapper.js","sources":["../../../../../src/fta/Domain/Models/Sorting/SortingMapper.ts"],"sourcesContent":["import type { Sorting, SortingDTO } from \"./Sorting.js\";\n\nexport type DbSorting = `${string}_ASC` | `${string}_DESC`;\n\nexport interface ColumnSorting {\n id: string;\n desc: boolean;\n}\n\nexport class SortingMapper {\n static toDTO(data: Sorting | SortingDTO): SortingDTO {\n const { field, order } = data;\n\n return {\n field,\n order\n };\n }\n\n static fromColumnToDTO(data: ColumnSorting): SortingDTO {\n const { id, desc } = data;\n\n return {\n field: id,\n order: desc ? \"desc\" : \"asc\"\n };\n }\n\n static fromDTOtoColumn(data: SortingDTO): ColumnSorting {\n const { field, order } = data;\n\n return {\n id: field,\n desc: order === \"desc\"\n };\n }\n\n static fromDTOtoDb(data: SortingDTO): DbSorting {\n const { field, order } = data;\n\n if (order === \"asc\") {\n return `${field}_ASC`;\n }\n\n return `${field}_DESC`;\n }\n}\n"],"names":["SortingMapper","data","field","order","id","desc"],"mappings":"AASO,MAAMA;IACT,OAAO,MAAMC,IAA0B,EAAc;QACjD,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QAEzB,OAAO;YACHC;YACAC;QACJ;IACJ;IAEA,OAAO,gBAAgBF,IAAmB,EAAc;QACpD,MAAM,EAAEG,EAAE,EAAEC,IAAI,EAAE,GAAGJ;QAErB,OAAO;YACH,OAAOG;YACP,OAAOC,OAAO,SAAS;QAC3B;IACJ;IAEA,OAAO,gBAAgBJ,IAAgB,EAAiB;QACpD,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QAEzB,OAAO;YACH,IAAIC;YACJ,MAAMC,AAAU,WAAVA;QACV;IACJ;IAEA,OAAO,YAAYF,IAAgB,EAAa;QAC5C,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;QAEzB,IAAIE,AAAU,UAAVA,OACA,OAAO,GAAGD,MAAM,IAAI,CAAC;QAGzB,OAAO,GAAGA,MAAM,KAAK,CAAC;IAC1B;AACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Sorting";
|
|
2
|
-
export * from "./SortingMapper";
|
|
1
|
+
export * from "./Sorting.js";
|
|
2
|
+
export * from "./SortingMapper.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Meta";
|
|
2
|
-
export * from "./Sorting";
|
|
1
|
+
export * from "./Meta/index.js";
|
|
2
|
+
export * from "./Sorting/index.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface ILoadingRepository {
|
|
2
2
|
get: () => Record<string, boolean>;
|
|
3
3
|
set: (action: string, isLoading?: boolean) => Promise<void>;
|
|
4
|
+
getActiveLoadings(): string[];
|
|
4
5
|
runCallBack: <T>(callback: Promise<T>, action: string) => Promise<T>;
|
|
5
6
|
isLoading: (action: string) => boolean;
|
|
6
7
|
hasLoading: () => boolean;
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
import { makeAutoObservable } from "mobx";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
class LoadingRepository {
|
|
3
|
+
constructor(){
|
|
4
|
+
this.loadings = new Map();
|
|
5
|
+
makeAutoObservable(this);
|
|
6
|
+
}
|
|
7
|
+
get() {
|
|
8
|
+
return Object.fromEntries(this.loadings);
|
|
9
|
+
}
|
|
10
|
+
getActiveLoadings() {
|
|
11
|
+
return [
|
|
12
|
+
...this.loadings.entries()
|
|
13
|
+
].filter(([, value])=>value).map(([key])=>key);
|
|
14
|
+
}
|
|
15
|
+
hasLoading() {
|
|
16
|
+
return [
|
|
17
|
+
...this.loadings.values()
|
|
18
|
+
].some(Boolean);
|
|
19
|
+
}
|
|
20
|
+
isLoading(action) {
|
|
21
|
+
return this.loadings.get(action) ?? false;
|
|
22
|
+
}
|
|
23
|
+
isEmpty() {
|
|
24
|
+
return 0 === this.loadings.size;
|
|
25
|
+
}
|
|
26
|
+
async set(action, isLoading = true) {
|
|
27
|
+
this.loadings.set(action, isLoading);
|
|
28
|
+
}
|
|
29
|
+
async runCallBack(callback, action) {
|
|
30
|
+
await this.set(action, true);
|
|
31
|
+
try {
|
|
32
|
+
const result = await callback;
|
|
33
|
+
await this.set(action, false);
|
|
34
|
+
return result;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
await this.set(action, false);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
}
|
|
41
|
+
export { LoadingRepository };
|
|
32
42
|
|
|
33
43
|
//# sourceMappingURL=LoadingRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Repositories/Loading/LoadingRepository.js","sources":["../../../../../src/fta/Domain/Repositories/Loading/LoadingRepository.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { ILoadingRepository } from \"./ILoadingRepository.js\";\n\nexport class LoadingRepository implements ILoadingRepository {\n private loadings: Map<string, boolean>;\n\n constructor() {\n this.loadings = new Map();\n makeAutoObservable(this);\n }\n\n get() {\n return Object.fromEntries(this.loadings);\n }\n\n getActiveLoadings(): string[] {\n return [...this.loadings.entries()].filter(([, value]) => value).map(([key]) => key);\n }\n\n hasLoading() {\n return [...this.loadings.values()].some(Boolean);\n }\n\n isLoading(action: string) {\n return this.loadings.get(action) ?? false;\n }\n\n isEmpty() {\n return this.loadings.size === 0;\n }\n\n async set(action: string, isLoading = true) {\n this.loadings.set(action, isLoading);\n }\n\n async runCallBack(callback: Promise<any>, action: string) {\n await this.set(action, true);\n try {\n const result = await callback;\n await this.set(action, false);\n return result;\n } catch (error) {\n await this.set(action, false);\n throw error;\n }\n }\n}\n"],"names":["LoadingRepository","Map","makeAutoObservable","Object","value","key","Boolean","action","isLoading","callback","result","error"],"mappings":";AAGO,MAAMA;IAGT,aAAc;QACV,IAAI,CAAC,QAAQ,GAAG,IAAIC;QACpBC,mBAAmB,IAAI;IAC3B;IAEA,MAAM;QACF,OAAOC,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ;IAC3C;IAEA,oBAA8B;QAC1B,OAAO;eAAI,IAAI,CAAC,QAAQ,CAAC,OAAO;SAAG,CAAC,MAAM,CAAC,CAAC,GAAGC,MAAM,GAAKA,OAAO,GAAG,CAAC,CAAC,CAACC,IAAI,GAAKA;IACpF;IAEA,aAAa;QACT,OAAO;eAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;SAAG,CAAC,IAAI,CAACC;IAC5C;IAEA,UAAUC,MAAc,EAAE;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,WAAW;IACxC;IAEA,UAAU;QACN,OAAO,AAAuB,MAAvB,IAAI,CAAC,QAAQ,CAAC,IAAI;IAC7B;IAEA,MAAM,IAAIA,MAAc,EAAEC,YAAY,IAAI,EAAE;QACxC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACD,QAAQC;IAC9B;IAEA,MAAM,YAAYC,QAAsB,EAAEF,MAAc,EAAE;QACtD,MAAM,IAAI,CAAC,GAAG,CAACA,QAAQ;QACvB,IAAI;YACA,MAAMG,SAAS,MAAMD;YACrB,MAAM,IAAI,CAAC,GAAG,CAACF,QAAQ;YACvB,OAAOG;QACX,EAAE,OAAOC,OAAO;YACZ,MAAM,IAAI,CAAC,GAAG,CAACJ,QAAQ;YACvB,MAAMI;QACV;IACJ;AACJ"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { LoadingRepository } from "./LoadingRepository";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { LoadingRepository } from "./LoadingRepository.js";
|
|
2
|
+
class LoadingRepositoryFactory {
|
|
3
|
+
getRepository(namespace) {
|
|
4
|
+
const cacheKey = this.getCacheKey(namespace);
|
|
5
|
+
if (!this.cache.has(cacheKey)) this.cache.set(cacheKey, new LoadingRepository());
|
|
6
|
+
return this.cache.get(cacheKey);
|
|
7
|
+
}
|
|
8
|
+
getCacheKey(namespace) {
|
|
9
|
+
return namespace ?? Date.now().toString();
|
|
10
|
+
}
|
|
11
|
+
constructor(){
|
|
12
|
+
this.cache = new Map();
|
|
8
13
|
}
|
|
9
|
-
return this.cache.get(cacheKey);
|
|
10
|
-
}
|
|
11
|
-
getCacheKey(namespace) {
|
|
12
|
-
return namespace ?? Date.now().toString();
|
|
13
|
-
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const loadingRepositoryFactory = new LoadingRepositoryFactory();
|
|
16
|
+
export { LoadingRepositoryFactory, loadingRepositoryFactory };
|
|
16
17
|
|
|
17
18
|
//# sourceMappingURL=LoadingRepositoryFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Repositories/Loading/LoadingRepositoryFactory.js","sources":["../../../../../src/fta/Domain/Repositories/Loading/LoadingRepositoryFactory.ts"],"sourcesContent":["import { LoadingRepository } from \"./LoadingRepository.js\";\n\nexport class LoadingRepositoryFactory {\n private cache: Map<string, LoadingRepository> = new Map();\n\n getRepository(namespace?: string) {\n const cacheKey = this.getCacheKey(namespace);\n\n if (!this.cache.has(cacheKey)) {\n this.cache.set(cacheKey, new LoadingRepository());\n }\n\n return this.cache.get(cacheKey) as LoadingRepository;\n }\n\n private getCacheKey(namespace?: string) {\n return namespace ?? Date.now().toString();\n }\n}\n\nexport const loadingRepositoryFactory = new LoadingRepositoryFactory();\n"],"names":["LoadingRepositoryFactory","namespace","cacheKey","LoadingRepository","Date","Map","loadingRepositoryFactory"],"mappings":";AAEO,MAAMA;IAGT,cAAcC,SAAkB,EAAE;QAC9B,MAAMC,WAAW,IAAI,CAAC,WAAW,CAACD;QAElC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAACC,WAChB,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,UAAU,IAAIC;QAGjC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACD;IAC1B;IAEQ,YAAYD,SAAkB,EAAE;QACpC,OAAOA,aAAaG,KAAK,GAAG,GAAG,QAAQ;IAC3C;;aAdQ,KAAK,GAAmC,IAAIC;;AAexD;AAEO,MAAMC,2BAA2B,IAAIN"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./ILoadingRepository";
|
|
2
|
-
export * from "./LoadingRepository";
|
|
3
|
-
export * from "./LoadingRepositoryFactory";
|
|
1
|
+
export type * from "./ILoadingRepository.js";
|
|
2
|
+
export * from "./LoadingRepository.js";
|
|
3
|
+
export * from "./LoadingRepositoryFactory.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IMetaRepository } from "./IMetaRepository";
|
|
2
|
-
import type { MetaDTO } from "
|
|
1
|
+
import type { IMetaRepository } from "./IMetaRepository.js";
|
|
2
|
+
import type { MetaDTO } from "../../../../fta/Domain/Models/Meta/index.js";
|
|
3
3
|
export declare class MetaRepository implements IMetaRepository {
|
|
4
4
|
private meta;
|
|
5
5
|
constructor();
|
|
@@ -1,44 +1,38 @@
|
|
|
1
1
|
import { makeAutoObservable, runInAction } from "mobx";
|
|
2
2
|
import { decodeCursor, encodeCursor } from "@webiny/utils";
|
|
3
|
-
import { Meta, MetaMapper } from "../../Models/Meta";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Update the meta with the new totalCount and cursor
|
|
36
|
-
return await this.set({
|
|
37
|
-
...current,
|
|
38
|
-
totalCount,
|
|
39
|
-
cursor
|
|
40
|
-
});
|
|
41
|
-
}
|
|
3
|
+
import { Meta, MetaMapper } from "../../Models/Meta/index.js";
|
|
4
|
+
class MetaRepository {
|
|
5
|
+
constructor(){
|
|
6
|
+
this.meta = Meta.createEmpty();
|
|
7
|
+
makeAutoObservable(this);
|
|
8
|
+
}
|
|
9
|
+
async set(meta) {
|
|
10
|
+
runInAction(()=>{
|
|
11
|
+
this.meta = Meta.create(meta);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
get() {
|
|
15
|
+
return MetaMapper.toDto(this.meta);
|
|
16
|
+
}
|
|
17
|
+
async decreaseTotalCount(count = 1) {
|
|
18
|
+
return await this.updateMetaOnColumnDeltaChange(-count);
|
|
19
|
+
}
|
|
20
|
+
async increaseTotalCount(count = 1) {
|
|
21
|
+
return await this.updateMetaOnColumnDeltaChange(count);
|
|
22
|
+
}
|
|
23
|
+
async updateMetaOnColumnDeltaChange(countDelta) {
|
|
24
|
+
const current = this.get();
|
|
25
|
+
const totalCount = current.totalCount + countDelta;
|
|
26
|
+
const cursorDecoded = decodeCursor(current.cursor);
|
|
27
|
+
const newCursorDecoded = String(Number(cursorDecoded) + countDelta);
|
|
28
|
+
const cursor = encodeCursor(newCursorDecoded);
|
|
29
|
+
return await this.set({
|
|
30
|
+
...current,
|
|
31
|
+
totalCount,
|
|
32
|
+
cursor
|
|
33
|
+
});
|
|
34
|
+
}
|
|
42
35
|
}
|
|
36
|
+
export { MetaRepository };
|
|
43
37
|
|
|
44
38
|
//# sourceMappingURL=MetaRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Repositories/Meta/MetaRepository.js","sources":["../../../../../src/fta/Domain/Repositories/Meta/MetaRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { decodeCursor, encodeCursor } from \"@webiny/utils\";\nimport type { IMetaRepository } from \"./IMetaRepository.js\";\nimport type { MetaDTO } from \"~/fta/Domain/Models/Meta/index.js\";\nimport { Meta, MetaMapper } from \"~/fta/Domain/Models/Meta/index.js\";\n\nexport class MetaRepository implements IMetaRepository {\n private meta: Meta;\n\n constructor() {\n this.meta = Meta.createEmpty();\n makeAutoObservable(this);\n }\n\n async set(meta: MetaDTO) {\n runInAction(() => {\n this.meta = Meta.create(meta);\n });\n }\n\n get() {\n return MetaMapper.toDto(this.meta);\n }\n\n async decreaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(-count);\n }\n\n async increaseTotalCount(count = 1) {\n return await this.updateMetaOnColumnDeltaChange(count);\n }\n\n private async updateMetaOnColumnDeltaChange(countDelta: number) {\n // Retrieve the current meta\n const current = this.get();\n\n // Calculate the new totalCount based on the delta change\n const totalCount = current.totalCount + countDelta;\n\n // Calculate the new cursor position based on the delta change\n const cursorDecoded = decodeCursor(current.cursor);\n const newCursorDecoded = String(Number(cursorDecoded) + countDelta);\n const cursor = encodeCursor(newCursorDecoded);\n\n // Update the meta with the new totalCount and cursor\n return await this.set({ ...current, totalCount, cursor });\n }\n}\n"],"names":["MetaRepository","Meta","makeAutoObservable","meta","runInAction","MetaMapper","count","countDelta","current","totalCount","cursorDecoded","decodeCursor","newCursorDecoded","String","Number","cursor","encodeCursor"],"mappings":";;;AAMO,MAAMA;IAGT,aAAc;QACV,IAAI,CAAC,IAAI,GAAGC,KAAK,WAAW;QAC5BC,mBAAmB,IAAI;IAC3B;IAEA,MAAM,IAAIC,IAAa,EAAE;QACrBC,YAAY;YACR,IAAI,CAAC,IAAI,GAAGH,KAAK,MAAM,CAACE;QAC5B;IACJ;IAEA,MAAM;QACF,OAAOE,WAAW,KAAK,CAAC,IAAI,CAAC,IAAI;IACrC;IAEA,MAAM,mBAAmBC,QAAQ,CAAC,EAAE;QAChC,OAAO,MAAM,IAAI,CAAC,6BAA6B,CAAC,CAACA;IACrD;IAEA,MAAM,mBAAmBA,QAAQ,CAAC,EAAE;QAChC,OAAO,MAAM,IAAI,CAAC,6BAA6B,CAACA;IACpD;IAEA,MAAc,8BAA8BC,UAAkB,EAAE;QAE5D,MAAMC,UAAU,IAAI,CAAC,GAAG;QAGxB,MAAMC,aAAaD,QAAQ,UAAU,GAAGD;QAGxC,MAAMG,gBAAgBC,aAAaH,QAAQ,MAAM;QACjD,MAAMI,mBAAmBC,OAAOC,OAAOJ,iBAAiBH;QACxD,MAAMQ,SAASC,aAAaJ;QAG5B,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC;YAAE,GAAGJ,OAAO;YAAEC;YAAYM;QAAO;IAC3D;AACJ"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { MetaRepository } from "./MetaRepository";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { MetaRepository } from "./MetaRepository.js";
|
|
2
|
+
class MetaRepositoryFactory {
|
|
3
|
+
getRepository(namespace) {
|
|
4
|
+
const cacheKey = this.getCacheKey(namespace);
|
|
5
|
+
if (!this.cache.has(cacheKey)) this.cache.set(cacheKey, new MetaRepository());
|
|
6
|
+
return this.cache.get(cacheKey);
|
|
7
|
+
}
|
|
8
|
+
getCacheKey(namespace) {
|
|
9
|
+
return namespace ?? Date.now().toString();
|
|
10
|
+
}
|
|
11
|
+
constructor(){
|
|
12
|
+
this.cache = new Map();
|
|
8
13
|
}
|
|
9
|
-
return this.cache.get(cacheKey);
|
|
10
|
-
}
|
|
11
|
-
getCacheKey(namespace) {
|
|
12
|
-
return namespace ?? Date.now().toString();
|
|
13
|
-
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const metaRepositoryFactory = new MetaRepositoryFactory();
|
|
16
|
+
export { MetaRepositoryFactory, metaRepositoryFactory };
|
|
16
17
|
|
|
17
18
|
//# sourceMappingURL=MetaRepositoryFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Repositories/Meta/MetaRepositoryFactory.js","sources":["../../../../../src/fta/Domain/Repositories/Meta/MetaRepositoryFactory.ts"],"sourcesContent":["import { MetaRepository } from \"./MetaRepository.js\";\n\nexport class MetaRepositoryFactory {\n private cache: Map<string, MetaRepository> = new Map();\n\n getRepository(namespace?: string) {\n const cacheKey = this.getCacheKey(namespace);\n\n if (!this.cache.has(cacheKey)) {\n this.cache.set(cacheKey, new MetaRepository());\n }\n\n return this.cache.get(cacheKey) as MetaRepository;\n }\n\n private getCacheKey(namespace?: string) {\n return namespace ?? Date.now().toString();\n }\n}\n\nexport const metaRepositoryFactory = new MetaRepositoryFactory();\n"],"names":["MetaRepositoryFactory","namespace","cacheKey","MetaRepository","Date","Map","metaRepositoryFactory"],"mappings":";AAEO,MAAMA;IAGT,cAAcC,SAAkB,EAAE;QAC9B,MAAMC,WAAW,IAAI,CAAC,WAAW,CAACD;QAElC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAACC,WAChB,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,UAAU,IAAIC;QAGjC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACD;IAC1B;IAEQ,YAAYD,SAAkB,EAAE;QACpC,OAAOA,aAAaG,KAAK,GAAG,GAAG,QAAQ;IAC3C;;aAdQ,KAAK,GAAgC,IAAIC;;AAerD;AAEO,MAAMC,wBAAwB,IAAIN"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./IMetaRepository";
|
|
2
|
-
export * from "./MetaRepository";
|
|
3
|
-
export * from "./MetaRepositoryFactory";
|
|
1
|
+
export type * from "./IMetaRepository.js";
|
|
2
|
+
export * from "./MetaRepository.js";
|
|
3
|
+
export * from "./MetaRepositoryFactory.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ISortingRepository } from "./ISortingRepository";
|
|
2
|
-
import type { Sorting } from "
|
|
1
|
+
import type { ISortingRepository } from "./ISortingRepository.js";
|
|
2
|
+
import type { Sorting } from "../../../../fta/Domain/Models/index.js";
|
|
3
3
|
export declare class SortingRepository implements ISortingRepository {
|
|
4
4
|
private sorting;
|
|
5
5
|
constructor();
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { makeAutoObservable } from "mobx";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
class SortingRepository {
|
|
3
|
+
constructor(){
|
|
4
|
+
this.sorting = [];
|
|
5
|
+
makeAutoObservable(this);
|
|
6
|
+
}
|
|
7
|
+
get() {
|
|
8
|
+
return this.sorting;
|
|
9
|
+
}
|
|
10
|
+
async set(sorts) {
|
|
11
|
+
this.sorting = sorts;
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
|
+
export { SortingRepository };
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=SortingRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fta/Domain/Repositories/Sorting/SortingRepository.js","sources":["../../../../../src/fta/Domain/Repositories/Sorting/SortingRepository.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { ISortingRepository } from \"./ISortingRepository.js\";\nimport type { Sorting } from \"~/fta/Domain/Models/index.js\";\n\nexport class SortingRepository implements ISortingRepository {\n private sorting: Sorting[] = [];\n\n constructor() {\n makeAutoObservable(this);\n }\n\n get() {\n return this.sorting;\n }\n\n async set(sorts: Sorting[]) {\n this.sorting = sorts;\n }\n}\n"],"names":["SortingRepository","makeAutoObservable","sorts"],"mappings":";AAIO,MAAMA;IAGT,aAAc;aAFN,OAAO,GAAc,EAAE;QAG3BC,mBAAmB,IAAI;IAC3B;IAEA,MAAM;QACF,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,MAAM,IAAIC,KAAgB,EAAE;QACxB,IAAI,CAAC,OAAO,GAAGA;IACnB;AACJ"}
|