@palmares/schemas 0.1.21 → 0.1.23

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 (78) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +10 -4
  3. package/.turbo/turbo-build$colon$watch.log +0 -24
  4. package/.turbo/turbo-build.log +0 -13
  5. package/.turbo/turbo-build:watch.log +0 -26
  6. package/__tests__/.drizzle/migrations/0000_skinny_harrier.sql +0 -22
  7. package/__tests__/.drizzle/migrations/meta/0000_snapshot.json +0 -156
  8. package/__tests__/.drizzle/migrations/meta/_journal.json +0 -13
  9. package/__tests__/.drizzle/schema.ts +0 -35
  10. package/__tests__/drizzle.config.ts +0 -11
  11. package/__tests__/eslint.config.js +0 -10
  12. package/__tests__/manage.ts +0 -5
  13. package/__tests__/node_modules/.bin/drizzle-kit +0 -17
  14. package/__tests__/node_modules/.bin/node-gyp +0 -17
  15. package/__tests__/node_modules/.bin/tsc +0 -17
  16. package/__tests__/node_modules/.bin/tsserver +0 -17
  17. package/__tests__/node_modules/.bin/tsx +0 -17
  18. package/__tests__/package.json +0 -34
  19. package/__tests__/sqlite.db +0 -0
  20. package/__tests__/src/core/array.test.ts +0 -131
  21. package/__tests__/src/core/boolean.test.ts +0 -66
  22. package/__tests__/src/core/datetime.test.ts +0 -102
  23. package/__tests__/src/core/index.ts +0 -35
  24. package/__tests__/src/core/model.test.ts +0 -260
  25. package/__tests__/src/core/models.ts +0 -50
  26. package/__tests__/src/core/numbers.test.ts +0 -177
  27. package/__tests__/src/core/object.test.ts +0 -218
  28. package/__tests__/src/core/string.test.ts +0 -222
  29. package/__tests__/src/core/test.test.ts +0 -59
  30. package/__tests__/src/core/types.test.ts +0 -97
  31. package/__tests__/src/core/union.test.ts +0 -99
  32. package/__tests__/src/settings.ts +0 -69
  33. package/__tests__/tsconfig.json +0 -11
  34. package/src/adapter/fields/array.ts +0 -31
  35. package/src/adapter/fields/boolean.ts +0 -43
  36. package/src/adapter/fields/datetime.ts +0 -43
  37. package/src/adapter/fields/index.ts +0 -72
  38. package/src/adapter/fields/number.ts +0 -43
  39. package/src/adapter/fields/object.ts +0 -52
  40. package/src/adapter/fields/string.ts +0 -43
  41. package/src/adapter/fields/union.ts +0 -43
  42. package/src/adapter/index.ts +0 -37
  43. package/src/adapter/types.ts +0 -276
  44. package/src/compile.ts +0 -14
  45. package/src/conf.ts +0 -30
  46. package/src/constants.ts +0 -7
  47. package/src/domain.ts +0 -15
  48. package/src/exceptions.ts +0 -17
  49. package/src/index.ts +0 -318
  50. package/src/middleware.ts +0 -52
  51. package/src/model.ts +0 -518
  52. package/src/parsers/convert-from-number.ts +0 -13
  53. package/src/parsers/convert-from-string.ts +0 -19
  54. package/src/parsers/index.ts +0 -2
  55. package/src/schema/array.ts +0 -825
  56. package/src/schema/boolean.ts +0 -792
  57. package/src/schema/datetime.ts +0 -704
  58. package/src/schema/index.ts +0 -5
  59. package/src/schema/number.ts +0 -929
  60. package/src/schema/object.ts +0 -799
  61. package/src/schema/schema.ts +0 -1179
  62. package/src/schema/string.ts +0 -941
  63. package/src/schema/types.ts +0 -154
  64. package/src/schema/union.ts +0 -724
  65. package/src/types.ts +0 -66
  66. package/src/utils.ts +0 -389
  67. package/src/validators/array.ts +0 -183
  68. package/src/validators/boolean.ts +0 -52
  69. package/src/validators/datetime.ts +0 -121
  70. package/src/validators/number.ts +0 -178
  71. package/src/validators/object.ts +0 -56
  72. package/src/validators/schema.ts +0 -142
  73. package/src/validators/string.ts +0 -278
  74. package/src/validators/types.ts +0 -1
  75. package/src/validators/union.ts +0 -52
  76. package/src/validators/utils.ts +0 -226
  77. package/tsconfig.json +0 -9
  78. package/tsconfig.types.json +0 -10
