@sprucelabs/schema 28.0.3 → 28.0.6

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.
@@ -36,7 +36,7 @@ export default abstract class AbstractField<F extends FieldDefinitions> implemen
36
36
  } | {
37
37
  relativeTo?: string | undefined;
38
38
  } | {
39
- requiredSizes: ("s" | "*" | "xxs" | "xs" | "m" | "l" | "xl" | "xxl")[];
39
+ requiredSizes: ("s" | "*" | "m" | "l" | "xl")[];
40
40
  } | undefined;
41
41
  get isRequired(): boolean;
42
42
  get isPrivate(): boolean;
@@ -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,16 +1,20 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare const requiredImageSizes: readonly ["xxs", "xs", "s", "m", "l", "xl", "xxl", "*"];
2
+ /**
3
+ * Min dimension for each size
4
+ xl: 1024
5
+ l: 500
6
+ m: 60
7
+ s: 30
8
+ */
9
+ export declare const requiredImageSizes: readonly ["s", "m", "l", "xl", "*"];
3
10
  export declare type RequiredImageSize = typeof requiredImageSizes[number];
4
11
  export interface ImageFieldValue {
5
12
  name: string;
6
13
  base64?: string;
7
- xxsUri?: string;
8
- xsUri?: string;
9
14
  sUri?: string;
10
15
  mUri?: string;
11
16
  lUri?: string;
12
17
  xlUri?: string;
13
- xxlUri?: string;
14
18
  }
15
19
  export declare type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
16
20
  /** * .image - a great way to deal with file management */
@@ -1,10 +1,8 @@
1
- export const requiredImageSizes = [
2
- 'xxs',
3
- 'xs',
4
- 's',
5
- 'm',
6
- 'l',
7
- 'xl',
8
- 'xxl',
9
- '*',
10
- ];
1
+ /**
2
+ * Min dimension for each size
3
+ xl: 1024
4
+ l: 500
5
+ m: 60
6
+ s: 30
7
+ */
8
+ export const requiredImageSizes = ['s', 'm', 'l', 'xl', '*'];
@@ -36,7 +36,7 @@ export default abstract class AbstractField<F extends FieldDefinitions> implemen
36
36
  } | {
37
37
  relativeTo?: string | undefined;
38
38
  } | {
39
- requiredSizes: ("s" | "*" | "xxs" | "xs" | "m" | "l" | "xl" | "xxl")[];
39
+ requiredSizes: ("s" | "*" | "m" | "l" | "xl")[];
40
40
  } | undefined;
41
41
  get isRequired(): boolean;
42
42
  get isPrivate(): boolean;
@@ -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) {
@@ -1,16 +1,20 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare const requiredImageSizes: readonly ["xxs", "xs", "s", "m", "l", "xl", "xxl", "*"];
2
+ /**
3
+ * Min dimension for each size
4
+ xl: 1024
5
+ l: 500
6
+ m: 60
7
+ s: 30
8
+ */
9
+ export declare const requiredImageSizes: readonly ["s", "m", "l", "xl", "*"];
3
10
  export declare type RequiredImageSize = typeof requiredImageSizes[number];
4
11
  export interface ImageFieldValue {
5
12
  name: string;
6
13
  base64?: string;
7
- xxsUri?: string;
8
- xsUri?: string;
9
14
  sUri?: string;
10
15
  mUri?: string;
11
16
  lUri?: string;
12
17
  xlUri?: string;
13
- xxlUri?: string;
14
18
  }
15
19
  export declare type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
16
20
  /** * .image - a great way to deal with file management */
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requiredImageSizes = void 0;
4
- exports.requiredImageSizes = [
5
- 'xxs',
6
- 'xs',
7
- 's',
8
- 'm',
9
- 'l',
10
- 'xl',
11
- 'xxl',
12
- '*',
13
- ];
4
+ /**
5
+ * Min dimension for each size
6
+ xl: 1024
7
+ l: 500
8
+ m: 60
9
+ s: 30
10
+ */
11
+ exports.requiredImageSizes = ['s', 'm', 'l', 'xl', '*'];
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!build/__tests__",
9
9
  "esm"
10
10
  ],
11
- "version": "28.0.3",
11
+ "version": "28.0.6",
12
12
  "main": "./build/index.js",
13
13
  "types": "./build/index.d.ts",
14
14
  "module": "./build/esm/index.js",