@lls/store 24.7.0-76f1a316 → 24.7.0-7ab37cbd
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 +27 -17
- 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;
|
|
@@ -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"), (_20, params) => params],
|
|
983
983
|
(currentUser, copyNotifications, { pageIds, read }) => {
|
|
984
984
|
const ids = currentUser?.copyNotifications;
|
|
985
985
|
return search9({ ids, read, pageIds })(copyNotifications);
|
|
@@ -1007,7 +1007,7 @@ var search11 = ({ ids, read, pageIds }) => {
|
|
|
1007
1007
|
return makeEntitiesFilter9({ read, id: ids, page: pageIds });
|
|
1008
1008
|
};
|
|
1009
1009
|
var makeSearchDrawerNotifications = () => createSearchSelector4(
|
|
1010
|
-
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (
|
|
1010
|
+
[makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
|
|
1011
1011
|
(currentUser, drawerNotifications, { read, pageIds }) => {
|
|
1012
1012
|
const ids = currentUser?.drawerNotifications;
|
|
1013
1013
|
return search11({ ids, read, pageIds })(drawerNotifications);
|
|
@@ -1302,10 +1302,18 @@ var { getCirconscriptions } = crud("circonscriptions", {
|
|
|
1302
1302
|
search: search29
|
|
1303
1303
|
});
|
|
1304
1304
|
|
|
1305
|
+
// src/selectors/documentType.ts
|
|
1306
|
+
init_define_import_meta();
|
|
1307
|
+
import _16 from "lodash/fp.js";
|
|
1308
|
+
var search30 = (_params) => _16.identity;
|
|
1309
|
+
var { getDocumentTypes, getDocumentType } = crud("documentTypes", {
|
|
1310
|
+
search: search30
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1305
1313
|
// src/reducers/entities.ts
|
|
1306
1314
|
init_define_import_meta();
|
|
1307
1315
|
import { makeReducer } from "@lls/utils";
|
|
1308
|
-
import
|
|
1316
|
+
import _17 from "lodash/fp.js";
|
|
1309
1317
|
|
|
1310
1318
|
// src/actions/index.ts
|
|
1311
1319
|
init_define_import_meta();
|
|
@@ -1328,16 +1336,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
|
|
|
1328
1336
|
// src/reducers/entities.ts
|
|
1329
1337
|
var deleteEntityReducer = (state, payload) => {
|
|
1330
1338
|
const { path } = payload;
|
|
1331
|
-
return
|
|
1339
|
+
return _17.omit(path, state);
|
|
1332
1340
|
};
|
|
1333
1341
|
var updateEntityReducer = (state, payload) => {
|
|
1334
1342
|
const { path, entity } = payload;
|
|
1335
|
-
const currentEntity =
|
|
1336
|
-
return
|
|
1343
|
+
const currentEntity = _17.get(path, state);
|
|
1344
|
+
return _17.set(path, _17.merge(currentEntity, entity), state);
|
|
1337
1345
|
};
|
|
1338
1346
|
var setEntityReducer = (state, payload) => {
|
|
1339
1347
|
const { path, entity } = payload;
|
|
1340
|
-
return
|
|
1348
|
+
return _17.set(path, entity, state);
|
|
1341
1349
|
};
|
|
1342
1350
|
var setEntitiesReducer = (state, payload) => {
|
|
1343
1351
|
if (typeof payload !== "object") return state;
|
|
@@ -1358,7 +1366,7 @@ var setEntitiesReducer = (state, payload) => {
|
|
|
1358
1366
|
}
|
|
1359
1367
|
const diff = Object.keys(entity).some((prop) => {
|
|
1360
1368
|
const value = entity[prop];
|
|
1361
|
-
if (!
|
|
1369
|
+
if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
|
|
1362
1370
|
return true;
|
|
1363
1371
|
}
|
|
1364
1372
|
});
|
|
@@ -1390,7 +1398,7 @@ var entities_default = entities;
|
|
|
1390
1398
|
// src/reducers/auth.ts
|
|
1391
1399
|
init_define_import_meta();
|
|
1392
1400
|
import { makeReducer as makeReducer2 } from "@lls/utils";
|
|
1393
|
-
import
|
|
1401
|
+
import _18 from "lodash/fp.js";
|
|
1394
1402
|
var initialState = {
|
|
1395
1403
|
id: void 0,
|
|
1396
1404
|
role: null,
|
|
@@ -1403,16 +1411,16 @@ var initialState = {
|
|
|
1403
1411
|
llsUserId: null
|
|
1404
1412
|
};
|
|
1405
1413
|
var auth = makeReducer2(initialState, {
|
|
1406
|
-
[actionTypes.SET_AUTH]:
|
|
1407
|
-
[actionTypes.RESET_AUTH]:
|
|
1414
|
+
[actionTypes.SET_AUTH]: _18.assign,
|
|
1415
|
+
[actionTypes.RESET_AUTH]: _18.constant(initialState)
|
|
1408
1416
|
});
|
|
1409
1417
|
var auth_default = auth;
|
|
1410
1418
|
|
|
1411
1419
|
// src/schema/index.ts
|
|
1412
1420
|
init_define_import_meta();
|
|
1413
1421
|
var import_normalizr = __toESM(require_normalizr(), 1);
|
|
1414
|
-
import
|
|
1415
|
-
var document = new import_normalizr.schema.Entity("documents"
|
|
1422
|
+
import _19 from "lodash/fp.js";
|
|
1423
|
+
var document = new import_normalizr.schema.Entity("documents");
|
|
1416
1424
|
var subject = new import_normalizr.schema.Entity("subjects");
|
|
1417
1425
|
var level = new import_normalizr.schema.Entity("levels");
|
|
1418
1426
|
var book = new import_normalizr.schema.Entity("books");
|
|
@@ -1617,7 +1625,7 @@ var querySchema = {
|
|
|
1617
1625
|
}
|
|
1618
1626
|
}
|
|
1619
1627
|
};
|
|
1620
|
-
var normalizeData =
|
|
1628
|
+
var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
|
|
1621
1629
|
export {
|
|
1622
1630
|
auth_default as authReducer,
|
|
1623
1631
|
entities_default as entitiesReducer,
|
|
@@ -1639,6 +1647,8 @@ export {
|
|
|
1639
1647
|
getContact,
|
|
1640
1648
|
getContacts,
|
|
1641
1649
|
getCurrentUser,
|
|
1650
|
+
getDocumentType,
|
|
1651
|
+
getDocumentTypes,
|
|
1642
1652
|
getDraft,
|
|
1643
1653
|
getDrafts,
|
|
1644
1654
|
getFaqs,
|
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.7.0-
|
|
5
|
+
"version": "24.7.0-7ab37cbd",
|
|
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/utils": "24.7.0-
|
|
53
|
-
"@lls/vitescripts": "24.7.0-76f1a316"
|
|
49
|
+
"vite": "5.4.11",
|
|
50
|
+
"vite-tsconfig-paths": "5.1.3",
|
|
51
|
+
"@lls/vitescripts": "24.7.0-7ab37cbd",
|
|
52
|
+
"@lls/utils": "24.7.0-7ab37cbd"
|
|
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
|
}
|