@@ -1,154 +0,0 @@
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
- import type { ErrorCodes } from '../adapter/types';
8
- import type { ValidatorTypes } from '../validators/types';
9
- import type { Validator } from '../validators/utils';
10
-
11
- export type OnlyFieldAdaptersFromSchemaAdapter = keyof {
12
- [key in keyof SchemaAdapter as SchemaAdapter[key] extends FieldAdapter ? key : never]: SchemaAdapter[key];
13
- };
14
-
15
- export type DefinitionsOfSchemaType = {
16
- schemaType: 'array' | 'object' | 'string' | 'number' | 'boolean' | 'union' | 'datetime' | 'field' | 'datetime';
17
- schemaAdapter: SchemaAdapter;
18
- hasSave?: boolean;
19
- };
20
-
21
- export type ValidationFallbackCallbackType = Validator['fallbacks'][number];
22
- export type ValidationFallbackCallbackReturnType = {
23
- parsed: any;
24
- errors: {
25
- received: any;
26
- isValid: boolean;
27
- code: ErrorCodes;
28
- message: string;
29
- path: (string | number)[];
30
- }[];
31
- preventChildValidation?: boolean;
32
- };
33
- export type ValidationFallbackReturnType = {
34
- type: ValidatorTypes;
35
- name: string;
36
- callback: ValidationFallbackCallbackType;
37
- };
38
-
39
- type TypesOfSchema = Schema extends Schema<infer TType, any> ? TType : never;
40
- type ExtractTypeFromSchemaByTypeOfSchema<
41
- TSchema extends Schema,
42
- TTypeToExtract extends keyof TypesOfSchema = 'input'
43
- > = TSchema extends
44
- | Schema<
45
- {
46
- input: infer TInputType;
47
- validate: infer TValidateType;
48
- internal: infer TInternalType;
49
- output: infer TOutputType;
50
- representation: infer TRepresentationType;
51
- },
52
- any
53
- >
54
- | StringSchema<
55
- {
56
- input: infer TInputType;
57
- validate: infer TValidateType;
58
- internal: infer TInternalType;
59
- output: infer TOutputType;
60
- representation: infer TRepresentationType;
61
- },
62
- any
63
- >
64
- | ObjectSchema<
65
- {
66
- input: infer TInputType;
67
- validate: infer TValidateType;
68
- internal: infer TInternalType;
69
- output: infer TOutputType;
70
- representation: infer TRepresentationType;
71
- },
72
- any,
73
- any
74
- >
75
- | BooleanSchema<
76
- {
77
- input: infer TInputType;
78
- validate: infer TValidateType;
79
- internal: infer TInternalType;
80
- output: infer TOutputType;
81
- representation: infer TRepresentationType;
82
- },
83
- any
84
- >
85
- ? TTypeToExtract extends 'input'
86
- ? TInputType
87
- : TTypeToExtract extends 'validate'
88
- ? TValidateType
89
- : TTypeToExtract extends 'internal'
90
- ? TInternalType
91
- : TTypeToExtract extends 'output'
92
- ? TOutputType
93
- : TRepresentationType
94
- : never;
95
- export type ExtractTypeFromObjectOfSchemas<
96
- TData extends Record<string, Schema>,
97
- TTypeToExtract extends keyof TypesOfSchema = 'input'
98
- > = {
99
- [key in keyof TData as undefined extends ExtractTypeFromSchemaByTypeOfSchema<TData[key], TTypeToExtract>
100
- ? never
101
- : key]: ExtractTypeFromSchemaByTypeOfSchema<TData[key], TTypeToExtract>;
102
- } & {
103
- [key in keyof TData as undefined extends ExtractTypeFromSchemaByTypeOfSchema<TData[key], TTypeToExtract>
104
- ? key
105
- : never]?: ExtractTypeFromSchemaByTypeOfSchema<TData[key], TTypeToExtract>;
106
- };
107
-
108
- export type ExtractTypeFromUnionOfSchemas<
109
- TSchemas extends readonly Schema[] = [],
110
- TType extends 'input' | 'output' | 'representation' | 'internal' | 'validate' = 'input'
111
- > = TSchemas extends readonly [infer TFirstSchema, ...infer TRestOfSchemas]
112
- ? TFirstSchema extends Schema<{
113
- input: infer TInput;
114
- internal: infer TInternal;
115
- output: infer TOutput;
116
- representation: infer TRepresentation;
117
- validate: infer TValidate;
118
- }>
119
- ?
120
- | (TType extends 'output'
121
- ? TOutput
122
- : TType extends 'representation'
123
- ? TRepresentation
124
- : TType extends 'internal'
125
- ? TInternal
126
- : TType extends 'validate'
127
- ? TValidate
128
- : TInput)
129
- | ExtractTypeFromUnionOfSchemas<TRestOfSchemas extends readonly Schema[] ? TRestOfSchemas : [], TType>
130
- : unknown
131
- : never;
132
-
133
- export type ExtractTypeFromArrayOfSchemas<
134
- TSchemas extends readonly [Schema, ...Schema[]] | [[Schema]],
135
- TTypeToExtract extends keyof TypesOfSchema = 'input',
136
- TResult extends any[] = []
137
- > = TSchemas extends readonly [infer TSchema, ...infer TRestSchemas]
138
- ? TSchema extends Schema
139
- ? TRestSchemas extends readonly [Schema, ...Schema[]]
140
- ? ExtractTypeFromArrayOfSchemas<
141
- TRestSchemas,
142
- TTypeToExtract,
143
- [...TResult, ExtractTypeFromSchemaByTypeOfSchema<TSchema, TTypeToExtract>]
144
- >
145
- : [...TResult, ExtractTypeFromSchemaByTypeOfSchema<TSchema, TTypeToExtract>]
146
- : TSchemas extends [[infer TSchema]]
147
- ? TSchema extends Schema
148
- ? ExtractTypeFromSchemaByTypeOfSchema<TSchema, TTypeToExtract>[]
149
- : never
150
- : never
151
- : never;
152
-
153
- export type ExtractUnionTypesFromSchemas<TSchemas extends readonly Schema<any, any>[]> =
154
- TSchemas[number] extends Schema<infer TType, any> ? TType : never;