Socket
Socket
Sign inDemoInstall

@stackbit/types

Package Overview
Dependencies
Maintainers
17
Versions
291
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackbit/types - npm Package Compare versions

Comparing version 2.0.5-staging.1 to 2.0.5-staging.2

46

dist/content-source-operation.d.ts

@@ -8,2 +8,48 @@ import type { Field, FieldList, FieldListItems, FieldType, FieldPath } from './model-fields';

}
/**
* The "set" operation is used to set (or replace) field values.
*
* The "modelField" contains the model field of the field being set.
* The "field" contains the new field value in the form of {@link UpdateOperationField}.
* The "fieldPath" contains the path to the field from the document root.
*
* When setting lists, the "fieldPath" is set to the path of the list field,
* the "modelField" is set to the model field describing the list
* (field.type === 'list'), and the "field" contain the new list in the form of
* {@link UpdateOperationListField}.
*
* ```
* {
* opType: "set",
* fieldPath: ["seo", "keywords"],
* modelField: {
* type: "list",
* name: "keywords",
* items: { type: "string" }
* },
* field: {
* type: "list",
* items: [
* { type: "string", value: "hello" },
* { type: "string", value: "world" }
* ]
* }
* }
* ```
*
* When replacing a list item, the "fieldPath" is set to the path of the list
* followed by the item index that need to be replaced, the "modelField" is the
* model of the list item (field.items.type), and the "field" contains the new
* item to be inserted in the form of {@link UpdateOperationField}.
*
* ```
* {
* opType: "set",
* fieldPath: ["seo", "keywords", 0],
* modelField: { type: "string" },
* field: { type: "string", value: "hi" }
* }
* ```
*
*/
export interface UpdateOperationSet extends UpdateOperationBase {

@@ -10,0 +56,0 @@ opType: 'set';

201

dist/model-fields.d.ts

@@ -9,3 +9,5 @@ /**

import type { CustomActionClientModel, CustomActionField, CustomActionObjectField } from './custom-actions';
import { DistributiveOmit } from './utility-types';
import type { DistributiveOmit } from './utility-types';
import type { ModelWithSource } from './models';
import type { UpdateOperation } from './content-source-operation';
export type Field = FieldString | FieldUrl | FieldSlug | FieldText | FieldMarkdown | FieldHtml | FieldNumber | FieldBoolean | FieldDate | FieldDatetime | FieldColor | FieldJson | FieldRichText | FieldFile | FieldEnum | FieldImage | FieldObject | FieldModel | FieldReference | FieldCrossReference | FieldStyle | FieldList;

@@ -93,8 +95,14 @@ export type ClientField<T extends Field = Field> = DistributiveOmit<T, 'default' | 'const' | 'actions'> & {

/**
* Use the `required` property to mark a field as required. Stackbit will display an error message
* below the field if its value is not set, and publishing the document containing this field will
* not be possible until it has been filled in.
* Use the `required` property to mark a field as required. Visual editor
* will display an error message below the field if its value is not set,
* and publishing the document containing this field will not be possible
* until it has been filled in.
*/
required?: boolean;
/**
* Field Validations
* An object specifying validation rules that must be met when saving the field.
*/
validations?: FieldValidationsCustom;
/**
* Use the `default` property to specify an initial value for a field

@@ -175,38 +183,51 @@ * when no value provided when creating the parent object.

type: 'string';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp & FieldValidationsUnique;
}
export interface FieldUrlProps extends FieldCustomControlTypeProps {
type: 'url';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp & FieldValidationsUnique;
}
export interface FieldSlugProps extends FieldCustomControlTypeProps {
type: 'slug';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp & FieldValidationsUnique;
}
export interface FieldTextProps extends FieldCustomControlTypeProps {
type: 'text';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}
export interface FieldMarkdownProps extends FieldCustomControlTypeProps {
type: 'markdown';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}
export interface FieldHtmlProps extends FieldCustomControlTypeProps {
type: 'html';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}
export interface FieldBooleanProps extends FieldCustomControlTypeProps<'button-group' | 'checkbox'> {
type: 'boolean';
validations?: FieldValidationsCustom;
}
export interface FieldDateProps extends FieldCustomControlTypeProps {
type: 'date';
validations?: FieldValidationsCustom & FieldValidationsDateRange;
}
export interface FieldDatetimeProps extends FieldCustomControlTypeProps {
type: 'datetime';
validations?: FieldValidationsCustom & FieldValidationsDateRange;
}
export interface FieldColorProps extends FieldCustomControlTypeProps {
type: 'color';
validations?: FieldValidationsCustom;
}
export interface FieldJsonProps extends FieldCustomControlTypeProps {
type: 'json';
validations?: FieldValidationsCustom;
}
export interface FieldRichTextProps extends FieldCustomControlTypeProps {
type: 'richText';
validations?: FieldValidationsCustom;
}
export interface FieldFileProps extends FieldCustomControlTypeProps {
type: 'file';
validations?: FieldValidationsCustom & FieldValidationsFile;
}

@@ -217,2 +238,3 @@ export type FieldEnumProps = FieldEnumDropdownProps | FieldEnumThumbnailsProps | FieldEnumPaletteProps | FieldEnumPaletteColorsProps;

options: FieldEnumOptionValue[] | FieldEnumOptionObject[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -223,2 +245,3 @@ export interface FieldEnumThumbnailsProps {

options: FieldEnumOptionThumbnails[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -229,2 +252,3 @@ export interface FieldEnumPaletteProps {

options: FieldEnumOptionPalette[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -235,2 +259,3 @@ export interface FieldEnumPaletteColorsProps {

options: FieldEnumOptionPaletteColors[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -256,2 +281,3 @@ export type FieldEnumOptionValue = string | number;

source?: string;
validations?: FieldValidationsCustom & FieldValidationsImage;
}

@@ -261,6 +287,10 @@ export interface FieldNumberProps extends FieldCustomControlTypeProps<'slider'> {

subtype?: 'int' | 'float';
/** @deprecated Use [`validations.min`]{@link FieldValidationsNumberRange#min} property. */
min?: number;
/** @deprecated Use [`validations.min`]{@link FieldValidationsNumberRange#max} property. */
max?: number;
/** @deprecated Use [`validations.step`]{@link FieldValidationsNumberRange#step} property. */
step?: number;
unit?: string;
validations?: FieldValidationsCustom & FieldValidationsNumberRange & FieldValidationsUnique;
}

