datastake-daf 0.6.827 → 0.6.829

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.
@@ -25059,13 +25059,6 @@ const Content$1 = _ref => {
25059
25059
  }
25060
25060
  return all;
25061
25061
  }, {});
25062
- console.log({
25063
- groups,
25064
- singleGroupsKeys,
25065
- addedContent,
25066
- _length,
25067
- groupped
25068
- });
25069
25062
  return Object.keys(groupped).map(key => {
25070
25063
  const groups = groupped[key];
25071
25064
  return /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
@@ -45278,7 +45271,7 @@ const filtersConfig$e = {
45278
45271
  datastakeId: '',
45279
45272
  name: ''
45280
45273
  };
45281
- const selectFiltersConfig$e = {
45274
+ const selectFiltersConfig$d = {
45282
45275
  country: {
45283
45276
  type: 'select',
45284
45277
  label: 'Country',
@@ -46055,7 +46048,7 @@ function DataStoreTable$1(_ref) {
46055
46048
  goNext,
46056
46049
  setPagination
46057
46050
  } = useFilters({
46058
- selectFiltersConfig: selectFiltersConfig$e,
46051
+ selectFiltersConfig: selectFiltersConfig$d,
46059
46052
  view,
46060
46053
  goTo,
46061
46054
  location,
@@ -46149,7 +46142,7 @@ function DataStoreTable$1(_ref) {
46149
46142
  rowKey: "key",
46150
46143
  doEmptyRows: true,
46151
46144
  selectOptions,
46152
- filtersConfig: selectFiltersConfig$e,
46145
+ filtersConfig: selectFiltersConfig$d,
46153
46146
  onFilterChange: onFiltersChange,
46154
46147
  showFilters,
46155
46148
  defaultFilters,
@@ -53935,7 +53928,7 @@ const checkboxConfig$d = {
53935
53928
  name: "Name",
53936
53929
  datastakeId: "ID"
53937
53930
  };
53938
- const selectFiltersConfig$d = {
53931
+ const selectFiltersConfig$c = {
53939
53932
  account: {
53940
53933
  type: "select",
53941
53934
  label: "Account",
@@ -54019,6 +54012,16 @@ const useGetQueryParams = ({
54019
54012
  product,
54020
54013
  ...rest
54021
54014
  } = queryParams;
54015
+ const parsedSearchParams = safeJsonParse(rawSearchParams);
54016
+ const otherParams = {
54017
+ ...rest,
54018
+ ...(product ? {
54019
+ "products.typeOfProduct": product
54020
+ } : {}),
54021
+ ...(status ? {
54022
+ published: status === "submitted"
54023
+ } : {})
54024
+ };
54022
54025
  return {
54023
54026
  paginationQuery: {
54024
54027
  skip: page,
@@ -54026,21 +54029,13 @@ const useGetQueryParams = ({
54026
54029
  },
54027
54030
  searchParams: {
54028
54031
  qs: search,
54029
- fields: safeJsonParse(rawSearchParams)
54030
- },
54031
- otherParams: {
54032
- ...rest,
54033
- ...(product && {
54034
- "products.typeOfProduct": product
54035
- }),
54036
- ...(status && {
54037
- published: status === "submitted" ? true : false
54038
- })
54032
+ fields: parsedSearchParams
54039
54033
  },
54034
+ otherParams,
54040
54035
  sortBy,
54041
54036
  sortDir
54042
54037
  };
54043
- }, [queryParams]);
54038
+ }, [JSON.stringify(queryParams)]);
54044
54039
  return params;
54045
54040
  };
54046
54041
 
@@ -54103,7 +54098,6 @@ function useAdminTable({
54103
54098
  const params = filterParams({
54104
54099
  activeFilters: filter.activeFilters
54105
54100
  });
54106
- console.log(params, "params");
54107
54101
  const {
54108
54102
  data
54109
54103
  } = await getData({
@@ -54156,9 +54150,6 @@ const useGetParams = ({
54156
54150
  activeTab,
54157
54151
  ...rest
54158
54152
  } = otherParams;
54159
- console.log({
54160
- hasPagination
54161
- });
54162
54153
  const params = React.useMemo(() => {
54163
54154
  if (!hasPagination) {
54164
54155
  return {
@@ -54281,7 +54272,7 @@ function UserTable(_ref) {
54281
54272
  } = useAdminTable({
54282
54273
  goTo,
54283
54274
  location,
54284
- selectFiltersConfig: selectFiltersConfig$d,
54275
+ selectFiltersConfig: selectFiltersConfig$c,
54285
54276
  view: view$2,
54286
54277
  defaultUrlParams: defaultUrlParams$6,
54287
54278
  module,
@@ -54363,7 +54354,7 @@ function UserTable(_ref) {
54363
54354
  pagination: filter.pagination,
54364
54355
  selectOptions: selectOptions,
54365
54356
  setShowFilters: setShowFilters,
54366
- filtersConfig: selectFiltersConfig$d,
54357
+ filtersConfig: selectFiltersConfig$c,
54367
54358
  onFilterChange: filter.onFiltersChange,
54368
54359
  showFilters: showFilters,
54369
54360
  defaultFilters: filter.defaultFilters,
@@ -54691,7 +54682,7 @@ const checkboxConfig$c = {
54691
54682
  name: "Name",
54692
54683
  datastakeId: "ID"
54693
54684
  };
54694
- const selectFiltersConfig$c = {
54685
+ const selectFiltersConfig$b = {
54695
54686
  type: {
54696
54687
  type: "select",
54697
54688
  label: "Type",
@@ -55030,7 +55021,7 @@ function AccountTable(_ref) {
55030
55021
  } = useAdminTable({
55031
55022
  goTo,
55032
55023
  location,
55033
- selectFiltersConfig: selectFiltersConfig$c,
55024
+ selectFiltersConfig: selectFiltersConfig$b,
55034
55025
  view: view$1,
55035
55026
  defaultUrlParams: defaultUrlParams$5,
55036
55027
  module,
@@ -55158,7 +55149,7 @@ function AccountTable(_ref) {
55158
55149
  doEmptyRows: true,
55159
55150
  selectOptions: selectOptions,
55160
55151
  setShowFilters: setShowFilters,
55161
- filtersConfig: selectFiltersConfig$c,
55152
+ filtersConfig: selectFiltersConfig$b,
55162
55153
  onFilterChange: filter.onFiltersChange,
55163
55154
  showFilters: showFilters,
55164
55155
  defaultFilters: filter.defaultFilters,
@@ -55194,7 +55185,7 @@ function AccountTable(_ref) {
55194
55185
  });
55195
55186
  }
55196
55187
 
55197
- const selectFiltersConfig$b = {
55188
+ const selectFiltersConfig$a = {
55198
55189
  category: {
55199
55190
  type: "select",
55200
55191
  label: "Category",
@@ -55858,7 +55849,7 @@ function LocationTable(_ref) {
55858
55849
  } = useSubjectsAdminTable({
55859
55850
  goTo,
55860
55851
  location,
55861
- selectFiltersConfig: selectFiltersConfig$b,
55852
+ selectFiltersConfig: selectFiltersConfig$a,
55862
55853
  view,
55863
55854
  defaultUrlParams: defaultUrlParams$4,
55864
55855
  module,
@@ -55940,7 +55931,7 @@ function LocationTable(_ref) {
55940
55931
  selectOptions: selectOptions,
55941
55932
  doEmptyRows: true,
55942
55933
  setShowFilters: setShowFilters,
55943
- filtersConfig: selectFiltersConfig$b,
55934
+ filtersConfig: selectFiltersConfig$a,
55944
55935
  onFilterChange: filter.onFiltersChange,
55945
55936
  showFilters: showFilters,
55946
55937
  defaultFilters: filter.defaultFilters,
@@ -55970,7 +55961,7 @@ function LocationTable(_ref) {
55970
55961
  });
55971
55962
  }
55972
55963
 
55973
- const selectFiltersConfig$a = {
55964
+ const selectFiltersConfig$9 = {
55974
55965
  category: {
55975
55966
  type: "select",
55976
55967
  label: "Category",
@@ -56535,7 +56526,7 @@ function SubjectsTable(_ref) {
56535
56526
  } = useSubjectsAdminTable({
56536
56527
  goTo,
56537
56528
  location,
56538
- selectFiltersConfig: selectFiltersConfig$a,
56529
+ selectFiltersConfig: selectFiltersConfig$9,
56539
56530
  view,
56540
56531
  defaultUrlParams: defaultUrlParams$3,
56541
56532
  module,
@@ -56616,7 +56607,7 @@ function SubjectsTable(_ref) {
56616
56607
  selectOptions: selectOptions,
56617
56608
  doEmptyRows: true,
56618
56609
  setShowFilters: setShowFilters,
56619
- filtersConfig: selectFiltersConfig$a,
56610
+ filtersConfig: selectFiltersConfig$9,
56620
56611
  onFilterChange: filter.onFiltersChange,
56621
56612
  showFilters: showFilters,
56622
56613
  defaultFilters: filter.defaultFilters,
@@ -57143,7 +57134,7 @@ const getColumns$2 = ({
57143
57134
  return cols.filter(v => v.show);
57144
57135
  };
57145
57136
  const checkboxConfig$9 = {};
57146
- const selectFiltersConfig$9 = {
57137
+ const selectFiltersConfig$8 = {
57147
57138
  userRole: {
57148
57139
  type: "select",
57149
57140
  label: "Role",
@@ -57219,7 +57210,7 @@ function Users({
57219
57210
  } = useFilters({
57220
57211
  goTo,
57221
57212
  location,
57222
- selectFiltersConfig: selectFiltersConfig$9,
57213
+ selectFiltersConfig: selectFiltersConfig$8,
57223
57214
  defaultUrlParams: defaultUrlParams$2,
57224
57215
  module,
57225
57216
  filtersConfig: filtersConfig$9,
@@ -57317,7 +57308,7 @@ function Users({
57317
57308
  selectOptions: selectOptions,
57318
57309
  setShowFilters: setShowFilters,
57319
57310
  sourcesKey: "authorId",
57320
- filtersConfig: selectFiltersConfig$9,
57311
+ filtersConfig: selectFiltersConfig$8,
57321
57312
  onFilterChange: onFiltersChange,
57322
57313
  showFilters: showFilters,
57323
57314
  defaultFilters: defaultFilters,
@@ -57904,10 +57895,15 @@ function AdminView(_ref) {
57904
57895
  })
57905
57896
  });
57906
57897
  try {
57907
- await updateAccount({
57898
+ const {
57899
+ data
57900
+ } = await updateAccount({
57908
57901
  id: editData.id,
57909
57902
  data: newData
57910
57903
  });
57904
+ console.log({
57905
+ data
57906
+ });
57911
57907
  console.log('Checking for pending users...', {
57912
57908
  hasPendingUsers: pendingUsers.length > 0,
57913
57909
  hasInviteFunction: !!inviteCompanyAccount,
@@ -58627,7 +58623,7 @@ function AdminLocationScreen$1({
58627
58623
  });
58628
58624
  }
58629
58625
 
58630
- const selectFiltersConfig$8 = {
58626
+ const selectFiltersConfig$7 = {
58631
58627
  category: {
58632
58628
  type: "select",
58633
58629
  label: "Category",
@@ -58818,7 +58814,7 @@ function DocumentsTable({
58818
58814
  } = useSubjectsAdminTable({
58819
58815
  goTo,
58820
58816
  location,
58821
- selectFiltersConfig: selectFiltersConfig$8,
58817
+ selectFiltersConfig: selectFiltersConfig$7,
58822
58818
  view,
58823
58819
  defaultUrlParams: defaultUrlParams$1,
58824
58820
  module,
@@ -58905,7 +58901,7 @@ function DocumentsTable({
58905
58901
  selectOptions: selectOptions,
58906
58902
  doEmptyRows: true,
58907
58903
  setShowFilters: setShowFilters,
58908
- filtersConfig: selectFiltersConfig$8,
58904
+ filtersConfig: selectFiltersConfig$7,
58909
58905
  onFilterChange: filter.onFiltersChange,
58910
58906
  showFilters: showFilters,
58911
58907
  defaultFilters: filter.defaultFilters,
@@ -58970,46 +58966,24 @@ function AdminLocationScreen({
58970
58966
  });
58971
58967
  }
58972
58968
 
58973
- const selectFiltersConfig$7 = {
58974
- category: {
58975
- type: "select",
58976
- label: "Category",
58977
- placeholder: t => t("Category"),
58978
- style: {
58979
- flex: 1
58980
- },
58981
- labelStyle: {
58982
- flex: 1
58983
- },
58984
- getLabel: option => option.label,
58985
- getValue: option => option.value
58986
- },
58987
- country: {
58988
- type: "select",
58989
- label: "Country",
58990
- placeholder: t => t("Country"),
58991
- style: {
58992
- flex: 1
58993
- },
58994
- labelStyle: {
58995
- flex: 1
58996
- },
58997
- getLabel: option => option.label,
58998
- getValue: option => option.value
58999
- },
59000
- sources: {
59001
- type: "select",
59002
- label: "Sources",
59003
- placeholder: t => t("Sources"),
59004
- style: {
59005
- flex: 1
59006
- },
59007
- labelStyle: {
59008
- flex: 1
59009
- },
59010
- getLabel: option => option.label,
59011
- getValue: option => option.value
59012
- }
58969
+ const getSelectFiltersConfig = ({
58970
+ t
58971
+ }) => {
58972
+ return {
58973
+ eventsType: {
58974
+ type: "select",
58975
+ label: "type",
58976
+ placeholder: t("type"),
58977
+ style: {
58978
+ flex: 1
58979
+ },
58980
+ labelStyle: {
58981
+ flex: 1
58982
+ },
58983
+ getLabel: option => option.label,
58984
+ getValue: option => option.value
58985
+ }
58986
+ };
59013
58987
  };
59014
58988
  const filtersConfig$7 = {
59015
58989
  name: "",
@@ -59170,6 +59144,11 @@ function EventsTable({
59170
59144
  const {
59171
59145
  token
59172
59146
  } = useToken();
59147
+ const selectFiltersConfig = React.useMemo(() => {
59148
+ return getSelectFiltersConfig({
59149
+ t
59150
+ });
59151
+ }, [t]);
59173
59152
  const {
59174
59153
  filter,
59175
59154
  activeTab,
@@ -59182,7 +59161,7 @@ function EventsTable({
59182
59161
  } = useSubjectsAdminTable({
59183
59162
  goTo,
59184
59163
  location,
59185
- selectFiltersConfig: selectFiltersConfig$7,
59164
+ selectFiltersConfig,
59186
59165
  view,
59187
59166
  defaultUrlParams,
59188
59167
  module,
@@ -59266,7 +59245,7 @@ function EventsTable({
59266
59245
  selectOptions: selectOptions,
59267
59246
  doEmptyRows: true,
59268
59247
  setShowFilters: setShowFilters,
59269
- filtersConfig: selectFiltersConfig$7,
59248
+ filtersConfig: selectFiltersConfig,
59270
59249
  onFilterChange: filter.onFiltersChange,
59271
59250
  showFilters: showFilters,
59272
59251
  defaultFilters: filter.defaultFilters,
@@ -59342,9 +59321,6 @@ function getAdminRoutes(config) {
59342
59321
  userIsAdmin
59343
59322
  } = config;
59344
59323
  const APP_PREFIX = "APP_".concat(appName.toUpperCase());
59345
- console.log({
59346
- useAdminEventsConfig
59347
- });
59348
59324
  function DashboardWrapper() {
59349
59325
  const dashboardConfig = useAdminDashboardConfig();
59350
59326
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
@@ -2292,7 +2292,7 @@ const useWidgetFetch = ({
2292
2292
  };
2293
2293
  React.useEffect(() => {
2294
2294
  fetchData();
2295
- }, [config]);
2295
+ }, [JSON.stringify(rest?.filters)]);
2296
2296
  return {
2297
2297
  data,
2298
2298
  loading,
@@ -2399,6 +2399,16 @@ const useGetQueryParams = ({
2399
2399
  product,
2400
2400
  ...rest
2401
2401
  } = queryParams;
2402
+ const parsedSearchParams = safeJsonParse(rawSearchParams);
2403
+ const otherParams = {
2404
+ ...rest,
2405
+ ...(product ? {
2406
+ "products.typeOfProduct": product
2407
+ } : {}),
2408
+ ...(status ? {
2409
+ published: status === "submitted"
2410
+ } : {})
2411
+ };
2402
2412
  return {
2403
2413
  paginationQuery: {
2404
2414
  skip: page,
@@ -2406,21 +2416,13 @@ const useGetQueryParams = ({
2406
2416
  },
2407
2417
  searchParams: {
2408
2418
  qs: search,
2409
- fields: safeJsonParse(rawSearchParams)
2410
- },
2411
- otherParams: {
2412
- ...rest,
2413
- ...(product && {
2414
- "products.typeOfProduct": product
2415
- }),
2416
- ...(status && {
2417
- published: status === "submitted" ? true : false
2418
- })
2419
+ fields: parsedSearchParams
2419
2420
  },
2421
+ otherParams,
2420
2422
  sortBy,
2421
2423
  sortDir
2422
2424
  };
2423
- }, [queryParams]);
2425
+ }, [JSON.stringify(queryParams)]);
2424
2426
  return params;
2425
2427
  };
2426
2428
 
@@ -7491,7 +7491,7 @@ const useWidgetFetch = ({
7491
7491
  };
7492
7492
  React.useEffect(() => {
7493
7493
  fetchData();
7494
- }, [config]);
7494
+ }, [JSON.stringify(rest?.filters)]);
7495
7495
  return {
7496
7496
  data,
7497
7497
  loading,
@@ -40577,6 +40577,16 @@ const useGetQueryParams = ({
40577
40577
  product,
40578
40578
  ...rest
40579
40579
  } = queryParams;
40580
+ const parsedSearchParams = safeJsonParse(rawSearchParams);
40581
+ const otherParams = {
40582
+ ...rest,
40583
+ ...(product ? {
40584
+ "products.typeOfProduct": product
40585
+ } : {}),
40586
+ ...(status ? {
40587
+ published: status === "submitted"
40588
+ } : {})
40589
+ };
40580
40590
  return {
40581
40591
  paginationQuery: {
40582
40592
  skip: page,
@@ -40584,21 +40594,13 @@ const useGetQueryParams = ({
40584
40594
  },
40585
40595
  searchParams: {
40586
40596
  qs: search,
40587
- fields: safeJsonParse(rawSearchParams)
40588
- },
40589
- otherParams: {
40590
- ...rest,
40591
- ...(product && {
40592
- "products.typeOfProduct": product
40593
- }),
40594
- ...(status && {
40595
- published: status === "submitted" ? true : false
40596
- })
40597
+ fields: parsedSearchParams
40597
40598
  },
40599
+ otherParams,
40598
40600
  sortBy,
40599
40601
  sortDir
40600
40602
  };
40601
- }, [queryParams]);
40603
+ }, [JSON.stringify(queryParams)]);
40602
40604
  return params;
40603
40605
  };
40604
40606
 
@@ -41564,7 +41566,7 @@ const getFilterOptions$c = (options, t) => {
41564
41566
  const formConfig$a = {
41565
41567
  namespace: 'OPERATOR',
41566
41568
  view: ['scoping', 'new'],
41567
- scope: 'global',
41569
+ scope: 'createOperator',
41568
41570
  formType: 'operator'
41569
41571
  };
41570
41572
  const viewConfig$a = {
@@ -41991,7 +41993,7 @@ const getFilterOptions$b = (options, t) => {
41991
41993
  const formConfig$9 = {
41992
41994
  namespace: 'WORKERS',
41993
41995
  view: ['scoping', 'new'],
41994
- scope: 'global',
41996
+ scope: 'createWorker',
41995
41997
  formType: 'worker'
41996
41998
  };
41997
41999
  const viewConfig$9 = {
@@ -44636,7 +44638,7 @@ const getFilterOptions$4 = (options, t) => {
44636
44638
  const formConfig$2 = {
44637
44639
  namespace: 'PRODUCTION SITES',
44638
44640
  view: ['scoping', 'new'],
44639
- scope: 'global',
44641
+ scope: 'create',
44640
44642
  formType: 'production-sites'
44641
44643
  };
44642
44644
  const viewConfig$2 = {
@@ -45491,6 +45493,7 @@ const useFetchData = ({
45491
45493
  } = useGetQueryParams({
45492
45494
  location
45493
45495
  });
45496
+ const prevParamsRef = React.useRef();
45494
45497
  React.useEffect(() => {
45495
45498
  const cleanSearchParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value != null && value !== ''));
45496
45499
  const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
@@ -45499,7 +45502,7 @@ const useFetchData = ({
45499
45502
  }
45500
45503
  const extendingSortKey = extendingFilters?.sortBy ? Object.keys(extendingFilters.sortBy)[0] : null;
45501
45504
  const extendingSortDir = extendingFilters?.sortBy && extendingSortKey ? extendingFilters.sortBy[extendingSortKey] : null;
45502
- getData({
45505
+ const currentParams = {
45503
45506
  ...extendingFilters,
45504
45507
  pagination: paginationQuery,
45505
45508
  ...(Object.keys(otherParams).length > 0 && otherParams),
@@ -45510,8 +45513,14 @@ const useFetchData = ({
45510
45513
  sortBy: {
45511
45514
  [sortBy || extendingSortKey || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : extendingSortDir || -1
45512
45515
  }
45513
- }, subject);
45514
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
45516
+ };
45517
+ const currentParamsString = JSON.stringify(currentParams);
45518
+ if (prevParamsRef.current === currentParamsString) {
45519
+ return;
45520
+ }
45521
+ prevParamsRef.current = currentParamsString;
45522
+ getData(currentParams, subject);
45523
+ }, [location.search, JSON.stringify(extendingFilters), activeTab]);
45515
45524
  };
45516
45525
  const useTablePage = ({
45517
45526
  subject,
@@ -50657,13 +50666,6 @@ const Content = ({
50657
50666
  }
50658
50667
  return all;
50659
50668
  }, {});
50660
- console.log({
50661
- groups,
50662
- singleGroupsKeys,
50663
- addedContent,
50664
- _length,
50665
- groupped
50666
- });
50667
50669
  return Object.keys(groupped).map(key => {
50668
50670
  const groups = groupped[key];
50669
50671
  return /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
@@ -61765,14 +61767,18 @@ const getNamespace = namespace => {
61765
61767
  let _namespace = namespace;
61766
61768
  switch (namespace) {
61767
61769
  case "locations":
61770
+ case "location":
61768
61771
  _namespace = "location";
61769
61772
  break;
61770
61773
  case "stakeholders":
61774
+ case "stakeholder":
61771
61775
  _namespace = "stakeholder";
61772
61776
  break;
61773
61777
  case "documents":
61778
+ case "document":
61774
61779
  _namespace = "document";
61775
61780
  break;
61781
+ case "event":
61776
61782
  case "nashirikiEvent":
61777
61783
  case "events":
61778
61784
  _namespace = "event";
@@ -61815,7 +61821,7 @@ class LinkedSubjectsService extends BaseService {
61815
61821
  version
61816
61822
  }) {
61817
61823
  return this.apiGet({
61818
- url: `/${namespace === "nashirikiEvent" ? "event" : namespace}/${id}`,
61824
+ url: `/${getNamespace(namespace)}/${id}`,
61819
61825
  isApp: true,
61820
61826
  signal,
61821
61827
  params: {
@@ -62131,7 +62137,7 @@ const View = ({
62131
62137
  "management-location": "location",
62132
62138
  "management-stakeholder": "stakeholder",
62133
62139
  "management-event": "event",
62134
- "management-incident": "incident"
62140
+ "management-document": "document"
62135
62141
  };
62136
62142
  const handleDeleteSubject = React.useCallback(async () => {
62137
62143
  try {
@@ -1535,14 +1535,18 @@ const getNamespace = namespace => {
1535
1535
  let _namespace = namespace;
1536
1536
  switch (namespace) {
1537
1537
  case "locations":
1538
+ case "location":
1538
1539
  _namespace = "location";
1539
1540
  break;
1540
1541
  case "stakeholders":
1542
+ case "stakeholder":
1541
1543
  _namespace = "stakeholder";
1542
1544
  break;
1543
1545
  case "documents":
1546
+ case "document":
1544
1547
  _namespace = "document";
1545
1548
  break;
1549
+ case "event":
1546
1550
  case "nashirikiEvent":
1547
1551
  case "events":
1548
1552
  _namespace = "event";
@@ -1585,7 +1589,7 @@ class LinkedSubjectsService extends BaseService {
1585
1589
  version
1586
1590
  }) {
1587
1591
  return this.apiGet({
1588
- url: `/${namespace === "nashirikiEvent" ? "event" : namespace}/${id}`,
1592
+ url: `/${getNamespace(namespace)}/${id}`,
1589
1593
  isApp: true,
1590
1594
  signal,
1591
1595
  params: {
@@ -15074,6 +15074,30 @@ const getAdminLevelName = (data, level) => {
15074
15074
  return entry?.name || "-";
15075
15075
  };
15076
15076
 
15077
+ const formatDataForTable = (data, options) => {
15078
+ // If data is an array, take the first element
15079
+ const dataObj = Array.isArray(data) ? data[0] : data;
15080
+ return {
15081
+ data: {
15082
+ data: (dataObj.data || []).map(({
15083
+ children,
15084
+ ...rest
15085
+ }) => {
15086
+ if (Array.isArray(children) && children.length === 0) {
15087
+ return rest;
15088
+ }
15089
+ return {
15090
+ ...rest,
15091
+ children
15092
+ };
15093
+ }),
15094
+ meta: dataObj.data
15095
+ },
15096
+ ...(Object.keys(options)?.length > 0 && options),
15097
+ totalItems: Array.isArray(dataObj?.meta) ? dataObj?.meta?.[0]?.total : dataObj?.meta?.total || 0
15098
+ };
15099
+ };
15100
+
15077
15101
  exports.ErrorFormat = ErrorFormat;
15078
15102
  exports.MessageTypes = MessageTypes;
15079
15103
  exports.StorageManager = StorageManager;
@@ -15112,6 +15136,7 @@ exports.filterParams = filterParams;
15112
15136
  exports.filterSelectOptions = filterSelectOptions;
15113
15137
  exports.filterString = filterString;
15114
15138
  exports.findOptions = findOptions;
15139
+ exports.formatDataForTable = formatDataForTable;
15115
15140
  exports.formatErrors = formatErrors;
15116
15141
  exports.formatToKebabCase = formatToKebabCase$1;
15117
15142
  exports.getAdminLevelName = getAdminLevelName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.827",
3
+ "version": "0.6.829",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",