@remoteoss/json-schema-form 0.11.5-dev.20240821134012 → 0.11.5-dev.20240821144620

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.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821134012
5
- Generated: Wed, 21 Aug 2024 13:40:24 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821144620
5
+ Generated: Wed, 21 Aug 2024 14:46:34 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -674,7 +674,9 @@ function buildYupSchema(field, config, logic) {
674
674
  );
675
675
  }
676
676
  function isValidFileInput(files) {
677
- return files === void 0 || files === null || files.every((file) => file instanceof File);
677
+ return files === void 0 || files === null || files.every(
678
+ (file) => file instanceof File || Object.prototype.hasOwnProperty.call(file, "name")
679
+ );
678
680
  }
679
681
  function withFile(yupSchema) {
680
682
  return yupSchema.test("isValidFile", "Not a valid file.", isValidFileInput);
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821134012
5
- Generated: Wed, 21 Aug 2024 13:40:24 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821144620
5
+ Generated: Wed, 21 Aug 2024 14:46:34 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -637,7 +637,9 @@ function buildYupSchema(field, config, logic) {
637
637
  );
638
638
  }
639
639
  function isValidFileInput(files) {
640
- return files === void 0 || files === null || files.every((file) => file instanceof File);
640
+ return files === void 0 || files === null || files.every(
641
+ (file) => file instanceof File || Object.prototype.hasOwnProperty.call(file, "name")
642
+ );
641
643
  }
642
644
  function withFile(yupSchema) {
643
645
  return yupSchema.test("isValidFile", "Not a valid file.", isValidFileInput);
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821134012
5
- Generated: Wed, 21 Aug 2024 13:40:24 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.11.5-dev.20240821144620
5
+ Generated: Wed, 21 Aug 2024 14:46:34 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12153,7 +12153,9 @@ function buildYupSchema(field, config, logic) {
12153
12153
  );
12154
12154
  }
12155
12155
  function isValidFileInput(files) {
12156
- return files === void 0 || files === null || files.every((file) => file instanceof File);
12156
+ return files === void 0 || files === null || files.every(
12157
+ (file) => file instanceof File || Object.prototype.hasOwnProperty.call(file, "name")
12158
+ );
12157
12159
  }
12158
12160
  function withFile(yupSchema) {
12159
12161
  return yupSchema.test("isValidFile", "Not a valid file.", isValidFileInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.11.5-dev.20240821134012",
3
+ "version": "0.11.5-dev.20240821144620",
4
4
  "description": "Headless UI form powered by JSON Schemas",
5
5
  "author": "Remote.com <engineering@remote.com> (https://remote.com/)",
6
6
  "license": "MIT",
@@ -2862,8 +2862,19 @@ describe('createHeadlessForm', () => {
2862
2862
  .validate({ fileInput: [file] })
2863
2863
  ).resolves.toEqual(assertObj));
2864
2864
  });
2865
+
2865
2866
  describe('and file is not instance of a File', () => {
2866
- it('should throw an error', async () =>
2867
+ it('accepts if file object has name property', async () => {
2868
+ expect(
2869
+ object()
2870
+ .shape({
2871
+ fileInput: fields[0].schema,
2872
+ })
2873
+ .validate({ fileInput: [{ name: 'foo.pdf' }] })
2874
+ ).resolves.toEqual({ fileInput: [{ name: 'foo.pdf' }] });
2875
+ });
2876
+
2877
+ it('throw an error if invalid file object', async () =>
2867
2878
  expect(
2868
2879
  object()
2869
2880
  .shape({