@lls/store 24.7.0-3fbc3b80 → 24.7.0-40cbb537

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