@lls/store 24.7.0-b7a63a02 → 24.7.0-ba04a5c1

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 -20
  2. 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: search30 }) => {
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) => search30(params)(elements)
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}`]: search30,
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"), (_19, params) => params],
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);
@@ -990,10 +990,17 @@ var useSearchCopyNotifications = makeUseSearch(makeSearchCopyNotifications);
990
990
  // src/selectors/document.ts
991
991
  init_define_import_meta();
992
992
  import { makeEntitiesFilter as makeEntitiesFilter8 } from "@lls/utils";
993
- var search10 = ({ ids, resourceIds }) => {
993
+ var search10 = ({
994
+ ids,
995
+ uuids,
996
+ resourceIds,
997
+ levelIds
998
+ }) => {
994
999
  return makeEntitiesFilter8({
995
1000
  id: ids,
996
- resourceId: resourceIds
1001
+ resourceId: resourceIds,
1002
+ levels: levelIds,
1003
+ uuidV2: uuids
997
1004
  });
998
1005
  };
999
1006
  var { useSearchDocuments } = crud("documents", {
@@ -1007,7 +1014,7 @@ var search11 = ({ ids, read, pageIds }) => {
1007
1014
  return makeEntitiesFilter9({ read, id: ids, page: pageIds });
1008
1015
  };
1009
1016
  var makeSearchDrawerNotifications = () => createSearchSelector4(
1010
- [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_19, params) => params],
1017
+ [makeGetCurrentUser(), makeGetAllEntities3("drawerNotifications"), (_20, params) => params],
1011
1018
  (currentUser, drawerNotifications, { read, pageIds }) => {
1012
1019
  const ids = currentUser?.drawerNotifications;
1013
1020
  return search11({ ids, read, pageIds })(drawerNotifications);
@@ -1302,10 +1309,18 @@ var { getCirconscriptions } = crud("circonscriptions", {
1302
1309
  search: search29
1303
1310
  });
1304
1311
 
1312
+ // src/selectors/documentType.ts
1313
+ init_define_import_meta();
1314
+ import _16 from "lodash/fp.js";
1315
+ var search30 = (_params) => _16.identity;
1316
+ var { getDocumentTypes, getDocumentType } = crud("documentTypes", {
1317
+ search: search30
1318
+ });
1319
+
1305
1320
  // src/reducers/entities.ts
1306
1321
  init_define_import_meta();
1307
1322
  import { makeReducer } from "@lls/utils";
1308
- import _16 from "lodash/fp.js";
1323
+ import _17 from "lodash/fp.js";
1309
1324
 
1310
1325
  // src/actions/index.ts
1311
1326
  init_define_import_meta();
@@ -1328,16 +1343,16 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
1328
1343
  // src/reducers/entities.ts
1329
1344
  var deleteEntityReducer = (state, payload) => {
1330
1345
  const { path } = payload;
1331
- return _16.omit(path, state);
1346
+ return _17.omit(path, state);
1332
1347
  };
1333
1348
  var updateEntityReducer = (state, payload) => {
1334
1349
  const { path, entity } = payload;
1335
- const currentEntity = _16.get(path, state);
1336
- return _16.set(path, _16.merge(currentEntity, entity), state);
1350
+ const currentEntity = _17.get(path, state);
1351
+ return _17.set(path, _17.merge(currentEntity, entity), state);
1337
1352
  };
1338
1353
  var setEntityReducer = (state, payload) => {
1339
1354
  const { path, entity } = payload;
1340
- return _16.set(path, entity, state);
1355
+ return _17.set(path, entity, state);
1341
1356
  };
1342
1357
  var setEntitiesReducer = (state, payload) => {
1343
1358
  if (typeof payload !== "object") return state;
@@ -1358,7 +1373,7 @@ var setEntitiesReducer = (state, payload) => {
1358
1373
  }
1359
1374
  const diff = Object.keys(entity).some((prop) => {
1360
1375
  const value = entity[prop];
1361
- if (!_16.isEqual(state[entityName]?.[id]?.[prop], value)) {
1376
+ if (!_17.isEqual(state[entityName]?.[id]?.[prop], value)) {
1362
1377
  return true;
1363
1378
  }
1364
1379
  });
@@ -1390,7 +1405,7 @@ var entities_default = entities;
1390
1405
  // src/reducers/auth.ts
1391
1406
  init_define_import_meta();
1392
1407
  import { makeReducer as makeReducer2 } from "@lls/utils";
1393
- import _17 from "lodash/fp.js";
1408
+ import _18 from "lodash/fp.js";
1394
1409
  var initialState = {
1395
1410
  id: void 0,
1396
1411
  role: null,
@@ -1403,16 +1418,16 @@ var initialState = {
1403
1418
  llsUserId: null
1404
1419
  };
1405
1420
  var auth = makeReducer2(initialState, {
1406
- [actionTypes.SET_AUTH]: _17.assign,
1407
- [actionTypes.RESET_AUTH]: _17.constant(initialState)
1421
+ [actionTypes.SET_AUTH]: _18.assign,
1422
+ [actionTypes.RESET_AUTH]: _18.constant(initialState)
1408
1423
  });
1409
1424
  var auth_default = auth;
1410
1425
 
1411
1426
  // src/schema/index.ts
1412
1427
  init_define_import_meta();
1413
1428
  var import_normalizr = __toESM(require_normalizr(), 1);
1414
- import _18 from "lodash/fp.js";
1415
- var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
1429
+ import _19 from "lodash/fp.js";
1430
+ var document = new import_normalizr.schema.Entity("documents");
1416
1431
  var subject = new import_normalizr.schema.Entity("subjects");
1417
1432
  var level = new import_normalizr.schema.Entity("levels");
1418
1433
  var book = new import_normalizr.schema.Entity("books");
@@ -1472,7 +1487,8 @@ var garDivisionSchema = define(garDivision, {
1472
1487
  school
1473
1488
  });
1474
1489
  var documentSchema = define(document, {
1475
- page
1490
+ page,
1491
+ levels: [level]
1476
1492
  });
1477
1493
  var chapterSchema = define(chapter, {
1478
1494
  book,
@@ -1617,7 +1633,7 @@ var querySchema = {
1617
1633
  }
1618
1634
  }
1619
1635
  };
1620
- var normalizeData = _18.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1636
+ var normalizeData = _19.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1621
1637
  export {
1622
1638
  auth_default as authReducer,
1623
1639
  entities_default as entitiesReducer,
@@ -1639,6 +1655,8 @@ export {
1639
1655
  getContact,
1640
1656
  getContacts,
1641
1657
  getCurrentUser,
1658
+ getDocumentType,
1659
+ getDocumentTypes,
1642
1660
  getDraft,
1643
1661
  getDrafts,
1644
1662
  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-b7a63a02",
5
+ "version": "24.7.0-ba04a5c1",
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.10",
50
- "vite-tsconfig-paths": "5.1.1",
51
- "vitest": "2.1.4",
52
- "@lls/utils": "24.7.0-b7a63a02",
53
- "@lls/vitescripts": "24.7.0-b7a63a02"
49
+ "vite": "5.4.11",
50
+ "vite-tsconfig-paths": "5.1.3",
51
+ "@lls/utils": "24.7.0-ba04a5c1",
52
+ "@lls/vitescripts": "24.7.0-ba04a5c1"
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": "pnpm vitest run",
64
- "v2test": "bun test"
62
+ "test": "bun test"
65
63
  }
66
64
  }