@lls/store 24.8.0-ec515f81 → 24.8.0-ed112729

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.
Files changed (2) hide show
  1. package/lib/index.js +34 -17
  2. package/package.json +3 -3
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"), (_20, params) => params],
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);
@@ -1018,7 +1018,7 @@ var search11 = ({ ids, read, pageIds }) => {
1018
1018
  return makeEntitiesFilter9({ read, id: ids, page: pageIds });
1019
1019
  };
1020
1020
  var makeSearchDrawerNotifications = () => createSearchSelector4(
1021
- [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
1021
+ [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
1022
1022
  (currentUser, drawerNotifications, { read, pageIds }) => {
1023
1023
  const ids = currentUser?.drawerNotifications;
1024
1024
  return search11({ ids, read, pageIds })(drawerNotifications);
@@ -1335,16 +1335,30 @@ var { getCirconscriptions } = crud("circonscriptions", {
1335
1335
 
1336
1336
  // src/selectors/documentType.ts
1337
1337
  init_define_import_meta();
1338
- import _16 from "lodash/fp.js";
1339
- var search30 = (_params) => _16.identity;
1340
- var { getDocumentTypes, getDocumentType } = crud("documentTypes", {
1338
+ import { makeEntitiesFilter as makeEntitiesFilter26 } from "@lls/utils";
1339
+ var search30 = ({ ids }) => {
1340
+ return makeEntitiesFilter26({
1341
+ id: ids
1342
+ });
1343
+ };
1344
+ var searchSubDocumentType = ({
1345
+ ids
1346
+ }) => {
1347
+ return makeEntitiesFilter26({
1348
+ id: ids
1349
+ });
1350
+ };
1351
+ var { getSubDocumentTypes, useSearchSubDocumentTypes } = crud("subDocumentTypes", {
1352
+ search: searchSubDocumentType
1353
+ });
1354
+ var { getDocumentTypes, getDocumentType, useSearchDocumentTypes } = crud("documentTypes", {
1341
1355
  search: search30
1342
1356
  });
1343
1357
 
1344
1358
  // src/reducers/entities.ts
1345
1359
  init_define_import_meta();
1346
1360
  import { makeReducer } from "@lls/utils";
1347
- import _17 from "lodash/fp.js";
1361
+ import _16 from "lodash/fp.js";
1348
1362
 
1349
1363
  // src/actions/index.ts
1350
1364
  init_define_import_meta();
@@ -1367,16 +1381,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
1367
1381
  // src/reducers/entities.ts
1368
1382
  var deleteEntityReducer = (state, payload) => {
1369
1383
  const { path } = payload;
1370
- return _17.omit(path, state);
1384
+ return _16.omit(path, state);
1371
1385
  };
1372
1386
  var updateEntityReducer = (state, payload) => {
1373
1387
  const { path, entity } = payload;
1374
- const currentEntity = _17.get(path, state);
1375
- return _17.set(path, _17.merge(currentEntity, entity), state);
1388
+ const currentEntity = _16.get(path, state);
1389
+ return _16.set(path, _16.merge(currentEntity, entity), state);
1376
1390
  };
1377
1391
  var setEntityReducer = (state, payload) => {
1378
1392
  const { path, entity } = payload;
1379
- return _17.set(path, entity, state);
1393
+ return _16.set(path, entity, state);
1380
1394
  };
1381
1395
  var setEntitiesReducer = (state, payload) => {
1382
1396
  if (typeof payload !== "object") return state;
@@ -1397,7 +1411,7 @@ var setEntitiesReducer = (state, payload) => {
1397
1411
  }
1398
1412
  const diff = Object.keys(entity).some((prop) => {
1399
1413
  const value = entity[prop];
1400
- if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
1414
+ if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
1401
1415
  return true;
1402
1416
  }
1403
1417
  });
@@ -1429,7 +1443,7 @@ var entities_default = entities;
1429
1443
  // src/reducers/auth.ts
1430
1444
  init_define_import_meta();
1431
1445
  import { makeReducer as makeReducer2 } from "@lls/utils";
1432
- import _18 from "lodash/fp.js";
1446
+ import _17 from "lodash/fp.js";
1433
1447
  var initialState = {
1434
1448
  id: void 0,
1435
1449
  role: null,
@@ -1442,15 +1456,15 @@ var initialState = {
1442
1456
  llsUserId: null
1443
1457
  };
1444
1458
  var auth = makeReducer2(initialState, {
1445
- [actionTypes.SET_AUTH]: _18.assign,
1446
- [actionTypes.RESET_AUTH]: _18.constant(initialState)
1459
+ [actionTypes.SET_AUTH]: _17.assign,
1460
+ [actionTypes.RESET_AUTH]: _17.constant(initialState)
1447
1461
  });
1448
1462
  var auth_default = auth;
1449
1463
 
1450
1464
  // src/schema/index.ts
1451
1465
  init_define_import_meta();
1452
1466
  var import_normalizr = __toESM(require_normalizr(), 1);
1453
- import _19 from "lodash/fp.js";
1467
+ import _18 from "lodash/fp.js";
1454
1468
  var document = new import_normalizr.schema.Entity("documents");
1455
1469
  var documentType = new import_normalizr.schema.Entity("documentTypes");
1456
1470
  var subDocumentType = new import_normalizr.schema.Entity("subDocumentTypes");
@@ -1513,7 +1527,7 @@ var garDivisionSchema = define(garDivision, {
1513
1527
  school
1514
1528
  });
1515
1529
  var documentTypeSchema = define(documentType, {
1516
- subDocumentType
1530
+ subTypes: [subDocumentType]
1517
1531
  });
1518
1532
  var documentSchema = define(document, {
1519
1533
  page,
@@ -1669,7 +1683,7 @@ var querySchema = {
1669
1683
  }
1670
1684
  }
1671
1685
  };
1672
- var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1686
+ var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1673
1687
  export {
1674
1688
  auth_default as authReducer,
1675
1689
  entities_default as entitiesReducer,
@@ -1723,6 +1737,7 @@ export {
1723
1737
  getSharedPages,
1724
1738
  getStudent,
1725
1739
  getStudents,
1740
+ getSubDocumentTypes,
1726
1741
  getSubject,
1727
1742
  getSubjects,
1728
1743
  getTeacher,
@@ -1756,6 +1771,7 @@ export {
1756
1771
  useSearchContacts,
1757
1772
  useSearchCopyNotifications,
1758
1773
  useSearchCurrentUserSharedPages,
1774
+ useSearchDocumentTypes,
1759
1775
  useSearchDocuments,
1760
1776
  useSearchDrafts,
1761
1777
  useSearchDrawerNotifications,
@@ -1774,6 +1790,7 @@ export {
1774
1790
  useSearchSchools,
1775
1791
  useSearchSharedPages,
1776
1792
  useSearchStudents,
1793
+ useSearchSubDocumentTypes,
1777
1794
  useSearchSubjects,
1778
1795
  useSearchTeachers,
1779
1796
  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.8.0-ec515f81",
5
+ "version": "24.8.0-ed112729",
6
6
  "type": "module",
7
7
  "types": "./lib/builttypes/store/src/index.d.ts",
8
8
  "exports": {
@@ -48,8 +48,8 @@
48
48
  "typescript": "5.6.3",
49
49
  "vite": "5.4.11",
50
50
  "vite-tsconfig-paths": "5.1.3",
51
- "@lls/utils": "24.8.0-ec515f81",
52
- "@lls/vitescripts": "24.8.0-ec515f81"
51
+ "@lls/utils": "24.8.0-ed112729",
52
+ "@lls/vitescripts": "24.8.0-ed112729"
53
53
  },
54
54
  "license": "ISC",
55
55
  "dependencies": {