@sprucelabs/schema 28.5.65 → 28.5.67

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.
Files changed (59) hide show
  1. package/build/.spruce/schemas/fields/fields.types.d.ts +2 -2
  2. package/build/AbstractEntity.js +3 -3
  3. package/build/errors/options.types.d.ts +3 -3
  4. package/build/esm/.spruce/schemas/fields/fields.types.d.ts +2 -2
  5. package/build/esm/AbstractEntity.js +3 -3
  6. package/build/esm/errors/options.types.d.ts +3 -3
  7. package/build/esm/fields/AddressField.types.d.ts +1 -1
  8. package/build/esm/fields/BooleanField.types.d.ts +1 -1
  9. package/build/esm/fields/DateField.types.d.ts +2 -2
  10. package/build/esm/fields/DateTimeField.types.d.ts +2 -2
  11. package/build/esm/fields/DirectoryField.types.d.ts +1 -1
  12. package/build/esm/fields/DurationField.types.d.ts +1 -1
  13. package/build/esm/fields/EmailField.types.d.ts +1 -1
  14. package/build/esm/fields/FileField.types.d.ts +2 -2
  15. package/build/esm/fields/IdField.types.d.ts +1 -1
  16. package/build/esm/fields/ImageField.types.d.ts +2 -2
  17. package/build/esm/fields/NumberField.types.d.ts +1 -1
  18. package/build/esm/fields/PhoneField.types.d.ts +1 -1
  19. package/build/esm/fields/RawField.types.d.ts +1 -1
  20. package/build/esm/fields/SchemaField.types.d.ts +3 -3
  21. package/build/esm/fields/SelectField.types.d.ts +2 -2
  22. package/build/esm/fields/TextField.types.d.ts +1 -1
  23. package/build/esm/fields/field.static.types.d.ts +8 -8
  24. package/build/esm/schemas.static.types.d.ts +24 -24
  25. package/build/esm/tests/validationErrorAssert.utility.d.ts +2 -2
  26. package/build/esm/types/utilities.types.d.ts +5 -5
  27. package/build/esm/utilities/assertOptions.d.ts +3 -3
  28. package/build/esm/utilities/cloneDeep.d.ts +1 -1
  29. package/build/esm/utilities/dropPrivateFields.d.ts +1 -1
  30. package/build/esm/utilities/makeFieldsOptional.d.ts +1 -1
  31. package/build/esm/utilities/optional.types.d.ts +1 -1
  32. package/build/esm/utilities/selectChoicesToHash.d.ts +1 -1
  33. package/build/fields/AddressField.types.d.ts +1 -1
  34. package/build/fields/BooleanField.types.d.ts +1 -1
  35. package/build/fields/DateField.types.d.ts +2 -2
  36. package/build/fields/DateTimeField.types.d.ts +2 -2
  37. package/build/fields/DirectoryField.types.d.ts +1 -1
  38. package/build/fields/DurationField.types.d.ts +1 -1
  39. package/build/fields/EmailField.types.d.ts +1 -1
  40. package/build/fields/FileField.types.d.ts +2 -2
  41. package/build/fields/IdField.types.d.ts +1 -1
  42. package/build/fields/ImageField.types.d.ts +2 -2
  43. package/build/fields/NumberField.types.d.ts +1 -1
  44. package/build/fields/PhoneField.types.d.ts +1 -1
  45. package/build/fields/RawField.types.d.ts +1 -1
  46. package/build/fields/SchemaField.types.d.ts +3 -3
  47. package/build/fields/SelectField.types.d.ts +2 -2
  48. package/build/fields/TextField.types.d.ts +1 -1
  49. package/build/fields/field.static.types.d.ts +8 -8
  50. package/build/schemas.static.types.d.ts +24 -24
  51. package/build/tests/validationErrorAssert.utility.d.ts +2 -2
  52. package/build/types/utilities.types.d.ts +5 -5
  53. package/build/utilities/assertOptions.d.ts +3 -3
  54. package/build/utilities/cloneDeep.d.ts +1 -1
  55. package/build/utilities/dropPrivateFields.d.ts +1 -1
  56. package/build/utilities/makeFieldsOptional.d.ts +1 -1
  57. package/build/utilities/optional.types.d.ts +1 -1
  58. package/build/utilities/selectChoicesToHash.d.ts +1 -1
  59. package/package.json +5 -5
@@ -15,8 +15,8 @@ import { RawFieldDefinition } from '../../../fields/RawField.types';
15
15
  import { SchemaFieldFieldDefinition, SchemaFieldValueTypeMapper } from '../../../fields/SchemaField.types';
16
16
  import { SelectFieldDefinition, SelectFieldValueTypeMapper } from '../../../fields/SelectField.types';
17
17
  import { TextFieldDefinition } from '../../../fields/TextField.types';
