@lls/store 24.11.0-e3175742 → 24.11.0-e34d1cd7
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 +14 -30
- package/package.json +3 -5
package/lib/index.js
CHANGED
|
@@ -979,7 +979,7 @@ var search9 = ({ ids, read, pageIds }) => {
|
|
|
979
979
|
return makeEntitiesFilter7({ read, id: ids, page: pageIds });
|
|
980
980
|
};
|
|
981
981
|
var makeSearchCopyNotifications = () => createSearchSelector3(
|
|
982
|
-
[makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (
|
|
982
|
+
[makeGetCurrentUser(), makeGetAllEntities2("copyNotifications"), (_19, params) => params],
|
|
983
983
|
(currentUser, copyNotifications, { pageIds, read }) => {
|
|
984
984
|
const ids = currentUser?.copyNotifications;
|
|
985
985
|
return search9({ ids, read, pageIds })(copyNotifications);
|
|
@@ -1009,7 +1009,7 @@ var search10 = ({
|
|
|
1009
1009
|
subDocumentType: subDocumentTypes
|
|
1010
1010
|
});
|
|
1011
1011
|
};
|
|
1012
|
-
var { useSearchDocuments
|
|
1012
|
+
var { useSearchDocuments } = crud("documents", {
|
|
1013
1013
|
search: search10
|
|
1014
1014
|
});
|
|
1015
1015
|
|
|
@@ -1020,7 +1020,7 @@ var search11 = ({ ids, read, pageIds }) => {
|
|
|
1020
1020
|
return makeEntitiesFilter9({ read, id: ids, page: pageIds });
|
|
1021
1021
|
};
|
|
1022
1022
|
var makeSearchDrawerNotifications = () => createSearchSelector4(
|
|
1023
|
-
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (
|
|
1023
|
+
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
|
|
1024
1024
|
(currentUser, drawerNotifications, { read, pageIds }) => {
|
|
1025
1025
|
const ids = currentUser?.drawerNotifications;
|
|
1026
1026
|
return search11({ ids, read, pageIds })(drawerNotifications);
|
|
@@ -1357,15 +1357,10 @@ var { getDocumentTypes, getDocumentType, useSearchDocumentTypes } = crud("docume
|
|
|
1357
1357
|
search: search30
|
|
1358
1358
|
});
|
|
1359
1359
|
|
|
1360
|
-
// src/selectors/globalRights.ts
|
|
1361
|
-
init_define_import_meta();
|
|
1362
|
-
import _16 from "lodash/fp.js";
|
|
1363
|
-
var getGlobalRights = _16.get("entities.globalRights");
|
|
1364
|
-
|
|
1365
1360
|
// src/reducers/entities.ts
|
|
1366
1361
|
init_define_import_meta();
|
|
1367
1362
|
import { makeReducer } from "@lls/utils";
|
|
1368
|
-
import
|
|
1363
|
+
import _16 from "lodash/fp.js";
|
|
1369
1364
|
|
|
1370
1365
|
// src/actions/index.ts
|
|
1371
1366
|
init_define_import_meta();
|
|
@@ -1388,16 +1383,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1388
1383
|
// src/reducers/entities.ts
|
|
1389
1384
|
var deleteEntityReducer = (state, payload) => {
|
|
1390
1385
|
const { path } = payload;
|
|
1391
|
-
return
|
|
1386
|
+
return _16.omit(path, state);
|
|
1392
1387
|
};
|
|
1393
1388
|
var updateEntityReducer = (state, payload) => {
|
|
1394
1389
|
const { path, entity } = payload;
|
|
1395
|
-
const currentEntity =
|
|
1396
|
-
return
|
|
1390
|
+
const currentEntity = _16.get(path, state);
|
|
1391
|
+
return _16.set(path, _16.merge(currentEntity, entity), state);
|
|
1397
1392
|
};
|
|
1398
1393
|
var setEntityReducer = (state, payload) => {
|
|
1399
1394
|
const { path, entity } = payload;
|
|
1400
|
-
return
|
|
1395
|
+
return _16.set(path, entity, state);
|
|
1401
1396
|
};
|
|
1402
1397
|
var setEntitiesReducer = (state, payload) => {
|
|
1403
1398
|
if (typeof payload !== "object") return state;
|
|
@@ -1418,7 +1413,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1418
1413
|
}
|
|
1419
1414
|
const diff = Object.keys(entity).some((prop) => {
|
|
1420
1415
|
const value = entity[prop];
|
|
1421
|
-
if (!
|
|
1416
|
+
if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1422
1417
|
return true;
|
|
1423
1418
|
}
|
|
1424
1419
|
});
|
|
@@ -1450,7 +1445,7 @@ var entities_default = entities;
|
|
|
1450
1445
|
// src/reducers/auth.ts
|
|
1451
1446
|
init_define_import_meta();
|
|
1452
1447
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1453
|
-
import
|
|
1448
|
+
import _17 from "lodash/fp.js";
|
|
1454
1449
|
var initialState = {
|
|
1455
1450
|
id: void 0,
|
|
1456
1451
|
role: null,
|
|
@@ -1463,15 +1458,15 @@ var initialState = {
|
|
|
1463
1458
|
llsUserId: null
|
|
1464
1459
|
};
|
|
1465
1460
|
var auth = makeReducer2(initialState, {
|
|
1466
|
-
[actionTypes.SET_AUTH]:
|
|
1467
|
-
[actionTypes.RESET_AUTH]:
|
|
1461
|
+
[actionTypes.SET_AUTH]: _17.assign,
|
|
1462
|
+
[actionTypes.RESET_AUTH]: _17.constant(initialState)
|
|
1468
1463
|
});
|
|
1469
1464
|
var auth_default = auth;
|
|
1470
1465
|
|
|
1471
1466
|
// src/schema/index.ts
|
|
1472
1467
|
init_define_import_meta();
|
|
1473
1468
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1474
|
-
import
|
|
1469
|
+
import _18 from "lodash/fp.js";
|
|
1475
1470
|
var document = new import_normalizr.schema.Entity("documents");
|
|
1476
1471
|
var documentType = new import_normalizr.schema.Entity("documentTypes");
|
|
1477
1472
|
var subDocumentType = new import_normalizr.schema.Entity("subDocumentTypes");
|
|
@@ -1490,14 +1485,6 @@ var product = new import_normalizr.schema.Entity("products");
|
|
|
1490
1485
|
var communityProjects = new import_normalizr.schema.Entity("communityProjects");
|
|
1491
1486
|
var builderIo = new import_normalizr.schema.Entity("builderIos");
|
|
1492
1487
|
var lexicalFlower = new import_normalizr.schema.Entity("lexicalFlowers");
|
|
1493
|
-
var globalRights = new import_normalizr.schema.Entity(
|
|
1494
|
-
"globalRights",
|
|
1495
|
-
{},
|
|
1496
|
-
{
|
|
1497
|
-
idAttribute: (_20, __, key) => key
|
|
1498
|
-
// Use keys from globalRights(anonymous, classroom, connected, teacher) as Id
|
|
1499
|
-
}
|
|
1500
|
-
);
|
|
1501
1488
|
var grammarRule = new import_normalizr.schema.Entity("grammarRules", {}, { idAttribute: "objectID" });
|
|
1502
1489
|
var mainNotification = new import_normalizr.schema.Entity("mainNotifications");
|
|
1503
1490
|
var explorerResult = new import_normalizr.schema.Entity("explorerResults", {}, { idAttribute: "resourceId" });
|
|
@@ -1660,7 +1647,6 @@ var querySchema = {
|
|
|
1660
1647
|
subDocumentTypes: { hits: [subDocumentType] },
|
|
1661
1648
|
explorerResults: [explorerResult],
|
|
1662
1649
|
levels: [level],
|
|
1663
|
-
globalRights: new import_normalizr.schema.Values(globalRights),
|
|
1664
1650
|
me: user,
|
|
1665
1651
|
// mutations
|
|
1666
1652
|
pages: { hits: [page] },
|
|
@@ -1699,7 +1685,7 @@ var querySchema = {
|
|
|
1699
1685
|
}
|
|
1700
1686
|
}
|
|
1701
1687
|
};
|
|
1702
|
-
var normalizeData =
|
|
1688
|
+
var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1703
1689
|
export {
|
|
1704
1690
|
auth_default as authReducer,
|
|
1705
1691
|
entities_default as entitiesReducer,
|
|
@@ -1721,7 +1707,6 @@ export {
|
|
|
1721
1707
|
getContact,
|
|
1722
1708
|
getContacts,
|
|
1723
1709
|
getCurrentUser,
|
|
1724
|
-
getDocument,
|
|
1725
1710
|
getDocumentType,
|
|
1726
1711
|
getDocumentTypes,
|
|
1727
1712
|
getDraft,
|
|
@@ -1729,7 +1714,6 @@ export {
|
|
|
1729
1714
|
getFaqs,
|
|
1730
1715
|
getGarDivision,
|
|
1731
1716
|
getGarDivisions,
|
|
1732
|
-
getGlobalRights,
|
|
1733
1717
|
getGroup,
|
|
1734
1718
|
getGroups,
|
|
1735
1719
|
getIsLogged,
|
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.11.0-
|
|
5
|
+
"version": "24.11.0-e34d1cd7",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"keywords": [],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@lls/utils": "*",
|
|
27
|
-
"@lls/common": "*",
|
|
28
27
|
"lodash": "*",
|
|
29
28
|
"react": "*",
|
|
30
29
|
"react-redux": "*",
|
|
@@ -49,9 +48,8 @@
|
|
|
49
48
|
"typescript": "5.6.3",
|
|
50
49
|
"vite": "5.4.11",
|
|
51
50
|
"vite-tsconfig-paths": "5.1.3",
|
|
52
|
-
"@lls/
|
|
53
|
-
"@lls/
|
|
54
|
-
"@lls/vitescripts": "24.11.0-e3175742"
|
|
51
|
+
"@lls/utils": "24.11.0-e34d1cd7",
|
|
52
|
+
"@lls/vitescripts": "24.11.0-e34d1cd7"
|
|
55
53
|
},
|
|
56
54
|
"license": "ISC",
|
|
57
55
|
"dependencies": {
|