@wix/sdk-types 1.13.24 → 1.13.26
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 +12 -1
- package/build/index.d.mts +12 -1
- package/build/index.d.ts +12 -1
- package/internal/build/browser/index.d.mts +18 -1
- package/internal/build/index.d.mts +18 -1
- package/internal/build/index.d.ts +18 -1
- package/package.json +4 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
2
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
3
4
|
|
|
4
5
|
type HostModule<T, H extends Host> = {
|
|
5
6
|
__type: 'host';
|
|
@@ -320,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
320
321
|
* Operators available for boolean fields
|
|
321
322
|
*/
|
|
322
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
323
328
|
/**
|
|
324
329
|
* Operators available for date fields
|
|
325
330
|
*/
|
|
@@ -532,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
532
537
|
searchable: readonly string[];
|
|
533
538
|
} ? Spec['searchable'][number] : string;
|
|
534
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;
|
|
535
546
|
/**
|
|
536
547
|
* Determines operators applicable to a field based on its type
|
|
537
548
|
* @template Entity The entity type
|
|
538
549
|
* @template Path The field path to check
|
|
539
550
|
*/
|
|
540
|
-
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;
|
|
541
552
|
/**
|
|
542
553
|
* Determines allowed operators for a field based on the search spec
|
|
543
554
|
* @template Entity The entity type
|
package/build/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
2
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
3
4
|
|
|
4
5
|
type HostModule<T, H extends Host> = {
|
|
5
6
|
__type: 'host';
|
|
@@ -320,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
320
321
|
* Operators available for boolean fields
|
|
321
322
|
*/
|
|
322
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
323
328
|
/**
|
|
324
329
|
* Operators available for date fields
|
|
325
330
|
*/
|
|
@@ -532,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
532
537
|
searchable: readonly string[];
|
|
533
538
|
} ? Spec['searchable'][number] : string;
|
|
534
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;
|
|
535
546
|
/**
|
|
536
547
|
* Determines operators applicable to a field based on its type
|
|
537
548
|
* @template Entity The entity type
|
|
538
549
|
* @template Path The field path to check
|
|
539
550
|
*/
|
|
540
|
-
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;
|
|
541
552
|
/**
|
|
542
553
|
* Determines allowed operators for a field based on the search spec
|
|
543
554
|
* @template Entity The entity type
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
2
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
3
4
|
|
|
4
5
|
type HostModule<T, H extends Host> = {
|
|
5
6
|
__type: 'host';
|
|
@@ -320,6 +321,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
320
321
|
* Operators available for boolean fields
|
|
321
322
|
*/
|
|
322
323
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
324
|
+
/**
|
|
325
|
+
* Operators available for enum fields
|
|
326
|
+
*/
|
|
327
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
323
328
|
/**
|
|
324
329
|
* Operators available for date fields
|
|
325
330
|
*/
|
|
@@ -532,12 +537,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
532
537
|
searchable: readonly string[];
|
|
533
538
|
} ? Spec['searchable'][number] : string;
|
|
534
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;
|
|
535
546
|
/**
|
|
536
547
|
* Determines operators applicable to a field based on its type
|
|
537
548
|
* @template Entity The entity type
|
|
538
549
|
* @template Path The field path to check
|
|
539
550
|
*/
|
|
540
|
-
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;
|
|
541
552
|
/**
|
|
542
553
|
* Determines allowed operators for a field based on the search spec
|
|
543
554
|
* @template Entity The entity type
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
|
+
import { ErrorHandlerAPI } from '@wix/error-handler-types/v2';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
2
4
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
5
|
|
|
4
6
|
interface BiLogger {
|
|
@@ -90,6 +92,11 @@ type Host<Environment = unknown> = {
|
|
|
90
92
|
* @internal
|
|
91
93
|
*/
|
|
92
94
|
getConductorClient?: () => Conductor;
|
|
95
|
+
/**
|
|
96
|
+
* Optional ErrorHandler instance provided by the host
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
getErrorHandler?: () => ErrorHandlerAPI;
|
|
93
100
|
/**
|
|
94
101
|
* Possible data to be provided by every host, for cross cutting concerns
|
|
95
102
|
* like internationalization, billing, etc.
|
|
@@ -383,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
383
390
|
* Operators available for boolean fields
|
|
384
391
|
*/
|
|
385
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
386
397
|
/**
|
|
387
398
|
* Operators available for date fields
|
|
388
399
|
*/
|
|
@@ -595,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
595
606
|
searchable: readonly string[];
|
|
596
607
|
} ? Spec['searchable'][number] : string;
|
|
597
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;
|
|
598
615
|
/**
|
|
599
616
|
* Determines operators applicable to a field based on its type
|
|
600
617
|
* @template Entity The entity type
|
|
601
618
|
* @template Path The field path to check
|
|
602
619
|
*/
|
|
603
|
-
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;
|
|
604
621
|
/**
|
|
605
622
|
* Determines allowed operators for a field based on the search spec
|
|
606
623
|
* @template Entity The entity type
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
|
+
import { ErrorHandlerAPI } from '@wix/error-handler-types/v2';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
2
4
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
5
|
|
|
4
6
|
interface BiLogger {
|
|
@@ -90,6 +92,11 @@ type Host<Environment = unknown> = {
|
|
|
90
92
|
* @internal
|
|
91
93
|
*/
|
|
92
94
|
getConductorClient?: () => Conductor;
|
|
95
|
+
/**
|
|
96
|
+
* Optional ErrorHandler instance provided by the host
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
getErrorHandler?: () => ErrorHandlerAPI;
|
|
93
100
|
/**
|
|
94
101
|
* Possible data to be provided by every host, for cross cutting concerns
|
|
95
102
|
* like internationalization, billing, etc.
|
|
@@ -383,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
383
390
|
* Operators available for boolean fields
|
|
384
391
|
*/
|
|
385
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
386
397
|
/**
|
|
387
398
|
* Operators available for date fields
|
|
388
399
|
*/
|
|
@@ -595,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
595
606
|
searchable: readonly string[];
|
|
596
607
|
} ? Spec['searchable'][number] : string;
|
|
597
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;
|
|
598
615
|
/**
|
|
599
616
|
* Determines operators applicable to a field based on its type
|
|
600
617
|
* @template Entity The entity type
|
|
601
618
|
* @template Path The field path to check
|
|
602
619
|
*/
|
|
603
|
-
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;
|
|
604
621
|
/**
|
|
605
622
|
* Determines allowed operators for a field based on the search spec
|
|
606
623
|
* @template Entity The entity type
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { MonitoringClient } from '@wix/monitoring-types';
|
|
2
|
+
import { ErrorHandlerAPI } from '@wix/error-handler-types/v2';
|
|
3
|
+
export { ErrorCodesMap, ErrorHandlerPublicAPI as ErrorHandler, ResolvedError } from '@wix/error-handler-types/v2';
|
|
2
4
|
import { ConditionalExcept, EmptyObject, Simplify, Paths, SetRequiredDeep, JsonObject } from 'type-fest';
|
|
3
5
|
|
|
4
6
|
interface BiLogger {
|
|
@@ -90,6 +92,11 @@ type Host<Environment = unknown> = {
|
|
|
90
92
|
* @internal
|
|
91
93
|
*/
|
|
92
94
|
getConductorClient?: () => Conductor;
|
|
95
|
+
/**
|
|
96
|
+
* Optional ErrorHandler instance provided by the host
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
getErrorHandler?: () => ErrorHandlerAPI;
|
|
93
100
|
/**
|
|
94
101
|
* Possible data to be provided by every host, for cross cutting concerns
|
|
95
102
|
* like internationalization, billing, etc.
|
|
@@ -383,6 +390,10 @@ type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exist
|
|
|
383
390
|
* Operators available for boolean fields
|
|
384
391
|
*/
|
|
385
392
|
type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
|
|
393
|
+
/**
|
|
394
|
+
* Operators available for enum fields
|
|
395
|
+
*/
|
|
396
|
+
type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
|
|
386
397
|
/**
|
|
387
398
|
* Operators available for date fields
|
|
388
399
|
*/
|
|
@@ -595,12 +606,18 @@ type SearchableFields<Spec extends SearchSpec> = Spec extends {
|
|
|
595
606
|
searchable: readonly string[];
|
|
596
607
|
} ? Spec['searchable'][number] : string;
|
|
597
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;
|
|
598
615
|
/**
|
|
599
616
|
* Determines operators applicable to a field based on its type
|
|
600
617
|
* @template Entity The entity type
|
|
601
618
|
* @template Path The field path to check
|
|
602
619
|
*/
|
|
603
|
-
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;
|
|
604
621
|
/**
|
|
605
622
|
* Determines allowed operators for a field based on the search spec
|
|
606
623
|
* @template Entity The entity type
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
"*.{js,ts}": "yarn lint"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@wix/error-handler-types": "^1.7.0",
|
|
33
34
|
"@wix/monitoring-types": "^0.12.0",
|
|
34
35
|
"type-fest": "^4.41.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@types/node": "^20.17.
|
|
38
|
+
"@types/node": "^20.17.50",
|
|
38
39
|
"eslint": "^8.57.1",
|
|
39
40
|
"eslint-config-sdk": "0.0.0",
|
|
40
41
|
"tsup": "^7.3.0",
|
|
@@ -61,5 +62,5 @@
|
|
|
61
62
|
"wallaby": {
|
|
62
63
|
"autoDetect": true
|
|
63
64
|
},
|
|
64
|
-
"falconPackageHash": "
|
|
65
|
+
"falconPackageHash": "5e33f8ab2891ecb1d550b247744b0226f8b30b0dcd39aa8a8b6d64c0"
|
|
65
66
|
}
|