@@ -273,2 +303,3 @@ export interface FieldObjectProps extends FieldCustomControlTypeProps {

variantField?: string;
validations?: FieldValidationsCustom;
actions?: (CustomActionField | CustomActionObjectField)[];

@@ -287,2 +318,3 @@ fieldGroups?: FieldGroupItem[];

groups?: string[];
validations?: FieldValidationsCustom;
}

@@ -293,2 +325,3 @@ export interface FieldReferenceProps extends FieldCustomControlTypeProps {

groups?: string[];
validations?: FieldValidationsCustom;
}

@@ -298,2 +331,3 @@ export interface FieldCrossReferenceProps extends FieldCustomControlTypeProps {

models: FieldCrossReferenceModel[];
validations?: FieldValidationsCustom;
}

@@ -309,6 +343,8 @@ export interface FieldCrossReferenceModel {

styles: Record<string, Partial<Record<StyleProps, any>>>;
validations?: FieldValidationsCustom;
}
export interface FieldListProps extends FieldCustomControlTypeProps<'checkbox'> {
type: 'list';
items: FieldBasicProps | FieldEnumProps | FieldImageProps | FieldNumberProps | FieldObjectProps | FieldModelProps | FieldReferenceProps | FieldCrossReferenceProps;
items: FieldBasicProps | FieldEnumProps | FieldBooleanProps | FieldImageProps | FieldNumberProps | FieldObjectProps | FieldModelProps | FieldReferenceProps | FieldCrossReferenceProps;
validations?: FieldValidationsCustom & FieldValidationsListLength & FieldValidationsUnique;
}

@@ -376,3 +412,158 @@ export type FieldListItems = FieldListProps['items'];

