@wix/sdk-types 1.13.8 → 1.13.9
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/index.d.mts +57 -1
- package/build/index.d.ts +57 -1
- package/package.json +3 -3
package/build/index.d.mts
CHANGED
|
@@ -1061,4 +1061,60 @@ type IsExposed<T, Scope extends Exposure> = Scope extends 'public' ? T : globalT
|
|
|
1061
1061
|
alpha: true;
|
|
1062
1062
|
} ? T : never;
|
|
1063
1063
|
|
|
1064
|
-
|
|
1064
|
+
/**
|
|
1065
|
+
* Extracts the first part of a dot-separated string.
|
|
1066
|
+
* @template T - The input string type
|
|
1067
|
+
* @example
|
|
1068
|
+
* // Returns "foo"
|
|
1069
|
+
* type Result = Head<"foo.bar.baz">
|
|
1070
|
+
*/
|
|
1071
|
+
type Head<T extends string> = T extends `${infer First}.${string}` ? First : T;
|
|
1072
|
+
/**
|
|
1073
|
+
* Extracts everything after the first dot in a dot-separated string.
|
|
1074
|
+
* Returns 'never' if there is no dot.
|
|
1075
|
+
* @template T - The input string type
|
|
1076
|
+
* @example
|
|
1077
|
+
* // Returns "bar.baz"
|
|
1078
|
+
* type Result = Tail<"foo.bar.baz">
|
|
1079
|
+
*/
|
|
1080
|
+
type Tail<T extends string> = T extends `${string}.${infer Rest}` ? Rest : never;
|
|
1081
|
+
/**
|
|
1082
|
+
* Extracts the element type from an array type, ensuring it's non-nullable.
|
|
1083
|
+
* Returns 'never' if the input type is not an array.
|
|
1084
|
+
* @template T - The potential array type
|
|
1085
|
+
* @example
|
|
1086
|
+
* // Returns string
|
|
1087
|
+
* type Result = OptionalArrayElementType<string[]>
|
|
1088
|
+
*/
|
|
1089
|
+
type OptionalArrayElementType<T> = T extends (infer U)[] ? NonNullable<U> : never;
|
|
1090
|
+
/**
|
|
1091
|
+
* Creates a new type where specified dot-notation paths are made non-nullable,
|
|
1092
|
+
* while maintaining the original structure of the object.
|
|
1093
|
+
* The behavior is conditional based on the global SDK type mode.
|
|
1094
|
+
* @template T - The input object type
|
|
1095
|
+
* @template K - The dot-notation path(s) to make non-nullable
|
|
1096
|
+
* @example
|
|
1097
|
+
* // Makes user.name and user.profile.email non-nullable
|
|
1098
|
+
* type Result = NonNullablePaths<MyType, "user.name" | "user.profile.email">
|
|
1099
|
+
*/
|
|
1100
|
+
type NonNullablePaths<T, K extends string> = T extends object ? {
|
|
1101
|
+
[P in K & keyof T]: NonNullable<T[P] extends readonly unknown[] | null | undefined ? NonNullablePaths<OptionalArrayElementType<T[P]>, Tail<Extract<K, `${P}.${string}`>>>[] : NonNullablePaths<T[P], Tail<Extract<K, `${P}.${string}`>>>>;
|
|
1102
|
+
} & {
|
|
1103
|
+
[P in keyof T as P extends K ? never : P]?: P extends Head<K> ? T[P] extends readonly unknown[] | null | undefined ? NonNullablePaths<OptionalArrayElementType<T[P]>, Tail<Extract<K, `${P}.${string}`>>>[] : NonNullablePaths<T[P], Tail<Extract<K, `${P}.${string}`>>> : T[P];
|
|
1104
|
+
} : T;
|
|
1105
|
+
declare global {
|
|
1106
|
+
/**
|
|
1107
|
+
* A global interface to set the type mode for the SDK.
|
|
1108
|
+
* @example
|
|
1109
|
+
* ```ts
|
|
1110
|
+
* declare global {
|
|
1111
|
+
* interface SDKTypeMode {
|
|
1112
|
+
* strict: true;
|
|
1113
|
+
* }
|
|
1114
|
+
* }
|
|
1115
|
+
*/
|
|
1116
|
+
interface SDKTypeMode {
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
export { type APIMetadata, type AmbassadorFactory, type AmbassadorFunctionDescriptor, type AmbassadorRequestOptions, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildAmbassadorFunction, type BuildDescriptors, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, type Descriptors, EventDefinition, type EventHandler, type EventIdentity, type ExposeFieldsBasedOnToggle, type HTTPMethod, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type MaybeContext, type Method, type NonNullablePaths, type OptionalArrayElementType, type PublicMetadata, type RESTFunctionDescriptor, type RequestContext, type RequestOptions, type RequestOptionsFactory, type RestModuleMeta, SERVICE_PLUGIN_ERROR_TYPE, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata };
|
package/build/index.d.ts
CHANGED
|
@@ -1061,4 +1061,60 @@ type IsExposed<T, Scope extends Exposure> = Scope extends 'public' ? T : globalT
|
|
|
1061
1061
|
alpha: true;
|
|
1062
1062
|
} ? T : never;
|
|
1063
1063
|
|
|
1064
|
-
|
|
1064
|
+
/**
|
|
1065
|
+
* Extracts the first part of a dot-separated string.
|
|
1066
|
+
* @template T - The input string type
|
|
1067
|
+
* @example
|
|
1068
|
+
* // Returns "foo"
|
|
1069
|
+
* type Result = Head<"foo.bar.baz">
|
|
1070
|
+
*/
|
|
1071
|
+
type Head<T extends string> = T extends `${infer First}.${string}` ? First : T;
|
|
1072
|
+
/**
|
|
1073
|
+
* Extracts everything after the first dot in a dot-separated string.
|
|
1074
|
+
* Returns 'never' if there is no dot.
|
|
1075
|
+
* @template T - The input string type
|
|
1076
|
+
* @example
|
|
1077
|
+
* // Returns "bar.baz"
|
|
1078
|
+
* type Result = Tail<"foo.bar.baz">
|
|
1079
|
+
*/
|
|
1080
|
+
type Tail<T extends string> = T extends `${string}.${infer Rest}` ? Rest : never;
|
|
1081
|
+
/**
|
|
1082
|
+
* Extracts the element type from an array type, ensuring it's non-nullable.
|
|
1083
|
+
* Returns 'never' if the input type is not an array.
|
|
1084
|
+
* @template T - The potential array type
|
|
1085
|
+
* @example
|
|
1086
|
+
* // Returns string
|
|
1087
|
+
* type Result = OptionalArrayElementType<string[]>
|
|
1088
|
+
*/
|
|
1089
|
+
type OptionalArrayElementType<T> = T extends (infer U)[] ? NonNullable<U> : never;
|
|
1090
|
+
/**
|
|
1091
|
+
* Creates a new type where specified dot-notation paths are made non-nullable,
|
|
1092
|
+
* while maintaining the original structure of the object.
|
|
1093
|
+
* The behavior is conditional based on the global SDK type mode.
|
|
1094
|
+
* @template T - The input object type
|
|
1095
|
+
* @template K - The dot-notation path(s) to make non-nullable
|
|
1096
|
+
* @example
|
|
1097
|
+
* // Makes user.name and user.profile.email non-nullable
|
|
1098
|
+
* type Result = NonNullablePaths<MyType, "user.name" | "user.profile.email">
|
|
1099
|
+
*/
|
|
1100
|
+
type NonNullablePaths<T, K extends string> = T extends object ? {
|
|
1101
|
+
[P in K & keyof T]: NonNullable<T[P] extends readonly unknown[] | null | undefined ? NonNullablePaths<OptionalArrayElementType<T[P]>, Tail<Extract<K, `${P}.${string}`>>>[] : NonNullablePaths<T[P], Tail<Extract<K, `${P}.${string}`>>>>;
|
|
1102
|
+
} & {
|
|
1103
|
+
[P in keyof T as P extends K ? never : P]?: P extends Head<K> ? T[P] extends readonly unknown[] | null | undefined ? NonNullablePaths<OptionalArrayElementType<T[P]>, Tail<Extract<K, `${P}.${string}`>>>[] : NonNullablePaths<T[P], Tail<Extract<K, `${P}.${string}`>>> : T[P];
|
|
1104
|
+
} : T;
|
|
1105
|
+
declare global {
|
|
1106
|
+
/**
|
|
1107
|
+
* A global interface to set the type mode for the SDK.
|
|
1108
|
+
* @example
|
|
1109
|
+
* ```ts
|
|
1110
|
+
* declare global {
|
|
1111
|
+
* interface SDKTypeMode {
|
|
1112
|
+
* strict: true;
|
|
1113
|
+
* }
|
|
1114
|
+
* }
|
|
1115
|
+
*/
|
|
1116
|
+
interface SDKTypeMode {
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
export { type APIMetadata, type AmbassadorFactory, type AmbassadorFunctionDescriptor, type AmbassadorRequestOptions, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildAmbassadorFunction, type BuildDescriptors, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, type Descriptors, EventDefinition, type EventHandler, type EventIdentity, type ExposeFieldsBasedOnToggle, type HTTPMethod, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type MaybeContext, type Method, type NonNullablePaths, type OptionalArrayElementType, type PublicMetadata, type RESTFunctionDescriptor, type RequestContext, type RequestOptions, type RequestOptionsFactory, type RestModuleMeta, SERVICE_PLUGIN_ERROR_TYPE, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsup",
|
|
23
|
-
"test": "
|
|
23
|
+
"test": "tsup --config tsup.test.config.ts",
|
|
24
24
|
"lint": "eslint --max-warnings=0 .",
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"wallaby": {
|
|
59
59
|
"autoDetect": true
|
|
60
60
|
},
|
|
61
|
-
"falconPackageHash": "
|
|
61
|
+
"falconPackageHash": "2fa1b5c41ad68972714dbbca1ce6e7c9151222df65273708160b69b8"
|
|
62
62
|
}
|