@lls/store 24.1.59-2800c639 → 24.1.59-2ace2ca0
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 +25 -128
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -198,7 +198,7 @@ var require_lib = __commonJS({
|
|
|
198
198
|
for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
199
199
|
memoizeOptionsFromArgs[_key - 1] = arguments[_key];
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var createSelector3 = function createSelector4() {
|
|
202
202
|
for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
203
203
|
funcs[_key2] = arguments[_key2];
|
|
204
204
|
}
|
|
@@ -247,13 +247,13 @@ var require_lib = __commonJS({
|
|
|
247
247
|
});
|
|
248
248
|
return selector;
|
|
249
249
|
};
|
|
250
|
-
return
|
|
250
|
+
return createSelector3;
|
|
251
251
|
}
|
|
252
|
-
var
|
|
253
|
-
exports.createSelector =
|
|
252
|
+
var createSelector2 = /* @__PURE__ */ createSelectorCreator(_defaultMemoize.defaultMemoize);
|
|
253
|
+
exports.createSelector = createSelector2;
|
|
254
254
|
var createStructuredSelector = function createStructuredSelector2(selectors, selectorCreator) {
|
|
255
255
|
if (selectorCreator === void 0) {
|
|
256
|
-
selectorCreator =
|
|
256
|
+
selectorCreator = createSelector2;
|
|
257
257
|
}
|
|
258
258
|
if (typeof selectors !== "object") {
|
|
259
259
|
throw new Error("createStructuredSelector expects first argument to be an object " + ("where each property is a selector, instead received a " + typeof selectors));
|
|
@@ -741,12 +741,12 @@ import _ from "lodash/fp.js";
|
|
|
741
741
|
// src/selectors/crud.ts
|
|
742
742
|
init_define_import_meta();
|
|
743
743
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
744
|
-
var crud = (entityName, { search:
|
|
744
|
+
var crud = (entityName, { search: search10 }) => {
|
|
745
745
|
const getElements = makeGetAllEntities(entityName);
|
|
746
746
|
const makeSearchElements = () => createSearchSelector(
|
|
747
747
|
getElements,
|
|
748
748
|
(_state, params) => params,
|
|
749
|
-
(elements, params) =>
|
|
749
|
+
(elements, params) => search10(params)(elements)
|
|
750
750
|
);
|
|
751
751
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
752
752
|
const getElementById = makeGetEntityById(entityName);
|
|
@@ -989,7 +989,7 @@ import { createSearchSelector as createSearchSelector4, filterEntitiesSimpleFiel
|
|
|
989
989
|
import _10 from "lodash/fp.js";
|
|
990
990
|
var getCopyNotifications = makeGetAllEntities3("copyNotifications");
|
|
991
991
|
var makeSearchCopyNotifications = () => createSearchSelector4(
|
|
992
|
-
[getCurrentUser, getCopyNotifications, (
|
|
992
|
+
[getCurrentUser, getCopyNotifications, (_16, params) => params],
|
|
993
993
|
(currentUser, copyNotifications, { pageIds, read }) => _10.flow(
|
|
994
994
|
_10.get("copyNotifications"),
|
|
995
995
|
(ids) => _10.flow(
|
|
@@ -1007,7 +1007,7 @@ import { createSearchSelector as createSearchSelector5, filterEntitiesSimpleFiel
|
|
|
1007
1007
|
import _11 from "lodash/fp.js";
|
|
1008
1008
|
var getDrawerNotifications = makeGetAllEntities4("drawerNotifications");
|
|
1009
1009
|
var makeSearchDrawerNotifications = () => createSearchSelector5(
|
|
1010
|
-
[getCurrentUser, getDrawerNotifications, (
|
|
1010
|
+
[getCurrentUser, getDrawerNotifications, (_16, params) => params],
|
|
1011
1011
|
(currentUser, drawerNotifications, { read, pageIds }) => _11.flow(
|
|
1012
1012
|
_11.get("drawerNotifications"),
|
|
1013
1013
|
(ids) => _11.flow(
|
|
@@ -1032,94 +1032,10 @@ var { getGarDivisions, getGarDivision, searchGarDivisions, makeSearchGarDivision
|
|
|
1032
1032
|
search: search9
|
|
1033
1033
|
});
|
|
1034
1034
|
|
|
1035
|
-
// src/selectors/group.ts
|
|
1036
|
-
init_define_import_meta();
|
|
1037
|
-
var import_reselect2 = __toESM(require_lib(), 1);
|
|
1038
|
-
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues9 } from "@lls/utils";
|
|
1039
|
-
import _13 from "lodash/fp.js";
|
|
1040
|
-
var search10 = ({ ownerIds }) => _13.flow(filterEntitiesSimpleFieldByValues9("owner", ownerIds), _13.orderBy("createdAt", ["desc"]));
|
|
1041
|
-
var { getGroups, getGroup, searchGroups, makeSearchGroups } = crud("groups", {
|
|
1042
|
-
search: search10
|
|
1043
|
-
});
|
|
1044
|
-
var getUserGroups = (0, import_reselect2.createSelector)(
|
|
1045
|
-
[getGroups, getCurrentUser],
|
|
1046
|
-
(groups, currentUser) => search10({ ownerIds: [currentUser?.id] })(groups)
|
|
1047
|
-
);
|
|
1048
|
-
|
|
1049
|
-
// src/selectors/level.ts
|
|
1050
|
-
init_define_import_meta();
|
|
1051
|
-
var import_reselect3 = __toESM(require_lib(), 1);
|
|
1052
|
-
import { filterEntitiesSimpleFieldByValue as filterEntitiesSimpleFieldByValue2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues10 } from "@lls/utils";
|
|
1053
|
-
import _14 from "lodash/fp.js";
|
|
1054
|
-
var search11 = ({
|
|
1055
|
-
ids,
|
|
1056
|
-
slugs,
|
|
1057
|
-
isPreSchool,
|
|
1058
|
-
isMiddleSchool,
|
|
1059
|
-
isHighSchool,
|
|
1060
|
-
isProHighSchool,
|
|
1061
|
-
isGenHighSchool,
|
|
1062
|
-
isElementarySchool
|
|
1063
|
-
}) => _14.flow(
|
|
1064
|
-
filterEntitiesSimpleFieldByValues10("id", ids),
|
|
1065
|
-
filterEntitiesSimpleFieldByValues10("slug", slugs),
|
|
1066
|
-
filterEntitiesSimpleFieldByValue2("isPreSchool", isPreSchool),
|
|
1067
|
-
filterEntitiesSimpleFieldByValue2("isMiddleSchool", isMiddleSchool),
|
|
1068
|
-
filterEntitiesSimpleFieldByValue2("isHighSchool", isHighSchool),
|
|
1069
|
-
filterEntitiesSimpleFieldByValue2("isProHighSchool", isProHighSchool),
|
|
1070
|
-
filterEntitiesSimpleFieldByValue2("isGenHighSchool", isGenHighSchool),
|
|
1071
|
-
filterEntitiesSimpleFieldByValue2("isElementarySchool", isElementarySchool),
|
|
1072
|
-
_14.orderBy("order", "desc")
|
|
1073
|
-
);
|
|
1074
|
-
var crudLevels = crud("levels", { search: search11 });
|
|
1075
|
-
var { getLevel, searchLevels, makeSearchLevels } = crudLevels;
|
|
1076
|
-
var getLevels = (0, import_reselect3.createSelector)(crudLevels.getLevels, _14.orderBy("order", "desc"));
|
|
1077
|
-
|
|
1078
|
-
// src/selectors/mainNotification.ts
|
|
1079
|
-
init_define_import_meta();
|
|
1080
|
-
var import_reselect4 = __toESM(require_lib(), 1);
|
|
1081
|
-
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues11, makeGetAllEntities as makeGetAllEntities6 } from "@lls/utils";
|
|
1082
|
-
import _15 from "lodash/fp.js";
|
|
1083
|
-
var getAllMainNotifications = makeGetAllEntities6("mainNotifications");
|
|
1084
|
-
var search12 = ({ ids }) => _15.flow(filterEntitiesSimpleFieldByValues11("id", ids));
|
|
1085
|
-
var getMainNotifications = (0, import_reselect4.createSelector)(
|
|
1086
|
-
[_15.flow(getCurrentUser, _15.get("mainNotifications")), getAllMainNotifications],
|
|
1087
|
-
(userNotifications, notifications) => search12({ ids: userNotifications })(notifications)
|
|
1088
|
-
);
|
|
1089
|
-
|
|
1090
|
-
// src/selectors/news.ts
|
|
1091
|
-
init_define_import_meta();
|
|
1092
|
-
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues12 } from "@lls/utils";
|
|
1093
|
-
var search13 = ({ ids }) => filterEntitiesSimpleFieldByValues12("id", ids);
|
|
1094
|
-
var {
|
|
1095
|
-
getNews: getAllNews,
|
|
1096
|
-
getNew: getNews,
|
|
1097
|
-
searchNews,
|
|
1098
|
-
makeSearchNews
|
|
1099
|
-
} = crud("news", {
|
|
1100
|
-
search: search13
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
// src/selectors/panorama.ts
|
|
1104
|
-
init_define_import_meta();
|
|
1105
|
-
import { makeGetEntityById as makeGetEntityById4 } from "@lls/utils";
|
|
1106
|
-
var getPanorama = makeGetEntityById4("panoramas");
|
|
1107
|
-
|
|
1108
|
-
// src/selectors/premiumResource.ts
|
|
1109
|
-
init_define_import_meta();
|
|
1110
|
-
import { filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues13 } from "@lls/utils";
|
|
1111
|
-
var search14 = ({ bookIds }) => filterEntitiesSimpleFieldByValues13("book", bookIds);
|
|
1112
|
-
var { getPremiumResources, getPremiumResource, searchPremiumResources, makeSearchPremiumResources } = crud(
|
|
1113
|
-
"premiumResources",
|
|
1114
|
-
{
|
|
1115
|
-
search: search14
|
|
1116
|
-
}
|
|
1117
|
-
);
|
|
1118
|
-
|
|
1119
1035
|
// src/reducers/entities.ts
|
|
1120
1036
|
init_define_import_meta();
|
|
1121
1037
|
import { makeReducer } from "@lls/utils";
|
|
1122
|
-
import
|
|
1038
|
+
import _13 from "lodash/fp.js";
|
|
1123
1039
|
|
|
1124
1040
|
// src/actions/index.ts
|
|
1125
1041
|
init_define_import_meta();
|
|
@@ -1142,23 +1058,23 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1142
1058
|
// src/reducers/entities.ts
|
|
1143
1059
|
var deleteEntityReducer = (state, payload) => {
|
|
1144
1060
|
const { path } = payload;
|
|
1145
|
-
return
|
|
1061
|
+
return _13.omit(path, state);
|
|
1146
1062
|
};
|
|
1147
1063
|
var updateEntityReducer = (state, payload) => {
|
|
1148
1064
|
const { path, entity } = payload;
|
|
1149
|
-
const currentEntity =
|
|
1150
|
-
return
|
|
1065
|
+
const currentEntity = _13.get(path, state);
|
|
1066
|
+
return _13.set(path, _13.merge(currentEntity, entity), state);
|
|
1151
1067
|
};
|
|
1152
1068
|
var setEntityReducer = (state, payload) => {
|
|
1153
1069
|
const { path, entity } = payload;
|
|
1154
|
-
return
|
|
1070
|
+
return _13.set(path, entity, state);
|
|
1155
1071
|
};
|
|
1156
1072
|
var shallowAssign = (old, next, transform) => {
|
|
1157
1073
|
let updated = false;
|
|
1158
|
-
const merged =
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
if (
|
|
1074
|
+
const merged = _13.flow(
|
|
1075
|
+
_13.toPairs,
|
|
1076
|
+
_13.reduce((memo, [key, val]) => {
|
|
1077
|
+
if (_13.isEmpty(val)) return memo;
|
|
1162
1078
|
if (!old[key]) {
|
|
1163
1079
|
updated = true;
|
|
1164
1080
|
memo[key] = val;
|
|
@@ -1171,7 +1087,7 @@ var shallowAssign = (old, next, transform) => {
|
|
|
1171
1087
|
return memo;
|
|
1172
1088
|
}
|
|
1173
1089
|
return memo;
|
|
1174
|
-
},
|
|
1090
|
+
}, _13.clone(old))
|
|
1175
1091
|
)(next);
|
|
1176
1092
|
return updated ? merged : old;
|
|
1177
1093
|
};
|
|
@@ -1180,7 +1096,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1180
1096
|
return shallowAssign(
|
|
1181
1097
|
entityKind,
|
|
1182
1098
|
nextEntityKind,
|
|
1183
|
-
(oldEntity, nextEntity) =>
|
|
1099
|
+
(oldEntity, nextEntity) => _13.isEqual(oldEntity, nextEntity) ? oldEntity : _13.assign(oldEntity, nextEntity)
|
|
1184
1100
|
);
|
|
1185
1101
|
});
|
|
1186
1102
|
};
|
|
@@ -1198,7 +1114,7 @@ var entities_default = entities;
|
|
|
1198
1114
|
// src/reducers/auth.ts
|
|
1199
1115
|
init_define_import_meta();
|
|
1200
1116
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1201
|
-
import
|
|
1117
|
+
import _14 from "lodash/fp.js";
|
|
1202
1118
|
var initialState = {
|
|
1203
1119
|
id: void 0,
|
|
1204
1120
|
role: null,
|
|
@@ -1211,15 +1127,15 @@ var initialState = {
|
|
|
1211
1127
|
llsUserId: null
|
|
1212
1128
|
};
|
|
1213
1129
|
var auth = makeReducer2(initialState, {
|
|
1214
|
-
[actionTypes.SET_AUTH]:
|
|
1215
|
-
[actionTypes.RESET_AUTH]:
|
|
1130
|
+
[actionTypes.SET_AUTH]: _14.assign,
|
|
1131
|
+
[actionTypes.RESET_AUTH]: _14.constant(initialState)
|
|
1216
1132
|
});
|
|
1217
1133
|
var auth_default = auth;
|
|
1218
1134
|
|
|
1219
1135
|
// src/schema/index.ts
|
|
1220
1136
|
init_define_import_meta();
|
|
1221
1137
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1222
|
-
import
|
|
1138
|
+
import _15 from "lodash/fp.js";
|
|
1223
1139
|
var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
|
|
1224
1140
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1225
1141
|
var level = new import_normalizr.schema.Entity("levels");
|
|
@@ -1406,11 +1322,10 @@ var querySchema = {
|
|
|
1406
1322
|
}
|
|
1407
1323
|
}
|
|
1408
1324
|
};
|
|
1409
|
-
var normalizeData =
|
|
1325
|
+
var normalizeData = _15.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1410
1326
|
export {
|
|
1411
1327
|
auth_default as authReducer,
|
|
1412
1328
|
entities_default as entitiesReducer,
|
|
1413
|
-
getAllNews,
|
|
1414
1329
|
getBook,
|
|
1415
1330
|
getBooks,
|
|
1416
1331
|
getChapter,
|
|
@@ -1427,21 +1342,11 @@ export {
|
|
|
1427
1342
|
getFaqs,
|
|
1428
1343
|
getGarDivision,
|
|
1429
1344
|
getGarDivisions,
|
|
1430
|
-
getGroup,
|
|
1431
|
-
getGroups,
|
|
1432
|
-
getLevel,
|
|
1433
|
-
getLevels,
|
|
1434
|
-
getMainNotifications,
|
|
1435
|
-
getNews,
|
|
1436
1345
|
getPage,
|
|
1437
1346
|
getPages,
|
|
1438
|
-
getPanorama,
|
|
1439
|
-
getPremiumResource,
|
|
1440
|
-
getPremiumResources,
|
|
1441
1347
|
getSchool,
|
|
1442
1348
|
getSchools,
|
|
1443
1349
|
getUser,
|
|
1444
|
-
getUserGroups,
|
|
1445
1350
|
getUsers,
|
|
1446
1351
|
makeGetBook,
|
|
1447
1352
|
makeGetDraftPage,
|
|
@@ -1454,12 +1359,8 @@ export {
|
|
|
1454
1359
|
makeSearchDraftPages,
|
|
1455
1360
|
makeSearchDrawerNotifications,
|
|
1456
1361
|
makeSearchGarDivisions,
|
|
1457
|
-
makeSearchGroups,
|
|
1458
|
-
makeSearchLevels,
|
|
1459
1362
|
makeSearchModifiedPages,
|
|
1460
|
-
makeSearchNews,
|
|
1461
1363
|
makeSearchPages,
|
|
1462
|
-
makeSearchPremiumResources,
|
|
1463
1364
|
makeSearchSchools,
|
|
1464
1365
|
makeSearchUsers,
|
|
1465
1366
|
makeSearchValidBooks,
|
|
@@ -1474,12 +1375,8 @@ export {
|
|
|
1474
1375
|
searchDraftPages,
|
|
1475
1376
|
searchDrawerNotifications,
|
|
1476
1377
|
searchGarDivisions,
|
|
1477
|
-
searchGroups,
|
|
1478
|
-
searchLevels,
|
|
1479
1378
|
searchModifiedPages,
|
|
1480
|
-
searchNews,
|
|
1481
1379
|
searchPages,
|
|
1482
|
-
searchPremiumResources,
|
|
1483
1380
|
searchSchools,
|
|
1484
1381
|
searchUsers,
|
|
1485
1382
|
searchValidBooks,
|
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.1.59-
|
|
5
|
+
"version": "24.1.59-2ace2ca0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"vite": "5.3.3",
|
|
42
42
|
"vite-tsconfig-paths": "4.3.2",
|
|
43
43
|
"vitest": "2.0.0",
|
|
44
|
-
"@lls/utils": "24.1.59-
|
|
45
|
-
"@lls/vitescripts": "24.1.59-
|
|
44
|
+
"@lls/utils": "24.1.59-2ace2ca0",
|
|
45
|
+
"@lls/vitescripts": "24.1.59-2ace2ca0"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"dependencies": {
|