@sprucelabs/schema 28.0.4 → 28.0.7

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.
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- declare const supportedTypes: readonly ["image/png", "image/jpeg", "application/pdf", "*"];
3
- export declare type SupportedFileType = typeof supportedTypes[number];
2
+ export declare const supportedFileTypes: readonly ["image/png", "image/jpeg", "application/pdf", "*"];
3
+ export declare type SupportedFileType = typeof supportedFileTypes[number];
4
4
  export interface FileFieldValue {
5
5
  name: string;
6
6
  type?: SupportedFileType;
@@ -14,4 +14,3 @@ export declare type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
14
14
  acceptableTypes: SupportedFileType[];
15
15
  };
16
16
  };
17
- export {};
@@ -1,7 +1,6 @@
1
- const supportedTypes = [
1
+ export const supportedFileTypes = [
2
2
  'image/png',
3
3
  'image/jpeg',
4
4
  'application/pdf',
5
5
  '*',
6
6
  ];
7
- export {};
@@ -1,9 +1,9 @@
1
1
  import { FieldTemplateDetailOptions, FieldTemplateDetails } from '../types/template.types';
2
2
  import AbstractField from './AbstractField';
3
- import { ImageFieldDefinition, ImageFieldValue } from './ImageField.types';
3
+ import { ImageFieldDefinition } from './ImageField.types';
4
4
  export default class ImageField extends AbstractField<ImageFieldDefinition> {
5
5
  static generateTemplateDetails(options: FieldTemplateDetailOptions<ImageFieldDefinition>): FieldTemplateDetails;
6
6
  static get description(): string;
7
- validate(value: ImageFieldValue): import("..").FieldError[];
7
+ validate(value: any): import("..").FieldError[];
8
8
  private getRequiredSizes;
9
9
  }
@@ -1,5 +1,5 @@
1
1
  import AbstractField from './AbstractField.js';
2
- import { requiredImageSizes, } from './ImageField.types.js';
2
+ import { requiredImageSizes } from './ImageField.types.js';
3
3
  export default class ImageField extends AbstractField {
4
4
  static generateTemplateDetails(options) {
5
5
  const { definition, importAs } = options;
@@ -13,7 +13,7 @@ export default class ImageField extends AbstractField {
13
13
  validate(value) {
14
14
  var _a;
15
15
  const errors = super.validate(value);
16
- if (errors.length === 0 && !value.base64) {
16
+ if (value && errors.length === 0 && !value.base64) {
17
17
  let sizes = this.getRequiredSizes();
18
18
  const missing = [];
19
19
  for (const size of sizes) {
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- declare const supportedTypes: readonly ["image/png", "image/jpeg", "application/pdf", "*"];
3
- export declare type SupportedFileType = typeof supportedTypes[number];
2
+ export declare const supportedFileTypes: readonly ["image/png", "image/jpeg", "application/pdf", "*"];
3
+ export declare type SupportedFileType = typeof supportedFileTypes[number];
4
4
  export interface FileFieldValue {
5
5
  name: string;
6
6
  type?: SupportedFileType;
@@ -14,4 +14,3 @@ export declare type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
14
14
  acceptableTypes: SupportedFileType[];
15
15
  };
16
16
  };
17
- export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const supportedTypes = [
3
+ exports.supportedFileTypes = void 0;
4
+ exports.supportedFileTypes = [
4
5
  'image/png',
5
6
  'image/jpeg',
6
7
  'application/pdf',
@@ -1,9 +1,9 @@
1
1
  import { FieldTemplateDetailOptions, FieldTemplateDetails } from '../types/template.types';
2
2
  import AbstractField from './AbstractField';
3
- import { ImageFieldDefinition, ImageFieldValue } from './ImageField.types';
3
+ import { ImageFieldDefinition } from './ImageField.types';
4
4
  export default class ImageField extends AbstractField<ImageFieldDefinition> {
5
5
  static generateTemplateDetails(options: FieldTemplateDetailOptions<ImageFieldDefinition>): FieldTemplateDetails;
6
6
  static get description(): string;
7
- validate(value: ImageFieldValue): import("..").FieldError[];
7
+ validate(value: any): import("..").FieldError[];
8
8
  private getRequiredSizes;
9
9
  }
@@ -18,7 +18,7 @@ class ImageField extends AbstractField_1.default {
18
18
  validate(value) {
19
19
  var _a;
20
20
  const errors = super.validate(value);
21
- if (errors.length === 0 && !value.base64) {
21
+ if (value && errors.length === 0 && !value.base64) {
22
22
  let sizes = this.getRequiredSizes();
23
23
  const missing = [];
24
24
  for (const size of sizes) {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!build/__tests__",
9
9
  "esm"
10
10
  ],
11
- "version": "28.0.4",
11
+ "version": "28.0.7",
12
12
  "main": "./build/index.js",
13
13
  "types": "./build/index.d.ts",
14
14
  "module": "./build/esm/index.js",
@@ -77,7 +77,7 @@
77
77
  "@sprucelabs/jest-sheets-reporter": "^1.3.29",
78
78
  "@sprucelabs/resolve-path-aliases": "^1.1.14",
79
79
  "@sprucelabs/semantic-release": "^4.0.8",
80
- "@sprucelabs/test-utils": "^3.0.541",
80
+ "@sprucelabs/test-utils": "^3.0.542",
81
81
  "@types/lodash": "^4.14.182",
82
82
  "chokidar-cli": "^3.0.0",
83
83
  "concurrently": "^7.1.0",