@regle/schemas 1.13.0 → 1.13.1

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.
@@ -1,9 +1,9 @@
1
1
  import * as _regle_core0 from "@regle/core";
2
- import { ArrayElement, CreateScopedUseRegleOptions, DeepMaybeRef, DeepReactiveState, HasNamedKeys, HaveAnyRequiredProps, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, MaybeOutput, NoInferLegacy, PrimitiveTypes, RegleBehaviourOptions, RegleCollectionErrors, RegleCommonStatus, RegleErrorTree, RegleFieldIssue, RegleIssuesTree, RegleRuleStatus, RegleShortcutDefinition, RegleStaticImpl, TupleToPlainObj, UseScopedRegleOptions, useCollectScopeFn } from "@regle/core";
2
+ import { ArrayElement, CreateScopedUseRegleOptions, DeepMaybeRef, DeepPartial, DeepReactiveState, HasNamedKeys, HaveAnyRequiredProps, JoinDiscriminatedUnions, LocalRegleBehaviourOptions, Maybe, MaybeOutput, NoInferLegacy, PrimitiveTypes, RegleBehaviourOptions, RegleCollectionErrors, RegleCommonStatus, RegleErrorTree, RegleFieldIssue, RegleIssuesTree, RegleRuleStatus, RegleShortcutDefinition, RegleStaticImpl, TupleToPlainObj, UseScopedRegleOptions, useCollectScopeFn } from "@regle/core";
3
3
  import * as vue0 from "vue";
4
4
  import { MaybeRef, Raw, UnwrapNestedRefs } from "vue";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
- import { EmptyObject, IsUnion, PartialDeep, UnionToTuple } from "type-fest";
6
+ import { EmptyObject, IsUnion, UnionToTuple } from "type-fest";
7
7
  type MaybeSchemaVariantStatus<TState extends Record<string, any> | undefined = Record<string, any>, TSchema extends StandardSchemaV1 = StandardSchemaV1, TShortcuts extends RegleShortcutDefinition = {}, TRoot extends boolean = false> = IsUnion<NonNullable<TState>> extends true ? Omit<RegleSchemaStatus<TState, TSchema, TShortcuts, TRoot>, '$fields'> & {
8
8
  $fields: ProcessChildrenFields<TState, TShortcuts>[keyof ProcessChildrenFields<TState, TShortcuts>];
9
9
  } & (HasNamedKeys<TState> extends true ? ProcessChildrenFields<TState, TShortcuts>[keyof ProcessChildrenFields<TState, TShortcuts>] : {}) : RegleSchemaStatus<TState, TSchema, TShortcuts, TRoot>;
@@ -29,7 +29,7 @@ type RegleSingleFieldSchema<TState extends Maybe<PrimitiveTypes>, TSchema extend
29
29
  } & TAdditionalReturnProperties;
