@lls/store 24.1.59-65ad9aaa → 24.1.59-6b359862

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 +26 -100
  2. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -742,12 +742,12 @@ import _2 from "lodash/fp.js";
742
742
  init_define_import_meta();
743
743
  import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
744
744
  import _ from "lodash/fp.js";
745
- var crud = (entityName, { search: search5 }) => {
745
+ var crud = (entityName, { search: search3 }) => {
746
746
  const getElements = makeGetAllEntities(entityName);
747
747
  const makeSearchElements = () => createSearchSelector(
748
748
  getElements,
749
749
  (_state, params) => params,
750
- (elements, params) => search5(params)(elements)
750
+ (elements, params) => search3(params)(elements)
751
751
  );
752
752
  const methodName = _.capitalize(entityName);
753
753
  const getElementById = makeGetEntityById(entityName);
@@ -766,73 +766,23 @@ var { getSchools, getSchool, searchSchools, makeSearchSchools } = crud("schools"
766
766
  search
767
767
  });
768
768
 
769
- // src/selectors/book.ts
770
- init_define_import_meta();
771
- import {
772
- createSearchSelector as createSearchSelector2,
773
- filterEntitiesArrayFieldByValues,
774
- filterEntitiesSimpleFieldByValue,
775
- filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2,
776
- makeGetEntityById as makeGetEntityById2
777
- } from "@lls/utils";
778
- import _3 from "lodash/fp.js";
779
- var search2 = ({
780
- ids,
781
- levelIds,
782
- subjectIds,
783
- years,
784
- isValid,
785
- isWorkbook,
786
- isWorkplan,
787
- hasNoTeacherBook,
788
- sortByQuery,
789
- hasNewDesign,
790
- slugs,
791
- uris,
792
- publishers,
793
- isRenewed,
794
- isPrimary
795
- }) => _3.flow(
796
- filterEntitiesSimpleFieldByValues2("id", ids),
797
- filterEntitiesSimpleFieldByValues2("year", years),
798
- filterEntitiesArrayFieldByValues("levels", levelIds),
799
- filterEntitiesArrayFieldByValues("subjects", subjectIds),
800
- filterEntitiesSimpleFieldByValues2("valid", _3.isNil(isValid) ? void 0 : [isValid]),
801
- filterEntitiesSimpleFieldByValues2("publisher", publishers),
802
- filterEntitiesSimpleFieldByValues2("hasNewDesign", _3.isNil(hasNewDesign) ? void 0 : [hasNewDesign]),
803
- filterEntitiesSimpleFieldByValues2("isWorkbook", _3.isNil(isWorkbook) ? void 0 : [isWorkbook]),
804
- filterEntitiesSimpleFieldByValues2("isWorkplan", _3.isNil(isWorkplan) ? void 0 : [isWorkplan]),
805
- filterEntitiesSimpleFieldByValues2("hasNoTeacherBook", _3.isNil(hasNoTeacherBook) ? void 0 : [hasNoTeacherBook]),
806
- filterEntitiesSimpleFieldByValues2("slug", slugs),
807
- filterEntitiesSimpleFieldByValues2("uri", uris),
808
- filterEntitiesSimpleFieldByValues2("isRenewed", _3.isNil(isRenewed) ? void 0 : [isRenewed]),
809
- filterEntitiesSimpleFieldByValue("isPrimary", isPrimary),
810
- _3.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _3.sortBy(sortByQuery) : _3.identity
811
- );
812
- var { getBooks, getBook, searchBooks, makeSearchBooks } = crud("books", {
813
- search: search2
814
- });
815
- var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _3.filter({ valid: true, hasNewDesign: true }, books));
816
- var searchValidBooks = makeSearchValidBooks();
817
- var makeGetBook = () => makeGetEntityById2("books");
818
-
819
769
  // src/selectors/user.ts
820
770
  init_define_import_meta();
821
771
  var import_reselect = __toESM(require_lib(), 1);
822
- import { filterEntitiesArrayFieldByValues as filterEntitiesArrayFieldByValues2, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues3 } from "@lls/utils";
823
- import _5 from "lodash/fp.js";
772
+ import { filterEntitiesArrayFieldByValues, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues2 } from "@lls/utils";
773
+ import _4 from "lodash/fp.js";
824
774
 
825
775
  // src/selectors/auth.ts
826
776
  init_define_import_meta();
