@stoker-platform/web-app 0.5.80 → 0.5.82

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.82
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @stoker-platform/web-client@0.5.46
9
+
10
+ ## 0.5.81
11
+
12
+ ### Patch Changes
13
+
14
+ - feat: use single args object for hooks
15
+ - feat: add relation list constraints option
16
+ - Updated dependencies
17
+ - @stoker-platform/node-client@0.5.46
18
+ - @stoker-platform/utils@0.5.38
19
+ - @stoker-platform/web-client@0.5.45
20
+
3
21
  ## 0.5.80
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.80",
3
+ "version": "0.5.82",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.8",
53
53
  "@sentry/react": "^10.47.0",
54
- "@stoker-platform/node-client": "0.5.45",
55
- "@stoker-platform/utils": "0.5.37",
56
- "@stoker-platform/web-client": "0.5.44",
54
+ "@stoker-platform/node-client": "0.5.46",
55
+ "@stoker-platform/utils": "0.5.38",
56
+ "@stoker-platform/web-client": "0.5.46",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
package/src/Files.tsx CHANGED
@@ -268,16 +268,16 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
268
268
  }
269
269
 
270
270
  try {
271
- await runHooks("preFileAdd", globalConfig, customization, [
271
+ await runHooks("preFileAdd", globalConfig, customization, {
272
272
  record,
273
- filePath,
273
+ fullPath: filePath,
274
274
  filename,
275
- {
275
+ permissions: {
276
276
  read: metadata.customMetadata.read,
277
277
  update: metadata.customMetadata.update,
278
278
  delete: metadata.customMetadata.delete,
279
279
  },
280
- ])
280
+ })
281
281
  } catch {
282
282
  setUploadProgress((prev) =>
283
283
  prev.map((item) => (item.file === file ? { ...item, status: "error" } : item)),
@@ -320,16 +320,16 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
320
320
  })
321
321
 
322
322
  try {
323
- await runHooks("postFileAdd", globalConfig, customization, [
323
+ await runHooks("postFileAdd", globalConfig, customization, {
324
324
  record,
325
- filePath,
325
+ fullPath: filePath,
326
326
  filename,
327
- {
327
+ permissions: {
328
328
  read: metadata.customMetadata.read,
329
329
  update: metadata.customMetadata.update,
330
330
  delete: metadata.customMetadata.delete,
331
331
  },
332
- ])
332
+ })
333
333
  } catch {
334
334
  return
335
335
  }
@@ -483,9 +483,9 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
483
483
  }
484
484
 
485
485
  try {
486
- await runHooks("preFileUpdate", globalConfig, customization, [
486
+ await runHooks("preFileUpdate", globalConfig, customization, {
487
487
  record,
488
- {
488
+ update: {
489
489
  type: "permissions",
490
490
  path: selectedFileForPermissions.fullPath,
491
491
  originalPermissions: {
@@ -499,7 +499,7 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
499
499
  delete: updatedMetadata.customMetadata.delete,
500
500
  },
501
501
  },
502
- ])
502
+ })
503
503
  } catch {
504
504
  return
505
505
  }
@@ -512,9 +512,9 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
512
512
  })
513
513
 
514
514
  try {
515
- await runHooks("postFileUpdate", globalConfig, customization, [
515
+ await runHooks("postFileUpdate", globalConfig, customization, {
516
516
  record,
517
- {
517
+ update: {
518
518
  type: "permissions",
519
519
  path: selectedFileForPermissions.fullPath,
520
520
  originalPermissions: {
@@ -528,7 +528,7 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
528
528
  delete: updatedMetadata.customMetadata.delete,
529
529
  },
530
530
  },
531
- ])
531
+ })
532
532
  } catch {
533
533
  return
534
534
  }
@@ -690,10 +690,10 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
690
690
  const metadata = await getMetadata(originalRef)
691
691
 
692
692
  try {
693
- await runHooks("preFileUpdate", globalConfig, customization, [
693
+ await runHooks("preFileUpdate", globalConfig, customization, {
694
694
  record,
695
- { type: "rename", oldPath: item.fullPath, newPath },
696
- ])
695
+ update: { type: "rename", oldPath: item.fullPath, newPath },
696
+ })
697
697
  } catch {
698
698
  return
699
699
  }
@@ -712,10 +712,10 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
712
712
  })
713
713
 
714
714
  try {
715
- await runHooks("postFileUpdate", globalConfig, customization, [
715
+ await runHooks("postFileUpdate", globalConfig, customization, {
716
716
  record,
717
- { type: "rename", oldPath: item.fullPath, newPath },
718
- ])
717
+ update: { type: "rename", oldPath: item.fullPath, newPath },
718
+ })
719
719
  } catch {
720
720
  return
721
721
  }
