@tinacms/schema-tools 1.10.0 → 1.10.1

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/dist/index.js CHANGED
@@ -2395,7 +2395,8 @@ ${formattedTypes}`;
2395
2395
  type: z.z.literal("image", {
2396
2396
  invalid_type_error: typeTypeError,
2397
2397
  required_error: typeRequiredError
2398
- })
2398
+ }),
2399
+ uploadDir: z.z.function().args(z.z.any()).returns(z.z.string()).optional()
2399
2400
  });
2400
2401
  const DateTimeField = TinaScalerBase.extend({
2401
2402
  type: z.z.literal("datetime", {
package/dist/index.mjs CHANGED
@@ -2377,7 +2377,8 @@ const ImageField = TinaScalerBase.extend({
2377
2377
  type: z.literal("image", {
2378
2378
  invalid_type_error: typeTypeError,
2379
2379
  required_error: typeRequiredError
2380
- })
2380
+ }),
2381
+ uploadDir: z.function().args(z.any()).returns(z.string()).optional()
2381
2382
  });
2382
2383
  const DateTimeField = TinaScalerBase.extend({
2383
2384
  type: z.literal("datetime", {
@@ -181,6 +181,16 @@ export type DateTimeField = (FieldGeneric<string, undefined, DateFormatProps> |
181
181
  };
182
182
  export type ImageField = (FieldGeneric<string, undefined> | FieldGeneric<string, true> | FieldGeneric<string, false>) & BaseField & {
183
183
  type: 'image';
184
+ /**
185
+ * A function that returns the upload directory path based on the form values.
186
+ * This is used to organize uploaded images into specific folders.
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * uploadDir: (formValues) => `uploads/${formValues.category}`
191
+ * ```
192
+ */
193
+ uploadDir?: (formValues: Record<string, any>) => string;
184
194
  };
185
195
  type ReferenceFieldOptions = {
186
196
  optionComponent?: OptionComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -26,17 +26,16 @@
26
26
  "@types/jest": "^29.5.14",
27
27
  "@types/micromatch": "^4.0.9",
28
28
  "@types/react": "^18.3.18",
29
- "@types/yup": "^0.29.14",
30
29
  "jest": "^29.7.0",
31
30
  "react": "^18.3.1",
32
31
  "ts-jest": "^29.2.5",
33
32
  "typescript": "^5.7.3",
34
- "yup": "^0.32.11",
33
+ "yup": "^1.6.1",
35
34
  "@tinacms/scripts": "1.4.1"
36
35
  },
37
36
  "peerDependencies": {
38
37
  "react": ">=16.14.0",
39
- "yup": "^0.32.0"
38
+ "yup": "^1.0.0"
40
39
  },
41
40
  "publishConfig": {
42
41
  "registry": "https://registry.npmjs.org"