@asteby/metacore-runtime-react 28.3.4 → 28.3.5

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,15 @@
1
1
  # @asteby/metacore-runtime-react
2
2
 
3
+ ## 28.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - ca3b27f: Subida de imágenes arreglada: el UploadField posteaba a `/uploads` (el host
8
+ sirve `/upload`) → 404. Además el subfolder declarado por campo
9
+ (`storage_path` en el manifest) ahora se manda también como `folder`, que es
10
+ el parámetro que lee el host — antes toda subida caía en la carpeta por
11
+ defecto.
12
+
3
13
  ## 28.3.4
4
14
 
5
15
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"upload-field.d.ts","sourceRoot":"","sources":["../src/upload-field.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC7B;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAWzD;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK1D;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAkHvE"}
1
+ {"version":3,"file":"upload-field.d.ts","sourceRoot":"","sources":["../src/upload-field.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC7B;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAWzD;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK1D;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAyHvE"}
@@ -17,7 +17,7 @@ import { Loader2, Paperclip, X } from 'lucide-react';
17
17
  import { useApi } from './api-context';
18
18
  import { getUploadConfig } from './dynamic-form-schema';
19
19
  /** Default host upload endpoint. Overridable per-field via `searchEndpoint`. */
20
- const DEFAULT_UPLOAD_ENDPOINT = '/uploads';
20
+ const DEFAULT_UPLOAD_ENDPOINT = '/upload';
21
21
  /**
22
22
  * Pulls the stored file url/path out of an upload response envelope, tolerating
23
23
  * the common key shapes a host might return. Pure — exported for tests.
@@ -72,8 +72,14 @@ export function UploadField({ field, value, onChange }) {
72
72
  }
73
73
  const form = new FormData();
74
74
  form.append('file', file);
75
- if (storagePath)
75
+ // The destination subfolder, declared per field via the manifest
76
+ // (`storage_path`). Sent under BOTH keys: `folder` is what the ops
77
+ // host reads (`c.FormValue("folder")`), `storage_path` is the
78
+ // canonical SDK name kept for hosts that read it.
79
+ if (storagePath) {
80
+ form.append('folder', storagePath);
76
81
  form.append('storage_path', storagePath);
82
+ }
77
83
  setUploading(true);
78
84
  try {
79
85
  const res = await api.post(endpoint, form, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "28.3.4",
3
+ "version": "28.3.5",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@ export interface UploadFieldProps {
24
24
  }
25
25
 
26
26
  /** Default host upload endpoint. Overridable per-field via `searchEndpoint`. */
27
- const DEFAULT_UPLOAD_ENDPOINT = '/uploads'
27
+ const DEFAULT_UPLOAD_ENDPOINT = '/upload'
28
28
 
29
29
  /**
30
30
  * Pulls the stored file url/path out of an upload response envelope, tolerating
@@ -79,7 +79,14 @@ export function UploadField({ field, value, onChange }: UploadFieldProps) {
79
79
  }
80
80
  const form = new FormData()
81
81
  form.append('file', file)
82
- if (storagePath) form.append('storage_path', storagePath)
82
+ // The destination subfolder, declared per field via the manifest
83
+ // (`storage_path`). Sent under BOTH keys: `folder` is what the ops
84
+ // host reads (`c.FormValue("folder")`), `storage_path` is the
85
+ // canonical SDK name kept for hosts that read it.
86
+ if (storagePath) {
87
+ form.append('folder', storagePath)
88
+ form.append('storage_path', storagePath)
89
+ }
83
90
  setUploading(true)
84
91
  try {
85
92
  const res = await api.post(endpoint, form, {