30
30
  type RegleSchemaResult<TSchema extends unknown> = {
31
31
  valid: false;
32
- data: PartialDeep<TSchema>;
32
+ data: DeepPartial<TSchema>;
33
33
  issues: RegleIssuesTree<TSchema, true>;
34
34
  errors: RegleErrorTree<TSchema, false, true>;
35
35
  } | {
@@ -56,7 +56,7 @@ type RegleSchemaStatus<TState extends Record<string, any> | undefined = Record<s
56
56
  /** Collection of all the error messages, collected for all children properties. */
57
57
  readonly $silentErrors: RegleErrorTree<TState, false, true>;
58
58
  /** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
59
- $extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
59
+ $extractDirtyFields: (filterNullishValues?: boolean) => DeepPartial<TState>;
60
60
  } & ProcessNestedFields<TState, TShortcuts> & (IsRoot extends true ? {
61
61
  /** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
62
62
  $validate: (forceValues?: TState extends EmptyObject ? (HasNamedKeys<TState> extends true ? TState : any) : TState) => Promise<RegleSchemaResult<StandardSchemaV1.InferOutput<TSchema>>>;
@@ -105,7 +105,7 @@ type RegleSchemaFieldStatus<TState = any, TShortcuts extends RegleShortcutDefini
105
105
  [`~validator`]: RegleRuleStatus<TState, []>;
106
106
  };
107
107
  /** Will return a copy of your state with only the fields that are dirty. By default it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
108
- $extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
108
+ $extractDirtyFields: (filterNullishValues?: boolean) => DeepPartial<TState>;
109
109
  } & ([TShortcuts['fields']] extends [never] ? {} : { [K in keyof TShortcuts['fields']]: ReturnType<NonNullable<TShortcuts['fields']>[K]> });
110
110
  /**
111
111
  * @public
@@ -128,7 +128,7 @@ type RegleSchemaCollectionStatus<TState extends any[], TShortcuts extends RegleS
128
128
  /** Collection of all the error messages, collected for all children properties and nested forms. */
129
129
  readonly $silentErrors: RegleCollectionErrors<TState>;
130
130
  /** Will return a copy of your state with only the fields that are dirty. By default, it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
131
- $extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
131
+ $extractDirtyFields: (filterNullishValues?: boolean) => DeepPartial<TState>;
132
132
  } & ([TShortcuts['collections']] extends [never] ? {} : { [K in keyof TShortcuts['collections']]: ReturnType<NonNullable<TShortcuts['collections']>[K]> });
133
133
  type RegleSchemaBehaviourOptions = {
134
134
  /**
@@ -147,11 +147,7 @@ type RegleSchemaBehaviourOptions = {
147
147
  };
148
148
  type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
149
149
  interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
150
- <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<PartialDeep<NoInferLegacy<TState>, {
151
- recurseIntoArrays: true;
152
- }>> | DeepReactiveState<PartialDeep<NoInferLegacy<TState>, {
153
- recurseIntoArrays: true;
154
- }>>, rulesFactory: MaybeRef<TSchema>, ...(HaveAnyRequiredProps<useRegleSchemaFnOptions<TAdditionalOptions>> extends true ? [options: useRegleSchemaFnOptions<TAdditionalOptions>] : [options?: useRegleSchemaFnOptions<TAdditionalOptions>])]): NonNullable<TState> extends PrimitiveTypes ? RegleSingleFieldSchema<NonNullable<TState>, TSchema, TShortcuts, TAdditionalReturnProperties> : RegleSchema<UnwrapNestedRefs<NonNullable<TState>>, TSchema, TShortcuts, TAdditionalReturnProperties>;
150
+ <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<DeepPartial<NoInferLegacy<TState>>> | DeepReactiveState<DeepPartial<NoInferLegacy<TState>>>, rulesFactory: MaybeRef<TSchema>, ...(HaveAnyRequiredProps<useRegleSchemaFnOptions<TAdditionalOptions>> extends true ? [options: useRegleSchemaFnOptions<TAdditionalOptions>] : [options?: useRegleSchemaFnOptions<TAdditionalOptions>])]): NonNullable<TState> extends PrimitiveTypes ? RegleSingleFieldSchema<NonNullable<TState>, TSchema, TShortcuts, TAdditionalReturnProperties> : RegleSchema<UnwrapNestedRefs<NonNullable<TState>>, TSchema, TShortcuts, TAdditionalReturnProperties>;
155
151
  }
156
152
  /**
157
153
  * useRegle serves as the foundation for validation logic.
@@ -191,11 +187,7 @@ declare const useRegleSchema: useRegleSchemaFn<RegleShortcutDefinition<any>, {},
191
187
  */
192
188
  declare function withDeps<TSchema extends StandardSchemaV1, TParams extends unknown[] = []>(schema: TSchema, _depsArray: [...TParams]): TSchema;
193
189
  interface inferSchemaFn {
194
- <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(state: MaybeRef<PartialDeep<TState, {
195
- recurseIntoArrays: true;
196
- }>> | DeepReactiveState<PartialDeep<TState, {
197
- recurseIntoArrays: true;
198
- }>>, rulesFactory: MaybeRef<TSchema>): NoInferLegacy<TSchema>;
190
+ <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(state: MaybeRef<DeepPartial<TState>> | DeepReactiveState<DeepPartial<TState>>, rulesFactory: MaybeRef<TSchema>): NoInferLegacy<TSchema>;
199
191
  }
200
192
  /**
201
193
  * Rule type helper to provide autocomplete and typecheck to your form rules or part of your form rules
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@regle/schemas",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Schemas adapter for Regle",
5
5
  "dependencies": {
6
6
  "@standard-schema/spec": "1.0.0",
7
7
  "type-fest": "5.2.0",
8
- "@regle/rules": "1.13.0",
9
- "@regle/core": "1.13.0"
8
+ "@regle/core": "1.13.1",
9
+ "@regle/rules": "1.13.1"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "valibot": "^1.0.0",