@lls/store 24.7.0-849da3ee → 24.7.0-8c95b376

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