@adminforth/list-in-place-edit 1.0.23 → 1.0.25

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/build.log CHANGED
@@ -7,5 +7,5 @@ custom/
7
7
  custom/InPlaceEdit.vue
8
8
  custom/tsconfig.json
9
9
 
10
- sent 5,347 bytes received 58 bytes 10,810.00 bytes/sec
10
+ sent 5,344 bytes received 58 bytes 10,804.00 bytes/sec
11
11
  total size is 5,132 speedup is 0.95
package/dist/index.js CHANGED
@@ -56,7 +56,16 @@ export default class ListInPlaceEditPlugin extends AdminForthPlugin {
56
56
  path: `/plugin/${this.pluginInstanceId}/update-field`,
57
57
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser }) {
58
58
  const { resourceId, recordId, field, value } = body;
59
+ if (this.resourceConfig.resourceId !== resourceId) {
60
+ return { error: 'Resource ID mismatch' };
61
+ }
62
+ if (!this.options.columns.includes(field)) {
63
+ return { error: 'Field not allowed to be edited' };
64
+ }
59
65
  const resource = this.adminforth.config.resources.find(r => r.resourceId === resourceId);
66
+ if (resource.columns.some(c => c.name === field && c.backendOnly === true)) {
67
+ return { error: 'Field is not editable, because it is marked as backendOnly' };
68
+ }
60
69
  // Create update object with just the single field
61
70
  const updateRecord = { [field]: value };
62
71
  // Use AdminForth's built-in update method
package/index.ts CHANGED
@@ -55,8 +55,16 @@ export default class ListInPlaceEditPlugin extends AdminForthPlugin {
55
55
  path: `/plugin/${this.pluginInstanceId}/update-field`,
56
56
  handler: async ({ body, adminUser }) => {
57
57
  const { resourceId, recordId, field, value } = body;
58
-
58
+ if (this.resourceConfig.resourceId !== resourceId) {
59
+ return { error: 'Resource ID mismatch' };
60
+ }
61
+ if (!this.options.columns.includes(field)) {
62
+ return { error: 'Field not allowed to be edited' };
63
+ }
59
64
  const resource = this.adminforth.config.resources.find(r => r.resourceId === resourceId);
65
+ if (resource.columns.some(c => c.name === field && c.backendOnly === true)) {
66
+ return { error: 'Field is not editable, because it is marked as backendOnly' };
67
+ }
60
68
  // Create update object with just the single field
61
69
  const updateRecord = { [field]: value };
62
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/list-in-place-edit",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "description": "AdminForth List In Place Edit Plugin",
20
20
  "devDependencies": {
21
21
  "@types/node": "^22.10.7",
22
- "adminforth": "^3.1.0",
22
+ "adminforth": "^3.6.2",
23
23
  "semantic-release": "^24.2.1",
24
24
  "semantic-release-slack-bot": "^4.0.2",
25
25
  "typescript": "^5.7.3"
@@ -32,7 +32,7 @@
32
32
  "vue-i18n": "^11.1.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "adminforth": "^3.1.0"
35
+ "adminforth": "^3.6.2"
36
36
  },
37
37
  "release": {
38
38
  "plugins": [
@@ -0,0 +1,2 @@
1
+ allowBuilds:
2
+ adminforth: true