@overmap-ai/core 1.0.63-selector-standardization.6 → 1.0.63-selector-standardization.8
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.
- package/dist/overmap-core.js +26 -95
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +26 -95
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/slices/assetSlice.d.ts +44 -13
- package/dist/store/slices/emailDomainsSlice.d.ts +6 -2
- package/dist/store/slices/formRevisionSlice.d.ts +1 -2
- package/dist/store/slices/formSlice.d.ts +8 -4
- package/dist/store/slices/organizationSlice.d.ts +7 -4
- package/dist/store/slices/userSlice.d.ts +0 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -950,42 +950,15 @@ const assetSlice = createSlice({
|
|
|
950
950
|
initialState: initialState$y,
|
|
951
951
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
952
952
|
reducers: {
|
|
953
|
-
initializeAssets:
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
assetAdapter.addMany(state, action);
|
|
963
|
-
prevAssets = null;
|
|
964
|
-
},
|
|
965
|
-
setAsset: (state, action) => {
|
|
966
|
-
assetAdapter.setOne(state, action);
|
|
967
|
-
prevAssets = null;
|
|
968
|
-
},
|
|
969
|
-
setAssets: (state, action) => {
|
|
970
|
-
assetAdapter.setMany(state, action);
|
|
971
|
-
prevAssets = null;
|
|
972
|
-
},
|
|
973
|
-
updateAsset: (state, action) => {
|
|
974
|
-
assetAdapter.updateOne(state, action);
|
|
975
|
-
prevAssets = null;
|
|
976
|
-
},
|
|
977
|
-
updateAssets: (state, action) => {
|
|
978
|
-
assetAdapter.updateMany(state, action);
|
|
979
|
-
prevAssets = null;
|
|
980
|
-
},
|
|
981
|
-
deleteAsset: (state, action) => {
|
|
982
|
-
assetAdapter.deleteOne(state, action);
|
|
983
|
-
prevAssets = null;
|
|
984
|
-
},
|
|
985
|
-
deleteAssets: (state, action) => {
|
|
986
|
-
assetAdapter.deleteMany(state, action);
|
|
987
|
-
prevAssets = null;
|
|
988
|
-
}
|
|
953
|
+
initializeAssets: assetAdapter.initialize,
|
|
954
|
+
addAsset: assetAdapter.addOne,
|
|
955
|
+
addAssets: assetAdapter.addMany,
|
|
956
|
+
setAsset: assetAdapter.setOne,
|
|
957
|
+
setAssets: assetAdapter.setMany,
|
|
958
|
+
updateAsset: assetAdapter.updateOne,
|
|
959
|
+
updateAssets: assetAdapter.updateMany,
|
|
960
|
+
deleteAsset: assetAdapter.deleteOne,
|
|
961
|
+
deleteAssets: assetAdapter.deleteMany
|
|
989
962
|
}
|
|
990
963
|
});
|
|
991
964
|
const {
|
|
@@ -999,14 +972,10 @@ const {
|
|
|
999
972
|
setAsset,
|
|
1000
973
|
setAssets
|
|
1001
974
|
} = assetSlice.actions;
|
|
1002
|
-
let prevAssets = null;
|
|
1003
|
-
const selectAssets = (state) => {
|
|
1004
|
-
if (!prevAssets) {
|
|
1005
|
-
prevAssets = Object.values(state.assetReducer.instances);
|
|
1006
|
-
}
|
|
1007
|
-
return prevAssets;
|
|
1008
|
-
};
|
|
1009
975
|
const selectAssetsMapping = (state) => state.assetReducer.instances;
|
|
976
|
+
const selectAssets = createSelector([selectAssetsMapping], (assetsMapping) => {
|
|
977
|
+
return Object.values(assetsMapping);
|
|
978
|
+
});
|
|
1010
979
|
const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
|
|
1011
980
|
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (components, assetTypeId) => {
|
|
1012
981
|
return components.filter((asset) => asset.asset_type === assetTypeId);
|
|
@@ -1739,11 +1708,6 @@ const {
|
|
|
1739
1708
|
const userReducer = userSlice.reducer;
|
|
1740
1709
|
const selectCurrentUser = (state) => state.userReducer.currentUser;
|
|
1741
1710
|
const selectUsersMapping = (state) => state.userReducer.users;
|
|
1742
|
-
const selectUser = (userId) => (state) => {
|
|
1743
|
-
if (userId === null)
|
|
1744
|
-
return void 0;
|
|
1745
|
-
return state.userReducer.users[userId];
|
|
1746
|
-
};
|
|
1747
1711
|
const selectUserById = (id) => (state) => {
|
|
1748
1712
|
return state.userReducer.users[id];
|
|
1749
1713
|
};
|
|
@@ -2015,19 +1979,19 @@ const organizationSlice = createSlice({
|
|
|
2015
1979
|
}
|
|
2016
1980
|
});
|
|
2017
1981
|
const { setOrganizations } = organizationSlice.actions;
|
|
2018
|
-
const selectOrganizations = (state) => {
|
|
2019
|
-
return Object.values(state.organizationReducer.organizations);
|
|
2020
|
-
};
|
|
2021
1982
|
const selectOrganizationsMapping = (state) => {
|
|
2022
1983
|
return state.organizationReducer.organizations;
|
|
2023
1984
|
};
|
|
1985
|
+
const selectOrganizations = createSelector([selectOrganizationsMapping], (organizationsMapping) => {
|
|
1986
|
+
return Object.values(organizationsMapping);
|
|
1987
|
+
});
|
|
1988
|
+
const selectOrganizationById = (id) => (state) => {
|
|
1989
|
+
return state.organizationReducer.organizations[id];
|
|
1990
|
+
};
|
|
2024
1991
|
const selectOrganizationsWithAccess = createSelector(
|
|
2025
1992
|
[selectOrganizations],
|
|
2026
1993
|
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2027
1994
|
);
|
|
2028
|
-
const selectOrganizationById = (id) => (state) => {
|
|
2029
|
-
return state.organizationReducer.organizations[id];
|
|
2030
|
-
};
|
|
2031
1995
|
const selectOrganizationUsersIds = createSelector(
|
|
2032
1996
|
[selectOrganizationAccesses],
|
|
2033
1997
|
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
@@ -2070,9 +2034,6 @@ const selectSortedOrganizationUsers = createSelector(
|
|
|
2070
2034
|
});
|
|
2071
2035
|
}
|
|
2072
2036
|
);
|
|
2073
|
-
const selectOrganization = (id) => (state) => {
|
|
2074
|
-
return state.organizationReducer.organizations[id];
|
|
2075
|
-
};
|
|
2076
2037
|
const organizationReducer = organizationSlice.reducer;
|
|
2077
2038
|
const createOfflineAction = (request2, baseUrl, serviceName) => {
|
|
2078
2039
|
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: v4() };
|
|
@@ -2377,32 +2338,6 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2377
2338
|
}
|
|
2378
2339
|
)
|
|
2379
2340
|
);
|
|
2380
|
-
const selectLatestFormRevisionsOfAssetTypes = restructureCreateSelectorWithArgs(
|
|
2381
|
-
createSelector(
|
|
2382
|
-
[
|
|
2383
|
-
(state) => state.formReducer.instances,
|
|
2384
|
-
selectFormRevisionMapping,
|
|
2385
|
-
(_state, assetTypeIds) => assetTypeIds
|
|
2386
|
-
],
|
|
2387
|
-
(formsMapping, revisions, assetTypeIds) => {
|
|
2388
|
-
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
2389
|
-
const formsOfAssetTypes = {};
|
|
2390
|
-
const ret = {};
|
|
2391
|
-
for (const form of Object.values(formsMapping)) {
|
|
2392
|
-
if (form.asset_type && assetTypeIdsSet.has(form.asset_type)) {
|
|
2393
|
-
formsOfAssetTypes[form.offline_id] = form;
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
for (const revision of Object.values(revisions)) {
|
|
2397
|
-
const form = formsOfAssetTypes[revision.form];
|
|
2398
|
-
if (!form || !form.asset_type || ret[form.asset_type] && formRevisionSortFn(ret[form.asset_type], revision) > 0)
|
|
2399
|
-
continue;
|
|
2400
|
-
ret[form.asset_type] = revision;
|
|
2401
|
-
}
|
|
2402
|
-
return ret;
|
|
2403
|
-
}
|
|
2404
|
-
)
|
|
2405
|
-
);
|
|
2406
2341
|
const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2407
2342
|
const latestRevisions = {};
|
|
2408
2343
|
for (const revision of Object.values(revisions)) {
|
|
@@ -2431,9 +2366,13 @@ const formSlice = createSlice({
|
|
|
2431
2366
|
}
|
|
2432
2367
|
});
|
|
2433
2368
|
const { initializeForms, setForm, addForm, addForms, updateForm, deleteForm } = formSlice.actions;
|
|
2434
|
-
const
|
|
2369
|
+
const formReducer = formSlice.reducer;
|
|
2370
|
+
const selectFormMapping = (state) => {
|
|
2435
2371
|
return state.formReducer.instances;
|
|
2436
2372
|
};
|
|
2373
|
+
const selectForms = createSelector([selectFormMapping], (formsMapping) => {
|
|
2374
|
+
return Object.values(formsMapping);
|
|
2375
|
+
});
|
|
2437
2376
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2438
2377
|
createSelector(
|
|
2439
2378
|
[
|
|
@@ -2470,9 +2409,6 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2470
2409
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2471
2410
|
)
|
|
2472
2411
|
);
|
|
2473
|
-
const selectFormMapping = (state) => {
|
|
2474
|
-
return state.formReducer.instances;
|
|
2475
|
-
};
|
|
2476
2412
|
const selectFormById = (formId) => (state) => {
|
|
2477
2413
|
return state.formReducer.instances[formId];
|
|
2478
2414
|
};
|
|
@@ -2498,7 +2434,6 @@ const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
|
2498
2434
|
const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2499
2435
|
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2500
2436
|
});
|
|
2501
|
-
const formReducer = formSlice.reducer;
|
|
2502
2437
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2503
2438
|
const initialState$d = submissionAdapter.getInitialState({});
|
|
2504
2439
|
const formSubmissionSlice = createSlice({
|
|
@@ -2817,7 +2752,7 @@ const emailDomainsSlice = createSlice({
|
|
|
2817
2752
|
});
|
|
2818
2753
|
const { initializeEmailDomains, addEmailDomain, deleteEmailDomain } = emailDomainsSlice.actions;
|
|
2819
2754
|
const selectEmailDomainsAsMapping = (state) => state.emailDomainsReducer.instances;
|
|
2820
|
-
const selectEmailDomains = (
|
|
2755
|
+
const selectEmailDomains = createSelector([selectEmailDomainsAsMapping], (mapping) => Object.values(mapping));
|
|
2821
2756
|
const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
2822
2757
|
createSelector(
|
|
2823
2758
|
[selectEmailDomains, (_, organizationId) => organizationId],
|
|
@@ -4309,7 +4244,6 @@ class AssetService extends BaseApiService {
|
|
|
4309
4244
|
}
|
|
4310
4245
|
// TODO: payload does not require asset_type
|
|
4311
4246
|
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
4312
|
-
const { store } = this.client;
|
|
4313
4247
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4314
4248
|
const transactionId = v4();
|
|
4315
4249
|
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
@@ -4353,7 +4287,7 @@ class AssetService extends BaseApiService {
|
|
|
4353
4287
|
}
|
|
4354
4288
|
void Promise.all(batchPromises).then((result) => {
|
|
4355
4289
|
const allCreatedAssets = result.flat();
|
|
4356
|
-
|
|
4290
|
+
this.dispatch(addAssets(allCreatedAssets));
|
|
4357
4291
|
});
|
|
4358
4292
|
return batchPromises;
|
|
4359
4293
|
}
|
|
@@ -7918,8 +7852,8 @@ export {
|
|
|
7918
7852
|
selectFormSubmissionsOfAsset,
|
|
7919
7853
|
selectFormSubmissionsOfForm,
|
|
7920
7854
|
selectFormSubmissionsOfIssue,
|
|
7855
|
+
selectForms,
|
|
7921
7856
|
selectFormsCount,
|
|
7922
|
-
selectFormsMapping,
|
|
7923
7857
|
selectGeneralFormCount,
|
|
7924
7858
|
selectGeoImageById,
|
|
7925
7859
|
selectGeoImageMapping,
|
|
@@ -7952,7 +7886,6 @@ export {
|
|
|
7952
7886
|
selectIssuesOfIssueTypeCount,
|
|
7953
7887
|
selectLatestFormRevisionByForm,
|
|
7954
7888
|
selectLatestFormRevisionOfForm,
|
|
7955
|
-
selectLatestFormRevisionsOfAssetTypes,
|
|
7956
7889
|
selectLatestRetryTime,
|
|
7957
7890
|
selectLicense,
|
|
7958
7891
|
selectLicenseForProject,
|
|
@@ -7961,7 +7894,6 @@ export {
|
|
|
7961
7894
|
selectLicensesOfOrganization,
|
|
7962
7895
|
selectMainWorkspace,
|
|
7963
7896
|
selectNumberOfAssetsOfAssetType,
|
|
7964
|
-
selectOrganization,
|
|
7965
7897
|
selectOrganizationAccessById,
|
|
7966
7898
|
selectOrganizationAccessForUser,
|
|
7967
7899
|
selectOrganizationAccessUserMapping,
|
|
@@ -8006,7 +7938,6 @@ export {
|
|
|
8006
7938
|
selectTeamsOfOrganization,
|
|
8007
7939
|
selectTeamsOfUser,
|
|
8008
7940
|
selectUploadUrl,
|
|
8009
|
-
selectUser,
|
|
8010
7941
|
selectUserById,
|
|
8011
7942
|
selectUsersByIds,
|
|
8012
7943
|
selectUsersMapping,
|