827
- import _4 from "lodash/fp.js";
828
- var getAuth = _4.get("auth");
829
- var getIsLogged = _4.flow(_4.get("auth.id"), _4.negate(_4.isNil));
830
- var getToken = _4.get("auth.token");
777
+ import _3 from "lodash/fp.js";
778
+ var getAuth = _3.get("auth");
779
+ var getIsLogged = _3.flow(_3.get("auth.id"), _3.negate(_3.isNil));
780
+ var getToken = _3.get("auth.token");
831
781
 
832
782
  // src/selectors/user.ts
833
- var search3 = ({ ids, schoolIds }) => _5.flow(filterEntitiesArrayFieldByValues2("schools", schoolIds), filterEntitiesSimpleFieldByValues3("id", ids));
783
+ var search2 = ({ ids, schoolIds }) => _4.flow(filterEntitiesArrayFieldByValues("schools", schoolIds), filterEntitiesSimpleFieldByValues2("id", ids));
834
784
  var { getUsers, getUser, searchUsers, makeSearchUsers } = crud("users", {
835
- search: search3
785
+ search: search2
836
786
  });
837
787
  var getCurrentUser = (0, import_reselect.createSelector)(
838
788
  getAuth,
@@ -840,23 +790,10 @@ var getCurrentUser = (0, import_reselect.createSelector)(
840
790
  (auth2, users) => users?.find((user2) => user2?.id === auth2?.id)
841
791
  );
842
792
 
843
- // src/selectors/chapter.ts
844
- init_define_import_meta();
845
- import { filterEntitiesFieldExists, filterEntitiesSimpleFieldByValues as filterEntitiesSimpleFieldByValues4 } from "@lls/utils";
846
- import _6 from "lodash/fp.js";
847
- var search4 = ({ bookIds, ids, hasTeacherBook }) => _6.flow(
848
- filterEntitiesSimpleFieldByValues4("book", bookIds),
849
- filterEntitiesSimpleFieldByValues4("id", ids),
850
- filterEntitiesFieldExists("teacherBook", hasTeacherBook)
851
- );
852
- var { getChapters, getChapter, searchChapters, makeSearchChapters } = crud("chapters", {
853
- search: search4
854
- });
855
-
856
793
  // src/reducers/entities.ts
857
794
  init_define_import_meta();
858
795
  import { makeReducer } from "@lls/utils";
859
- import _7 from "lodash/fp.js";
796
+ import _5 from "lodash/fp.js";
860
797
 
861
798
  // src/actions/index.ts
862
799
  init_define_import_meta();
@@ -879,23 +816,23 @@ var resetAuth = makeActionCreator(actionTypes.RESET_AUTH);
879
816
  // src/reducers/entities.ts
880
817
  var deleteEntityReducer = (state, payload) => {
881
818
  const { path } = payload;
882
- return _7.omit(path, state);
819
+ return _5.omit(path, state);
883
820
  };
884
821
  var updateEntityReducer = (state, payload) => {
885
822
  const { path, entity } = payload;
886
- const currentEntity = _7.get(path, state);
887
- return _7.set(path, _7.merge(currentEntity, entity), state);
823
+ const currentEntity = _5.get(path, state);
824
+ return _5.set(path, _5.merge(currentEntity, entity), state);
888
825
  };
889
826
  var setEntityReducer = (state, payload) => {
890
827
  const { path, entity } = payload;
891
- return _7.set(path, entity, state);
828
+ return _5.set(path, entity, state);
892
829
  };
893
830
  var shallowAssign = (old, next, transform) => {
894
831
  let updated = false;
895
- const merged = _7.flow(
896
- _7.toPairs,
897
- _7.reduce((memo, [key, val]) => {
898
- if (_7.isEmpty(val)) return memo;
832
+ const merged = _5.flow(
833
+ _5.toPairs,
834
+ _5.reduce((memo, [key, val]) => {
835
+ if (_5.isEmpty(val)) return memo;
899
836
  if (!old[key]) {
900
837
  updated = true;
901
838
  memo[key] = val;
@@ -908,7 +845,7 @@ var shallowAssign = (old, next, transform) => {
908
845
  return memo;
909
846
  }
910
847
  return memo;
911
- }, _7.clone(old))
848
+ }, _5.clone(old))
912
849
  )(next);
913
850
  return updated ? merged : old;
914
851
  };
@@ -917,7 +854,7 @@ var setEntitiesReducer = (state, payload) => {
917
854
  return shallowAssign(
918
855
  entityKind,
919
856
  nextEntityKind,
920
- (oldEntity, nextEntity) => _7.isEqual(oldEntity, nextEntity) ? oldEntity : _7.assign(oldEntity, nextEntity)
857
+ (oldEntity, nextEntity) => _5.isEqual(oldEntity, nextEntity) ? oldEntity : _5.assign(oldEntity, nextEntity)
921
858
  );
922
859
  });
923
860
  };
@@ -935,7 +872,7 @@ var entities_default = entities;
935
872
  // src/reducers/auth.ts
936
873
  init_define_import_meta();
937
874
  import { makeReducer as makeReducer2 } from "@lls/utils";
938
- import _8 from "lodash/fp.js";
875
+ import _6 from "lodash/fp.js";
939
876
  var initialState = {
940
877
  id: void 0,
941
878
  role: null,
@@ -948,15 +885,15 @@ var initialState = {
948
885
  llsUserId: null
949
886
  };
950
887
  var auth = makeReducer2(initialState, {
951
- [actionTypes.SET_AUTH]: _8.assign,
952
- [actionTypes.RESET_AUTH]: _8.constant(initialState)
888
+ [actionTypes.SET_AUTH]: _6.assign,
889
+ [actionTypes.RESET_AUTH]: _6.constant(initialState)
953
890
  });
954
891
  var auth_default = auth;
955
892
 
956
893
  // src/schema/index.ts
957
894
  init_define_import_meta();
958
895
  var import_normalizr = __toESM(require_normalizr(), 1);
959
- import _9 from "lodash/fp.js";
896
+ import _7 from "lodash/fp.js";
960
897
  var document = new import_normalizr.schema.Entity("documents", {}, { idAttribute: "resourceId" });
961
898
  var subject = new import_normalizr.schema.Entity("subjects");
962
899
  var level = new import_normalizr.schema.Entity("levels");
@@ -1141,31 +1078,20 @@ var querySchema = {
1141
1078
  }
1142
1079
  }
1143
1080
  };