export type FieldPath = (string | number)[];
export type FieldValidationsCustom = {
/**
* The `validate` functions allows you to define custom validation logic for
* a field.
*/
validate?: FieldValidationsCustomFunction | FieldValidationsCustomFunction[];
};
export type FieldValidationsCustomFunction = (options: {
updateOperation: UpdateOperation;
document?: DocumentWithSource;
model: ModelWithSource;
} & ConfigDelegate) => Promise<true | string>;
export type FieldValidationsUnique = {
/**
* Use the `unique` property to make the field unique across all the
* documents of the same type.
*/
unique?: boolean;
errors?: {
unique?: string;
};
};
export type FieldValidationsRegExp = {
regexp?: string;
regexpNot?: string;
regexpPattern?: FieldValidationsRegExpPatterns;
errors?: {
regexp?: string;
regexpNot?: string;
regexpPattern?: string;
};
};
export type FieldValidationsRegExpPatterns = 'uppercase' | 'lowercase' | 'email' | 'url' | 'date-us' | 'date-eu' | 'time-12h' | 'time-24h' | 'phone-us' | 'zip-code-us';
export type FieldValidationsStringLength = {
/** Minimum length of string (inclusive). */
min?: number;
/** Maximum length of string (inclusive). */
max?: number;
/** Exact length of string. */
exact?: number;
errors?: {
min?: string;
max?: string;
exact?: string;
};
};
export type FieldValidationsListLength = {
/** Minimum number of elements in array (inclusive). */
min?: number;
/** Maximum number of elements in array (inclusive). */
max?: number;
/** Exact number of elements in array. */
exact?: number;
errors?: {
min?: string;
max?: string;
exact?: string;
};
};
export type FieldValidationsDateRange = {
/** Minimum date (inclusive) */
min?: string;
/** Maximum date (inclusive). */
max?: string;
/** Minimum date (non-inclusive) */
after?: string;
/** Maximum date (non-inclusive). */
before?: string;
errors?: {
min?: string;
max?: string;
after?: string;
before?: string;
};
};
export type FieldValidationsNumberRange = {
/** Minimum value (inclusive). */
min?: number;
/** Maximum value (inclusive). */
max?: number;
/**
* Controls the step increments for fields with `controlType: "slider"`.
* When using the default control type, the value will be corrected upon save to the closest available step.
*/
step?: number;
/** Value must be less than the given limit. */
lessThan?: number;
/** Value must be greater than the given limit. */
greaterThan?: number;
errors?: {
min?: string;
max?: string;
step?: string;
lessThan?: string;
greaterThan?: string;
};
};
export type FieldValidationsImage = Omit<FieldValidationsFile, 'fileTypeGroups'> & {
/** Minimum image width in pixels (inclusive). */
minWidth?: number;
/** Maximum image width in pixels (inclusive). */
maxWidth?: number;
/** Minimum image height in pixels (inclusive). */
minHeight?: number;
/** Maximum image height in pixels (inclusive). */
maxHeight?: number;
/**
* The minimum ratio between image width and height i.e., min(width divided by height)
* Can be set to string specifying the ratio separated by a colon, or a fractional number.
* @example '4:3', 1.3333 => this will allow images with dimensions
* (w:600px, h:450px), (w:600px, h:300px), and will not allow images with
* dimensions (w:600px, h:600px), (w:300px, h:600px).
*/
minWidthToHeightRatio?: string | number;
/**
* The maximum ratio between image width and height i.e., max(width divided by height)
* Can be set to string specifying the ratio separated by a colon, or a fractional number.
* @example '2:1', 2 => this will allow images with dimensions
* (w:600px, h:300px), (w:400px, h:400px), and will not allow images with
* dimensions (w:600px, h:200px), (w:400px, h:100px).
*/
maxWidthToHeightRatio?: string | number;
errors?: {
minWidth?: string;
maxWidth?: string;
minHeight?: string;
maxHeight?: string;
minWidthToHeightRatio?: string;
maxWidthToHeightRatio?: string;
};
};
export type FieldValidationsFile = {
/** Minimum file size in bytes (inclusive). */
fileMinSize?: number;
/** Maximum file size in bytes (inclusive). */
fileMaxSize?: number;
/**
* Array of allowed file type extensions.
* @example ['gif', 'png', 'jpg', 'jpeg', 'webp', 'svg']
*/
fileTypes?: string[];
/**
* Array of allowed file type groups.
* The type groups contain predefined file types, and are added to the fileTypes array.
* @example ['image', 'video']
*/
fileTypeGroups?: FieldValidationsFileTypesGroup[];
errors?: {
fileMinSize?: string;
fileMaxSize?: string;
fileTypes?: string;
fileTypeGroups?: string;
};
};
export type FieldValidationsFileTypesGroup = 'image' | 'video' | 'audio' | 'text' | 'markup' | 'code' | 'document' | 'presentation' | 'spreadsheet' | 'archive';
export {};
//# sourceMappingURL=model-fields.d.ts.map

