@lls/store 24.7.0 → 24.8.0-02f7e82f
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/lib/index.js +123 -47
- package/package.json +6 -8
package/lib/index.js
CHANGED
|
@@ -750,12 +750,12 @@ init_define_import_meta();
|
|
|
750
750
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
751
751
|
import { useMemo } from "react";
|
|
752
752
|
import { useSelector } from "react-redux";
|
|
753
|
-
var crud = (entityName, { search:
|
|
753
|
+
var crud = (entityName, { search: search31 }) => {
|
|
754
754
|
const getElements = makeGetAllEntities(entityName);
|
|
755
755
|
const makeSearchElements = () => createSearchSelector(
|
|
756
756
|
makeGetAllEntities(entityName),
|
|
757
757
|
(_state, params) => params,
|
|
758
|
-
(elements, params) =>
|
|
758
|
+
(elements, params) => search31(params)(elements)
|
|
759
759
|
);
|
|
760
760
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
761
761
|
const getElementById = makeGetEntityById(entityName);
|
|
@@ -765,7 +765,7 @@ var crud = (entityName, { search: search30 }) => {
|
|
|
765
765
|
[`search${methodName}`]: makeSearchElements(),
|
|
766
766
|
[`get${methodName.replace(/s$/, "")}`]: getElementById,
|
|
767
767
|
[`makeSearch${methodName}`]: makeSearchElements,
|
|
768
|
-
[`filter${methodName}`]:
|
|
768
|
+
[`filter${methodName}`]: search31,
|
|
769
769
|
[`useSearch${methodName}`]: useSearch
|
|
770
770
|
};
|
|
771
771
|
return back;
|
|
@@ -990,10 +990,23 @@ var useSearchCopyNotifications = makeUseSearch(makeSearchCopyNotifications);
|
|
|
990
990
|
// src/selectors/document.ts
|
|
991
991
|
init_define_import_meta();
|
|
992
992
|
import { makeEntitiesFilter as makeEntitiesFilter8 } from "@lls/utils";
|
|
993
|
-
var search10 = ({
|
|
993
|
+
var search10 = ({
|
|
994
|
+
ids,
|
|
995
|
+
uuids,
|
|
996
|
+
resourceIds,
|
|
997
|
+
levelIds,
|
|
998
|
+
formats,
|
|
999
|
+
documentTypes,
|
|
1000
|
+
subDocumentTypes
|
|
1001
|
+
}) => {
|
|
994
1002
|
return makeEntitiesFilter8({
|
|
995
1003
|
id: ids,
|
|
996
|
-
resourceId: resourceIds
|
|
1004
|
+
resourceId: resourceIds,
|
|
1005
|
+
levels: levelIds,
|
|
1006
|
+
uuidV2: uuids,
|
|
1007
|
+
format: formats,
|
|
1008
|
+
documentType: documentTypes,
|
|
1009
|
+
subDocumentType: subDocumentTypes
|
|
997
1010
|
});
|
|
998
1011
|
};
|
|
999
1012
|
var { useSearchDocuments } = crud("documents", {
|
|
@@ -1045,9 +1058,22 @@ var getUserGroups = (0, import_reselect2.createSelector)(
|
|
|
1045
1058
|
// src/selectors/level.ts
|
|
1046
1059
|
init_define_import_meta();
|
|
1047
1060
|
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1048
|
-
import { makeEntitiesFilter as
|
|
1061
|
+
import { createSearchSelector as createSearchSelector5, makeEntitiesFilter as makeEntitiesFilter12, makeGetAllEntities as makeGetAllEntities5 } from "@lls/utils";
|
|
1049
1062
|
import _10 from "lodash/fp.js";
|
|
1050
|
-
|
|
1063
|
+
|
|
1064
|
+
// src/selectors/schoolType.ts
|
|
1065
|
+
init_define_import_meta();
|
|
1066
|
+
import { makeEntitiesFilter as makeEntitiesFilter11 } from "@lls/utils";
|
|
1067
|
+
var search14 = ({ slugs }) => makeEntitiesFilter11({ slug: slugs });
|
|
1068
|
+
var { getSchoolTypes, getSchoolType, useSearchSchoolTypes, makeSearchSchoolTypes, searchSchoolTypes } = crud(
|
|
1069
|
+
"schoolTypes",
|
|
1070
|
+
{
|
|
1071
|
+
search: search14
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
|
|
1075
|
+
// src/selectors/level.ts
|
|
1076
|
+
var search15 = ({
|
|
1051
1077
|
ids,
|
|
1052
1078
|
slugs,
|
|
1053
1079
|
isPreSchool,
|
|
@@ -1055,9 +1081,10 @@ var search14 = ({
|
|
|
1055
1081
|
isHighSchool,
|
|
1056
1082
|
isProHighSchool,
|
|
1057
1083
|
isGenHighSchool,
|
|
1058
|
-
isElementarySchool
|
|
1084
|
+
isElementarySchool,
|
|
1085
|
+
schoolTypes
|
|
1059
1086
|
}) => _10.flow(
|
|
1060
|
-
|
|
1087
|
+
makeEntitiesFilter12({
|
|
1061
1088
|
id: ids,
|
|
1062
1089
|
slug: slugs,
|
|
1063
1090
|
isPreSchool,
|
|
@@ -1065,35 +1092,49 @@ var search14 = ({
|
|
|
1065
1092
|
isHighSchool,
|
|
1066
1093
|
isProHighSchool,
|
|
1067
1094
|
isGenHighSchool,
|
|
1068
|
-
isElementarySchool
|
|
1095
|
+
isElementarySchool,
|
|
1096
|
+
schoolTypes
|
|
1069
1097
|
}),
|
|
1070
1098
|
_10.orderBy("order", "desc")
|
|
1071
1099
|
);
|
|
1072
|
-
var
|
|
1073
|
-
|
|
1074
|
-
|
|
1100
|
+
var makeSearchLevels = () => {
|
|
1101
|
+
const searchSchoolTypes2 = makeSearchSchoolTypes();
|
|
1102
|
+
return createSearchSelector5(
|
|
1103
|
+
makeGetAllEntities5("levels"),
|
|
1104
|
+
(state, { schoolTypes }) => schoolTypes ? searchSchoolTypes2(state, { slugs: schoolTypes }) : void 0,
|
|
1105
|
+
(_state, params) => params,
|
|
1106
|
+
(levels, schoolTypes, params) => search15({ ...params, schoolTypes: schoolTypes?.length ? schoolTypes?.map(({ id }) => id) : void 0 })(levels)
|
|
1107
|
+
);
|
|
1108
|
+
};
|
|
1109
|
+
var crudLevels = crud("levels", { search: search15 });
|
|
1110
|
+
var { getLevel, searchLevels } = crudLevels;
|
|
1111
|
+
var getLevels = (0, import_reselect3.createSelector)(
|
|
1112
|
+
crudLevels.getLevels,
|
|
1113
|
+
_10.orderBy("order", "desc")
|
|
1114
|
+
);
|
|
1115
|
+
var useSearchLevels = makeUseSearch(makeSearchLevels);
|
|
1075
1116
|
|
|
1076
1117
|
// src/selectors/mainNotification.ts
|
|
1077
1118
|
init_define_import_meta();
|
|
1078
1119
|
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1079
|
-
import { makeEntitiesFilter as
|
|
1120
|
+
import { makeEntitiesFilter as makeEntitiesFilter13, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1080
1121
|
import _11 from "lodash/fp.js";
|
|
1081
|
-
var
|
|
1122
|
+
var search16 = ({ ids }) => makeEntitiesFilter13({ id: ids });
|
|
1082
1123
|
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1083
|
-
[_11.flow(makeGetCurrentUser(), _11.get("mainNotifications")),
|
|
1084
|
-
(userNotifications, notifications) =>
|
|
1124
|
+
[_11.flow(makeGetCurrentUser(), _11.get("mainNotifications")), makeGetAllEntities6("mainNotifications")],
|
|
1125
|
+
(userNotifications, notifications) => search16({ ids: userNotifications })(notifications)
|
|
1085
1126
|
);
|
|
1086
1127
|
|
|
1087
1128
|
// src/selectors/news.ts
|
|
1088
1129
|
init_define_import_meta();
|
|
1089
|
-
import { makeEntitiesFilter as
|
|
1090
|
-
var
|
|
1130
|
+
import { makeEntitiesFilter as makeEntitiesFilter14 } from "@lls/utils";
|
|
1131
|
+
var search17 = ({ ids }) => makeEntitiesFilter14({ id: ids });
|
|
1091
1132
|
var {
|
|
1092
1133
|
getNews: getAllNews,
|
|
1093
1134
|
getNew: getNews,
|
|
1094
1135
|
useSearchNews
|
|
1095
1136
|
} = crud("news", {
|
|
1096
|
-
search:
|
|
1137
|
+
search: search17
|
|
1097
1138
|
});
|
|
1098
1139
|
|
|
1099
1140
|
// src/selectors/panorama.ts
|
|
@@ -1103,26 +1144,26 @@ var getPanorama = makeGetEntityById3("panoramas");
|
|
|
1103
1144
|
|
|
1104
1145
|
// src/selectors/premiumResource.ts
|
|
1105
1146
|
init_define_import_meta();
|
|
1106
|
-
import { makeEntitiesFilter as
|
|
1107
|
-
var
|
|
1147
|
+
import { makeEntitiesFilter as makeEntitiesFilter15 } from "@lls/utils";
|
|
1148
|
+
var search18 = ({ bookIds }) => makeEntitiesFilter15({ book: bookIds });
|
|
1108
1149
|
var { getPremiumResources, getPremiumResource, useSearchPremiumResources } = crud("premiumResources", {
|
|
1109
|
-
search:
|
|
1150
|
+
search: search18
|
|
1110
1151
|
});
|
|
1111
1152
|
|
|
1112
1153
|
// src/selectors/lexicalFlower.ts
|
|
1113
1154
|
init_define_import_meta();
|
|
1114
|
-
import { makeEntitiesFilter as
|
|
1115
|
-
var
|
|
1155
|
+
import { makeEntitiesFilter as makeEntitiesFilter16 } from "@lls/utils";
|
|
1156
|
+
var search19 = ({ ids }) => makeEntitiesFilter16({ id: ids });
|
|
1116
1157
|
var { getLexicalFlowers, useSearchLexicalFlowers } = crud("lexicalFlowers", {
|
|
1117
|
-
search:
|
|
1158
|
+
search: search19
|
|
1118
1159
|
});
|
|
1119
1160
|
|
|
1120
1161
|
// src/selectors/product.ts
|
|
1121
1162
|
init_define_import_meta();
|
|
1122
1163
|
import _12 from "lodash/fp.js";
|
|
1123
|
-
import { createSearchSelector as
|
|
1124
|
-
var getProducts =
|
|
1125
|
-
var
|
|
1164
|
+
import { createSearchSelector as createSearchSelector6, makeEntitiesFilter as makeEntitiesFilter17, makeGetAllEntities as makeGetAllEntities7 } from "@lls/utils";
|
|
1165
|
+
var getProducts = makeGetAllEntities7("products");
|
|
1166
|
+
var search20 = ({
|
|
1126
1167
|
ids,
|
|
1127
1168
|
eans,
|
|
1128
1169
|
isAdoptant,
|
|
@@ -1132,7 +1173,7 @@ var search19 = ({
|
|
|
1132
1173
|
productTypes
|
|
1133
1174
|
}) => {
|
|
1134
1175
|
let bookIds;
|
|
1135
|
-
const filter =
|
|
1176
|
+
const filter = makeEntitiesFilter17(
|
|
1136
1177
|
{
|
|
1137
1178
|
id: ids,
|
|
1138
1179
|
ean: eans,
|
|
@@ -1149,36 +1190,28 @@ var search19 = ({
|
|
|
1149
1190
|
};
|
|
1150
1191
|
var makeSearchProducts = () => {
|
|
1151
1192
|
const searchBooks = makeSearchBooks();
|
|
1152
|
-
return
|
|
1153
|
-
|
|
1193
|
+
return createSearchSelector6(
|
|
1194
|
+
makeGetAllEntities7("products"),
|
|
1154
1195
|
(state, { levelIds, subjectIds }) => searchBooks(state, { levelIds, subjectIds }),
|
|
1155
1196
|
(_state, params) => params,
|
|
1156
|
-
(products, books, params) =>
|
|
1197
|
+
(products, books, params) => search20(params)(products, books)
|
|
1157
1198
|
);
|
|
1158
1199
|
};
|
|
1159
1200
|
var useSearchProducts = makeUseSearch(makeSearchProducts);
|
|
1160
1201
|
|
|
1161
1202
|
// src/selectors/resource.ts
|
|
1162
1203
|
init_define_import_meta();
|
|
1163
|
-
import { makeEntitiesFilter as
|
|
1164
|
-
var
|
|
1204
|
+
import { makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
|
|
1205
|
+
var search21 = ({ chapterIds }) => makeEntitiesFilter18({
|
|
1165
1206
|
chapter: chapterIds
|
|
1166
1207
|
});
|
|
1167
1208
|
var { getResources, getResource, useSearchResources } = crud("resources", {
|
|
1168
|
-
search: search20
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
// src/selectors/schoolType.ts
|
|
1172
|
-
init_define_import_meta();
|
|
1173
|
-
import { makeEntitiesFilter as makeEntitiesFilter18 } from "@lls/utils";
|
|
1174
|
-
var search21 = ({ slugs }) => makeEntitiesFilter18({ slug: slugs });
|
|
1175
|
-
var { getSchoolTypes, getSchoolType, useSearchSchoolTypes, makeSearchSchoolTypes } = crud("schoolTypes", {
|
|
1176
1209
|
search: search21
|
|
1177
1210
|
});
|
|
1178
1211
|
|
|
1179
1212
|
// src/selectors/sharedPage.ts
|
|
1180
1213
|
init_define_import_meta();
|
|
1181
|
-
import { createSearchSelector as
|
|
1214
|
+
import { createSearchSelector as createSearchSelector7, makeEntitiesFilter as makeEntitiesFilter19 } from "@lls/utils";
|
|
1182
1215
|
import _13 from "lodash/fp.js";
|
|
1183
1216
|
var search22 = ({
|
|
1184
1217
|
parentIds,
|
|
@@ -1198,7 +1231,7 @@ var search22 = ({
|
|
|
1198
1231
|
var { getSharedPages, getSharedPage, useSearchSharedPages } = crud("sharedPages", {
|
|
1199
1232
|
search: search22
|
|
1200
1233
|
});
|
|
1201
|
-
var makeSearchCurrentUserSharedPages = () =>
|
|
1234
|
+
var makeSearchCurrentUserSharedPages = () => createSearchSelector7(
|
|
1202
1235
|
getCurrentUser,
|
|
1203
1236
|
getSharedPages,
|
|
1204
1237
|
(__, params) => params,
|
|
@@ -1302,6 +1335,28 @@ var { getCirconscriptions } = crud("circonscriptions", {
|
|
|
1302
1335
|
search: search29
|
|
1303
1336
|
});
|
|
1304
1337
|
|
|
1338
|
+
// src/selectors/documentType.ts
|
|
1339
|
+
init_define_import_meta();
|
|
1340
|
+
import { makeEntitiesFilter as makeEntitiesFilter26 } from "@lls/utils";
|
|
1341
|
+
var search30 = ({ ids }) => {
|
|
1342
|
+
return makeEntitiesFilter26({
|
|
1343
|
+
id: ids
|
|
1344
|
+
});
|
|
1345
|
+
};
|
|
1346
|
+
var searchSubDocumentType = ({
|
|
1347
|
+
ids
|
|
1348
|
+
}) => {
|
|
1349
|
+
return makeEntitiesFilter26({
|
|
1350
|
+
id: ids
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
var { getSubDocumentTypes, useSearchSubDocumentTypes } = crud("subDocumentTypes", {
|
|
1354
|
+
search: searchSubDocumentType
|
|
1355
|
+
});
|
|
1356
|
+
var { getDocumentTypes, getDocumentType, useSearchDocumentTypes } = crud("documentTypes", {
|
|
1357
|
+
search: search30
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1305
1360
|
// src/reducers/entities.ts
|
|
1306
1361
|
init_define_import_meta();
|
|
1307
1362
|
import { makeReducer } from "@lls/utils";
|
|
@@ -1412,7 +1467,9 @@ var auth_default = auth;
|
|
|
1412
1467
|
init_define_import_meta();
|
|
1413
1468
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1414
1469
|
import _18 from "lodash/fp.js";
|
|
1415
|
-
var document = new import_normalizr.schema.Entity("documents"
|
|
1470
|
+
var document = new import_normalizr.schema.Entity("documents");
|
|
1471
|
+
var documentType = new import_normalizr.schema.Entity("documentTypes");
|
|
1472
|
+
var subDocumentType = new import_normalizr.schema.Entity("subDocumentTypes");
|
|
1416
1473
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1417
1474
|
var level = new import_normalizr.schema.Entity("levels");
|
|
1418
1475
|
var book = new import_normalizr.schema.Entity("books");
|
|
@@ -1471,8 +1528,14 @@ var garDivisionSchema = define(garDivision, {
|
|
|
1471
1528
|
students: [user],
|
|
1472
1529
|
school
|
|
1473
1530
|
});
|
|
1531
|
+
var documentTypeSchema = define(documentType, {
|
|
1532
|
+
subTypes: [subDocumentType]
|
|
1533
|
+
});
|
|
1474
1534
|
var documentSchema = define(document, {
|
|
1475
|
-
page
|
|
1535
|
+
page,
|
|
1536
|
+
levels: [level],
|
|
1537
|
+
documentType,
|
|
1538
|
+
subDocumentType
|
|
1476
1539
|
});
|
|
1477
1540
|
var chapterSchema = define(chapter, {
|
|
1478
1541
|
book,
|
|
@@ -1562,6 +1625,9 @@ var newsSchema = define(news, {
|
|
|
1562
1625
|
var premiumResourceSchema = define(premiumResource, {
|
|
1563
1626
|
book
|
|
1564
1627
|
});
|
|
1628
|
+
var levelSchema = define(level, {
|
|
1629
|
+
schoolTypes: [schoolType]
|
|
1630
|
+
});
|
|
1565
1631
|
var querySchema = {
|
|
1566
1632
|
viewer: {
|
|
1567
1633
|
addCorrectionsToGroup: group,
|
|
@@ -1577,6 +1643,8 @@ var querySchema = {
|
|
|
1577
1643
|
createUser: user,
|
|
1578
1644
|
createLexicalFlower: lexicalFlower,
|
|
1579
1645
|
documents: { hits: [document] },
|
|
1646
|
+
documentTypes: { hits: [documentType] },
|
|
1647
|
+
subDocumentTypes: { hits: [subDocumentType] },
|
|
1580
1648
|
explorerResults: [explorerResult],
|
|
1581
1649
|
levels: [level],
|
|
1582
1650
|
me: user,
|
|
@@ -1639,6 +1707,8 @@ export {
|
|
|
1639
1707
|
getContact,
|
|
1640
1708
|
getContacts,
|
|
1641
1709
|
getCurrentUser,
|
|
1710
|
+
getDocumentType,
|
|
1711
|
+
getDocumentTypes,
|
|
1642
1712
|
getDraft,
|
|
1643
1713
|
getDrafts,
|
|
1644
1714
|
getFaqs,
|
|
@@ -1669,6 +1739,7 @@ export {
|
|
|
1669
1739
|
getSharedPages,
|
|
1670
1740
|
getStudent,
|
|
1671
1741
|
getStudents,
|
|
1742
|
+
getSubDocumentTypes,
|
|
1672
1743
|
getSubject,
|
|
1673
1744
|
getSubjects,
|
|
1674
1745
|
getTeacher,
|
|
@@ -1683,6 +1754,7 @@ export {
|
|
|
1683
1754
|
makeGetCurrentUser,
|
|
1684
1755
|
makeSearchBooks,
|
|
1685
1756
|
makeSearchDrawerNotifications,
|
|
1757
|
+
makeSearchLevels,
|
|
1686
1758
|
makeSearchPages,
|
|
1687
1759
|
makeSearchSchoolTypes,
|
|
1688
1760
|
makeSearchSubjects,
|
|
@@ -1690,6 +1762,8 @@ export {
|
|
|
1690
1762
|
makeUseSearch,
|
|
1691
1763
|
normalizeData,
|
|
1692
1764
|
querySchema,
|
|
1765
|
+
searchLevels,
|
|
1766
|
+
searchSchoolTypes,
|
|
1693
1767
|
setEntitiesReducer,
|
|
1694
1768
|
useSearchBooks,
|
|
1695
1769
|
useSearchBuilderIos,
|
|
@@ -1699,6 +1773,7 @@ export {
|
|
|
1699
1773
|
useSearchContacts,
|
|
1700
1774
|
useSearchCopyNotifications,
|
|
1701
1775
|
useSearchCurrentUserSharedPages,
|
|
1776
|
+
useSearchDocumentTypes,
|
|
1702
1777
|
useSearchDocuments,
|
|
1703
1778
|
useSearchDrafts,
|
|
1704
1779
|
useSearchDrawerNotifications,
|
|
@@ -1717,6 +1792,7 @@ export {
|
|
|
1717
1792
|
useSearchSchools,
|
|
1718
1793
|
useSearchSharedPages,
|
|
1719
1794
|
useSearchStudents,
|
|
1795
|
+
useSearchSubDocumentTypes,
|
|
1720
1796
|
useSearchSubjects,
|
|
1721
1797
|
useSearchTeachers,
|
|
1722
1798
|
useSearchTools,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lls/store",
|
|
3
3
|
"description": "model de donnée et selecteurs",
|
|
4
4
|
"homepage": "https://github.com/lelivrescolaire/monorepo/tree/dev/libs/store",
|
|
5
|
-
"version": "24.
|
|
5
|
+
"version": "24.8.0-02f7e82f",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
"redux": "5.0.1",
|
|
47
47
|
"reselect": "4.1.8",
|
|
48
48
|
"typescript": "5.6.3",
|
|
49
|
-
"vite": "5.4.
|
|
50
|
-
"vite-tsconfig-paths": "5.1.
|
|
51
|
-
"
|
|
52
|
-
"@lls/
|
|
53
|
-
"@lls/vitescripts": "24.7.0"
|
|
49
|
+
"vite": "5.4.11",
|
|
50
|
+
"vite-tsconfig-paths": "5.1.3",
|
|
51
|
+
"@lls/utils": "24.8.0-02f7e82f",
|
|
52
|
+
"@lls/vitescripts": "24.8.0-02f7e82f"
|
|
54
53
|
},
|
|
55
54
|
"license": "ISC",
|
|
56
55
|
"dependencies": {
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"build": "node build.mjs",
|
|
61
60
|
"lint": "pnpm biome check --apply src __tests__",
|
|
62
61
|
"dts": "pnpm tsc --project tsconfig.production.json",
|
|
63
|
-
"test": "
|
|
64
|
-
"v2test": "bun test"
|
|
62
|
+
"test": "bun test"
|
|
65
63
|
}
|
|
66
64
|
}
|