1144
- var normalizeData = _9.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1081
+ var normalizeData = _7.flow((data) => (0, import_normalizr.normalize)(data, querySchema));
1145
1082
  export {
1146
1083
  auth_default as authReducer,
1147
1084
  entities_default as entitiesReducer,
1148
- getBook,
1149
- getBooks,
1150
- getChapter,
1151
- getChapters,
1152
1085
  getCurrentUser,
1153
1086
  getSchool,
1154
1087
  getSchools,
1155
1088
  getUser,
1156
1089
  getUsers,
1157
- makeGetBook,
1158
- makeSearchBooks,
1159
- makeSearchChapters,
1160
1090
  makeSearchSchools,
1161
1091
  makeSearchUsers,
1162
- makeSearchValidBooks,
1163
1092
  normalizeData,
1164
1093
  querySchema,
1165
- searchBooks,
1166
- searchChapters,
1167
1094
  searchSchools,
1168
1095
  searchUsers,
1169
- searchValidBooks,
1170
1096
  setEntitiesReducer
1171
1097
  };
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.1.59-65ad9aaa",
5
+ "version": "24.1.59-6b359862",
6
6
  "type": "module",
7
7
  "types": "./lib/builttypes/store/src/index.d.ts",
8
8
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "react": "*"
29
29
  },
30
30
  "devDependencies": {
31
- "@biomejs/biome": "1.8.4-nightly.7aaf0ce",
31
+ "@biomejs/biome": "1.8.4-nightly.a579bf7",
32
32
  "@types/lodash": "4.17.6",
33
33
  "@types/node": "20.14.10",
34
34
  "@types/react": "18.3.3",
@@ -41,8 +41,8 @@
41
41
  "vite": "5.3.3",
42
42
  "vite-tsconfig-paths": "4.3.2",
43
43
  "vitest": "2.0.0",
44
- "@lls/utils": "24.1.59-65ad9aaa",
45
- "@lls/vitescripts": "24.1.59-65ad9aaa"
44
+ "@lls/utils": "24.1.59-6b359862",
45
+ "@lls/vitescripts": "24.1.59-6b359862"
46
46
  },
47
47
  "license": "ISC",
48
48
  "dependencies": {