4

package.json
{
"name": "@stackbit/types",
"version": "2.0.5-staging.1",
"version": "2.0.5-staging.2",
"description": "Types for Stackbit config and Content Source Interface",

@@ -30,3 +30,3 @@ "main": "dist/index.js",

"homepage": "https://github.com/stackbit/stackbit#readme",
"gitHead": "427c4ee428e86c6ba83bb9e6e8ed8735c270b0d7"
"gitHead": "30b71660d4542e3119807ba2b92ef7816c464c21"
}

@@ -16,2 +16,48 @@ import type { Field, FieldList, FieldListItems, FieldType, FieldPath } from './model-fields';

/**
* The "set" operation is used to set (or replace) field values.
*
* The "modelField" contains the model field of the field being set.
* The "field" contains the new field value in the form of {@link UpdateOperationField}.
* The "fieldPath" contains the path to the field from the document root.
*
* When setting lists, the "fieldPath" is set to the path of the list field,
* the "modelField" is set to the model field describing the list
* (field.type === 'list'), and the "field" contain the new list in the form of
* {@link UpdateOperationListField}.
*
* ```
* {
* opType: "set",
* fieldPath: ["seo", "keywords"],
* modelField: {
* type: "list",
* name: "keywords",
* items: { type: "string" }
* },
* field: {
* type: "list",
* items: [
* { type: "string", value: "hello" },
* { type: "string", value: "world" }
* ]
* }
* }
* ```
*
* When replacing a list item, the "fieldPath" is set to the path of the list
* followed by the item index that need to be replaced, the "modelField" is the
* model of the list item (field.items.type), and the "field" contains the new
* item to be inserted in the form of {@link UpdateOperationField}.
*
* ```
* {
* opType: "set",
* fieldPath: ["seo", "keywords", 0],
* modelField: { type: "string" },
* field: { type: "string", value: "hi" }
* }
* ```
*
*/
export interface UpdateOperationSet extends UpdateOperationBase {

@@ -18,0 +64,0 @@ opType: 'set';

@@ -10,3 +10,5 @@ /**

import type { CustomActionClientModel, CustomActionField, CustomActionObjectField } from './custom-actions';
import { DistributiveOmit } from './utility-types';
import type { DistributiveOmit } from './utility-types';
import type { ModelWithSource } from './models';
import type { UpdateOperation } from './content-source-operation';

@@ -142,8 +144,14 @@ export type Field =

/**
* Use the `required` property to mark a field as required. Stackbit will display an error message
* below the field if its value is not set, and publishing the document containing this field will
* not be possible until it has been filled in.
* Use the `required` property to mark a field as required. Visual editor
* will display an error message below the field if its value is not set,
* and publishing the document containing this field will not be possible
* until it has been filled in.
*/
required?: boolean;
/**
* Field Validations
* An object specifying validation rules that must be met when saving the field.
*/
validations?: FieldValidationsCustom;
/**
* Use the `default` property to specify an initial value for a field

@@ -248,2 +256,6 @@ * when no value provided when creating the parent object.

type: 'string';
validations?: FieldValidationsCustom &
FieldValidationsStringLength &
FieldValidationsRegExp &
FieldValidationsUnique;
}

@@ -253,2 +265,6 @@

type: 'url';
validations?: FieldValidationsCustom &
FieldValidationsStringLength &
FieldValidationsRegExp &
FieldValidationsUnique;
}

@@ -258,2 +274,6 @@

type: 'slug';
validations?: FieldValidationsCustom &
FieldValidationsStringLength &
FieldValidationsRegExp &
FieldValidationsUnique;
}

@@ -263,2 +283,3 @@

type: 'text';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}

@@ -268,2 +289,3 @@

type: 'markdown';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}

@@ -273,2 +295,3 @@

type: 'html';
validations?: FieldValidationsCustom & FieldValidationsStringLength & FieldValidationsRegExp;
}

@@ -278,2 +301,3 @@

type: 'boolean';
validations?: FieldValidationsCustom;
}

@@ -283,2 +307,3 @@

type: 'date';
validations?: FieldValidationsCustom & FieldValidationsDateRange;
}

@@ -288,2 +313,3 @@

type: 'datetime';
validations?: FieldValidationsCustom & FieldValidationsDateRange;
}

@@ -293,2 +319,3 @@

type: 'color';
validations?: FieldValidationsCustom;
}

@@ -298,2 +325,3 @@

type: 'json';
validations?: FieldValidationsCustom;
}

@@ -303,2 +331,3 @@

type: 'richText';
validations?: FieldValidationsCustom;
}

@@ -308,2 +337,3 @@

type: 'file';
validations?: FieldValidationsCustom & FieldValidationsFile;
}

@@ -320,2 +350,3 @@

options: FieldEnumOptionValue[] | FieldEnumOptionObject[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -327,2 +358,3 @@

options: FieldEnumOptionThumbnails[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -334,2 +366,3 @@

options: FieldEnumOptionPalette[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -341,2 +374,3 @@

options: FieldEnumOptionPaletteColors[];
validations?: FieldValidationsCustom & FieldValidationsUnique;
}

@@ -368,2 +402,3 @@

source?: string;
validations?: FieldValidationsCustom & FieldValidationsImage;
}

@@ -374,6 +409,10 @@

subtype?: 'int' | 'float';
/** @deprecated Use [`validations.min`]{@link FieldValidationsNumberRange#min} property. */
min?: number;
/** @deprecated Use [`validations.min`]{@link FieldValidationsNumberRange#max} property. */
max?: number;
/** @deprecated Use [`validations.step`]{@link FieldValidationsNumberRange#step} property. */
step?: number;
unit?: string;
validations?: FieldValidationsCustom & FieldValidationsNumberRange & FieldValidationsUnique;
}