18
- export declare type FieldDefinitions = BooleanFieldDefinition | SelectFieldDefinition | DurationFieldDefinition | IdFieldDefinition | TextFieldDefinition | AddressFieldDefinition | PhoneFieldDefinition | SchemaFieldFieldDefinition | RawFieldDefinition | NumberFieldDefinition | DateTimeFieldDefinition | FileFieldDefinition | DateFieldDefinition | DirectoryFieldDefinition | EmailFieldDefinition | ImageFieldDefinition;
19
- export declare type Fields = Field<BooleanFieldDefinition> | Field<SelectFieldDefinition> | Field<DurationFieldDefinition> | Field<IdFieldDefinition> | Field<TextFieldDefinition> | Field<AddressFieldDefinition> | Field<PhoneFieldDefinition> | Field<SchemaFieldFieldDefinition> | Field<RawFieldDefinition> | Field<NumberFieldDefinition> | Field<DateTimeFieldDefinition> | Field<FileFieldDefinition> | Field<DateFieldDefinition> | Field<DirectoryFieldDefinition> | Field<EmailFieldDefinition> | Field<ImageFieldDefinition>;
18
+ export type FieldDefinitions = BooleanFieldDefinition | SelectFieldDefinition | DurationFieldDefinition | IdFieldDefinition | TextFieldDefinition | AddressFieldDefinition | PhoneFieldDefinition | SchemaFieldFieldDefinition | RawFieldDefinition | NumberFieldDefinition | DateTimeFieldDefinition | FileFieldDefinition | DateFieldDefinition | DirectoryFieldDefinition | EmailFieldDefinition | ImageFieldDefinition;
19
+ export type Fields = Field<BooleanFieldDefinition> | Field<SelectFieldDefinition> | Field<DurationFieldDefinition> | Field<IdFieldDefinition> | Field<TextFieldDefinition> | Field<AddressFieldDefinition> | Field<PhoneFieldDefinition> | Field<SchemaFieldFieldDefinition> | Field<RawFieldDefinition> | Field<NumberFieldDefinition> | Field<DateTimeFieldDefinition> | Field<FileFieldDefinition> | Field<DateFieldDefinition> | Field<DirectoryFieldDefinition> | Field<EmailFieldDefinition> | Field<ImageFieldDefinition>;
20
20
  export interface FieldDefinitionMap {
21
21
  boolean: BooleanFieldDefinition;
22
22
  select: SelectFieldDefinition;
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class AbstractEntity {
4
- constructor(schema) {
5
- this.schema = schema;
6
- }
7
4
  get schemaId() {
8
5
  return this.schema.id;
9
6
  }
@@ -19,5 +16,8 @@ class AbstractEntity {
19
16
  get description() {
20
17
  return this.schema.id;
21
18
  }
19
+ constructor(schema) {
20
+ this.schema = schema;
21
+ }
22
22
  }
23
23
  exports.default = AbstractEntity;
@@ -1,7 +1,7 @@
1
1
  import AbstractSpruceError, { ErrorOptions as ISpruceErrorOptions } from '@sprucelabs/error';
2
2
  import { FieldType } from '../fields/field.static.types';
3
- export declare type SchemaErrorOptions = DuplicateSchemaErrorOptions | SchemaErrorOptionsNotFound | TransformationFailedErrorOptions | InvalidSchemaDefinitionErrorOptions | NotImplementedErrorOptions | InvalidFieldRegistrationErrorOptions | VersionRequiredErrorOptions | MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions | ValidationFailedErrorOptions | InvalidSchemaReferenceErrorOptions;
4
- export declare type FieldErrorCode = 'MISSING_PARAMETER' | 'INVALID_PARAMETER' | 'UNEXPECTED_PARAMETER';
3
+ export type SchemaErrorOptions = DuplicateSchemaErrorOptions | SchemaErrorOptionsNotFound | TransformationFailedErrorOptions | InvalidSchemaDefinitionErrorOptions | NotImplementedErrorOptions | InvalidFieldRegistrationErrorOptions | VersionRequiredErrorOptions | MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions | ValidationFailedErrorOptions | InvalidSchemaReferenceErrorOptions;
4
+ export type FieldErrorCode = 'MISSING_PARAMETER' | 'INVALID_PARAMETER' | 'UNEXPECTED_PARAMETER';
5
5
  export interface FieldError {
6
6
  code: FieldErrorCode;
7
7
  errors?: FieldError[];
@@ -77,5 +77,5 @@ export interface ValidationFailedErrorOptions extends ISpruceErrorOptions {
77
77
  export interface InvalidSchemaReferenceErrorOptions extends ISpruceErrorOptions {
78
78
  code: 'INVALID_SCHEMA_REFERENCE';
79
79
  }
80
- export declare type ValidationError = AbstractSpruceError<MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions>;
80
+ export type ValidationError = AbstractSpruceError<MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions>;
81
81
  export {};
@@ -15,8 +15,8 @@ import { RawFieldDefinition } from '../../../fields/RawField.types';
15
15
  import { SchemaFieldFieldDefinition, SchemaFieldValueTypeMapper } from '../../../fields/SchemaField.types';
16
16
  import { SelectFieldDefinition, SelectFieldValueTypeMapper } from '../../../fields/SelectField.types';
17
17
  import { TextFieldDefinition } from '../../../fields/TextField.types';
18
- export declare type FieldDefinitions = BooleanFieldDefinition | SelectFieldDefinition | DurationFieldDefinition | IdFieldDefinition | TextFieldDefinition | AddressFieldDefinition | PhoneFieldDefinition | SchemaFieldFieldDefinition | RawFieldDefinition | NumberFieldDefinition | DateTimeFieldDefinition | FileFieldDefinition | DateFieldDefinition | DirectoryFieldDefinition | EmailFieldDefinition | ImageFieldDefinition;
19
- export declare type Fields = Field<BooleanFieldDefinition> | Field<SelectFieldDefinition> | Field<DurationFieldDefinition> | Field<IdFieldDefinition> | Field<TextFieldDefinition> | Field<AddressFieldDefinition> | Field<PhoneFieldDefinition> | Field<SchemaFieldFieldDefinition> | Field<RawFieldDefinition> | Field<NumberFieldDefinition> | Field<DateTimeFieldDefinition> | Field<FileFieldDefinition> | Field<DateFieldDefinition> | Field<DirectoryFieldDefinition> | Field<EmailFieldDefinition> | Field<ImageFieldDefinition>;
18
+ export type FieldDefinitions = BooleanFieldDefinition | SelectFieldDefinition | DurationFieldDefinition | IdFieldDefinition | TextFieldDefinition | AddressFieldDefinition | PhoneFieldDefinition | SchemaFieldFieldDefinition | RawFieldDefinition | NumberFieldDefinition | DateTimeFieldDefinition | FileFieldDefinition | DateFieldDefinition | DirectoryFieldDefinition | EmailFieldDefinition | ImageFieldDefinition;
19
+ export type Fields = Field<BooleanFieldDefinition> | Field<SelectFieldDefinition> | Field<DurationFieldDefinition> | Field<IdFieldDefinition> | Field<TextFieldDefinition> | Field<AddressFieldDefinition> | Field<PhoneFieldDefinition> | Field<SchemaFieldFieldDefinition> | Field<RawFieldDefinition> | Field<NumberFieldDefinition> | Field<DateTimeFieldDefinition> | Field<FileFieldDefinition> | Field<DateFieldDefinition> | Field<DirectoryFieldDefinition> | Field<EmailFieldDefinition> | Field<ImageFieldDefinition>;
20
20
  export interface FieldDefinitionMap {
21
21
  boolean: BooleanFieldDefinition;
22
22
  select: SelectFieldDefinition;
@@ -1,7 +1,4 @@
1
1
  export default class AbstractEntity {
2
- constructor(schema) {
3
- this.schema = schema;
4
- }
5
2
  get schemaId() {
6
3
  return this.schema.id;
7
4
  }
@@ -17,4 +14,7 @@ export default class AbstractEntity {
17
14
  get description() {
18
15
  return this.schema.id;
19
16
  }
17
+ constructor(schema) {
18
+ this.schema = schema;
19
+ }
20
20
  }
@@ -1,7 +1,7 @@
1
1
  import AbstractSpruceError, { ErrorOptions as ISpruceErrorOptions } from '@sprucelabs/error';
2
2
  import { FieldType } from '../fields/field.static.types';
3
- export declare type SchemaErrorOptions = DuplicateSchemaErrorOptions | SchemaErrorOptionsNotFound | TransformationFailedErrorOptions | InvalidSchemaDefinitionErrorOptions | NotImplementedErrorOptions | InvalidFieldRegistrationErrorOptions | VersionRequiredErrorOptions | MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions | ValidationFailedErrorOptions | InvalidSchemaReferenceErrorOptions;
4
- export declare type FieldErrorCode = 'MISSING_PARAMETER' | 'INVALID_PARAMETER' | 'UNEXPECTED_PARAMETER';
3
+ export type SchemaErrorOptions = DuplicateSchemaErrorOptions | SchemaErrorOptionsNotFound | TransformationFailedErrorOptions | InvalidSchemaDefinitionErrorOptions | NotImplementedErrorOptions | InvalidFieldRegistrationErrorOptions | VersionRequiredErrorOptions | MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions | ValidationFailedErrorOptions | InvalidSchemaReferenceErrorOptions;
4
+ export type FieldErrorCode = 'MISSING_PARAMETER' | 'INVALID_PARAMETER' | 'UNEXPECTED_PARAMETER';
5
5
  export interface FieldError {
6
6
  code: FieldErrorCode;
7
7
  errors?: FieldError[];
@@ -77,5 +77,5 @@ export interface ValidationFailedErrorOptions extends ISpruceErrorOptions {
77
77
  export interface InvalidSchemaReferenceErrorOptions extends ISpruceErrorOptions {
78
78
  code: 'INVALID_SCHEMA_REFERENCE';
79
79
  }
80
- export declare type ValidationError = AbstractSpruceError<MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions>;
80
+ export type ValidationError = AbstractSpruceError<MissingParametersOptions | InvalidParametersOptions | UnexpectedParametersOptions>;
81
81
  export {};
@@ -7,7 +7,7 @@ export interface AddressFieldValue {
7
7
  country: string;
8
8
  zip: string;
9
9
  }
10
- export declare type AddressFieldDefinition = FieldDefinition<AddressFieldValue> & {
10
+ export type AddressFieldDefinition = FieldDefinition<AddressFieldValue> & {
11
11
  /** * An address with street, city, province, country, and zip details */
12
12
  type: 'address';
13
13
  options?: {};
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type BooleanFieldDefinition = FieldDefinition<boolean, boolean, boolean[], boolean[]> & {
2
+ export type BooleanFieldDefinition = FieldDefinition<boolean, boolean, boolean[], boolean[]> & {
3
3
  /** * A true/false field */
4
4
  type: 'boolean';
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type DateFieldValue = number;
3
- export declare type DateFieldDefinition = FieldDefinition<DateFieldValue> & {
2
+ export type DateFieldValue = number;
3
+ export type DateFieldDefinition = FieldDefinition<DateFieldValue> & {
4
4
  /** * A date/time field that stores everything in GMT and handles all the timezone */
5
5
  type: 'date';
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type DateTimeFieldValue = number;
3
- export declare type DateTimeFieldDefinition = FieldDefinition<DateTimeFieldValue> & {
2
+ export type DateTimeFieldValue = number;
3
+ export type DateTimeFieldDefinition = FieldDefinition<DateTimeFieldValue> & {
4
4
  /** * A date/time field that stores everything in GMT and handles all the timezone */
5
5
  type: 'dateTime';
6
6
  options?: {
@@ -2,7 +2,7 @@ import { FieldDefinition } from './field.static.types';
2
2
  export interface DirectoryFieldValue {
3
3
  path: string;
4
4
  }
5
- export declare type DirectoryFieldDefinition = FieldDefinition<DirectoryFieldValue> & {
5
+ export type DirectoryFieldDefinition = FieldDefinition<DirectoryFieldValue> & {
6
6
  /** * .Directory - select whole directories all at once */
7
7
  type: 'directory';
8
8
  options?: {
@@ -6,7 +6,7 @@ export interface DurationFieldValue {
6
6
  seconds: number;
7
7
  ms: number;
8
8
  }
9
- export declare type DurationFieldDefinition = FieldDefinition<DurationFieldValue> & {
9
+ export type DurationFieldDefinition = FieldDefinition<DurationFieldValue> & {
10
10
  /** * .Duration - a span of time */
11
11
  type: 'duration';
12
12
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type EmailFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type EmailFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * .Email an easy way to capture emails */
4
4
  type: 'email';
5
5
  options?: {};
@@ -1,13 +1,13 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
2
  export declare const supportedFileTypes: readonly ["image/png", "image/svg+xml", "image/jpeg", "application/pdf", "text/csv", "*"];
3
- export declare type SupportedFileType = typeof supportedFileTypes[number];
3
+ export type SupportedFileType = typeof supportedFileTypes[number];
4
4
  export interface FileFieldValue {
5
5
  name: string;
6
6
  type?: SupportedFileType;
7
7
  uri?: string;
8
8
  base64?: string;
9
9
  }
10
- export declare type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
10
+ export type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
11
11
  /** * .File - a great way to deal with file management */
12
12
  type: 'file';
13
13
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type IdFieldDefinition = FieldDefinition<string> & {
2
+ export type IdFieldDefinition = FieldDefinition<string> & {
3
3
  /** * .Id a field to hold a unique id (UUID4 in Spruce) */
4
4
  type: 'id';
5
5
  options?: {};
@@ -8,7 +8,7 @@ import { SupportedFileType } from './FileField.types';
8
8
  s: 30
9
9
  */
10
10
  export declare const requiredImageSizes: readonly ["s", "m", "l", "xl", "*"];
11
- export declare type RequiredImageSize = typeof requiredImageSizes[number];
11
+ export type RequiredImageSize = typeof requiredImageSizes[number];
12
12
  export interface ImageFieldValue {
13
13
  name: string;
14
14
  base64?: string;
@@ -18,7 +18,7 @@ export interface ImageFieldValue {
18
18
  lUri?: string;
19
19
  xlUri?: string;
20
20
  }
21
- export declare type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
21
+ export type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
22
22
  /** * .image - a great way to deal with file management */
23
23
  type: 'image';
24
24
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type NumberFieldDefinition = FieldDefinition<number, number, number[], number[]> & {
2
+ export type NumberFieldDefinition = FieldDefinition<number, number, number[], number[]> & {
3
3
  /** * .Number - a number, silly */
4
4
  type: 'number';
5
5
  /** Configure this field */
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type PhoneFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type PhoneFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * .Phone a great way to validate and format values */
4
4
  type: 'phone';
5
5
  options?: {};
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type RawFieldDefinition = FieldDefinition<any> & {
2
+ export type RawFieldDefinition = FieldDefinition<any> & {
3
3
  type: 'raw';
4
4
  options: {
5
5
  valueType: string;
@@ -15,15 +15,15 @@ export interface SchemaFieldOptions {
15
15
  /** Dropped in after the type. Used to generate generics, like <T> */
16
16
  typeSuffix?: string;
17
17
  }
18
- export declare type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
18
+ export type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
19
19
  [K in keyof S]: S[K] extends Schema ? CreateEntityInstances extends true ? StaticSchemaEntity<S[K]> : {
20
20
  schemaId: S[K]['id'];
21
21
  version?: S[K]['version'];
22
22
  values: SchemaValues<S[K]>;
23
23
  } : any;
24
24
  };
25
- export declare type SchemaFieldValueTypeMapper<F extends SchemaFieldFieldDefinition, CreateEntityInstances extends boolean = false> = F['options']['schemas'] extends Array<Schema> ? IsArrayNoUnpack<SchemaFieldUnion<F['options']['schemas'], CreateEntityInstances>[number], F['isArray']> : F['options']['schema'] extends Schema ? CreateEntityInstances extends true ? IsArray<StaticSchemaEntity<F['options']['schema']>, F['isArray']> : IsArray<SchemaValues<F['options']['schema']>, F['isArray']> : any;
26
- export declare type SchemaFieldFieldDefinition = FieldDefinition<Record<string, any>, Record<string, any>, SchemaFieldValueUnion[], SchemaFieldValueUnion[]> & {
25
+ export type SchemaFieldValueTypeMapper<F extends SchemaFieldFieldDefinition, CreateEntityInstances extends boolean = false> = F['options']['schemas'] extends Array<Schema> ? IsArrayNoUnpack<SchemaFieldUnion<F['options']['schemas'], CreateEntityInstances>[number], F['isArray']> : F['options']['schema'] extends Schema ? CreateEntityInstances extends true ? IsArray<StaticSchemaEntity<F['options']['schema']>, F['isArray']> : IsArray<SchemaValues<F['options']['schema']>, F['isArray']> : any;
26
+ export type SchemaFieldFieldDefinition = FieldDefinition<Record<string, any>, Record<string, any>, SchemaFieldValueUnion[], SchemaFieldValueUnion[]> & {
27
27
  /** * .Schema go team! */
28
28
  type: 'schema';
29
29
  options: SchemaFieldOptions;
@@ -8,8 +8,8 @@ export interface SelectChoice {
8
8
  export interface SelectFieldOptions {
9
9
  choices: SelectChoice[];
10
10
  }
11
- export declare type SelectFieldValueTypeMapper<F extends SelectFieldDefinition> = F['options']['choices'][number]['value'];
12
- export declare type SelectFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
11
+ export type SelectFieldValueTypeMapper<F extends SelectFieldDefinition> = F['options']['choices'][number]['value'];
12
+ export type SelectFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
13
13
  /** * .Select - A way to chose between a choices */
14
14
  type: 'select';
15
15
  options: SelectFieldOptions;
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type TextFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type TextFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * Text field */
4
4
  type: 'text';
5
5
  /** Options */
@@ -5,7 +5,7 @@ import { Unpack, IsArray, IsRequired } from '../types/utilities.types';
5
5
  export interface SchemasById {
6
6
  [id: string]: Schema[];
7
7
  }
8
- export declare type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
8
+ export type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
9
9
  [K in keyof S]: S[K] extends Schema ? CreateEntityInstances extends true ? StaticSchemaEntity<S[K]> : {
10
10
  schemaId: S[K]['id'];
11
11
  version?: S[K]['version'];
@@ -16,18 +16,18 @@ export interface FieldDefinitionToSchemaOptions {
16
16
  /** All definitions we're validating against */
17
17
  schemasById?: SchemasById;
18
18
  }
19
- export declare type ToValueTypeOptions<F extends FieldDefinitions, CreateEntityInstances extends boolean = true> = {
19
+ export type ToValueTypeOptions<F extends FieldDefinitions, CreateEntityInstances extends boolean = true> = {
20
20
  schemasById?: SchemasById;
21
21
  createEntityInstances?: CreateEntityInstances;
22
22
  } & Partial<F['options']>;
23
23
  /** Options passed to validate() */
24
- export declare type ValidateOptions<F extends FieldDefinitions> = {
24
+ export type ValidateOptions<F extends FieldDefinitions> = {
25
25
  /** All schemas we're validating against */
26
26
  schemasById?: SchemasById;
27
27
  } & Partial<F['options']>;
28
- export declare type FieldType = keyof FieldMap;
29
- export declare type FieldName<F extends SchemaFieldsByName> = Extract<keyof F, string>;
30
- export declare type FieldDefinition<Value = any, DefaultValue = Value, ArrayValue = Value[], DefaultArrayValue = DefaultValue[]> = {
28
+ export type FieldType = keyof FieldMap;
29
+ export type FieldName<F extends SchemaFieldsByName> = Extract<keyof F, string>;
30
+ export type FieldDefinition<Value = any, DefaultValue = Value, ArrayValue = Value[], DefaultArrayValue = DefaultValue[]> = {
31
31
  type: FieldType;
32
32
  /** Default options are empty */
33
33
  options?: {};
@@ -45,7 +45,7 @@ export declare type FieldDefinition<Value = any, DefaultValue = Value, ArrayValu
45
45
  defaultValue?: DefaultValue | null;
46
46
  value?: Value | null;
47
47
  });
48
- export declare type FieldDefinitionValueType<F extends FieldDefinitions, CreateEntityInstances extends boolean = false> = F extends FieldDefinitions ? IsRequired<IsArray<NonNullable<FieldValueTypeGeneratorMap<F, CreateEntityInstances>[F['type']]>, F['isArray']>, F['isRequired']> : any;
48
+ export type FieldDefinitionValueType<F extends FieldDefinitions, CreateEntityInstances extends boolean = false> = F extends FieldDefinitions ? IsRequired<IsArray<NonNullable<FieldValueTypeGeneratorMap<F, CreateEntityInstances>[F['type']]>, F['isArray']>, F['isRequired']> : any;
49
49
  export interface Field<F extends FieldDefinitions> {
50
50
  readonly definition: F;
51
51
  readonly type: F['type'];
@@ -60,4 +60,4 @@ export interface Field<F extends FieldDefinitions> {
60
60
  validate(value: any, options?: ValidateOptions<F>): FieldError[];
61
61
  toValueType<CreateEntityInstances extends boolean>(value: any, options?: ToValueTypeOptions<F, CreateEntityInstances>): Unpack<Exclude<FieldDefinitionValueType<F, CreateEntityInstances>, undefined | null>>;
62
62
  }
63
- export declare type FieldSubclass<F extends FieldDefinitions> = new (name: string, definition: F) => Field<F>;
63
+ export type FieldSubclass<F extends FieldDefinitions> = new (name: string, definition: F) => Field<F>;
@@ -61,47 +61,47 @@ export interface SchemaFieldValueUnion<V extends Record<string, any> = Record<st
61
61
  version?: string;
62
62
  values: V;
63
63
  }
64
- export declare type SchemaFields<T extends Schema> = {
64
+ export type SchemaFields<T extends Schema> = {
65
65
  [F in SchemaFieldNames<T>]: T['fields'][F] extends FieldDefinition ? FieldMap[T['fields'][F]['type']] : never;
66
66
  };
67
- export declare type SchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S, CreateEntityInstances> : StaticSchemaAllValues<S, CreateEntityInstances>;
68
- export declare type StaticSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
67
+ export type SchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S, CreateEntityInstances> : StaticSchemaAllValues<S, CreateEntityInstances>;
68
+ export type StaticSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
69
69
  [K in SchemaFieldNames<S>]-?: SchemaFieldValueType<S, K, CreateEntityInstances>;
70
70
  };
71
- export declare type DynamicSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
71
+ export type DynamicSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
72
72
  [dynamicKey: string]: S['dynamicFieldSignature'] extends FieldDefinitions ? FieldDefinitionValueType<S['dynamicFieldSignature'], CreateEntityInstances> : never;
73
73
  };
74
- export declare type SchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaPartialValues<S, CreateEntityInstances> : StaticSchemaPartialValues<S, CreateEntityInstances>;
75
- export declare type StaticSchemaPartialValues<T extends Schema, CreateEntityInstances extends boolean = false> = {
74
+ export type SchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaPartialValues<S, CreateEntityInstances> : StaticSchemaPartialValues<S, CreateEntityInstances>;
75
+ export type StaticSchemaPartialValues<T extends Schema, CreateEntityInstances extends boolean = false> = {
76
76
  [K in SchemaFieldNames<T>]?: SchemaFieldValueType<T, K, CreateEntityInstances> | undefined | null;
77
77
  };
78
- export declare type DynamicSchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = Partial<{
78
+ export type DynamicSchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = Partial<{
79
79
  [dynamicField: string]: S['dynamicFieldSignature'] extends FieldDefinitions ? FieldDefinitionValueType<S['dynamicFieldSignature'], CreateEntityInstances> | undefined | null : never;
80
80
  }>;
81
- export declare type SchemaStaticValues<T extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaOptionalFieldNames<T> = SchemaOptionalFieldNames<T>, V extends SchemaAllValues<T, CreateEntityInstances> = SchemaAllValues<T, CreateEntityInstances>> = Omit<V, K> & Partial<Pick<V, K>>;
82
- export declare type SchemaValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S> : SchemaStaticValues<S, CreateEntityInstances>;
83
- export declare type IsDynamicSchema<S extends Schema> = S['dynamicFieldSignature'] extends FieldDefinitions ? true : false;
84
- export declare type SchemaDefaultValues<S extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaFieldNamesWithDefaultValue<S> = SchemaFieldNamesWithDefaultValue<S>, V extends SchemaAllValues<S, CreateEntityInstances> = SchemaAllValues<S, CreateEntityInstances>> = {
81
+ export type SchemaStaticValues<T extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaOptionalFieldNames<T> = SchemaOptionalFieldNames<T>, V extends SchemaAllValues<T, CreateEntityInstances> = SchemaAllValues<T, CreateEntityInstances>> = Omit<V, K> & Partial<Pick<V, K>>;
82
+ export type SchemaValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S> : SchemaStaticValues<S, CreateEntityInstances>;
83
+ export type IsDynamicSchema<S extends Schema> = S['dynamicFieldSignature'] extends FieldDefinitions ? true : false;
84
+ export type SchemaDefaultValues<S extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaFieldNamesWithDefaultValue<S> = SchemaFieldNamesWithDefaultValue<S>, V extends SchemaAllValues<S, CreateEntityInstances> = SchemaAllValues<S, CreateEntityInstances>> = {
85
85
  [F in K]: NonNullable<V[F]>;
86
86
  };
87
- export declare type SchemaValuesWithDefaults<T extends Schema> = SchemaValues<T> & SchemaDefaultValues<T>;
88
- export declare type SchemaOptionalFieldNames<T extends Schema> = {
87
+ export type SchemaValuesWithDefaults<T extends Schema> = SchemaValues<T> & SchemaDefaultValues<T>;
88
+ export type SchemaOptionalFieldNames<T extends Schema> = {
89
89
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['isRequired'] extends true ? never : K : never;
90
90
  }[SchemaFieldNames<T>];
91
- export declare type SchemaRequiredFieldNames<T extends Schema> = {
91
+ export type SchemaRequiredFieldNames<T extends Schema> = {
92
92
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['isRequired'] extends true ? K : never : never;
93
93
  }[SchemaFieldNames<T>];
94
- export declare type SchemaFieldNamesWithDefaultValue<T extends Schema> = {
94
+ export type SchemaFieldNamesWithDefaultValue<T extends Schema> = {
95
95
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['defaultValue'] extends Required<T['fields'][K]['defaultValue']> ? K : never : never;
96
96
  }[SchemaFieldNames<T>];
97
- export declare type SchemaFieldValueType<S extends Schema, K extends SchemaFieldNames<S>, CreateEntityInstances extends boolean = false> = S['fields'][K] extends FieldDefinitions ? FieldDefinitionValueType<S['fields'][K], CreateEntityInstances> : never;
98
- export declare type SchemaFieldNames<T extends Schema> = Extract<keyof T['fields'], string>;
99
- export declare type SchemaPublicFieldNames<S extends Schema> = {
97
+ export type SchemaFieldValueType<S extends Schema, K extends SchemaFieldNames<S>, CreateEntityInstances extends boolean = false> = S['fields'][K] extends FieldDefinitions ? FieldDefinitionValueType<S['fields'][K], CreateEntityInstances> : never;
98
+ export type SchemaFieldNames<T extends Schema> = Extract<keyof T['fields'], string>;
99
+ export type SchemaPublicFieldNames<S extends Schema> = {
100
100
  [K in SchemaFieldNames<S>]: S['fields'][K] extends FieldDefinitions ? S['fields'][K]['isPrivate'] extends true ? never : K : never;
101
101
  }[SchemaFieldNames<S>];
102
- export declare type SchemaPublicValues<S extends Schema, CreateEntityInstances extends boolean = false, PublicFieldNames extends SchemaPublicFieldNames<S> = SchemaPublicFieldNames<S>, AllValues extends SchemaValues<S, CreateEntityInstances> = SchemaValues<S, CreateEntityInstances>> = S['fields'] extends SchemaFieldsByName ? Exclude<Pick<AllValues, PublicFieldNames>, never> : never;
103
- export declare type SchemaFieldDefinition<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
104
- export declare type SchemaFieldType<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
102
+ export type SchemaPublicValues<S extends Schema, CreateEntityInstances extends boolean = false, PublicFieldNames extends SchemaPublicFieldNames<S> = SchemaPublicFieldNames<S>, AllValues extends SchemaValues<S, CreateEntityInstances> = SchemaValues<S, CreateEntityInstances>> = S['fields'] extends SchemaFieldsByName ? Exclude<Pick<AllValues, PublicFieldNames>, never> : never;
103
+ export type SchemaFieldDefinition<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
104
+ export type SchemaFieldType<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
105
105
  export interface SchemaNamedField<T extends Schema> {
106
106
  name: SchemaFieldNames<T>;
107
107
  field: Fields;
@@ -124,14 +124,14 @@ export interface SchemaNormalizeOptions<S extends Schema, CreateEntityInstances
124
124
  }
125
125
  export interface DynamicSchemaNormalizeOptions<CreateEntityInstances extends boolean> extends SchemaNormalizeFieldValueOptions<CreateEntityInstances> {
126
126
  }
127
- export declare type SchemaGetValuesOptions<T extends Schema, F extends SchemaFieldNames<T>, PF extends SchemaPublicFieldNames<T>, CreateEntityInstances extends boolean, IncludePrivateFields extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & (IncludePrivateFields extends false ? {
127
+ export type SchemaGetValuesOptions<T extends Schema, F extends SchemaFieldNames<T>, PF extends SchemaPublicFieldNames<T>, CreateEntityInstances extends boolean, IncludePrivateFields extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & (IncludePrivateFields extends false ? {
128
128
  shouldIncludePrivateFields: IncludePrivateFields;
129
129
  fields?: PF[];
130
130
  } : {
131
131
  shouldIncludePrivateFields?: IncludePrivateFields;
132
132
  fields?: F[];
133
133
  });
134
- export declare type DynamicSchemaGetValuesOptions<T extends Schema, F extends string, CreateEntityInstances extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & {
134
+ export type DynamicSchemaGetValuesOptions<T extends Schema, F extends string, CreateEntityInstances extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & {
135
135
  fields?: F[];
136
136
  };
137
137
  export interface SchemaGetDefaultValuesOptions<T extends Schema, F extends SchemaFieldNamesWithDefaultValue<T>, CreateEntityInstances extends boolean> extends SchemaNormalizeOptions<T, CreateEntityInstances> {
@@ -148,7 +148,7 @@ export interface DynamicSchemaNamedFieldsOptions<F extends string> {
148
148
  export interface SchemaValidateOptions<T extends Schema, F extends SchemaFieldNames<T> = SchemaFieldNames<T>> extends SchemaNamedFieldsOptions<T, F> {
149
149
  shouldMapToParameterErrors?: boolean;
150
150
  }
151
- export declare type PickFieldNames<S extends Schema, T extends FieldType> = {
151
+ export type PickFieldNames<S extends Schema, T extends FieldType> = {
152
152
  [F in keyof S['fields']]: S['fields'][F] extends FieldDefinitions ? S['fields'][F]['type'] extends T ? F : never : never;
153
153
  }[Extract<keyof S['fields'], string>];
154
154
  export interface SchemaIdWithVersion {
@@ -1,9 +1,9 @@
1
- declare type ValidationErrorAssertOptions = {
1
+ type ValidationErrorAssertOptions = {
2
2
  missing?: string[];
3
3
  invalid?: string[];
4
4
  unexpected?: string[];
5
5
  };
6
- export declare type ValidationErrorAssertOptionsKey = keyof ValidationErrorAssertOptions;
6
+ export type ValidationErrorAssertOptionsKey = keyof ValidationErrorAssertOptions;
7
7
  declare const validationErrorAssert: {
8
8
  assertError(error: any, options: ValidationErrorAssertOptions): void;
9
9
  };
@@ -1,6 +1,6 @@
1
1
  import { Schema, SchemaRequiredFieldNames } from '../schemas.static.types';
2
- export declare type Unpack<A> = A extends Array<infer E> ? E : A;
3
- export declare type IsArray<T, isArray> = isArray extends true ? Unpack<T>[] : Unpack<T>;
4
- export declare type IsArrayNoUnpack<T, isArray> = isArray extends true ? T[] : T;
5
- export declare type IsRequired<T, isRequired> = isRequired extends true ? T : T | undefined | null;
6
- export declare type AreAnyFieldsRequired<S extends Schema | undefined> = S extends Schema ? SchemaRequiredFieldNames<S> extends [] ? false : true : false;
2
+ export type Unpack<A> = A extends Array<infer E> ? E : A;
3
+ export type IsArray<T, isArray> = isArray extends true ? Unpack<T>[] : Unpack<T>;
4
+ export type IsArrayNoUnpack<T, isArray> = isArray extends true ? T[] : T;
5
+ export type IsRequired<T, isRequired> = isRequired extends true ? T : T | undefined | null;
6
+ export type AreAnyFieldsRequired<S extends Schema | undefined> = S extends Schema ? SchemaRequiredFieldNames<S> extends [] ? false : true : false;
@@ -1,8 +1,8 @@
1
1
  export default function assertOptions<Options extends Record<string, any>, Path extends Paths<Options> = Paths<Options>>(options: Options, toCheck: Path[], friendlyMessage?: string): Options & {
2
2
  [P in Path]: NonNullable<Options[P]>;
3
3
  };
4
- declare type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
5
- declare type Prev = [
4
+ type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
5
+ type Prev = [
6
6
  never,
7
7
  0,
8
8
  1,
@@ -27,7 +27,7 @@ declare type Prev = [
27
27
  20,
28
28
  ...0[]
29
29
  ];
30
- declare type Paths<T, D extends number = 3> = [D] extends [never] ? never : T extends object ? {
30
+ type Paths<T, D extends number = 3> = [D] extends [never] ? never : T extends object ? {
31
31
  [K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K], Prev[D]>> : never;
32
32
  }[keyof T] : '';
33
33
  export {};
@@ -1,3 +1,3 @@
1
1
  export default function cloneDeep<T>(obj: T, transformer?: Transformer): T;
2
- declare type Transformer = (value: any, key: string) => any | void;
2
+ type Transformer = (value: any, key: string) => any | void;
3
3
  export {};
@@ -1,6 +1,6 @@
1
1
  import { FieldName } from '../fields/field.static.types';
2
2
  import { SchemaFieldsByName } from '../schemas.static.types';
3
- declare type PrivateFieldNames<F extends SchemaFieldsByName> = {
3
+ type PrivateFieldNames<F extends SchemaFieldsByName> = {
4
4
  [K in FieldName<F>]: F[K]['isPrivate'] extends true ? K : never;
5
5
  }[FieldName<F>];
6
6
  export default function dropPrivateFields<F extends SchemaFieldsByName, D extends PrivateFieldNames<F>>(fields: F): Omit<F, D>;
@@ -1,6 +1,6 @@
1
1
  import { FieldName } from '../fields/field.static.types';
2
2
  import { SchemaFieldsByName } from '../schemas.static.types';
3
- declare type MakeFieldsOptional<F extends SchemaFieldsByName> = {
3
+ type MakeFieldsOptional<F extends SchemaFieldsByName> = {
4
4
  [K in keyof F]: {
5
5
  isRequired: false;
6
6
  } & Omit<F[K], 'isRequired'>;
@@ -1,3 +1,3 @@
1
- export declare type Optional<T> = {
1
+ export type Optional<T> = {
2
2
  [P in keyof T]?: T[P] | null;
3
3
  };
@@ -1,7 +1,7 @@
1
1
  import { SelectFieldDefinition, SelectChoice } from '../fields/SelectField.types';
2
2
  import { Schema, SchemaFieldsByName, PickFieldNames } from '../schemas.static.types';
3
3
  /** Turn select options into a key/value pair */
4
- export declare type SelectChoicesToHash<Options extends SelectChoice[]> = {
4
+ export type SelectChoicesToHash<Options extends SelectChoice[]> = {
5
5
  [P in Options[number]['value']]: Extract<Options[number], {
6
6
  label: P;
7
7
  }>['label'];
@@ -7,7 +7,7 @@ export interface AddressFieldValue {
7
7
  country: string;
8
8
  zip: string;
9
9
  }
10
- export declare type AddressFieldDefinition = FieldDefinition<AddressFieldValue> & {
10
+ export type AddressFieldDefinition = FieldDefinition<AddressFieldValue> & {
11
11
  /** * An address with street, city, province, country, and zip details */
12
12
  type: 'address';
13
13
  options?: {};
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type BooleanFieldDefinition = FieldDefinition<boolean, boolean, boolean[], boolean[]> & {
2
+ export type BooleanFieldDefinition = FieldDefinition<boolean, boolean, boolean[], boolean[]> & {
3
3
  /** * A true/false field */
4
4
  type: 'boolean';
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type DateFieldValue = number;
3
- export declare type DateFieldDefinition = FieldDefinition<DateFieldValue> & {
2
+ export type DateFieldValue = number;
3
+ export type DateFieldDefinition = FieldDefinition<DateFieldValue> & {
4
4
  /** * A date/time field that stores everything in GMT and handles all the timezone */
5
5
  type: 'date';
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type DateTimeFieldValue = number;
3
- export declare type DateTimeFieldDefinition = FieldDefinition<DateTimeFieldValue> & {
2
+ export type DateTimeFieldValue = number;
3
+ export type DateTimeFieldDefinition = FieldDefinition<DateTimeFieldValue> & {
4
4
  /** * A date/time field that stores everything in GMT and handles all the timezone */
5
5
  type: 'dateTime';
6
6
  options?: {
@@ -2,7 +2,7 @@ import { FieldDefinition } from './field.static.types';
2
2
  export interface DirectoryFieldValue {
3
3
  path: string;
4
4
  }
5
- export declare type DirectoryFieldDefinition = FieldDefinition<DirectoryFieldValue> & {
5
+ export type DirectoryFieldDefinition = FieldDefinition<DirectoryFieldValue> & {
6
6
  /** * .Directory - select whole directories all at once */
7
7
  type: 'directory';
8
8
  options?: {
@@ -6,7 +6,7 @@ export interface DurationFieldValue {
6
6
  seconds: number;
7
7
  ms: number;
8
8
  }
9
- export declare type DurationFieldDefinition = FieldDefinition<DurationFieldValue> & {
9
+ export type DurationFieldDefinition = FieldDefinition<DurationFieldValue> & {
10
10
  /** * .Duration - a span of time */
11
11
  type: 'duration';
12
12
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type EmailFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type EmailFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * .Email an easy way to capture emails */
4
4
  type: 'email';
5
5
  options?: {};
@@ -1,13 +1,13 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
2
  export declare const supportedFileTypes: readonly ["image/png", "image/svg+xml", "image/jpeg", "application/pdf", "text/csv", "*"];
3
- export declare type SupportedFileType = typeof supportedFileTypes[number];
3
+ export type SupportedFileType = typeof supportedFileTypes[number];
4
4
  export interface FileFieldValue {
5
5
  name: string;
6
6
  type?: SupportedFileType;
7
7
  uri?: string;
8
8
  base64?: string;
9
9
  }
10
- export declare type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
10
+ export type FileFieldDefinition = FieldDefinition<FileFieldValue> & {
11
11
  /** * .File - a great way to deal with file management */
12
12
  type: 'file';
13
13
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type IdFieldDefinition = FieldDefinition<string> & {
2
+ export type IdFieldDefinition = FieldDefinition<string> & {
3
3
  /** * .Id a field to hold a unique id (UUID4 in Spruce) */
4
4
  type: 'id';
5
5
  options?: {};
@@ -8,7 +8,7 @@ import { SupportedFileType } from './FileField.types';
8
8
  s: 30
9
9
  */
10
10
  export declare const requiredImageSizes: readonly ["s", "m", "l", "xl", "*"];
11
- export declare type RequiredImageSize = typeof requiredImageSizes[number];
11
+ export type RequiredImageSize = typeof requiredImageSizes[number];
12
12
  export interface ImageFieldValue {
13
13
  name: string;
14
14
  base64?: string;
@@ -18,7 +18,7 @@ export interface ImageFieldValue {
18
18
  lUri?: string;
19
19
  xlUri?: string;
20
20
  }
21
- export declare type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
21
+ export type ImageFieldDefinition = FieldDefinition<ImageFieldValue> & {
22
22
  /** * .image - a great way to deal with file management */
23
23
  type: 'image';
24
24
  options?: {
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type NumberFieldDefinition = FieldDefinition<number, number, number[], number[]> & {
2
+ export type NumberFieldDefinition = FieldDefinition<number, number, number[], number[]> & {
3
3
  /** * .Number - a number, silly */
4
4
  type: 'number';
5
5
  /** Configure this field */
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type PhoneFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type PhoneFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * .Phone a great way to validate and format values */
4
4
  type: 'phone';
5
5
  options?: {};
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type RawFieldDefinition = FieldDefinition<any> & {
2
+ export type RawFieldDefinition = FieldDefinition<any> & {
3
3
  type: 'raw';
4
4
  options: {
5
5
  valueType: string;
@@ -15,15 +15,15 @@ export interface SchemaFieldOptions {
15
15
  /** Dropped in after the type. Used to generate generics, like <T> */
16
16
  typeSuffix?: string;
17
17
  }
18
- export declare type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
18
+ export type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
19
19
  [K in keyof S]: S[K] extends Schema ? CreateEntityInstances extends true ? StaticSchemaEntity<S[K]> : {
20
20
  schemaId: S[K]['id'];
21
21
  version?: S[K]['version'];
22
22
  values: SchemaValues<S[K]>;
23
23
  } : any;
24
24
  };
25
- export declare type SchemaFieldValueTypeMapper<F extends SchemaFieldFieldDefinition, CreateEntityInstances extends boolean = false> = F['options']['schemas'] extends Array<Schema> ? IsArrayNoUnpack<SchemaFieldUnion<F['options']['schemas'], CreateEntityInstances>[number], F['isArray']> : F['options']['schema'] extends Schema ? CreateEntityInstances extends true ? IsArray<StaticSchemaEntity<F['options']['schema']>, F['isArray']> : IsArray<SchemaValues<F['options']['schema']>, F['isArray']> : any;
26
- export declare type SchemaFieldFieldDefinition = FieldDefinition<Record<string, any>, Record<string, any>, SchemaFieldValueUnion[], SchemaFieldValueUnion[]> & {
25
+ export type SchemaFieldValueTypeMapper<F extends SchemaFieldFieldDefinition, CreateEntityInstances extends boolean = false> = F['options']['schemas'] extends Array<Schema> ? IsArrayNoUnpack<SchemaFieldUnion<F['options']['schemas'], CreateEntityInstances>[number], F['isArray']> : F['options']['schema'] extends Schema ? CreateEntityInstances extends true ? IsArray<StaticSchemaEntity<F['options']['schema']>, F['isArray']> : IsArray<SchemaValues<F['options']['schema']>, F['isArray']> : any;
26
+ export type SchemaFieldFieldDefinition = FieldDefinition<Record<string, any>, Record<string, any>, SchemaFieldValueUnion[], SchemaFieldValueUnion[]> & {
27
27
  /** * .Schema go team! */
28
28
  type: 'schema';
29
29
  options: SchemaFieldOptions;
@@ -8,8 +8,8 @@ export interface SelectChoice {
8
8
  export interface SelectFieldOptions {
9
9
  choices: SelectChoice[];
10
10
  }
11
- export declare type SelectFieldValueTypeMapper<F extends SelectFieldDefinition> = F['options']['choices'][number]['value'];
12
- export declare type SelectFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
11
+ export type SelectFieldValueTypeMapper<F extends SelectFieldDefinition> = F['options']['choices'][number]['value'];
12
+ export type SelectFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
13
13
  /** * .Select - A way to chose between a choices */
14
14
  type: 'select';
15
15
  options: SelectFieldOptions;
@@ -1,5 +1,5 @@
1
1
  import { FieldDefinition } from './field.static.types';
2
- export declare type TextFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
2
+ export type TextFieldDefinition = FieldDefinition<string, string, string[], string[]> & {
3
3
  /** * Text field */
4
4
  type: 'text';
5
5
  /** Options */
@@ -5,7 +5,7 @@ import { Unpack, IsArray, IsRequired } from '../types/utilities.types';
5
5
  export interface SchemasById {
6
6
  [id: string]: Schema[];
7
7
  }
8
- export declare type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
8
+ export type SchemaFieldUnion<S extends Array<Schema>, CreateEntityInstances extends boolean = false> = {
9
9
  [K in keyof S]: S[K] extends Schema ? CreateEntityInstances extends true ? StaticSchemaEntity<S[K]> : {
10
10
  schemaId: S[K]['id'];
11
11
  version?: S[K]['version'];
@@ -16,18 +16,18 @@ export interface FieldDefinitionToSchemaOptions {
16
16
  /** All definitions we're validating against */
17
17
  schemasById?: SchemasById;
18
18
  }
19
- export declare type ToValueTypeOptions<F extends FieldDefinitions, CreateEntityInstances extends boolean = true> = {
19
+ export type ToValueTypeOptions<F extends FieldDefinitions, CreateEntityInstances extends boolean = true> = {
20
20
  schemasById?: SchemasById;
21
21
  createEntityInstances?: CreateEntityInstances;
22
22
  } & Partial<F['options']>;
23
23
  /** Options passed to validate() */
24
- export declare type ValidateOptions<F extends FieldDefinitions> = {
24
+ export type ValidateOptions<F extends FieldDefinitions> = {
25
25
  /** All schemas we're validating against */
26
26
  schemasById?: SchemasById;
27
27
  } & Partial<F['options']>;
28
- export declare type FieldType = keyof FieldMap;
29
- export declare type FieldName<F extends SchemaFieldsByName> = Extract<keyof F, string>;
30
- export declare type FieldDefinition<Value = any, DefaultValue = Value, ArrayValue = Value[], DefaultArrayValue = DefaultValue[]> = {
28
+ export type FieldType = keyof FieldMap;
29
+ export type FieldName<F extends SchemaFieldsByName> = Extract<keyof F, string>;
30
+ export type FieldDefinition<Value = any, DefaultValue = Value, ArrayValue = Value[], DefaultArrayValue = DefaultValue[]> = {
31
31
  type: FieldType;
32
32
  /** Default options are empty */
33
33
  options?: {};
@@ -45,7 +45,7 @@ export declare type FieldDefinition<Value = any, DefaultValue = Value, ArrayValu
45
45
  defaultValue?: DefaultValue | null;
46
46
  value?: Value | null;
47
47
  });
48
- export declare type FieldDefinitionValueType<F extends FieldDefinitions, CreateEntityInstances extends boolean = false> = F extends FieldDefinitions ? IsRequired<IsArray<NonNullable<FieldValueTypeGeneratorMap<F, CreateEntityInstances>[F['type']]>, F['isArray']>, F['isRequired']> : any;
48
+ export type FieldDefinitionValueType<F extends FieldDefinitions, CreateEntityInstances extends boolean = false> = F extends FieldDefinitions ? IsRequired<IsArray<NonNullable<FieldValueTypeGeneratorMap<F, CreateEntityInstances>[F['type']]>, F['isArray']>, F['isRequired']> : any;
49
49
  export interface Field<F extends FieldDefinitions> {
50
50
  readonly definition: F;
51
51
  readonly type: F['type'];
@@ -60,4 +60,4 @@ export interface Field<F extends FieldDefinitions> {
60
60
  validate(value: any, options?: ValidateOptions<F>): FieldError[];
61
61
  toValueType<CreateEntityInstances extends boolean>(value: any, options?: ToValueTypeOptions<F, CreateEntityInstances>): Unpack<Exclude<FieldDefinitionValueType<F, CreateEntityInstances>, undefined | null>>;
62
62
  }
63
- export declare type FieldSubclass<F extends FieldDefinitions> = new (name: string, definition: F) => Field<F>;
63
+ export type FieldSubclass<F extends FieldDefinitions> = new (name: string, definition: F) => Field<F>;
@@ -61,47 +61,47 @@ export interface SchemaFieldValueUnion<V extends Record<string, any> = Record<st
61
61
  version?: string;
62
62
  values: V;
63
63
  }
64
- export declare type SchemaFields<T extends Schema> = {
64
+ export type SchemaFields<T extends Schema> = {
65
65
  [F in SchemaFieldNames<T>]: T['fields'][F] extends FieldDefinition ? FieldMap[T['fields'][F]['type']] : never;
66
66
  };
67
- export declare type SchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S, CreateEntityInstances> : StaticSchemaAllValues<S, CreateEntityInstances>;
68
- export declare type StaticSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
67
+ export type SchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S, CreateEntityInstances> : StaticSchemaAllValues<S, CreateEntityInstances>;
68
+ export type StaticSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
69
69
  [K in SchemaFieldNames<S>]-?: SchemaFieldValueType<S, K, CreateEntityInstances>;
70
70
  };
71
- export declare type DynamicSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
71
+ export type DynamicSchemaAllValues<S extends Schema, CreateEntityInstances extends boolean = false> = {
72
72
  [dynamicKey: string]: S['dynamicFieldSignature'] extends FieldDefinitions ? FieldDefinitionValueType<S['dynamicFieldSignature'], CreateEntityInstances> : never;
73
73
  };
74
- export declare type SchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaPartialValues<S, CreateEntityInstances> : StaticSchemaPartialValues<S, CreateEntityInstances>;
75
- export declare type StaticSchemaPartialValues<T extends Schema, CreateEntityInstances extends boolean = false> = {
74
+ export type SchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaPartialValues<S, CreateEntityInstances> : StaticSchemaPartialValues<S, CreateEntityInstances>;
75
+ export type StaticSchemaPartialValues<T extends Schema, CreateEntityInstances extends boolean = false> = {
76
76
  [K in SchemaFieldNames<T>]?: SchemaFieldValueType<T, K, CreateEntityInstances> | undefined | null;
77
77
  };
78
- export declare type DynamicSchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = Partial<{
78
+ export type DynamicSchemaPartialValues<S extends Schema, CreateEntityInstances extends boolean = false> = Partial<{
79
79
  [dynamicField: string]: S['dynamicFieldSignature'] extends FieldDefinitions ? FieldDefinitionValueType<S['dynamicFieldSignature'], CreateEntityInstances> | undefined | null : never;
80
80
  }>;
81
- export declare type SchemaStaticValues<T extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaOptionalFieldNames<T> = SchemaOptionalFieldNames<T>, V extends SchemaAllValues<T, CreateEntityInstances> = SchemaAllValues<T, CreateEntityInstances>> = Omit<V, K> & Partial<Pick<V, K>>;
82
- export declare type SchemaValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S> : SchemaStaticValues<S, CreateEntityInstances>;
83
- export declare type IsDynamicSchema<S extends Schema> = S['dynamicFieldSignature'] extends FieldDefinitions ? true : false;
84
- export declare type SchemaDefaultValues<S extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaFieldNamesWithDefaultValue<S> = SchemaFieldNamesWithDefaultValue<S>, V extends SchemaAllValues<S, CreateEntityInstances> = SchemaAllValues<S, CreateEntityInstances>> = {
81
+ export type SchemaStaticValues<T extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaOptionalFieldNames<T> = SchemaOptionalFieldNames<T>, V extends SchemaAllValues<T, CreateEntityInstances> = SchemaAllValues<T, CreateEntityInstances>> = Omit<V, K> & Partial<Pick<V, K>>;
82
+ export type SchemaValues<S extends Schema, CreateEntityInstances extends boolean = false> = IsDynamicSchema<S> extends true ? DynamicSchemaAllValues<S> : SchemaStaticValues<S, CreateEntityInstances>;
83
+ export type IsDynamicSchema<S extends Schema> = S['dynamicFieldSignature'] extends FieldDefinitions ? true : false;
84
+ export type SchemaDefaultValues<S extends Schema, CreateEntityInstances extends boolean = false, K extends SchemaFieldNamesWithDefaultValue<S> = SchemaFieldNamesWithDefaultValue<S>, V extends SchemaAllValues<S, CreateEntityInstances> = SchemaAllValues<S, CreateEntityInstances>> = {
85
85
  [F in K]: NonNullable<V[F]>;
86
86
  };
87
- export declare type SchemaValuesWithDefaults<T extends Schema> = SchemaValues<T> & SchemaDefaultValues<T>;
88
- export declare type SchemaOptionalFieldNames<T extends Schema> = {
87
+ export type SchemaValuesWithDefaults<T extends Schema> = SchemaValues<T> & SchemaDefaultValues<T>;
88
+ export type SchemaOptionalFieldNames<T extends Schema> = {
89
89
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['isRequired'] extends true ? never : K : never;
90
90
  }[SchemaFieldNames<T>];
91
- export declare type SchemaRequiredFieldNames<T extends Schema> = {
91
+ export type SchemaRequiredFieldNames<T extends Schema> = {
92
92
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['isRequired'] extends true ? K : never : never;
93
93
  }[SchemaFieldNames<T>];
94
- export declare type SchemaFieldNamesWithDefaultValue<T extends Schema> = {
94
+ export type SchemaFieldNamesWithDefaultValue<T extends Schema> = {
95
95
  [K in SchemaFieldNames<T>]: T['fields'][K] extends FieldDefinitions ? T['fields'][K]['defaultValue'] extends Required<T['fields'][K]['defaultValue']> ? K : never : never;
96
96
  }[SchemaFieldNames<T>];
97
- export declare type SchemaFieldValueType<S extends Schema, K extends SchemaFieldNames<S>, CreateEntityInstances extends boolean = false> = S['fields'][K] extends FieldDefinitions ? FieldDefinitionValueType<S['fields'][K], CreateEntityInstances> : never;
98
- export declare type SchemaFieldNames<T extends Schema> = Extract<keyof T['fields'], string>;
99
- export declare type SchemaPublicFieldNames<S extends Schema> = {
97
+ export type SchemaFieldValueType<S extends Schema, K extends SchemaFieldNames<S>, CreateEntityInstances extends boolean = false> = S['fields'][K] extends FieldDefinitions ? FieldDefinitionValueType<S['fields'][K], CreateEntityInstances> : never;
98
+ export type SchemaFieldNames<T extends Schema> = Extract<keyof T['fields'], string>;
99
+ export type SchemaPublicFieldNames<S extends Schema> = {
100
100
  [K in SchemaFieldNames<S>]: S['fields'][K] extends FieldDefinitions ? S['fields'][K]['isPrivate'] extends true ? never : K : never;
101
101
  }[SchemaFieldNames<S>];
102
- export declare type SchemaPublicValues<S extends Schema, CreateEntityInstances extends boolean = false, PublicFieldNames extends SchemaPublicFieldNames<S> = SchemaPublicFieldNames<S>, AllValues extends SchemaValues<S, CreateEntityInstances> = SchemaValues<S, CreateEntityInstances>> = S['fields'] extends SchemaFieldsByName ? Exclude<Pick<AllValues, PublicFieldNames>, never> : never;
103
- export declare type SchemaFieldDefinition<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
104
- export declare type SchemaFieldType<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
102
+ export type SchemaPublicValues<S extends Schema, CreateEntityInstances extends boolean = false, PublicFieldNames extends SchemaPublicFieldNames<S> = SchemaPublicFieldNames<S>, AllValues extends SchemaValues<S, CreateEntityInstances> = SchemaValues<S, CreateEntityInstances>> = S['fields'] extends SchemaFieldsByName ? Exclude<Pick<AllValues, PublicFieldNames>, never> : never;
103
+ export type SchemaFieldDefinition<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
104
+ export type SchemaFieldType<T extends Schema, K extends SchemaFieldNames<T>> = T['fields'][K] extends FieldDefinitions ? T['fields'][K]['type'] : never;
105
105
  export interface SchemaNamedField<T extends Schema> {
106
106
  name: SchemaFieldNames<T>;
107
107
  field: Fields;
@@ -124,14 +124,14 @@ export interface SchemaNormalizeOptions<S extends Schema, CreateEntityInstances
124
124
  }
125
125
  export interface DynamicSchemaNormalizeOptions<CreateEntityInstances extends boolean> extends SchemaNormalizeFieldValueOptions<CreateEntityInstances> {
126
126
  }
127
- export declare type SchemaGetValuesOptions<T extends Schema, F extends SchemaFieldNames<T>, PF extends SchemaPublicFieldNames<T>, CreateEntityInstances extends boolean, IncludePrivateFields extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & (IncludePrivateFields extends false ? {
127
+ export type SchemaGetValuesOptions<T extends Schema, F extends SchemaFieldNames<T>, PF extends SchemaPublicFieldNames<T>, CreateEntityInstances extends boolean, IncludePrivateFields extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & (IncludePrivateFields extends false ? {
128
128
  shouldIncludePrivateFields: IncludePrivateFields;
129
129
  fields?: PF[];
130
130
  } : {
131
131
  shouldIncludePrivateFields?: IncludePrivateFields;
132
132
  fields?: F[];
133
133
  });
134
- export declare type DynamicSchemaGetValuesOptions<T extends Schema, F extends string, CreateEntityInstances extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & {
134
+ export type DynamicSchemaGetValuesOptions<T extends Schema, F extends string, CreateEntityInstances extends boolean> = SchemaNormalizeOptions<T, CreateEntityInstances> & {
135
135
  fields?: F[];
136
136
  };
137
137
  export interface SchemaGetDefaultValuesOptions<T extends Schema, F extends SchemaFieldNamesWithDefaultValue<T>, CreateEntityInstances extends boolean> extends SchemaNormalizeOptions<T, CreateEntityInstances> {
@@ -148,7 +148,7 @@ export interface DynamicSchemaNamedFieldsOptions<F extends string> {
148
148
  export interface SchemaValidateOptions<T extends Schema, F extends SchemaFieldNames<T> = SchemaFieldNames<T>> extends SchemaNamedFieldsOptions<T, F> {
149
149
  shouldMapToParameterErrors?: boolean;
150
150
  }
151
- export declare type PickFieldNames<S extends Schema, T extends FieldType> = {
151
+ export type PickFieldNames<S extends Schema, T extends FieldType> = {
152
152
  [F in keyof S['fields']]: S['fields'][F] extends FieldDefinitions ? S['fields'][F]['type'] extends T ? F : never : never;
153
153
  }[Extract<keyof S['fields'], string>];
154
154
  export interface SchemaIdWithVersion {
@@ -1,9 +1,9 @@
1
- declare type ValidationErrorAssertOptions = {
1
+ type ValidationErrorAssertOptions = {
2
2
  missing?: string[];
3
3
  invalid?: string[];
4
4
  unexpected?: string[];
5
5
  };
6
- export declare type ValidationErrorAssertOptionsKey = keyof ValidationErrorAssertOptions;
6
+ export type ValidationErrorAssertOptionsKey = keyof ValidationErrorAssertOptions;
7
7
  declare const validationErrorAssert: {
8
8
  assertError(error: any, options: ValidationErrorAssertOptions): void;
9
9
  };
@@ -1,6 +1,6 @@
1
1
  import { Schema, SchemaRequiredFieldNames } from '../schemas.static.types';
2
- export declare type Unpack<A> = A extends Array<infer E> ? E : A;
3
- export declare type IsArray<T, isArray> = isArray extends true ? Unpack<T>[] : Unpack<T>;
4
- export declare type IsArrayNoUnpack<T, isArray> = isArray extends true ? T[] : T;
5
- export declare type IsRequired<T, isRequired> = isRequired extends true ? T : T | undefined | null;
6
- export declare type AreAnyFieldsRequired<S extends Schema | undefined> = S extends Schema ? SchemaRequiredFieldNames<S> extends [] ? false : true : false;
2
+ export type Unpack<A> = A extends Array<infer E> ? E : A;
3
+ export type IsArray<T, isArray> = isArray extends true ? Unpack<T>[] : Unpack<T>;
4
+ export type IsArrayNoUnpack<T, isArray> = isArray extends true ? T[] : T;
5
+ export type IsRequired<T, isRequired> = isRequired extends true ? T : T | undefined | null;
6
+ export type AreAnyFieldsRequired<S extends Schema | undefined> = S extends Schema ? SchemaRequiredFieldNames<S> extends [] ? false : true : false;
@@ -1,8 +1,8 @@
1
1
  export default function assertOptions<Options extends Record<string, any>, Path extends Paths<Options> = Paths<Options>>(options: Options, toCheck: Path[], friendlyMessage?: string): Options & {
2
2
  [P in Path]: NonNullable<Options[P]>;
3
3
  };
4
- declare type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
5
- declare type Prev = [
4
+ type Join<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
5
+ type Prev = [
6
6
  never,
7
7
  0,
8
8
  1,
@@ -27,7 +27,7 @@ declare type Prev = [
27
27
  20,
28
28
  ...0[]
29
29
  ];
30
- declare type Paths<T, D extends number = 3> = [D] extends [never] ? never : T extends object ? {
30
+ type Paths<T, D extends number = 3> = [D] extends [never] ? never : T extends object ? {
31
31
  [K in keyof T]-?: K extends string | number ? `${K}` | Join<K, Paths<T[K], Prev[D]>> : never;
32
32
  }[keyof T] : '';
33
33
  export {};
@@ -1,3 +1,3 @@
1
1
  export default function cloneDeep<T>(obj: T, transformer?: Transformer): T;
2
- declare type Transformer = (value: any, key: string) => any | void;
2
+ type Transformer = (value: any, key: string) => any | void;
3
3
  export {};
@@ -1,6 +1,6 @@
1
1
  import { FieldName } from '../fields/field.static.types';
2
2
  import { SchemaFieldsByName } from '../schemas.static.types';
3
- declare type PrivateFieldNames<F extends SchemaFieldsByName> = {
3
+ type PrivateFieldNames<F extends SchemaFieldsByName> = {
4
4
  [K in FieldName<F>]: F[K]['isPrivate'] extends true ? K : never;
5
5
  }[FieldName<F>];
6
6
  export default function dropPrivateFields<F extends SchemaFieldsByName, D extends PrivateFieldNames<F>>(fields: F): Omit<F, D>;
@@ -1,6 +1,6 @@
1
1
  import { FieldName } from '../fields/field.static.types';
2
2
  import { SchemaFieldsByName } from '../schemas.static.types';
3
- declare type MakeFieldsOptional<F extends SchemaFieldsByName> = {
3
+ type MakeFieldsOptional<F extends SchemaFieldsByName> = {
4
4
  [K in keyof F]: {
5
5
  isRequired: false;
6
6
  } & Omit<F[K], 'isRequired'>;
@@ -1,3 +1,3 @@
1
- export declare type Optional<T> = {
1
+ export type Optional<T> = {
2
2
  [P in keyof T]?: T[P] | null;
3
3
  };
@@ -1,7 +1,7 @@
1
1
  import { SelectFieldDefinition, SelectChoice } from '../fields/SelectField.types';
2
2
  import { Schema, SchemaFieldsByName, PickFieldNames } from '../schemas.static.types';
3
3
  /** Turn select options into a key/value pair */
4
- export declare type SelectChoicesToHash<Options extends SelectChoice[]> = {
4
+ export type SelectChoicesToHash<Options extends SelectChoice[]> = {
5
5
  [P in Options[number]['value']]: Extract<Options[number], {
6
6
  label: P;
7
7
  }>['label'];
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!build/__tests__",
9
9
  "esm"
10
10
  ],
11
- "version": "28.5.65",
11
+ "version": "28.5.67",
12
12
  "main": "./build/index.js",
13
13
  "types": "./build/index.d.ts",
14
14
  "module": "./build/esm/index.js",
@@ -66,8 +66,8 @@
66
66
  "build.copy-files": "mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/"
67
67
  },
68
68
  "dependencies": {
69
- "@sprucelabs/error": "^5.0.540",
70
- "@sprucelabs/test-utils": "^3.2.53",
69
+ "@sprucelabs/error": "^5.0.541",
70
+ "@sprucelabs/test-utils": "^3.2.55",
71
71
  "email-validator": "^2.0.4",
72
72
  "just-safe-get": "^4.1.1",
73
73
  "just-safe-set": "^4.1.1"
@@ -78,7 +78,7 @@
78
78
  "@sprucelabs/jest-sheets-reporter": "^2.0.20",
79
79
  "@sprucelabs/resolve-path-aliases": "^1.1.122",
80
80
  "@sprucelabs/semantic-release": "^4.0.8",
81
- "@sprucelabs/test": "^7.7.386",
81
+ "@sprucelabs/test": "^7.7.387",
82
82
  "chokidar-cli": "^3.0.0",
83
83
  "concurrently": "^7.5.0",
84
84
  "eslint": "^8.27.0",
@@ -89,7 +89,7 @@
89
89
  "ts-node": "^10.9.1",
90
90
  "tsc-watch": "^5.0.3",
91
91
  "tsconfig-paths": "^4.1.0",
92
- "typescript": "^4.8.4"
92
+ "typescript": "^4.9.3"
93
93
  },
94
94
  "jest": {
95
95
  "testEnvironment": "node",