package/src/Form.tsx CHANGED
@@ -2541,16 +2541,16 @@ function RecordForm({
2541
2541
  }
2542
2542
 
2543
2543
  try {
2544
- await runHooks("preFileAdd", globalConfig, customization, [
2545
- targetRecord,
2546
- filePath,
2544
+ await runHooks("preFileAdd", globalConfig, customization, {
2545
+ record: targetRecord,
2546
+ fullPath: filePath,
2547
2547
  filename,
2548
- {
2548
+ permissions: {
2549
2549
  read: metadata.customMetadata.read,
2550
2550
  update: metadata.customMetadata.update,
2551
2551
  delete: metadata.customMetadata.delete,
2552
2552
  },
2553
- ])
2553
+ })
2554
2554
  } catch {
2555
2555
  continue
2556
2556
  }
@@ -2572,16 +2572,16 @@ function RecordForm({
2572
2572
  toast({ title: "Upload successful", description: `${filename} uploaded successfully` })
2573
2573
 
2574
2574
  try {
2575
- await runHooks("postFileAdd", globalConfig, customization, [
2576
- targetRecord,
2577
- filePath,
2575
+ await runHooks("postFileAdd", globalConfig, customization, {
2576
+ record: targetRecord,
2577
+ fullPath: filePath,
2578
2578
  filename,
2579
- {
2579
+ permissions: {
2580
2580
  read: metadata.customMetadata.read,
2581
2581
  update: metadata.customMetadata.update,
2582
2582
  delete: metadata.customMetadata.delete,
2583
2583
  },
2584
- ])
2584
+ })
2585
2585
  } catch {
2586
2586
  return
2587
2587
  }
@@ -2682,16 +2682,16 @@ function RecordForm({
2682
2682
  ...record,
2683
2683
  } as StokerRecord
2684
2684
  try {
2685
- await runHooks("preFileAdd", globalConfig, customization, [
2686
- targetRecord,
2687
- filePath,
2685
+ await runHooks("preFileAdd", globalConfig, customization, {
2686
+ record: targetRecord,
2687
+ fullPath: filePath,
2688
2688
  filename,
2689
- {
2689
+ permissions: {
2690
2690
  read: metadata.customMetadata.read,
2691
2691
  update: metadata.customMetadata.update,
2692
2692
  delete: metadata.customMetadata.delete,
2693
2693
  },
2694
- ])
2694
+ })
2695
2695
  } catch {
2696
2696
  setShowPermissionsDialog(false)
2697
2697
  setPendingImageForUpdate(null)
@@ -2717,16 +2717,16 @@ function RecordForm({
2717
2717
  },
2718
2718
  async () => {
2719
2719
  try {
2720
- await runHooks("postFileAdd", globalConfig, customization, [
2721
- targetRecord,
2722
- filePath,
2720
+ await runHooks("postFileAdd", globalConfig, customization, {
2721
+ record: targetRecord,
2722
+ fullPath: filePath,
2723
2723
  filename,
2724
- {
2724
+ permissions: {
2725
2725
  read: metadata.customMetadata.read,
2726
2726
  update: metadata.customMetadata.update,
2727
2727
  delete: metadata.customMetadata.delete,
2728
2728
  },
2729
- ])
2729
+ })
2730
2730
  } catch {
2731
2731
  resolve()
2732
2732
  return
@@ -4368,7 +4368,7 @@ function RecordForm({
4368
4368
  if (!formValues) return
4369
4369
  const record = cloneDeep(originalRecord) as Partial<StokerRecord>
4370
4370
  const globalConfig = getGlobalConfigModule()
4371
- await runHooks("preDuplicate", globalConfig, customization, [record])
4371
+ await runHooks("preDuplicate", globalConfig, customization, { data: record })
4372
4372
  const recordToDuplicate: Partial<StokerRecord> = {}
4373
4373
  for (const field of fields) {
4374
4374
  const fieldCustomization = getFieldCustomization(field, customization)
@@ -5312,6 +5312,7 @@ function RecordForm({
5312
5312
  field: formList.sortField || relationCollection.recordTitleField,
5313
5313
  direction: formList.sortDirection,
5314
5314
  }}
5315
+ additionalConstraints={relationList.constraints}
5315
5316
  />
5316
5317
  </FiltersProvider>
5317
5318
  </div>
package/src/Record.tsx CHANGED
@@ -277,6 +277,7 @@ export const Record = ({ collection }: { collection: CollectionSchema }) => {
277
277
  item.collection === relationList.collection,
278
278
  )}
279
279
  hasBreadcrumbs={!!breadcrumbs}
280
+ additionalConstraints={relationList.constraints}
280
281
  />
281
282
  </FiltersProvider>
282
283
  </main>