@wix/sdk-types 1.13.25 → 1.13.27
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/build/browser/index.d.mts +20 -1
- package/build/index.d.mts +20 -1
- package/build/index.d.ts +20 -1
- package/internal/build/browser/index.d.mts +20 -1
- package/internal/build/index.d.mts +20 -1
- package/internal/build/index.d.ts +20 -1
- package/package.json +4 -4
|
@@ -321,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
321
321
|
* Operators available for boolean fields
|
|
322
322
|
*/
|
|
323
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
324
328
|
/**
|
|
325
329
|
* Operators available for date fields
|
|
326
330
|
*/
|
|
@@ -533,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
533
537
|
searchable: readonly string[];
|
|
534
538
|
} ? Spec['searchable'][number] : string;
|
|
535
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
542
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
543
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
544
|
+
*/
|
|
545
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
536
546
|
/**
|
|
537
547
|
* Determines operators applicable to a field based on its type
|
|
538
548
|
* @template Entity The entity type
|
|
539
549
|
* @template Path The field path to check
|
|
540
550
|
*/
|
|
541
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
551
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
542
552
|
/**
|
|
543
553
|
* Determines allowed operators for a field based on the search spec
|
|
544
554
|
* @template Entity The entity type
|
|
@@ -630,6 +640,14 @@ interface ValueAggregation {
|
|
|
630
640
|
interface RangeAggregation {
|
|
631
641
|
buckets?: RangeBucket[];
|
|
632
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Group by aggregation configuration
|
|
645
|
+
*/
|
|
646
|
+
interface GroupByAggregation {
|
|
647
|
+
name?: string | null;
|
|
648
|
+
fieldPath?: string | null;
|
|
649
|
+
value?: ValueAggregation;
|
|
650
|
+
}
|
|
633
651
|
/**
|
|
634
652
|
* Scalar aggregation configuration
|
|
635
653
|
*/
|
|
@@ -673,6 +691,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
673
691
|
range?: RangeAggregation;
|
|
674
692
|
scalar?: ScalarAggregation;
|
|
675
693
|
value?: ValueAggregation;
|
|
694
|
+
groupBy?: GroupByAggregation;
|
|
676
695
|
};
|
|
677
696
|
/**
|
|
678
697
|
* Base aggregation interface
|
package/build/index.d.mts
CHANGED
|
@@ -321,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
321
321
|
* Operators available for boolean fields
|
|
322
322
|
*/
|
|
323
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
324
328
|
/**
|
|
325
329
|
* Operators available for date fields
|
|
326
330
|
*/
|
|
@@ -533,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
533
537
|
searchable: readonly string[];
|
|
534
538
|
} ? Spec['searchable'][number] : string;
|
|
535
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
542
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
543
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
544
|
+
*/
|
|
545
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
536
546
|
/**
|
|
537
547
|
* Determines operators applicable to a field based on its type
|
|
538
548
|
* @template Entity The entity type
|
|
539
549
|
* @template Path The field path to check
|
|
540
550
|
*/
|
|
541
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
551
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
542
552
|
/**
|
|
543
553
|
* Determines allowed operators for a field based on the search spec
|
|
544
554
|
* @template Entity The entity type
|
|
@@ -630,6 +640,14 @@ interface ValueAggregation {
|
|
|
630
640
|
interface RangeAggregation {
|
|
631
641
|
buckets?: RangeBucket[];
|
|
632
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Group by aggregation configuration
|
|
645
|
+
*/
|
|
646
|
+
interface GroupByAggregation {
|
|
647
|
+
name?: string | null;
|
|
648
|
+
fieldPath?: string | null;
|
|
649
|
+
value?: ValueAggregation;
|
|
650
|
+
}
|
|
633
651
|
/**
|
|
634
652
|
* Scalar aggregation configuration
|
|
635
653
|
*/
|
|
@@ -673,6 +691,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
673
691
|
range?: RangeAggregation;
|
|
674
692
|
scalar?: ScalarAggregation;
|
|
675
693
|
value?: ValueAggregation;
|
|
694
|
+
groupBy?: GroupByAggregation;
|
|
676
695
|
};
|
|
677
696
|
/**
|
|
678
697
|
* Base aggregation interface
|
package/build/index.d.ts
CHANGED
|
@@ -321,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
321
321
|
* Operators available for boolean fields
|
|
322
322
|
*/
|
|
323
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
324
328
|
/**
|
|
325
329
|
* Operators available for date fields
|
|
326
330
|
*/
|
|
@@ -533,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
533
537
|
searchable: readonly string[];
|
|
534
538
|
} ? Spec['searchable'][number] : string;
|
|
535
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
542
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
543
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
544
|
+
*/
|
|
545
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
536
546
|
/**
|
|
537
547
|
* Determines operators applicable to a field based on its type
|
|
538
548
|
* @template Entity The entity type
|
|
539
549
|
* @template Path The field path to check
|
|
540
550
|
*/
|
|
541
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
551
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
542
552
|
/**
|
|
543
553
|
* Determines allowed operators for a field based on the search spec
|
|
544
554
|
* @template Entity The entity type
|
|
@@ -630,6 +640,14 @@ interface ValueAggregation {
|
|
|
630
640
|
interface RangeAggregation {
|
|
631
641
|
buckets?: RangeBucket[];
|
|
632
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Group by aggregation configuration
|
|
645
|
+
*/
|
|
646
|
+
interface GroupByAggregation {
|
|
647
|
+
name?: string | null;
|
|
648
|
+
fieldPath?: string | null;
|
|
649
|
+
value?: ValueAggregation;
|
|
650
|
+
}
|
|
633
651
|
/**
|
|
634
652
|
* Scalar aggregation configuration
|
|
635
653
|
*/
|
|
@@ -673,6 +691,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
673
691
|
range?: RangeAggregation;
|
|
674
692
|
scalar?: ScalarAggregation;
|
|
675
693
|
value?: ValueAggregation;
|
|
694
|
+
groupBy?: GroupByAggregation;
|
|
676
695
|
};
|
|
677
696
|
/**
|
|
678
697
|
* Base aggregation interface
|
|
@@ -390,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
390
390
|
* Operators available for boolean fields
|
|
391
391
|
*/
|
|
392
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
393
397
|
/**
|
|
394
398
|
* Operators available for date fields
|
|
395
399
|
*/
|
|
@@ -602,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
602
606
|
searchable: readonly string[];
|
|
603
607
|
} ? Spec['searchable'][number] : string;
|
|
604
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
611
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
612
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
613
|
+
*/
|
|
614
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
605
615
|
/**
|
|
606
616
|
* Determines operators applicable to a field based on its type
|
|
607
617
|
* @template Entity The entity type
|
|
608
618
|
* @template Path The field path to check
|
|
609
619
|
*/
|
|
610
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
620
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
611
621
|
/**
|
|
612
622
|
* Determines allowed operators for a field based on the search spec
|
|
613
623
|
* @template Entity The entity type
|
|
@@ -699,6 +709,14 @@ interface ValueAggregation {
|
|
|
699
709
|
interface RangeAggregation {
|
|
700
710
|
buckets?: RangeBucket[];
|
|
701
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Group by aggregation configuration
|
|
714
|
+
*/
|
|
715
|
+
interface GroupByAggregation {
|
|
716
|
+
name?: string | null;
|
|
717
|
+
fieldPath?: string | null;
|
|
718
|
+
value?: ValueAggregation;
|
|
719
|
+
}
|
|
702
720
|
/**
|
|
703
721
|
* Scalar aggregation configuration
|
|
704
722
|
*/
|
|
@@ -742,6 +760,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
742
760
|
range?: RangeAggregation;
|
|
743
761
|
scalar?: ScalarAggregation;
|
|
744
762
|
value?: ValueAggregation;
|
|
763
|
+
groupBy?: GroupByAggregation;
|
|
745
764
|
};
|
|
746
765
|
/**
|
|
747
766
|
* Base aggregation interface
|
|
@@ -390,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
390
390
|
* Operators available for boolean fields
|
|
391
391
|
*/
|
|
392
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
393
397
|
/**
|
|
394
398
|
* Operators available for date fields
|
|
395
399
|
*/
|
|
@@ -602,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
602
606
|
searchable: readonly string[];
|
|
603
607
|
} ? Spec['searchable'][number] : string;
|
|
604
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
611
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
612
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
613
|
+
*/
|
|
614
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
605
615
|
/**
|
|
606
616
|
* Determines operators applicable to a field based on its type
|
|
607
617
|
* @template Entity The entity type
|
|
608
618
|
* @template Path The field path to check
|
|
609
619
|
*/
|
|
610
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
620
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
611
621
|
/**
|
|
612
622
|
* Determines allowed operators for a field based on the search spec
|
|
613
623
|
* @template Entity The entity type
|
|
@@ -699,6 +709,14 @@ interface ValueAggregation {
|
|
|
699
709
|
interface RangeAggregation {
|
|
700
710
|
buckets?: RangeBucket[];
|
|
701
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Group by aggregation configuration
|
|
714
|
+
*/
|
|
715
|
+
interface GroupByAggregation {
|
|
716
|
+
name?: string | null;
|
|
717
|
+
fieldPath?: string | null;
|
|
718
|
+
value?: ValueAggregation;
|
|
719
|
+
}
|
|
702
720
|
/**
|
|
703
721
|
* Scalar aggregation configuration
|
|
704
722
|
*/
|
|
@@ -742,6 +760,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
742
760
|
range?: RangeAggregation;
|
|
743
761
|
scalar?: ScalarAggregation;
|
|
744
762
|
value?: ValueAggregation;
|
|
763
|
+
groupBy?: GroupByAggregation;
|
|
745
764
|
};
|
|
746
765
|
/**
|
|
747
766
|
* Base aggregation interface
|
|
@@ -390,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
390
390
|
* Operators available for boolean fields
|
|
391
391
|
*/
|
|
392
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
393
397
|
/**
|
|
394
398
|
* Operators available for date fields
|
|
395
399
|
*/
|
|
@@ -602,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
602
606
|
searchable: readonly string[];
|
|
603
607
|
} ? Spec['searchable'][number] : string;
|
|
604
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Helper type to detect if a type is an enum-like union of string literals
|
|
611
|
+
* This checks if the type is a union of specific string literals (not a generic string)
|
|
612
|
+
* It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
|
|
613
|
+
*/
|
|
614
|
+
type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
|
|
605
615
|
/**
|
|
606
616
|
* Determines operators applicable to a field based on its type
|
|
607
617
|
* @template Entity The entity type
|
|
608
618
|
* @template Path The field path to check
|
|
609
619
|
*/
|
|
610
|
-
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
620
|
+
type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
|
|
611
621
|
/**
|
|
612
622
|
* Determines allowed operators for a field based on the search spec
|
|
613
623
|
* @template Entity The entity type
|
|
@@ -699,6 +709,14 @@ interface ValueAggregation {
|
|
|
699
709
|
interface RangeAggregation {
|
|
700
710
|
buckets?: RangeBucket[];
|
|
701
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Group by aggregation configuration
|
|
714
|
+
*/
|
|
715
|
+
interface GroupByAggregation {
|
|
716
|
+
name?: string | null;
|
|
717
|
+
fieldPath?: string | null;
|
|
718
|
+
value?: ValueAggregation;
|
|
719
|
+
}
|
|
702
720
|
/**
|
|
703
721
|
* Scalar aggregation configuration
|
|
704
722
|
*/
|
|
@@ -742,6 +760,7 @@ type BaseAggregationWithoutType<Spec extends SearchSpec> = {
|
|
|
742
760
|
range?: RangeAggregation;
|
|
743
761
|
scalar?: ScalarAggregation;
|
|
744
762
|
value?: ValueAggregation;
|
|
763
|
+
groupBy?: GroupByAggregation;
|
|
745
764
|
};
|
|
746
765
|
/**
|
|
747
766
|
* Base aggregation interface
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"*.{js,ts}": "yarn lint"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@wix/error-handler-types": "^1.
|
|
33
|
+
"@wix/error-handler-types": "^1.7.0",
|
|
34
34
|
"@wix/monitoring-types": "^0.12.0",
|
|
35
35
|
"type-fest": "^4.41.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "^20.17.
|
|
38
|
+
"@types/node": "^20.17.50",
|
|
39
39
|
"eslint": "^8.57.1",
|
|
40
40
|
"eslint-config-sdk": "0.0.0",
|
|
41
41
|
"tsup": "^7.3.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"wallaby": {
|
|
63
63
|
"autoDetect": true
|
|
64
64
|
},
|
|
65
|
-
"falconPackageHash": "
|
|
65
|
+
"falconPackageHash": "e7c3abb583a6a4d25b4f984896ab8cb74e0c24603bf5693f3f7af15a"
|
|
66
66
|
}
|