@lls/store 24.8.0-dc8e1b8b → 24.8.0-dc98effb

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 +38 -19
  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);
@@ -996,7 +996,8 @@ var search10 = ({
996
996
  resourceIds,
997
997
  levelIds,
998
998
  formats,
999
- documentTypes
999
+ documentTypes,
1000
+ subDocumentTypes
1000
1001
  }) => {
1001
1002
  return makeEntitiesFilter8({
1002
1003
  id: ids,
@@ -1004,7 +1005,8 @@ var search10 = ({
1004
1005
  levels: levelIds,
1005
1006
  uuidV2: uuids,
1006
1007
  format: formats,
1007
- documentType: documentTypes
1008
+ documentType: documentTypes,
1009
+ subDocumentType: subDocumentTypes
1008
1010
  });
1009
1011
  };
1010
1012
  var { useSearchDocuments } = crud("documents", {
@@ -1018,7 +1020,7 @@ var search11 = ({ ids, read, pageIds }) => {
1018
1020
  return makeEntitiesFilter9({ read, id: ids, page: pageIds });
1019
1021
  };
1020
1022
  var makeSearchDrawerNotifications = () => createSearchSelector4(
1021
- [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
1023
+ [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
1022
1024
  (currentUser, drawerNotifications, { read, pageIds }) => {
1023
1025
  const ids = currentUser?.drawerNotifications;
1024
1026
  return search11({ ids, read, pageIds })(drawerNotifications);
@@ -1335,16 +1337,30 @@ var { getCirconscriptions } = crud("circonscriptions", {
1335
1337
 
1336
1338
  // src/selectors/documentType.ts
1337
1339
  init_define_import_meta();
1338
- import _16 from "lodash/fp.js";
1339
- var search30 = (_params) => _16.identity;
1340
- var { getDocumentTypes, getDocumentType } = crud("documentTypes", {
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", {
1341
1357
  search: search30
1342
1358
  });
1343
1359
 
1344
1360
  // src/reducers/entities.ts
1345
1361
  init_define_import_meta();
1346
1362
  import { makeReducer } from "@lls/utils";
1347
- import _17 from "lodash/fp.js";
1363
+ import _16 from "lodash/fp.js";
1348
1364
 
1349
1365
  // src/actions/index.ts
1350
1366
  init_define_import_meta();
@@ -1367,16 +1383,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
1367
1383
  // src/reducers/entities.ts
1368
1384
  var deleteEntityReducer = (state, payload) => {
1369
1385
  const { path } = payload;
1370
- return _17.omit(path, state);
1386
+ return _16.omit(path, state);
1371
1387
  };
1372
1388
  var updateEntityReducer = (state, payload) => {
1373
1389
  const { path, entity } = payload;
1374
- const currentEntity = _17.get(path, state);
1375
- return _17.set(path, _17.merge(currentEntity, entity), state);
1390
+ const currentEntity = _16.get(path, state);
1391
+ return _16.set(path, _16.merge(currentEntity, entity), state);
1376
1392
  };
1377
1393
  var setEntityReducer = (state, payload) => {
1378
1394
  const { path, entity } = payload;
1379
- return _17.set(path, entity, state);
1395
+ return _16.set(path, entity, state);
1380
1396
  };
1381
1397
  var setEntitiesReducer = (state, payload) => {
1382
1398
  if (typeof payload !== "object") return state;
@@ -1397,7 +1413,7 @@ var setEntitiesReducer = (state, payload) => {
1397
1413
  }
1398
1414
  const diff = Object.keys(entity).some((prop) => {
1399
1415
  const value = entity[prop];
1400
- if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
1416
+ if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
1401
1417
  return true;
1402
1418
  }
1403
1419
  });
@@ -1429,7 +1445,7 @@ var entities_default = entities;
1429
1445
  // src/reducers/auth.ts
1430
1446
  init_define_import_meta();
1431
1447
  import { makeReducer as makeReducer2 } from "@lls/utils";
1432
- import _18 from "lodash/fp.js";
1448
+ import _17 from "lodash/fp.js";
1433
1449
  var initialState = {
1434
1450
  id: void 0,
1435
1451
  role: null,
@@ -1442,15 +1458,15 @@ var initialState = {
1442
1458
  llsUserId: null
1443
1459
  };
1444
1460
  var auth = makeReducer2(initialState, {
1445
- [actionTypes.SET_AUTH]: _18.assign,
1446
- [actionTypes.RESET_AUTH]: _18.constant(initialState)
1461
+ [actionTypes.SET_AUTH]: _17.assign,
1462
+ [actionTypes.RESET_AUTH]: _17.constant(initialState)
1447
1463
  });
1448
1464
  var auth_default = auth;
1449
1465
 
1450
1466
  // src/schema/index.ts
1451
1467
  init_define_import_meta();
1452
1468
  var import_normalizr = __toESM(require_normalizr(), 1);
1453
- import _19 from "lodash/fp.js";
1469
+ import _18 from "lodash/fp.js";
1454
1470
  var document = new import_normalizr.schema.Entity("documents");
1455
1471
  var documentType = new import_normalizr.schema.Entity("documentTypes");
1456
1472
  var subDocumentType = new import_normalizr.schema.Entity("subDocumentTypes");
@@ -1513,7 +1529,7 @@ var garDivisionSchema = define(garDivision, {
1513
1529
  school
1514
1530
  });
1515
1531
  var documentTypeSchema = define(documentType, {
1516
- subDocumentType
1532
+ subTypes: [subDocumentType]
1517
1533
  });
1518
1534
  var documentSchema = define(document, {
1519
1535
  page,
@@ -1669,7 +1685,7 @@ var querySchema = {
1669
1685
  }
1670
1686
  }
1671
1687
  };
1672
- var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1688
+ var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1673
1689
  export {
1674
1690
  auth_default as authReducer,
1675
1691
  entities_default as entitiesReducer,
@@ -1723,6 +1739,7 @@ export {
1723
1739
  getSharedPages,
1724
1740
  getStudent,
1725
1741
  getStudents,
1742
+ getSubDocumentTypes,
1726
1743
  getSubject,
1727
1744
  getSubjects,
1728
1745
  getTeacher,
@@ -1756,6 +1773,7 @@ export {
1756
1773
  useSearchContacts,
1757
1774
  useSearchCopyNotifications,
1758
1775
  useSearchCurrentUserSharedPages,
1776
+ useSearchDocumentTypes,
1759
1777
  useSearchDocuments,
1760
1778
  useSearchDrafts,
1761
1779
  useSearchDrawerNotifications,
@@ -1774,6 +1792,7 @@ export {
1774
1792
  useSearchSchools,
1775
1793
  useSearchSharedPages,
1776
1794
  useSearchStudents,
1795
+ useSearchSubDocumentTypes,
1777
1796
  useSearchSubjects,
1778
1797
  useSearchTeachers,
1779
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.8.0-dc8e1b8b",
5
+ "version": "24.8.0-dc98effb",
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-dc8e1b8b",
52
- "@lls/vitescripts": "24.8.0-dc8e1b8b"
51
+ "@lls/utils": "24.8.0-dc98effb",
52
+ "@lls/vitescripts": "24.8.0-dc98effb"
53
53
  },
54
54
  "license": "ISC",
55
55
  "dependencies": {