@@ -387,2 +426,3 @@

variantField?: string;
validations?: FieldValidationsCustom;
actions?: (CustomActionField | CustomActionObjectField)[];

@@ -403,2 +443,3 @@ fieldGroups?: FieldGroupItem[];

groups?: string[];
validations?: FieldValidationsCustom;
}

@@ -410,2 +451,3 @@

groups?: string[];
validations?: FieldValidationsCustom;
}

@@ -416,2 +458,3 @@

models: FieldCrossReferenceModel[];
validations?: FieldValidationsCustom;
}

@@ -430,2 +473,3 @@

styles: Record<string, Partial<Record<StyleProps, any>>>;
validations?: FieldValidationsCustom;
}

@@ -438,2 +482,3 @@

| FieldEnumProps
| FieldBooleanProps
| FieldImageProps

@@ -445,2 +490,3 @@ | FieldNumberProps

| FieldCrossReferenceProps;
validations?: FieldValidationsCustom & FieldValidationsListLength & FieldValidationsUnique;
}

@@ -532,1 +578,193 @@

export type FieldPath = (string | number)[];
// Field Validations
// =================
export type FieldValidationsCustom = {
/**
* The `validate` functions allows you to define custom validation logic for
* a field.
*/
validate?: FieldValidationsCustomFunction | FieldValidationsCustomFunction[];
};
export type FieldValidationsCustomFunction = (
options: {
updateOperation: UpdateOperation;
document?: DocumentWithSource;
model: ModelWithSource;
} & ConfigDelegate
) => Promise<true | string>;
export type FieldValidationsUnique = {
/**
* Use the `unique` property to make the field unique across all the
* documents of the same type.
*/
unique?: boolean;
errors?: {
unique?: string;
};
};
export type FieldValidationsRegExp = {
regexp?: string;
regexpNot?: string;
regexpPattern?: FieldValidationsRegExpPatterns;
errors?: {
regexp?: string;
regexpNot?: string;
regexpPattern?: string;
};
};
export type FieldValidationsRegExpPatterns =
| 'uppercase'
| 'lowercase'
| 'email'
| 'url'
| 'date-us'
| 'date-eu'
| 'time-12h'
| 'time-24h'
| 'phone-us'
| 'zip-code-us';
export type FieldValidationsStringLength = {
/** Minimum length of string (inclusive). */
min?: number;
/** Maximum length of string (inclusive). */
max?: number;
/** Exact length of string. */
exact?: number;
errors?: {
min?: string;
max?: string;
exact?: string;
};
};
export type FieldValidationsListLength = {
/** Minimum number of elements in array (inclusive). */
min?: number;
/** Maximum number of elements in array (inclusive). */
max?: number;
/** Exact number of elements in array. */
exact?: number;
errors?: {
min?: string;
max?: string;
exact?: string;
};
};
export type FieldValidationsDateRange = {
/** Minimum date (inclusive) */
min?: string;
/** Maximum date (inclusive). */
max?: string;
/** Minimum date (non-inclusive) */
after?: string;
/** Maximum date (non-inclusive). */
before?: string;
errors?: {
min?: string;
max?: string;
after?: string;
before?: string;
};
};
export type FieldValidationsNumberRange = {
/** Minimum value (inclusive). */
min?: number;
/** Maximum value (inclusive). */
max?: number;
/**
* Controls the step increments for fields with `controlType: "slider"`.
* When using the default control type, the value will be corrected upon save to the closest available step.
*/
step?: number;
/** Value must be less than the given limit. */
lessThan?: number;
/** Value must be greater than the given limit. */
greaterThan?: number;
errors?: {
min?: string;
max?: string;
step?: string;
lessThan?: string;
greaterThan?: string;
};
};
export type FieldValidationsImage = Omit<FieldValidationsFile, 'fileTypeGroups'> & {
/** Minimum image width in pixels (inclusive). */
minWidth?: number;
/** Maximum image width in pixels (inclusive). */
maxWidth?: number;
/** Minimum image height in pixels (inclusive). */
minHeight?: number;
/** Maximum image height in pixels (inclusive). */
maxHeight?: number;
/**
* The minimum ratio between image width and height i.e., min(width divided by height)
* Can be set to string specifying the ratio separated by a colon, or a fractional number.
* @example '4:3', 1.3333 => this will allow images with dimensions
* (w:600px, h:450px), (w:600px, h:300px), and will not allow images with
* dimensions (w:600px, h:600px), (w:300px, h:600px).
*/
minWidthToHeightRatio?: string | number;
/**
* The maximum ratio between image width and height i.e., max(width divided by height)
* Can be set to string specifying the ratio separated by a colon, or a fractional number.
* @example '2:1', 2 => this will allow images with dimensions
* (w:600px, h:300px), (w:400px, h:400px), and will not allow images with
* dimensions (w:600px, h:200px), (w:400px, h:100px).
*/
maxWidthToHeightRatio?: string | number;
errors?: {
minWidth?: string;
maxWidth?: string;
minHeight?: string;
maxHeight?: string;
minWidthToHeightRatio?: string;
maxWidthToHeightRatio?: string;
};
};
export type FieldValidationsFile = {
/** Minimum file size in bytes (inclusive). */
fileMinSize?: number;
/** Maximum file size in bytes (inclusive). */
fileMaxSize?: number;
/**
* Array of allowed file type extensions.
* @example ['gif', 'png', 'jpg', 'jpeg', 'webp', 'svg']
*/
fileTypes?: string[];
/**
* Array of allowed file type groups.
* The type groups contain predefined file types, and are added to the fileTypes array.
* @example ['image', 'video']
*/
fileTypeGroups?: FieldValidationsFileTypesGroup[];
errors?: {
fileMinSize?: string;
fileMaxSize?: string;
fileTypes?: string;
fileTypeGroups?: string;
};
};
export type FieldValidationsFileTypesGroup =
| 'image'
| 'video'
| 'audio'
| 'text'
| 'markup'
| 'code'
| 'document'
| 'presentation'
| 'spreadsheet'
| 'archive';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc