@overmap-ai/core 1.0.60-forms-removal.5 → 1.0.60-forms-removal.7

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.
@@ -2334,7 +2334,7 @@ const projectFileSlice = createSlice({
2334
2334
  doesn't exist.`
2335
2335
  );
2336
2336
  }
2337
- state.projectFiles[activeProjectFileId].geo_bounds = action.payload;
2337
+ state.projectFiles[activeProjectFileId].bounds = action.payload;
2338
2338
  },
2339
2339
  // TODO: Move to MapContext. Should not be persisted.
2340
2340
  setActiveProjectFileId: (state, action) => {
@@ -4199,6 +4199,9 @@ function chunkArray(arr, chunkSize) {
4199
4199
  class AssetService extends BaseApiService {
4200
4200
  // Basic CRUD functions
4201
4201
  add(asset, workspaceId) {
4202
+ if (!asset.canvas_marker && !asset.geo_marker) {
4203
+ throw new Error("Asset must have either a canvas_marker or geo_marker");
4204
+ }
4202
4205
  const offlineAsset = offline(asset);
4203
4206
  this.dispatch(addAsset(offlineAsset));
4204
4207
  const promise = this.enqueueRequest({
@@ -4215,6 +4218,9 @@ class AssetService extends BaseApiService {
4215
4218
  return [offlineAsset, promise];
4216
4219
  }
4217
4220
  update(asset, workspaceId) {
4221
+ if (!asset.canvas_marker && !asset.geo_marker) {
4222
+ throw new Error("Asset must have either a canvas_marker or geo_marker");
4223
+ }
4218
4224
  this.client.store.dispatch(updateAsset(asset));
4219
4225
  const promise = this.enqueueRequest({
4220
4226
  description: "Edit asset",
@@ -5339,6 +5345,9 @@ class ProjectFileService extends BaseApiService {
5339
5345
  if (!activeProjectFile) {
5340
5346
  throw new Error("No active project file");
5341
5347
  }
5348
+ if (!activeProjectFile.bounds && !activeProjectFile.canvas_bounds) {
5349
+ throw new Error("Project file must either have bounds or canvas_bounds set");
5350
+ }
5342
5351
  let requestDetails;
5343
5352
  const existing = typeof activeProjectFile.file === "string" && !activeProjectFile.file.startsWith("blob:");
5344
5353
  if (existing) {
@@ -5359,7 +5368,6 @@ class ProjectFileService extends BaseApiService {
5359
5368
  url: `/projects/${activeProjectId}/files/`,
5360
5369
  payload: {
5361
5370
  ...activeProjectFile,
5362
- geo_bounds: JSON.stringify(activeProjectFile.geo_bounds),
5363
5371
  ...fileProps
5364
5372
  },
5365
5373
  blockers: [activeProjectFileId],
@@ -5431,6 +5439,9 @@ class ProjectService extends BaseApiService {
5431
5439
  if (!project.owner_organization && !project.owner_user) {
5432
5440
  throw new Error("Project type was not chosen when trying to create a project");
5433
5441
  }
5442
+ if (!project.bounds && !project.canvas_bounds) {
5443
+ throw new Error("Project must either have bounds or canvas_bounds set");
5444
+ }
5434
5445
  const isOrganizationProject = !!project.owner_organization;
5435
5446
  const url = isOrganizationProject ? `/organizations/${project.owner_organization}/projects/` : "/projects/";
5436
5447
  const projectType = isOrganizationProject ? { organization_owner: project.owner_organization } : { user_owner: project.owner_user };
@@ -5440,7 +5451,7 @@ class ProjectService extends BaseApiService {
5440
5451
  url,
5441
5452
  payload: {
5442
5453
  name: project.name,
5443
- geo_bounds: project.geo_bounds,
5454
+ bounds: project.bounds,
5444
5455
  ...projectType
5445
5456
  },
5446
5457
  blockers: [],
@@ -5449,6 +5460,9 @@ class ProjectService extends BaseApiService {
5449
5460
  return result;
5450
5461
  }
5451
5462
  async update(project) {
5463
+ if (!project.bounds || !project.canvas_bounds) {
5464
+ throw new Error("Project must either have bounds or canvas_bounds set");
5465
+ }
5452
5466
  this.dispatch(updateOrCreateProject(project));
5453
5467
  return await this.enqueueRequest({
5454
5468
  description: "Update project",
@@ -5456,7 +5470,7 @@ class ProjectService extends BaseApiService {
5456
5470
  url: `/projects/${project.id}/`,
5457
5471
  payload: {
5458
5472
  name: project.name,
5459
- geo_bounds: project.geo_bounds
5473
+ bounds: project.bounds
5460
5474
  },
5461
5475
  blockers: [project.id.toString()],
5462
5476
  blocks: [project.id.toString()]