@palmares/schemas 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -19
- package/CHANGELOG.md +22 -0
- package/dist/cjs/src/adapter/fields/array.js +5 -10
- package/dist/cjs/src/adapter/fields/boolean.js +5 -10
- package/dist/cjs/src/adapter/fields/datetime.js +5 -10
- package/dist/cjs/src/adapter/fields/index.js +1 -1
- package/dist/cjs/src/adapter/fields/number.js +3 -8
- package/dist/cjs/src/adapter/fields/object.js +3 -8
- package/dist/cjs/src/adapter/fields/string.js +3 -8
- package/dist/cjs/src/adapter/fields/union.js +3 -8
- package/dist/cjs/src/adapter/index.js +1 -1
- package/dist/cjs/src/compile.js +1 -1
- package/dist/cjs/src/domain.js +2 -3
- package/dist/cjs/src/index.js +49 -92
- package/dist/cjs/src/middleware.js +1 -3
- package/dist/cjs/src/model.js +10 -15
- package/dist/cjs/src/parsers/convert-from-number.js +1 -6
- package/dist/cjs/src/parsers/convert-from-string.js +1 -6
- package/dist/cjs/src/parsers/index.js +4 -9
- package/dist/cjs/src/schema/array.js +7 -12
- package/dist/cjs/src/schema/boolean.js +7 -12
- package/dist/cjs/src/schema/datetime.js +5 -10
- package/dist/cjs/src/schema/index.js +2 -7
- package/dist/cjs/src/schema/number.js +3 -8
- package/dist/cjs/src/schema/object.js +6 -11
- package/dist/cjs/src/schema/schema.js +1 -1
- package/dist/cjs/src/schema/string.js +3 -8
- package/dist/cjs/src/schema/union.js +5 -10
- package/dist/cjs/src/utils.js +10 -15
- package/dist/cjs/src/validators/utils.js +1 -1
- package/dist/cjs/tsconfig.types.tsbuildinfo +1 -1
- package/dist/cjs/types/adapter/fields/array.d.ts +3 -3
- package/dist/cjs/types/adapter/fields/array.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/boolean.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/boolean.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/datetime.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/datetime.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/index.d.ts +3 -3
- package/dist/cjs/types/adapter/fields/index.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/number.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/number.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/object.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/object.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/string.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/string.d.ts.map +1 -1
- package/dist/cjs/types/adapter/fields/union.d.ts +4 -4
- package/dist/cjs/types/adapter/fields/union.d.ts.map +1 -1
- package/dist/cjs/types/adapter/index.d.ts +9 -9
- package/dist/cjs/types/adapter/index.d.ts.map +1 -1
- package/dist/cjs/types/adapter/types.d.ts +1 -1
- package/dist/cjs/types/adapter/types.d.ts.map +1 -1
- package/dist/cjs/types/compile.d.ts +2 -2
- package/dist/cjs/types/compile.d.ts.map +1 -1
- package/dist/cjs/types/conf.d.ts +1 -1
- package/dist/cjs/types/conf.d.ts.map +1 -1
- package/dist/cjs/types/domain.d.ts +1 -2
- package/dist/cjs/types/domain.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +21 -20
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/middleware.d.ts +2 -2
- package/dist/cjs/types/middleware.d.ts.map +1 -1
- package/dist/cjs/types/model.d.ts +3 -3
- package/dist/cjs/types/model.d.ts.map +1 -1
- package/dist/cjs/types/parsers/convert-from-number.d.ts +2 -2
- package/dist/cjs/types/parsers/convert-from-number.d.ts.map +1 -1
- package/dist/cjs/types/parsers/convert-from-string.d.ts +2 -2
- package/dist/cjs/types/parsers/convert-from-string.d.ts.map +1 -1
- package/dist/cjs/types/parsers/index.d.ts +2 -2
- package/dist/cjs/types/parsers/index.d.ts.map +1 -1
- package/dist/cjs/types/schema/array.d.ts +2 -2
- package/dist/cjs/types/schema/array.d.ts.map +1 -1
- package/dist/cjs/types/schema/boolean.d.ts +2 -2
- package/dist/cjs/types/schema/boolean.d.ts.map +1 -1
- package/dist/cjs/types/schema/datetime.d.ts +2 -2
- package/dist/cjs/types/schema/datetime.d.ts.map +1 -1
- package/dist/cjs/types/schema/index.d.ts +1 -1
- package/dist/cjs/types/schema/index.d.ts.map +1 -1
- package/dist/cjs/types/schema/number.d.ts +2 -2
- package/dist/cjs/types/schema/number.d.ts.map +1 -1
- package/dist/cjs/types/schema/object.d.ts +3 -3
- package/dist/cjs/types/schema/object.d.ts.map +1 -1
- package/dist/cjs/types/schema/schema.d.ts +4 -4
- package/dist/cjs/types/schema/schema.d.ts.map +1 -1
- package/dist/cjs/types/schema/string.d.ts +2 -2
- package/dist/cjs/types/schema/string.d.ts.map +1 -1
- package/dist/cjs/types/schema/types.d.ts +7 -7
- package/dist/cjs/types/schema/types.d.ts.map +1 -1
- package/dist/cjs/types/schema/union.d.ts +3 -3
- package/dist/cjs/types/schema/union.d.ts.map +1 -1
- package/dist/cjs/types/types.d.ts +2 -2
- package/dist/cjs/types/types.d.ts.map +1 -1
- package/dist/cjs/types/utils.d.ts +4 -4
- package/dist/cjs/types/utils.d.ts.map +1 -1
- package/dist/cjs/types/validators/array.d.ts +2 -2
- package/dist/cjs/types/validators/array.d.ts.map +1 -1
- package/dist/cjs/types/validators/datetime.d.ts +1 -1
- package/dist/cjs/types/validators/datetime.d.ts.map +1 -1
- package/dist/cjs/types/validators/number.d.ts +1 -1
- package/dist/cjs/types/validators/number.d.ts.map +1 -1
- package/dist/cjs/types/validators/object.d.ts +1 -1
- package/dist/cjs/types/validators/object.d.ts.map +1 -1
- package/dist/cjs/types/validators/schema.d.ts +4 -4
- package/dist/cjs/types/validators/schema.d.ts.map +1 -1
- package/dist/cjs/types/validators/string.d.ts +1 -1
- package/dist/cjs/types/validators/string.d.ts.map +1 -1
- package/dist/cjs/types/validators/union.d.ts +1 -1
- package/dist/cjs/types/validators/union.d.ts.map +1 -1
- package/dist/cjs/types/validators/utils.d.ts +2 -2
- package/dist/cjs/types/validators/utils.d.ts.map +1 -1
- package/dist/esm/src/adapter/fields/array.js +2 -2
- package/dist/esm/src/adapter/fields/boolean.js +2 -2
- package/dist/esm/src/adapter/fields/datetime.js +2 -2
- package/dist/esm/src/adapter/fields/index.js +1 -1
- package/dist/esm/src/adapter/fields/number.js +2 -2
- package/dist/esm/src/adapter/fields/object.js +2 -2
- package/dist/esm/src/adapter/fields/string.js +2 -2
- package/dist/esm/src/adapter/fields/union.js +2 -2
- package/dist/esm/src/adapter/index.js +1 -1
- package/dist/esm/src/compile.js +1 -1
- package/dist/esm/src/domain.js +1 -2
- package/dist/esm/src/index.js +21 -20
- package/dist/esm/src/middleware.js +1 -1
- package/dist/esm/src/model.js +3 -3
- package/dist/esm/src/parsers/convert-from-number.js +1 -1
- package/dist/esm/src/parsers/convert-from-string.js +1 -1
- package/dist/esm/src/parsers/index.js +2 -2
- package/dist/esm/src/schema/array.js +3 -3
- package/dist/esm/src/schema/boolean.js +3 -3
- package/dist/esm/src/schema/datetime.js +2 -2
- package/dist/esm/src/schema/index.js +1 -1
- package/dist/esm/src/schema/number.js +2 -2
- package/dist/esm/src/schema/object.js +3 -3
- package/dist/esm/src/schema/schema.js +1 -1
- package/dist/esm/src/schema/string.js +2 -2
- package/dist/esm/src/schema/union.js +3 -3
- package/dist/esm/src/utils.js +3 -3
- package/dist/esm/src/validators/utils.js +1 -1
- package/package.json +5 -5
- package/src/adapter/fields/array.ts +4 -4
- package/src/adapter/fields/boolean.ts +4 -4
- package/src/adapter/fields/datetime.ts +4 -4
- package/src/adapter/fields/index.ts +3 -3
- package/src/adapter/fields/number.ts +4 -4
- package/src/adapter/fields/object.ts +4 -4
- package/src/adapter/fields/string.ts +4 -4
- package/src/adapter/fields/union.ts +4 -4
- package/src/adapter/index.ts +9 -9
- package/src/adapter/types.ts +1 -1
- package/src/compile.ts +2 -2
- package/src/conf.ts +1 -1
- package/src/domain.ts +1 -3
- package/src/index.ts +21 -20
- package/src/middleware.ts +2 -2
- package/src/model.ts +3 -3
- package/src/parsers/convert-from-number.ts +2 -2
- package/src/parsers/convert-from-string.ts +3 -3
- package/src/parsers/index.ts +2 -2
- package/src/schema/array.ts +3 -3
- package/src/schema/boolean.ts +3 -3
- package/src/schema/datetime.ts +2 -2
- package/src/schema/index.ts +1 -1
- package/src/schema/number.ts +2 -2
- package/src/schema/object.ts +4 -4
- package/src/schema/schema.ts +4 -4
- package/src/schema/string.ts +2 -2
- package/src/schema/types.ts +7 -7
- package/src/schema/union.ts +4 -4
- package/src/types.ts +2 -2
- package/src/utils.ts +5 -5
- package/src/validators/array.ts +2 -2
- package/src/validators/boolean.ts +1 -1
- package/src/validators/datetime.ts +2 -2
- package/src/validators/number.ts +2 -2
- package/src/validators/object.ts +1 -1
- package/src/validators/schema.ts +4 -4
- package/src/validators/string.ts +2 -2
- package/src/validators/union.ts +1 -1
- package/src/validators/utils.ts +2 -2
- package/__tests__/node_modules/.bin/node-gyp +0 -17
@@ -1,4 +1,4 @@
|
|
1
|
-
import type Schema from '../schema/schema';
|
1
|
+
import type { Schema } from '../schema/schema';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* This will convert a value from a string to any other type.
|
@@ -6,14 +6,14 @@ import type Schema from '../schema/schema';
|
|
6
6
|
* @param callback
|
7
7
|
* @returns
|
8
8
|
*/
|
9
|
-
export
|
9
|
+
export function convertFromStringBuilder(
|
10
10
|
callback: (value: string) => Awaited<ReturnType<Parameters<Schema['__parsers']['high']['set']>[1]>>
|
11
11
|
): Parameters<Schema['__parsers']['high']['set']>[1] {
|
12
12
|
return (value: any) => {
|
13
13
|
if (typeof value === 'string') return callback(value);
|
14
14
|
return {
|
15
15
|
value,
|
16
|
-
preventNextParsers: false
|
16
|
+
preventNextParsers: false
|
17
17
|
};
|
18
18
|
};
|
19
19
|
}
|
package/src/parsers/index.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export {
|
2
|
-
export {
|
1
|
+
export { convertFromNumberBuilder } from './convert-from-number';
|
2
|
+
export { convertFromStringBuilder } from './convert-from-string';
|
package/src/schema/array.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import {
|
3
3
|
defaultTransform,
|
4
4
|
defaultTransformToAdapter,
|
@@ -7,11 +7,11 @@ import {
|
|
7
7
|
} from '../utils';
|
8
8
|
import { arrayValidation, maxLength, minLength, nonEmpty } from '../validators/array';
|
9
9
|
import { nullable, optional } from '../validators/schema';
|
10
|
-
import Validator from '../validators/utils';
|
10
|
+
import { Validator } from '../validators/utils';
|
11
11
|
|
12
12
|
import type { DefinitionsOfSchemaType, ExtractTypeFromArrayOfSchemas } from './types';
|
13
13
|
|
14
|
-
export
|
14
|
+
export class ArraySchema<
|
15
15
|
TType extends {
|
16
16
|
input: any;
|
17
17
|
validate: any;
|
package/src/schema/boolean.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import Schema from './schema';
|
2
|
-
import convertFromStringBuilder from '../parsers/convert-from-string';
|
1
|
+
import { Schema } from './schema';
|
2
|
+
import { convertFromStringBuilder } from '../parsers/convert-from-string';
|
3
3
|
import { defaultTransform, defaultTransformToAdapter } from '../utils';
|
4
4
|
import { booleanValidation } from '../validators/boolean';
|
5
5
|
import { is, nullable, optional } from '../validators/schema';
|
6
6
|
|
7
7
|
import type { DefinitionsOfSchemaType } from './types';
|
8
8
|
|
9
|
-
export
|
9
|
+
export class BooleanSchema<
|
10
10
|
TType extends {
|
11
11
|
input: any;
|
12
12
|
validate: any;
|
package/src/schema/datetime.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import { defaultTransform, defaultTransformToAdapter } from '../utils';
|
3
3
|
import { above, allowStringParser, below, datetimeValidation } from '../validators/datetime';
|
4
4
|
import { nullable, optional } from '../validators/schema';
|
5
5
|
|
6
6
|
import type { DefinitionsOfSchemaType } from './types';
|
7
7
|
|
8
|
-
export
|
8
|
+
export class DatetimeSchema<
|
9
9
|
TType extends {
|
10
10
|
input: any;
|
11
11
|
validate: any;
|
package/src/schema/index.ts
CHANGED
package/src/schema/number.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import {
|
3
3
|
DEFAULT_NUMBER_INTEGER_EXCEPTION,
|
4
4
|
DEFAULT_NUMBER_MAX_EXCEPTION,
|
@@ -11,7 +11,7 @@ import { is, nullable, optional } from '../validators/schema';
|
|
11
11
|
|
12
12
|
import type { DefinitionsOfSchemaType } from './types';
|
13
13
|
|
14
|
-
export
|
14
|
+
export class NumberSchema<
|
15
15
|
TType extends {
|
16
16
|
input: any;
|
17
17
|
validate: any;
|
package/src/schema/object.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import {
|
3
3
|
defaultTransform,
|
4
4
|
defaultTransformToAdapter,
|
@@ -6,12 +6,12 @@ import {
|
|
6
6
|
transformSchemaAndCheckIfShouldBeHandledByFallbackOnComplexSchemas
|
7
7
|
} from '../utils';
|
8
8
|
import { objectValidation } from '../validators/object';
|
9
|
-
import Validator from '../validators/utils';
|
9
|
+
import { Validator } from '../validators/utils';
|
10
10
|
|
11
11
|
import type { DefinitionsOfSchemaType, ExtractTypeFromObjectOfSchemas } from './types';
|
12
|
-
import type FieldAdapter from '../adapter/fields';
|
12
|
+
import type { FieldAdapter } from '../adapter/fields';
|
13
13
|
|
14
|
-
export
|
14
|
+
export class ObjectSchema<
|
15
15
|
TType extends {
|
16
16
|
input: any;
|
17
17
|
validate: any;
|
package/src/schema/schema.ts
CHANGED
@@ -6,12 +6,12 @@ import type {
|
|
6
6
|
OnlyFieldAdaptersFromSchemaAdapter,
|
7
7
|
ValidationFallbackCallbackReturnType
|
8
8
|
} from './types';
|
9
|
-
import type SchemaAdapter from '../adapter';
|
10
|
-
import type FieldAdapter from '../adapter/fields';
|
9
|
+
import type { SchemaAdapter } from '../adapter';
|
10
|
+
import type { FieldAdapter } from '../adapter/fields';
|
11
11
|
import type { ValidationDataBasedOnType } from '../adapter/types';
|
12
|
-
import type Validator from '../validators/utils';
|
12
|
+
import type { Validator } from '../validators/utils';
|
13
13
|
|
14
|
-
export
|
14
|
+
export class Schema<
|
15
15
|
TType extends {
|
16
16
|
input: any;
|
17
17
|
validate: any;
|
package/src/schema/string.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import { defaultTransform, defaultTransformToAdapter } from '../utils';
|
3
3
|
import { is, nullable, optional } from '../validators/schema';
|
4
4
|
import {
|
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
|
16
16
|
import type { DefinitionsOfSchemaType } from './types';
|
17
17
|
|
18
|
-
export
|
18
|
+
export class StringSchema<
|
19
19
|
TType extends {
|
20
20
|
input: any;
|
21
21
|
validate: any;
|
package/src/schema/types.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type BooleanSchema from './boolean';
|
2
|
-
import type ObjectSchema from './object';
|
3
|
-
import type Schema from './schema';
|
4
|
-
import type StringSchema from './string';
|
5
|
-
import type SchemaAdapter from '../adapter';
|
6
|
-
import type FieldAdapter from '../adapter/fields';
|
1
|
+
import type { BooleanSchema } from './boolean';
|
2
|
+
import type { ObjectSchema } from './object';
|
3
|
+
import type { Schema } from './schema';
|
4
|
+
import type { StringSchema } from './string';
|
5
|
+
import type { SchemaAdapter } from '../adapter';
|
6
|
+
import type { FieldAdapter } from '../adapter/fields';
|
7
7
|
import type { ErrorCodes } from '../adapter/types';
|
8
8
|
import type { ValidatorTypes } from '../validators/types';
|
9
|
-
import type Validator from '../validators/utils';
|
9
|
+
import type { Validator } from '../validators/utils';
|
10
10
|
|
11
11
|
export type OnlyFieldAdaptersFromSchemaAdapter = keyof {
|
12
12
|
[key in keyof SchemaAdapter as SchemaAdapter[key] extends FieldAdapter ? key : never]: SchemaAdapter[key];
|
package/src/schema/union.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import Schema from './schema';
|
1
|
+
import { Schema } from './schema';
|
2
2
|
import {
|
3
3
|
defaultTransform,
|
4
4
|
defaultTransformToAdapter,
|
5
5
|
transformSchemaAndCheckIfShouldBeHandledByFallbackOnComplexSchemas
|
6
6
|
} from '../utils';
|
7
7
|
import { unionValidation } from '../validators/union';
|
8
|
-
import Validator from '../validators/utils';
|
8
|
+
import { Validator } from '../validators/utils';
|
9
9
|
|
10
10
|
import type { DefinitionsOfSchemaType, ExtractTypeFromUnionOfSchemas } from './types';
|
11
|
-
import type FieldAdapter from '../adapter/fields';
|
11
|
+
import type { FieldAdapter } from '../adapter/fields';
|
12
12
|
import type { Narrow } from '@palmares/core';
|
13
13
|
|
14
|
-
export
|
14
|
+
export class UnionSchema<
|
15
15
|
TType extends {
|
16
16
|
input: unknown;
|
17
17
|
validate: unknown;
|
package/src/types.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type SchemaAdapter from './adapter';
|
2
|
-
import type Schema from './schema/schema';
|
1
|
+
import type { SchemaAdapter } from './adapter';
|
2
|
+
import type { Schema } from './schema/schema';
|
3
3
|
import type { ValidatorTypes } from './validators/types';
|
4
4
|
|
5
5
|
export type MaybePromise<T> = T | Promise<T>;
|
package/src/utils.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import SchemaAdapter from './adapter';
|
1
|
+
import { SchemaAdapter } from './adapter';
|
2
2
|
import { getDefaultAdapter } from './conf';
|
3
3
|
import { checkType, nullable, optional } from './validators/schema';
|
4
|
-
import Validator from './validators/utils';
|
4
|
+
import { Validator } from './validators/utils';
|
5
5
|
|
6
|
-
import type FieldAdapter from './adapter/fields';
|
6
|
+
import type { FieldAdapter } from './adapter/fields';
|
7
7
|
import type { ValidationDataBasedOnType } from './adapter/types';
|
8
|
-
import type Schema from './schema/schema';
|
8
|
+
import type { Schema } from './schema/schema';
|
9
9
|
import type { ValidationFallbackCallbackReturnType, ValidationFallbackReturnType } from './schema/types';
|
10
10
|
import type { FallbackFunctionsType, SupportedSchemas } from './types';
|
11
11
|
|
@@ -14,7 +14,7 @@ import type { FallbackFunctionsType, SupportedSchemas } from './types';
|
|
14
14
|
* our schema definition, it can return an instance of this class and with this instance we are able to
|
15
15
|
* fallback to our default implementation of the schema validation.
|
16
16
|
*/
|
17
|
-
export
|
17
|
+
export class WithFallback<TType extends SupportedSchemas> {
|
18
18
|
fallbackFor: Set<
|
19
19
|
| keyof Omit<ValidationDataBasedOnType<TType>, 'withFallback' | 'parsers'>
|
20
20
|
| keyof ValidationDataBasedOnType<TType>['parsers']
|
package/src/validators/array.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type ArraySchema from '../schema/array';
|
2
|
-
import type Schema from '../schema/schema';
|
1
|
+
import type { ArraySchema } from '../schema/array';
|
2
|
+
import type { Schema } from '../schema/schema';
|
3
3
|
import type { ValidationFallbackCallbackReturnType, ValidationFallbackReturnType } from '../schema/types';
|
4
4
|
|
5
5
|
export function arrayValidation(isTuple: boolean, schemas: Schema<any, any>[]): ValidationFallbackReturnType {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type DatetimeSchema from '../schema/datetime';
|
2
|
-
import type Schema from '../schema/schema';
|
1
|
+
import type { DatetimeSchema } from '../schema/datetime';
|
2
|
+
import type { Schema } from '../schema/schema';
|
3
3
|
import type { ValidationFallbackReturnType } from '../schema/types';
|
4
4
|
|
5
5
|
export function datetimeValidation(): ValidationFallbackReturnType {
|
package/src/validators/number.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type NumberSchema from '../schema/number';
|
2
|
-
import type Schema from '../schema/schema';
|
1
|
+
import type { NumberSchema } from '../schema/number';
|
2
|
+
import type { Schema } from '../schema/schema';
|
3
3
|
import type { ValidationFallbackReturnType } from '../schema/types';
|
4
4
|
|
5
5
|
export function numberValidation(): ValidationFallbackReturnType {
|
package/src/validators/object.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type Schema from '../schema/schema';
|
1
|
+
import type { Schema } from '../schema/schema';
|
2
2
|
import type { ValidationFallbackCallbackReturnType, ValidationFallbackReturnType } from '../schema/types';
|
3
3
|
|
4
4
|
export function objectValidation(keysToFallback: { [key: string]: Schema }): ValidationFallbackReturnType {
|
package/src/validators/schema.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { ErrorCodes } from '../adapter/types';
|
2
|
-
import type BooleanSchema from '../schema/boolean';
|
3
|
-
import type NumberSchema from '../schema/number';
|
4
|
-
import type Schema from '../schema/schema';
|
5
|
-
import type StringSchema from '../schema/string';
|
2
|
+
import type { BooleanSchema } from '../schema/boolean';
|
3
|
+
import type { NumberSchema } from '../schema/number';
|
4
|
+
import type { Schema } from '../schema/schema';
|
5
|
+
import type { StringSchema } from '../schema/string';
|
6
6
|
import type { ValidationFallbackReturnType } from '../schema/types';
|
7
7
|
|
8
8
|
export function optional(args: Schema['__optional']): ValidationFallbackReturnType {
|
package/src/validators/string.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type ValidationFallbackReturnType } from '../schema/types';
|
2
2
|
|
3
|
-
import type Schema from '../schema/schema';
|
4
|
-
import type StringSchema from '../schema/string';
|
3
|
+
import type { Schema } from '../schema/schema';
|
4
|
+
import type { StringSchema } from '../schema/string';
|
5
5
|
|
6
6
|
export function stringValidation(): ValidationFallbackReturnType {
|
7
7
|
return {
|
package/src/validators/union.ts
CHANGED
package/src/validators/utils.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ValidatorTypes } from './types';
|
2
2
|
import type { ErrorCodes } from '../adapter/types';
|
3
|
-
import type Schema from '../schema/schema';
|
3
|
+
import type { Schema } from '../schema/schema';
|
4
4
|
import type {
|
5
5
|
ValidationFallbackCallbackReturnType,
|
6
6
|
ValidationFallbackCallbackType,
|
@@ -42,7 +42,7 @@ const typeByPriority = Object.entries(priorityByType).reduce(
|
|
42
42
|
* That's what this solve, it's a better approach than repeating the same code 3 times on the schema. It's also
|
43
43
|
* more powerful, because if we need to add any extra priorities we can do that easily without changing the schema.
|
44
44
|
*/
|
45
|
-
export
|
45
|
+
export class Validator {
|
46
46
|
child?: Validator;
|
47
47
|
parent?: Validator;
|
48
48
|
fallbackNamesAdded = new Set();
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
3
|
-
|
4
|
-
case `uname` in
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
6
|
-
esac
|
7
|
-
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
9
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules"
|
10
|
-
else
|
11
|
-
export NODE_PATH="/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/nicolasmelo/workspace/palmares/node_modules/.pnpm/node_modules:$NODE_PATH"
|
12
|
-
fi
|
13
|
-
if [ -x "$basedir/node" ]; then
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
15
|
-
else
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
17
|
-
fi
|