@overmap-ai/core 1.0.60-forms-removal.6 → 1.0.60-forms-removal.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.
@@ -2613,6 +2613,9 @@ const formSlice = createSlice({
2613
2613
  }
2614
2614
  });
2615
2615
  const { setForms, setForm, addForm, addForms, updateForm, deleteForm } = formSlice.actions;
2616
+ const selectFormsMapping = (state) => {
2617
+ return state.formReducer.instances;
2618
+ };
2616
2619
  const selectFilteredForms = restructureCreateSelectorWithArgs(
2617
2620
  createSelector(
2618
2621
  [
@@ -2649,9 +2652,11 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
2649
2652
  { memoizeOptions: { equalityCheck: shallowEqual } }
2650
2653
  )
2651
2654
  );
2652
- const selectForm = (formId) => (state) => {
2653
- return state.formReducer.instances[formId];
2654
- };
2655
+ const selectForm = restructureCreateSelectorWithArgs(
2656
+ createSelector([selectFormsMapping, (_, formId) => formId], (userForms, formId) => {
2657
+ return userForms[formId];
2658
+ })
2659
+ );
2655
2660
  const selectFormMapping = (state) => {
2656
2661
  return state.formReducer.instances;
2657
2662
  };
@@ -4199,6 +4204,9 @@ function chunkArray(arr, chunkSize) {
4199
4204
  class AssetService extends BaseApiService {
4200
4205
  // Basic CRUD functions
4201
4206
  add(asset, workspaceId) {
4207
+ if (!asset.canvas_marker && !asset.geo_marker) {
4208
+ throw new Error("Asset must have either a canvas_marker or geo_marker");
4209
+ }
4202
4210
  const offlineAsset = offline(asset);
4203
4211
  this.dispatch(addAsset(offlineAsset));
4204
4212
  const promise = this.enqueueRequest({
@@ -4215,6 +4223,9 @@ class AssetService extends BaseApiService {
4215
4223
  return [offlineAsset, promise];
4216
4224
  }
4217
4225
  update(asset, workspaceId) {
4226
+ if (!asset.canvas_marker && !asset.geo_marker) {
4227
+ throw new Error("Asset must have either a canvas_marker or geo_marker");
4228
+ }
4218
4229
  this.client.store.dispatch(updateAsset(asset));
4219
4230
  const promise = this.enqueueRequest({
4220
4231
  description: "Edit asset",
@@ -5339,6 +5350,9 @@ class ProjectFileService extends BaseApiService {
5339
5350
  if (!activeProjectFile) {
5340
5351
  throw new Error("No active project file");
5341
5352
  }
5353
+ if (!activeProjectFile.bounds && !activeProjectFile.canvas_bounds) {
5354
+ throw new Error("Project file must either have bounds or canvas_bounds set");
5355
+ }
5342
5356
  let requestDetails;
5343
5357
  const existing = typeof activeProjectFile.file === "string" && !activeProjectFile.file.startsWith("blob:");
5344
5358
  if (existing) {
@@ -5359,7 +5373,6 @@ class ProjectFileService extends BaseApiService {
5359
5373
  url: `/projects/${activeProjectId}/files/`,
5360
5374
  payload: {
5361
5375
  ...activeProjectFile,
5362
- bounds: JSON.stringify(activeProjectFile.bounds),
5363
5376
  ...fileProps
5364
5377
  },
5365
5378
  blockers: [activeProjectFileId],
@@ -5431,6 +5444,9 @@ class ProjectService extends BaseApiService {
5431
5444
  if (!project.owner_organization && !project.owner_user) {
5432
5445
  throw new Error("Project type was not chosen when trying to create a project");
5433
5446
  }
5447
+ if (!project.bounds && !project.canvas_bounds) {
5448
+ throw new Error("Project must either have bounds or canvas_bounds set");
5449
+ }
5434
5450
  const isOrganizationProject = !!project.owner_organization;
5435
5451
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
5436
5452
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
@@ -5449,6 +5465,9 @@ class ProjectService extends BaseApiService {
5449
5465
  return result;
5450
5466
  }
5451
5467
  async update(project) {
5468
+ if (!project.bounds || !project.canvas_bounds) {
5469
+ throw new Error("Project must either have bounds or canvas_bounds set");
5470
+ }
5452
5471
  this.dispatch(updateOrCreateProject(project));
5453
5472
  return await this.enqueueRequest({
5454
5473
  description: "Update project",
@@ -7513,6 +7532,7 @@ export {
7513
7532
  selectFormSubmissionsOfForm,
7514
7533
  selectFormSubmissionsOfIssue,
7515
7534
  selectFormsCount,
7535
+ selectFormsMapping,
7516
7536
  selectGeneralFormCount,
7517
7537
  selectHiddenAssetTypeIds,
7518
7538
  selectHiddenCategoryCount,