@wix/domains 1.0.37 → 1.0.38
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/package.json +2 -2
- package/type-bundles/context.bundle.d.ts +2274 -634
- package/type-bundles/index.bundle.d.ts +2274 -634
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type HostModule<T, H extends Host> = {
|
|
1
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
2
2
|
__type: 'host';
|
|
3
3
|
create(host: H): T;
|
|
4
4
|
};
|
|
5
|
-
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
-
type Host<Environment = unknown> = {
|
|
5
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
6
|
+
type Host$4<Environment = unknown> = {
|
|
7
7
|
channel: {
|
|
8
8
|
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
9
|
disconnect: () => void;
|
|
@@ -36,92 +36,92 @@ type Host<Environment = unknown> = {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
40
|
-
interface HttpClient {
|
|
41
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
39
|
+
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
40
|
+
interface HttpClient$4 {
|
|
41
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
42
42
|
fetchWithAuth: typeof fetch;
|
|
43
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
44
|
getActiveToken?: () => string | undefined;
|
|
45
45
|
}
|
|
46
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
47
|
-
type HttpResponse<T = any> = {
|
|
46
|
+
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
47
|
+
type HttpResponse$4<T = any> = {
|
|
48
48
|
data: T;
|
|
49
49
|
status: number;
|
|
50
50
|
statusText: string;
|
|
51
51
|
headers: any;
|
|
52
52
|
request?: any;
|
|
53
53
|
};
|
|
54
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
54
|
+
type RequestOptions$4<_TResponse = any, Data = any> = {
|
|
55
55
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
56
56
|
url: string;
|
|
57
57
|
data?: Data;
|
|
58
58
|
params?: URLSearchParams;
|
|
59
|
-
} & APIMetadata;
|
|
60
|
-
type APIMetadata = {
|
|
59
|
+
} & APIMetadata$4;
|
|
60
|
+
type APIMetadata$4 = {
|
|
61
61
|
methodFqn?: string;
|
|
62
62
|
entityFqdn?: string;
|
|
63
63
|
packageName?: string;
|
|
64
64
|
};
|
|
65
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
65
|
+
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
66
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
67
67
|
__type: 'event-definition';
|
|
68
68
|
type: Type;
|
|
69
69
|
isDomainEvent?: boolean;
|
|
70
70
|
transformations?: (envelope: unknown) => Payload;
|
|
71
71
|
__payload: Payload;
|
|
72
72
|
};
|
|
73
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
74
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
73
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
74
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
76
76
|
|
|
77
|
-
type ServicePluginMethodInput = {
|
|
77
|
+
type ServicePluginMethodInput$4 = {
|
|
78
78
|
request: any;
|
|
79
79
|
metadata: any;
|
|
80
80
|
};
|
|
81
|
-
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
82
|
-
type ServicePluginMethodMetadata = {
|
|
81
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata$4 = {
|
|
83
83
|
name: string;
|
|
84
84
|
primaryHttpMappingPath: string;
|
|
85
85
|
transformations: {
|
|
86
|
-
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
87
87
|
toREST: (...args: unknown[]) => unknown;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
90
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
91
91
|
__type: 'service-plugin-definition';
|
|
92
92
|
componentType: string;
|
|
93
|
-
methods: ServicePluginMethodMetadata[];
|
|
93
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
94
94
|
__contract: Contract;
|
|
95
95
|
};
|
|
96
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
97
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
98
|
-
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
96
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
99
99
|
|
|
100
|
-
type RequestContext = {
|
|
100
|
+
type RequestContext$4 = {
|
|
101
101
|
isSSR: boolean;
|
|
102
102
|
host: string;
|
|
103
103
|
protocol?: string;
|
|
104
104
|
};
|
|
105
|
-
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
105
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
106
106
|
/**
|
|
107
107
|
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
108
|
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
109
|
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
110
|
*/
|
|
111
|
-
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
-
type AmbassadorRequestOptions<T = any> = {
|
|
111
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
113
113
|
_?: T;
|
|
114
114
|
url?: string;
|
|
115
|
-
method?: Method;
|
|
115
|
+
method?: Method$4;
|
|
116
116
|
params?: any;
|
|
117
117
|
data?: any;
|
|
118
|
-
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
118
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
119
119
|
};
|
|
120
|
-
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
120
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
121
121
|
__isAmbassador: boolean;
|
|
122
122
|
};
|
|
123
|
-
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
124
|
-
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
123
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
125
125
|
|
|
126
126
|
declare global {
|
|
127
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -130,7 +130,7 @@ declare global {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
declare const emptyObjectSymbol: unique symbol;
|
|
133
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
Represents a strictly empty plain object, the `{}` value.
|
|
@@ -158,7 +158,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
|
|
|
158
158
|
|
|
159
159
|
@category Object
|
|
160
160
|
*/
|
|
161
|
-
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
161
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
Returns a boolean for whether the two given types are equal.
|
|
@@ -186,7 +186,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
186
186
|
@category Type Guard
|
|
187
187
|
@category Utilities
|
|
188
188
|
*/
|
|
189
|
-
type IsEqual<A, B> =
|
|
189
|
+
type IsEqual$4<A, B> =
|
|
190
190
|
(<G>() => G extends A ? 1 : 2) extends
|
|
191
191
|
(<G>() => G extends B ? 1 : 2)
|
|
192
192
|
? true
|
|
@@ -219,9 +219,9 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
219
219
|
|
|
220
220
|
@see {Except}
|
|
221
221
|
*/
|
|
222
|
-
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
222
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
223
|
|
|
224
|
-
type ExceptOptions = {
|
|
224
|
+
type ExceptOptions$4 = {
|
|
225
225
|
/**
|
|
226
226
|
Disallow assigning non-specified properties.
|
|
227
227
|
|
|
@@ -265,8 +265,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
|
265
265
|
|
|
266
266
|
@category Object
|
|
267
267
|
*/
|
|
268
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
269
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
268
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
270
|
} & (Options['requireExactProps'] extends true
|
|
271
271
|
? Partial<Record<KeysType, never>>
|
|
272
272
|
: {});
|
|
@@ -303,7 +303,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
|
303
303
|
|
|
304
304
|
@category Object
|
|
305
305
|
*/
|
|
306
|
-
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
306
|
+
type ConditionalKeys$4<Base, Condition> = NonNullable<
|
|
307
307
|
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
308
|
{
|
|
309
309
|
// Map through all the keys of the given base type.
|
|
@@ -357,9 +357,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
|
357
357
|
|
|
358
358
|
@category Object
|
|
359
359
|
*/
|
|
360
|
-
type ConditionalExcept<Base, Condition> = Except<
|
|
360
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
361
361
|
Base,
|
|
362
|
-
ConditionalKeys<Base, Condition>
|
|
362
|
+
ConditionalKeys$4<Base, Condition>
|
|
363
363
|
>;
|
|
364
364
|
|
|
365
365
|
/**
|
|
@@ -367,8 +367,8 @@ ConditionalKeys<Base, Condition>
|
|
|
367
367
|
* can either be a REST module or a host module.
|
|
368
368
|
* This type is recursive, so it can describe nested modules.
|
|
369
369
|
*/
|
|
370
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
371
|
-
[key: string]: Descriptors | PublicMetadata | any;
|
|
370
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$4<any> | ServicePluginDefinition$4<any> | {
|
|
371
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
372
372
|
};
|
|
373
373
|
/**
|
|
374
374
|
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
@@ -376,12 +376,12 @@ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostM
|
|
|
376
376
|
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
377
|
* do not match the given host (as they will not work with the given host).
|
|
378
378
|
*/
|
|
379
|
-
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
379
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
380
380
|
done: T;
|
|
381
381
|
recurse: T extends {
|
|
382
|
-
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
384
|
-
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
385
385
|
-1,
|
|
386
386
|
0,
|
|
387
387
|
1,
|
|
@@ -390,9 +390,9 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
|
|
|
390
390
|
4,
|
|
391
391
|
5
|
|
392
392
|
][Depth]> : never;
|
|
393
|
-
}, EmptyObject>;
|
|
393
|
+
}, EmptyObject$4>;
|
|
394
394
|
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
-
type PublicMetadata = {
|
|
395
|
+
type PublicMetadata$4 = {
|
|
396
396
|
PACKAGE_NAME?: string;
|
|
397
397
|
};
|
|
398
398
|
|
|
@@ -404,9 +404,9 @@ declare global {
|
|
|
404
404
|
* A type used to create concerete types from SDK descriptors in
|
|
405
405
|
* case a contextual client is available.
|
|
406
406
|
*/
|
|
407
|
-
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
408
|
-
host: Host;
|
|
409
|
-
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
407
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host$4;
|
|
409
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
410
410
|
|
|
411
411
|
/** A `connectedDomain` object holds information about an external domain and its connection to a Wix site. */
|
|
412
412
|
interface ConnectedDomain {
|
|
@@ -723,7 +723,7 @@ interface ListConnectedDomainsOptions {
|
|
|
723
723
|
paging?: CursorPaging$1;
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
-
declare function createConnectedDomain$1(httpClient: HttpClient): CreateConnectedDomainSignature;
|
|
726
|
+
declare function createConnectedDomain$1(httpClient: HttpClient$4): CreateConnectedDomainSignature;
|
|
727
727
|
interface CreateConnectedDomainSignature {
|
|
728
728
|
/**
|
|
729
729
|
* Creates a `connectedDomain` object and starts the domain connection process. It may take up to 48 hours for the DNS changes to take effect.
|
|
@@ -742,7 +742,7 @@ interface CreateConnectedDomainSignature {
|
|
|
742
742
|
*/
|
|
743
743
|
(connectedDomain: ConnectedDomain): Promise<ConnectedDomain & ConnectedDomainNonNullableFields>;
|
|
744
744
|
}
|
|
745
|
-
declare function getConnectedDomain$1(httpClient: HttpClient): GetConnectedDomainSignature;
|
|
745
|
+
declare function getConnectedDomain$1(httpClient: HttpClient$4): GetConnectedDomainSignature;
|
|
746
746
|
interface GetConnectedDomainSignature {
|
|
747
747
|
/**
|
|
748
748
|
* Retrieves a connected domain.
|
|
@@ -756,7 +756,7 @@ interface GetConnectedDomainSignature {
|
|
|
756
756
|
*/
|
|
757
757
|
(connectedDomainId: string): Promise<ConnectedDomain & ConnectedDomainNonNullableFields>;
|
|
758
758
|
}
|
|
759
|
-
declare function deleteConnectedDomain$1(httpClient: HttpClient): DeleteConnectedDomainSignature;
|
|
759
|
+
declare function deleteConnectedDomain$1(httpClient: HttpClient$4): DeleteConnectedDomainSignature;
|
|
760
760
|
interface DeleteConnectedDomainSignature {
|
|
761
761
|
/**
|
|
762
762
|
* Deletes a `connectedDomain` object and removes related DNS records from
|
|
@@ -776,7 +776,7 @@ interface DeleteConnectedDomainSignature {
|
|
|
776
776
|
*/
|
|
777
777
|
(connectedDomainId: string): Promise<void>;
|
|
778
778
|
}
|
|
779
|
-
declare function listConnectedDomains$1(httpClient: HttpClient): ListConnectedDomainsSignature;
|
|
779
|
+
declare function listConnectedDomains$1(httpClient: HttpClient$4): ListConnectedDomainsSignature;
|
|
780
780
|
interface ListConnectedDomainsSignature {
|
|
781
781
|
/**
|
|
782
782
|
* Retrieves a list of up to 100 connected domains.
|
|
@@ -791,10 +791,10 @@ interface ListConnectedDomainsSignature {
|
|
|
791
791
|
(options?: ListConnectedDomainsOptions | undefined): Promise<ListConnectedDomainsResponse & ListConnectedDomainsResponseNonNullableFields>;
|
|
792
792
|
}
|
|
793
793
|
|
|
794
|
-
declare const createConnectedDomain: MaybeContext<BuildRESTFunction<typeof createConnectedDomain$1> & typeof createConnectedDomain$1>;
|
|
795
|
-
declare const getConnectedDomain: MaybeContext<BuildRESTFunction<typeof getConnectedDomain$1> & typeof getConnectedDomain$1>;
|
|
796
|
-
declare const deleteConnectedDomain: MaybeContext<BuildRESTFunction<typeof deleteConnectedDomain$1> & typeof deleteConnectedDomain$1>;
|
|
797
|
-
declare const listConnectedDomains: MaybeContext<BuildRESTFunction<typeof listConnectedDomains$1> & typeof listConnectedDomains$1>;
|
|
794
|
+
declare const createConnectedDomain: MaybeContext$4<BuildRESTFunction$4<typeof createConnectedDomain$1> & typeof createConnectedDomain$1>;
|
|
795
|
+
declare const getConnectedDomain: MaybeContext$4<BuildRESTFunction$4<typeof getConnectedDomain$1> & typeof getConnectedDomain$1>;
|
|
796
|
+
declare const deleteConnectedDomain: MaybeContext$4<BuildRESTFunction$4<typeof deleteConnectedDomain$1> & typeof deleteConnectedDomain$1>;
|
|
797
|
+
declare const listConnectedDomains: MaybeContext$4<BuildRESTFunction$4<typeof listConnectedDomains$1> & typeof listConnectedDomains$1>;
|
|
798
798
|
|
|
799
799
|
type index_d$4_AssignmentType = AssignmentType;
|
|
800
800
|
declare const index_d$4_AssignmentType: typeof AssignmentType;
|
|
@@ -825,381 +825,1201 @@ declare namespace index_d$4 {
|
|
|
825
825
|
export { type ActionEvent$1 as ActionEvent, index_d$4_AssignmentType as AssignmentType, type index_d$4_ConnectedDomain as ConnectedDomain, type index_d$4_ConnectedDomainNonNullableFields as ConnectedDomainNonNullableFields, ConnectionType$1 as ConnectionType, type index_d$4_CreateConnectedDomainRequest as CreateConnectedDomainRequest, type index_d$4_CreateConnectedDomainResponse as CreateConnectedDomainResponse, type index_d$4_CreateConnectedDomainResponseNonNullableFields as CreateConnectedDomainResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type Cursors$1 as Cursors, type index_d$4_DeleteConnectedDomainRequest as DeleteConnectedDomainRequest, type index_d$4_DeleteConnectedDomainResponse as DeleteConnectedDomainResponse, index_d$4_DnsPropagationStatus as DnsPropagationStatus, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type DomainRemovedEvent$1 as DomainRemovedEvent, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type index_d$4_GetConnectedDomainRequest as GetConnectedDomainRequest, type index_d$4_GetConnectedDomainResponse as GetConnectedDomainResponse, type index_d$4_GetConnectedDomainResponseNonNullableFields as GetConnectedDomainResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$4_ListConnectedDomainsOptions as ListConnectedDomainsOptions, type index_d$4_ListConnectedDomainsRequest as ListConnectedDomainsRequest, type index_d$4_ListConnectedDomainsResponse as ListConnectedDomainsResponse, type index_d$4_ListConnectedDomainsResponseNonNullableFields as ListConnectedDomainsResponseNonNullableFields, type MessageEnvelope$1 as MessageEnvelope, type index_d$4_RedirectAssignmentInfo as RedirectAssignmentInfo, type RestoreInfo$1 as RestoreInfo, type index_d$4_SiteInfo as SiteInfo, type index_d$4_SiteInfoAssignmentInfoOneOf as SiteInfoAssignmentInfoOneOf, WebhookIdentityType$1 as WebhookIdentityType, index_d$4_createConnectedDomain as createConnectedDomain, index_d$4_deleteConnectedDomain as deleteConnectedDomain, index_d$4_getConnectedDomain as getConnectedDomain, index_d$4_listConnectedDomains as listConnectedDomains };
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
* @readonly
|
|
843
|
-
*/
|
|
844
|
-
pointingRecords?: PointingRecords;
|
|
845
|
-
/**
|
|
846
|
-
* Information about subdomains. Available only for subdomains.
|
|
847
|
-
* @readonly
|
|
848
|
-
*/
|
|
849
|
-
subdomainRecords?: SubdomainRecords;
|
|
850
|
-
/** ID of the connected domain. Identical to the domain name including TLD. */
|
|
851
|
-
connectedDomainId?: string;
|
|
852
|
-
/**
|
|
853
|
-
* Information about the external domain registrar including current name
|
|
854
|
-
* servers.
|
|
855
|
-
*/
|
|
856
|
-
registrar?: Registrar;
|
|
857
|
-
}
|
|
858
|
-
/** @oneof */
|
|
859
|
-
interface ConnectedDomainSetupInfoDnsRecordsOneOf {
|
|
860
|
-
/**
|
|
861
|
-
* Information about domains connected using nameservers. Available only for
|
|
862
|
-
* `{"connectionType": "NAMESERVERS"}`.
|
|
863
|
-
*/
|
|
864
|
-
nameserverRecord?: NameserverRecord;
|
|
865
|
-
/**
|
|
866
|
-
* Information about domains connected by pointing. Available only for
|
|
867
|
-
* `{"connectionType": "POINTING"}`.
|
|
868
|
-
* @readonly
|
|
869
|
-
*/
|
|
870
|
-
pointingRecords?: PointingRecords;
|
|
871
|
-
/**
|
|
872
|
-
* Information about subdomains. Available only for subdomains.
|
|
873
|
-
* @readonly
|
|
874
|
-
*/
|
|
875
|
-
subdomainRecords?: SubdomainRecords;
|
|
876
|
-
}
|
|
877
|
-
interface Registrar {
|
|
878
|
-
/**
|
|
879
|
-
* Name of the external domain registrar. For subdomains it's the registrar of the root domain.
|
|
880
|
-
* @readonly
|
|
881
|
-
*/
|
|
882
|
-
name?: string | null;
|
|
883
|
-
/**
|
|
884
|
-
* Values of the current name server records. In case you connect an external
|
|
885
|
-
* domain using name servers, site owners must replace these current name servers
|
|
886
|
-
* with the new name servers found in `connectedDomainSetupInfo.nameserverRecord.nsRecord.values`
|
|
887
|
-
* during the initial domain setup.
|
|
888
|
-
* The replacement can't be performed through Wix APIs, you must use the
|
|
889
|
-
* infrastructure of the external domain registrar. Read more about
|
|
890
|
-
* [connecting domains using nameservers](https://dev.wix.com/api/rest/account-level-apis/connected-domains/sample-flows#account-level-apis_connected-domains_sample-flows_connect-an-external-domain-using-nameservers).
|
|
891
|
-
* @readonly
|
|
892
|
-
*/
|
|
893
|
-
nameServers?: string[];
|
|
894
|
-
}
|
|
895
|
-
/** Information about domains connected by nameservers. */
|
|
896
|
-
interface NameserverRecord {
|
|
897
|
-
/**
|
|
898
|
-
* Default [nameserver record](https://en.wikipedia.org/wiki/List_of_DNS_record_types#NS).
|
|
899
|
-
* @readonly
|
|
900
|
-
*/
|
|
901
|
-
nsRecord?: NsRecord;
|
|
902
|
-
}
|
|
903
|
-
interface NsRecord {
|
|
904
|
-
/** Domain host name. For example `domain.com` or `mail.domain.com`. Can be a subdomain. */
|
|
905
|
-
hostName?: string;
|
|
906
|
-
/** [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. */
|
|
907
|
-
ttl?: number;
|
|
908
|
-
/** DNS record values. */
|
|
909
|
-
values?: string[];
|
|
910
|
-
}
|
|
911
|
-
/** Information about domains connected by pointing. */
|
|
912
|
-
interface PointingRecords {
|
|
828
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
829
|
+
__type: 'host';
|
|
830
|
+
create(host: H): T;
|
|
831
|
+
};
|
|
832
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
833
|
+
type Host$3<Environment = unknown> = {
|
|
834
|
+
channel: {
|
|
835
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
836
|
+
disconnect: () => void;
|
|
837
|
+
} | Promise<{
|
|
838
|
+
disconnect: () => void;
|
|
839
|
+
}>;
|
|
840
|
+
};
|
|
841
|
+
environment?: Environment;
|
|
913
842
|
/**
|
|
914
|
-
*
|
|
915
|
-
* @readonly
|
|
843
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
916
844
|
*/
|
|
917
|
-
|
|
845
|
+
apiBaseUrl?: string;
|
|
918
846
|
/**
|
|
919
|
-
*
|
|
920
|
-
*
|
|
847
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
848
|
+
* like internationalization, billing, etc.
|
|
921
849
|
*/
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
850
|
+
essentials?: {
|
|
851
|
+
/**
|
|
852
|
+
* The language of the currently viewed session
|
|
853
|
+
*/
|
|
854
|
+
language?: string;
|
|
855
|
+
/**
|
|
856
|
+
* The locale of the currently viewed session
|
|
857
|
+
*/
|
|
858
|
+
locale?: string;
|
|
859
|
+
/**
|
|
860
|
+
* Any headers that should be passed through to the API requests
|
|
861
|
+
*/
|
|
862
|
+
passThroughHeaders?: Record<string, string>;
|
|
863
|
+
};
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
867
|
+
interface HttpClient$3 {
|
|
868
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
869
|
+
fetchWithAuth: typeof fetch;
|
|
870
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
871
|
+
getActiveToken?: () => string | undefined;
|
|
931
872
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
interface
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
}
|
|
1018
|
-
interface SubdomainRecordsNonNullableFields {
|
|
1019
|
-
cnameRecords: CnameRecordNonNullableFields[];
|
|
1020
|
-
}
|
|
1021
|
-
interface RegistrarNonNullableFields {
|
|
1022
|
-
nameServers: string[];
|
|
1023
|
-
}
|
|
1024
|
-
interface ConnectedDomainSetupInfoNonNullableFields {
|
|
1025
|
-
nameserverRecord?: NameserverRecordNonNullableFields;
|
|
1026
|
-
pointingRecords?: PointingRecordsNonNullableFields;
|
|
1027
|
-
subdomainRecords?: SubdomainRecordsNonNullableFields;
|
|
1028
|
-
connectedDomainId: string;
|
|
1029
|
-
registrar?: RegistrarNonNullableFields;
|
|
1030
|
-
}
|
|
1031
|
-
interface GetConnectedDomainSetupInfoResponseNonNullableFields {
|
|
1032
|
-
connectedDomainSetupInfo?: ConnectedDomainSetupInfoNonNullableFields;
|
|
873
|
+
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
874
|
+
type HttpResponse$3<T = any> = {
|
|
875
|
+
data: T;
|
|
876
|
+
status: number;
|
|
877
|
+
statusText: string;
|
|
878
|
+
headers: any;
|
|
879
|
+
request?: any;
|
|
880
|
+
};
|
|
881
|
+
type RequestOptions$3<_TResponse = any, Data = any> = {
|
|
882
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
883
|
+
url: string;
|
|
884
|
+
data?: Data;
|
|
885
|
+
params?: URLSearchParams;
|
|
886
|
+
} & APIMetadata$3;
|
|
887
|
+
type APIMetadata$3 = {
|
|
888
|
+
methodFqn?: string;
|
|
889
|
+
entityFqdn?: string;
|
|
890
|
+
packageName?: string;
|
|
891
|
+
};
|
|
892
|
+
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
893
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
894
|
+
__type: 'event-definition';
|
|
895
|
+
type: Type;
|
|
896
|
+
isDomainEvent?: boolean;
|
|
897
|
+
transformations?: (envelope: unknown) => Payload;
|
|
898
|
+
__payload: Payload;
|
|
899
|
+
};
|
|
900
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
901
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
902
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
903
|
+
|
|
904
|
+
type ServicePluginMethodInput$3 = {
|
|
905
|
+
request: any;
|
|
906
|
+
metadata: any;
|
|
907
|
+
};
|
|
908
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
909
|
+
type ServicePluginMethodMetadata$3 = {
|
|
910
|
+
name: string;
|
|
911
|
+
primaryHttpMappingPath: string;
|
|
912
|
+
transformations: {
|
|
913
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
914
|
+
toREST: (...args: unknown[]) => unknown;
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
918
|
+
__type: 'service-plugin-definition';
|
|
919
|
+
componentType: string;
|
|
920
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
921
|
+
__contract: Contract;
|
|
922
|
+
};
|
|
923
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
924
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
925
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
926
|
+
|
|
927
|
+
type RequestContext$3 = {
|
|
928
|
+
isSSR: boolean;
|
|
929
|
+
host: string;
|
|
930
|
+
protocol?: string;
|
|
931
|
+
};
|
|
932
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
933
|
+
/**
|
|
934
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
935
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
936
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
937
|
+
*/
|
|
938
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
939
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
940
|
+
_?: T;
|
|
941
|
+
url?: string;
|
|
942
|
+
method?: Method$3;
|
|
943
|
+
params?: any;
|
|
944
|
+
data?: any;
|
|
945
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
946
|
+
};
|
|
947
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
948
|
+
__isAmbassador: boolean;
|
|
949
|
+
};
|
|
950
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
951
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
952
|
+
|
|
953
|
+
declare global {
|
|
954
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
955
|
+
interface SymbolConstructor {
|
|
956
|
+
readonly observable: symbol;
|
|
957
|
+
}
|
|
1033
958
|
}
|
|
1034
959
|
|
|
1035
|
-
declare
|
|
1036
|
-
interface GetConnectedDomainSetupInfoSignature {
|
|
1037
|
-
/**
|
|
1038
|
-
* Retrieves information for the initial setup of a connected domain.
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
* You must pass the relevant Wix account ID in the header of the call.
|
|
1042
|
-
*
|
|
1043
|
-
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1044
|
-
* @param - ID of the connected domain to retrieve setup information for.
|
|
1045
|
-
* Identical to the domain name including TLD.
|
|
1046
|
-
*/
|
|
1047
|
-
(connectedDomainId: string): Promise<GetConnectedDomainSetupInfoResponse & GetConnectedDomainSetupInfoResponseNonNullableFields>;
|
|
1048
|
-
}
|
|
960
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
1049
961
|
|
|
1050
|
-
|
|
962
|
+
/**
|
|
963
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1051
964
|
|
|
1052
|
-
type
|
|
1053
|
-
type index_d$3_CnameRecord = CnameRecord;
|
|
1054
|
-
type index_d$3_ConnectedDomainSetupInfo = ConnectedDomainSetupInfo;
|
|
1055
|
-
type index_d$3_ConnectedDomainSetupInfoDnsRecordsOneOf = ConnectedDomainSetupInfoDnsRecordsOneOf;
|
|
1056
|
-
type index_d$3_ConnectionType = ConnectionType;
|
|
1057
|
-
declare const index_d$3_ConnectionType: typeof ConnectionType;
|
|
1058
|
-
type index_d$3_GetConnectedDomainSetupInfoRequest = GetConnectedDomainSetupInfoRequest;
|
|
1059
|
-
type index_d$3_GetConnectedDomainSetupInfoResponse = GetConnectedDomainSetupInfoResponse;
|
|
1060
|
-
type index_d$3_GetConnectedDomainSetupInfoResponseNonNullableFields = GetConnectedDomainSetupInfoResponseNonNullableFields;
|
|
1061
|
-
type index_d$3_GetSetupInfoRequest = GetSetupInfoRequest;
|
|
1062
|
-
type index_d$3_GetSetupInfoResponse = GetSetupInfoResponse;
|
|
1063
|
-
type index_d$3_NameserverRecord = NameserverRecord;
|
|
1064
|
-
type index_d$3_NsRecord = NsRecord;
|
|
1065
|
-
type index_d$3_PointingRecords = PointingRecords;
|
|
1066
|
-
type index_d$3_PreCreateConnectedDomainRequest = PreCreateConnectedDomainRequest;
|
|
1067
|
-
type index_d$3_PreCreateConnectedDomainResponse = PreCreateConnectedDomainResponse;
|
|
1068
|
-
type index_d$3_Registrar = Registrar;
|
|
1069
|
-
type index_d$3_SubdomainRecords = SubdomainRecords;
|
|
1070
|
-
declare const index_d$3_getConnectedDomainSetupInfo: typeof getConnectedDomainSetupInfo;
|
|
1071
|
-
declare namespace index_d$3 {
|
|
1072
|
-
export { type index_d$3_ARecord as ARecord, type index_d$3_CnameRecord as CnameRecord, type index_d$3_ConnectedDomainSetupInfo as ConnectedDomainSetupInfo, type index_d$3_ConnectedDomainSetupInfoDnsRecordsOneOf as ConnectedDomainSetupInfoDnsRecordsOneOf, index_d$3_ConnectionType as ConnectionType, type index_d$3_GetConnectedDomainSetupInfoRequest as GetConnectedDomainSetupInfoRequest, type index_d$3_GetConnectedDomainSetupInfoResponse as GetConnectedDomainSetupInfoResponse, type index_d$3_GetConnectedDomainSetupInfoResponseNonNullableFields as GetConnectedDomainSetupInfoResponseNonNullableFields, type index_d$3_GetSetupInfoRequest as GetSetupInfoRequest, type index_d$3_GetSetupInfoResponse as GetSetupInfoResponse, type index_d$3_NameserverRecord as NameserverRecord, type index_d$3_NsRecord as NsRecord, type index_d$3_PointingRecords as PointingRecords, type index_d$3_PreCreateConnectedDomainRequest as PreCreateConnectedDomainRequest, type index_d$3_PreCreateConnectedDomainResponse as PreCreateConnectedDomainResponse, type index_d$3_Registrar as Registrar, type index_d$3_SubdomainRecords as SubdomainRecords, index_d$3_getConnectedDomainSetupInfo as getConnectedDomainSetupInfo };
|
|
1073
|
-
}
|
|
965
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
1074
966
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
967
|
+
@example
|
|
968
|
+
```
|
|
969
|
+
import type {EmptyObject} from 'type-fest';
|
|
970
|
+
|
|
971
|
+
// The following illustrates the problem with `{}`.
|
|
972
|
+
const foo1: {} = {}; // Pass
|
|
973
|
+
const foo2: {} = []; // Pass
|
|
974
|
+
const foo3: {} = 42; // Pass
|
|
975
|
+
const foo4: {} = {a: 1}; // Pass
|
|
976
|
+
|
|
977
|
+
// With `EmptyObject` only the first case is valid.
|
|
978
|
+
const bar1: EmptyObject = {}; // Pass
|
|
979
|
+
const bar2: EmptyObject = 42; // Fail
|
|
980
|
+
const bar3: EmptyObject = []; // Fail
|
|
981
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
985
|
+
|
|
986
|
+
@category Object
|
|
987
|
+
*/
|
|
988
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
Returns a boolean for whether the two given types are equal.
|
|
992
|
+
|
|
993
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
994
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
995
|
+
|
|
996
|
+
Use-cases:
|
|
997
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
998
|
+
|
|
999
|
+
@example
|
|
1000
|
+
```
|
|
1001
|
+
import type {IsEqual} from 'type-fest';
|
|
1002
|
+
|
|
1003
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1004
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1005
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1006
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1007
|
+
? IsEqual<Value[0], Item> extends true
|
|
1008
|
+
? true
|
|
1009
|
+
: Includes<rest, Item>
|
|
1010
|
+
: false;
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
@category Type Guard
|
|
1014
|
+
@category Utilities
|
|
1015
|
+
*/
|
|
1016
|
+
type IsEqual$3<A, B> =
|
|
1017
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1018
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1019
|
+
? true
|
|
1020
|
+
: false;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
Filter out keys from an object.
|
|
1024
|
+
|
|
1025
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1026
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1027
|
+
Returns `Key` otherwise.
|
|
1028
|
+
|
|
1029
|
+
@example
|
|
1030
|
+
```
|
|
1031
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1032
|
+
//=> never
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
@example
|
|
1036
|
+
```
|
|
1037
|
+
type Filtered = Filter<'bar', string>;
|
|
1038
|
+
//=> never
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
@example
|
|
1042
|
+
```
|
|
1043
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1044
|
+
//=> 'bar'
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
@see {Except}
|
|
1048
|
+
*/
|
|
1049
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1050
|
+
|
|
1051
|
+
type ExceptOptions$3 = {
|
|
1052
|
+
/**
|
|
1053
|
+
Disallow assigning non-specified properties.
|
|
1054
|
+
|
|
1055
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1056
|
+
|
|
1057
|
+
@default false
|
|
1058
|
+
*/
|
|
1059
|
+
requireExactProps?: boolean;
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
Create a type from an object type without certain keys.
|
|
1064
|
+
|
|
1065
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1066
|
+
|
|
1067
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
1068
|
+
|
|
1069
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
1070
|
+
|
|
1071
|
+
@example
|
|
1072
|
+
```
|
|
1073
|
+
import type {Except} from 'type-fest';
|
|
1074
|
+
|
|
1075
|
+
type Foo = {
|
|
1076
|
+
a: number;
|
|
1077
|
+
b: string;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1081
|
+
//=> {b: string}
|
|
1082
|
+
|
|
1083
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1084
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1085
|
+
|
|
1086
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1087
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1088
|
+
|
|
1089
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1090
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
@category Object
|
|
1094
|
+
*/
|
|
1095
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
1096
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1097
|
+
} & (Options['requireExactProps'] extends true
|
|
1098
|
+
? Partial<Record<KeysType, never>>
|
|
1099
|
+
: {});
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1103
|
+
|
|
1104
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1105
|
+
|
|
1106
|
+
@example
|
|
1107
|
+
```
|
|
1108
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1109
|
+
|
|
1110
|
+
interface Example {
|
|
1111
|
+
a: string;
|
|
1112
|
+
b: string | number;
|
|
1113
|
+
c?: string;
|
|
1114
|
+
d: {};
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1118
|
+
//=> 'a'
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1122
|
+
|
|
1123
|
+
@example
|
|
1124
|
+
```
|
|
1125
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1126
|
+
|
|
1127
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1128
|
+
//=> 'a' | 'c'
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
@category Object
|
|
1132
|
+
*/
|
|
1133
|
+
type ConditionalKeys$3<Base, Condition> = NonNullable<
|
|
1134
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1135
|
+
{
|
|
1136
|
+
// Map through all the keys of the given base type.
|
|
1137
|
+
[Key in keyof Base]:
|
|
1138
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1139
|
+
Base[Key] extends Condition
|
|
1140
|
+
// Retain this key since the condition passes.
|
|
1141
|
+
? Key
|
|
1142
|
+
// Discard this key since the condition fails.
|
|
1143
|
+
: never;
|
|
1144
|
+
|
|
1145
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1146
|
+
}[keyof Base]
|
|
1147
|
+
>;
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1151
|
+
|
|
1152
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
1153
|
+
|
|
1154
|
+
@example
|
|
1155
|
+
```
|
|
1156
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1157
|
+
|
|
1158
|
+
class Awesome {
|
|
1159
|
+
name: string;
|
|
1160
|
+
successes: number;
|
|
1161
|
+
failures: bigint;
|
|
1162
|
+
|
|
1163
|
+
run() {}
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1167
|
+
//=> {run: () => void}
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
@example
|
|
1171
|
+
```
|
|
1172
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1173
|
+
|
|
1174
|
+
interface Example {
|
|
1175
|
+
a: string;
|
|
1176
|
+
b: string | number;
|
|
1177
|
+
c: () => void;
|
|
1178
|
+
d: {};
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1182
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
@category Object
|
|
1186
|
+
*/
|
|
1187
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
1188
|
+
Base,
|
|
1189
|
+
ConditionalKeys$3<Base, Condition>
|
|
1190
|
+
>;
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1194
|
+
* can either be a REST module or a host module.
|
|
1195
|
+
* This type is recursive, so it can describe nested modules.
|
|
1196
|
+
*/
|
|
1197
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$3<any> | ServicePluginDefinition$3<any> | {
|
|
1198
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1202
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1203
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1204
|
+
* do not match the given host (as they will not work with the given host).
|
|
1205
|
+
*/
|
|
1206
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
1207
|
+
done: T;
|
|
1208
|
+
recurse: T extends {
|
|
1209
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
1210
|
+
} ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
|
|
1211
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
1212
|
+
-1,
|
|
1213
|
+
0,
|
|
1214
|
+
1,
|
|
1215
|
+
2,
|
|
1216
|
+
3,
|
|
1217
|
+
4,
|
|
1218
|
+
5
|
|
1219
|
+
][Depth]> : never;
|
|
1220
|
+
}, EmptyObject$3>;
|
|
1221
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1222
|
+
type PublicMetadata$3 = {
|
|
1223
|
+
PACKAGE_NAME?: string;
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
declare global {
|
|
1227
|
+
interface ContextualClient {
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1232
|
+
* case a contextual client is available.
|
|
1233
|
+
*/
|
|
1234
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
1235
|
+
host: Host$3;
|
|
1236
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* A `connectedDomainSetupInfo` object holds information the connected domain's
|
|
1240
|
+
* external registrar and some DNS records. You can use this information to guide
|
|
1241
|
+
* the site owner through the domain's setup process.
|
|
1242
|
+
*/
|
|
1243
|
+
interface ConnectedDomainSetupInfo extends ConnectedDomainSetupInfoDnsRecordsOneOf {
|
|
1244
|
+
/**
|
|
1245
|
+
* Information about domains connected using nameservers. Available only for
|
|
1246
|
+
* `{"connectionType": "NAMESERVERS"}`.
|
|
1247
|
+
*/
|
|
1248
|
+
nameserverRecord?: NameserverRecord;
|
|
1249
|
+
/**
|
|
1250
|
+
* Information about domains connected by pointing. Available only for
|
|
1251
|
+
* `{"connectionType": "POINTING"}`.
|
|
1252
|
+
* @readonly
|
|
1253
|
+
*/
|
|
1254
|
+
pointingRecords?: PointingRecords;
|
|
1255
|
+
/**
|
|
1256
|
+
* Information about subdomains. Available only for subdomains.
|
|
1257
|
+
* @readonly
|
|
1258
|
+
*/
|
|
1259
|
+
subdomainRecords?: SubdomainRecords;
|
|
1260
|
+
/** ID of the connected domain. Identical to the domain name including TLD. */
|
|
1261
|
+
connectedDomainId?: string;
|
|
1262
|
+
/**
|
|
1263
|
+
* Information about the external domain registrar including current name
|
|
1264
|
+
* servers.
|
|
1265
|
+
*/
|
|
1266
|
+
registrar?: Registrar;
|
|
1267
|
+
}
|
|
1268
|
+
/** @oneof */
|
|
1269
|
+
interface ConnectedDomainSetupInfoDnsRecordsOneOf {
|
|
1270
|
+
/**
|
|
1271
|
+
* Information about domains connected using nameservers. Available only for
|
|
1272
|
+
* `{"connectionType": "NAMESERVERS"}`.
|
|
1273
|
+
*/
|
|
1274
|
+
nameserverRecord?: NameserverRecord;
|
|
1275
|
+
/**
|
|
1276
|
+
* Information about domains connected by pointing. Available only for
|
|
1277
|
+
* `{"connectionType": "POINTING"}`.
|
|
1278
|
+
* @readonly
|
|
1279
|
+
*/
|
|
1280
|
+
pointingRecords?: PointingRecords;
|
|
1281
|
+
/**
|
|
1282
|
+
* Information about subdomains. Available only for subdomains.
|
|
1283
|
+
* @readonly
|
|
1284
|
+
*/
|
|
1285
|
+
subdomainRecords?: SubdomainRecords;
|
|
1286
|
+
}
|
|
1287
|
+
interface Registrar {
|
|
1288
|
+
/**
|
|
1289
|
+
* Name of the external domain registrar. For subdomains it's the registrar of the root domain.
|
|
1290
|
+
* @readonly
|
|
1291
|
+
*/
|
|
1292
|
+
name?: string | null;
|
|
1293
|
+
/**
|
|
1294
|
+
* Values of the current name server records. In case you connect an external
|
|
1295
|
+
* domain using name servers, site owners must replace these current name servers
|
|
1296
|
+
* with the new name servers found in `connectedDomainSetupInfo.nameserverRecord.nsRecord.values`
|
|
1297
|
+
* during the initial domain setup.
|
|
1298
|
+
* The replacement can't be performed through Wix APIs, you must use the
|
|
1299
|
+
* infrastructure of the external domain registrar. Read more about
|
|
1300
|
+
* [connecting domains using nameservers](https://dev.wix.com/api/rest/account-level-apis/connected-domains/sample-flows#account-level-apis_connected-domains_sample-flows_connect-an-external-domain-using-nameservers).
|
|
1301
|
+
* @readonly
|
|
1302
|
+
*/
|
|
1303
|
+
nameServers?: string[];
|
|
1304
|
+
}
|
|
1305
|
+
/** Information about domains connected by nameservers. */
|
|
1306
|
+
interface NameserverRecord {
|
|
1307
|
+
/**
|
|
1308
|
+
* Default [nameserver record](https://en.wikipedia.org/wiki/List_of_DNS_record_types#NS).
|
|
1309
|
+
* @readonly
|
|
1310
|
+
*/
|
|
1311
|
+
nsRecord?: NsRecord;
|
|
1312
|
+
}
|
|
1313
|
+
interface NsRecord {
|
|
1314
|
+
/** Domain host name. For example `domain.com` or `mail.domain.com`. Can be a subdomain. */
|
|
1315
|
+
hostName?: string;
|
|
1316
|
+
/** [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. */
|
|
1317
|
+
ttl?: number;
|
|
1318
|
+
/** DNS record values. */
|
|
1319
|
+
values?: string[];
|
|
1320
|
+
}
|
|
1321
|
+
/** Information about domains connected by pointing. */
|
|
1322
|
+
interface PointingRecords {
|
|
1323
|
+
/**
|
|
1324
|
+
* [Address record](https://en.wikipedia.org/wiki/List_of_DNS_record_types#A).
|
|
1325
|
+
* @readonly
|
|
1326
|
+
*/
|
|
1327
|
+
aRecord?: ARecord;
|
|
1328
|
+
/**
|
|
1329
|
+
* [Canonical Name record](https://en.wikipedia.org/wiki/CNAME_record).
|
|
1330
|
+
* @readonly
|
|
1331
|
+
*/
|
|
1332
|
+
cnameRecord?: CnameRecord;
|
|
1333
|
+
}
|
|
1334
|
+
interface ARecord {
|
|
1335
|
+
/** Domain host name. For example `domain.com` or `mail.domain.com`. Can be a subdomain. */
|
|
1336
|
+
hostName?: string;
|
|
1337
|
+
/** [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. */
|
|
1338
|
+
ttl?: number;
|
|
1339
|
+
/** DNS record values. */
|
|
1340
|
+
values?: string[];
|
|
1341
|
+
}
|
|
1342
|
+
interface CnameRecord {
|
|
1343
|
+
/** Domain host name. For example `domain.com` or `mail.domain.com`. Can be a subdomain. */
|
|
1344
|
+
hostName?: string;
|
|
1345
|
+
/** [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. */
|
|
1346
|
+
ttl?: number;
|
|
1347
|
+
/** DNS record value. */
|
|
1348
|
+
value?: string;
|
|
1349
|
+
}
|
|
1350
|
+
/** Information about subdomains. */
|
|
1351
|
+
interface SubdomainRecords {
|
|
1352
|
+
/**
|
|
1353
|
+
* [Canonical Name records](https://en.wikipedia.org/wiki/CNAME_record).
|
|
1354
|
+
* @readonly
|
|
1355
|
+
*/
|
|
1356
|
+
cnameRecords?: CnameRecord[];
|
|
1357
|
+
}
|
|
1358
|
+
interface GetSetupInfoRequest {
|
|
1359
|
+
/** Domain name including TLD */
|
|
1360
|
+
domain?: string;
|
|
1361
|
+
/**
|
|
1362
|
+
* How the domain should be to connected the Wix site.
|
|
1363
|
+
*
|
|
1364
|
+
* + `"UNKNOWN_CONNECTION_TYPE"`: supported only for subdomain.
|
|
1365
|
+
* + `"POINTING"`: Get domain or subdomain setup by pointing
|
|
1366
|
+
* + `"NAMESERVERS"`: Get domain setup by nameservers
|
|
1367
|
+
* + `"HIDDEN"`: supported only for subdomain.
|
|
1368
|
+
*/
|
|
1369
|
+
connectionType?: ConnectionType;
|
|
1370
|
+
/** Whether to return registrar information or not. Default is false. */
|
|
1371
|
+
includeRegistrar?: boolean;
|
|
1372
|
+
}
|
|
1373
|
+
declare enum ConnectionType {
|
|
1374
|
+
/** Used by sub domain */
|
|
1375
|
+
UNKNOWN_CONNECTION_TYPE = "UNKNOWN_CONNECTION_TYPE",
|
|
1376
|
+
POINTING = "POINTING",
|
|
1377
|
+
NAMESERVERS = "NAMESERVERS",
|
|
1378
|
+
/**
|
|
1379
|
+
* internal used by photography company.
|
|
1380
|
+
* when a customer creates a photo album, each album has its sub domain and this sub domain
|
|
1381
|
+
* is not visible in my domains page.
|
|
1382
|
+
*/
|
|
1383
|
+
HIDDEN = "HIDDEN"
|
|
1384
|
+
}
|
|
1385
|
+
interface GetSetupInfoResponse {
|
|
1386
|
+
/** Retrieved setup information. */
|
|
1387
|
+
domainSetupInfo?: ConnectedDomainSetupInfo;
|
|
1388
|
+
}
|
|
1389
|
+
interface PreCreateConnectedDomainRequest {
|
|
1390
|
+
/** Domain name including TLD */
|
|
1391
|
+
domain?: string;
|
|
1392
|
+
}
|
|
1393
|
+
interface PreCreateConnectedDomainResponse {
|
|
1394
|
+
}
|
|
1395
|
+
interface GetConnectedDomainSetupInfoRequest {
|
|
1396
|
+
/**
|
|
1397
|
+
* ID of the connected domain to retrieve setup information for.
|
|
1398
|
+
* Identical to the domain name including TLD.
|
|
1399
|
+
*/
|
|
1400
|
+
connectedDomainId: string;
|
|
1401
|
+
}
|
|
1402
|
+
interface GetConnectedDomainSetupInfoResponse {
|
|
1403
|
+
/** Retrieved setup information. */
|
|
1404
|
+
connectedDomainSetupInfo?: ConnectedDomainSetupInfo;
|
|
1405
|
+
}
|
|
1406
|
+
interface NsRecordNonNullableFields {
|
|
1407
|
+
hostName: string;
|
|
1408
|
+
ttl: number;
|
|
1409
|
+
values: string[];
|
|
1410
|
+
}
|
|
1411
|
+
interface NameserverRecordNonNullableFields {
|
|
1412
|
+
nsRecord?: NsRecordNonNullableFields;
|
|
1413
|
+
}
|
|
1414
|
+
interface ARecordNonNullableFields {
|
|
1415
|
+
hostName: string;
|
|
1416
|
+
ttl: number;
|
|
1417
|
+
values: string[];
|
|
1418
|
+
}
|
|
1419
|
+
interface CnameRecordNonNullableFields {
|
|
1420
|
+
hostName: string;
|
|
1421
|
+
ttl: number;
|
|
1422
|
+
value: string;
|
|
1423
|
+
}
|
|
1424
|
+
interface PointingRecordsNonNullableFields {
|
|
1425
|
+
aRecord?: ARecordNonNullableFields;
|
|
1426
|
+
cnameRecord?: CnameRecordNonNullableFields;
|
|
1427
|
+
}
|
|
1428
|
+
interface SubdomainRecordsNonNullableFields {
|
|
1429
|
+
cnameRecords: CnameRecordNonNullableFields[];
|
|
1430
|
+
}
|
|
1431
|
+
interface RegistrarNonNullableFields {
|
|
1432
|
+
nameServers: string[];
|
|
1433
|
+
}
|
|
1434
|
+
interface ConnectedDomainSetupInfoNonNullableFields {
|
|
1435
|
+
nameserverRecord?: NameserverRecordNonNullableFields;
|
|
1436
|
+
pointingRecords?: PointingRecordsNonNullableFields;
|
|
1437
|
+
subdomainRecords?: SubdomainRecordsNonNullableFields;
|
|
1438
|
+
connectedDomainId: string;
|
|
1439
|
+
registrar?: RegistrarNonNullableFields;
|
|
1440
|
+
}
|
|
1441
|
+
interface GetConnectedDomainSetupInfoResponseNonNullableFields {
|
|
1442
|
+
connectedDomainSetupInfo?: ConnectedDomainSetupInfoNonNullableFields;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
declare function getConnectedDomainSetupInfo$1(httpClient: HttpClient$3): GetConnectedDomainSetupInfoSignature;
|
|
1446
|
+
interface GetConnectedDomainSetupInfoSignature {
|
|
1447
|
+
/**
|
|
1448
|
+
* Retrieves information for the initial setup of a connected domain.
|
|
1449
|
+
*
|
|
1450
|
+
*
|
|
1451
|
+
* You must pass the relevant Wix account ID in the header of the call.
|
|
1452
|
+
*
|
|
1453
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1454
|
+
* @param - ID of the connected domain to retrieve setup information for.
|
|
1455
|
+
* Identical to the domain name including TLD.
|
|
1456
|
+
*/
|
|
1457
|
+
(connectedDomainId: string): Promise<GetConnectedDomainSetupInfoResponse & GetConnectedDomainSetupInfoResponseNonNullableFields>;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
declare const getConnectedDomainSetupInfo: MaybeContext$3<BuildRESTFunction$3<typeof getConnectedDomainSetupInfo$1> & typeof getConnectedDomainSetupInfo$1>;
|
|
1461
|
+
|
|
1462
|
+
type index_d$3_ARecord = ARecord;
|
|
1463
|
+
type index_d$3_CnameRecord = CnameRecord;
|
|
1464
|
+
type index_d$3_ConnectedDomainSetupInfo = ConnectedDomainSetupInfo;
|
|
1465
|
+
type index_d$3_ConnectedDomainSetupInfoDnsRecordsOneOf = ConnectedDomainSetupInfoDnsRecordsOneOf;
|
|
1466
|
+
type index_d$3_ConnectionType = ConnectionType;
|
|
1467
|
+
declare const index_d$3_ConnectionType: typeof ConnectionType;
|
|
1468
|
+
type index_d$3_GetConnectedDomainSetupInfoRequest = GetConnectedDomainSetupInfoRequest;
|
|
1469
|
+
type index_d$3_GetConnectedDomainSetupInfoResponse = GetConnectedDomainSetupInfoResponse;
|
|
1470
|
+
type index_d$3_GetConnectedDomainSetupInfoResponseNonNullableFields = GetConnectedDomainSetupInfoResponseNonNullableFields;
|
|
1471
|
+
type index_d$3_GetSetupInfoRequest = GetSetupInfoRequest;
|
|
1472
|
+
type index_d$3_GetSetupInfoResponse = GetSetupInfoResponse;
|
|
1473
|
+
type index_d$3_NameserverRecord = NameserverRecord;
|
|
1474
|
+
type index_d$3_NsRecord = NsRecord;
|
|
1475
|
+
type index_d$3_PointingRecords = PointingRecords;
|
|
1476
|
+
type index_d$3_PreCreateConnectedDomainRequest = PreCreateConnectedDomainRequest;
|
|
1477
|
+
type index_d$3_PreCreateConnectedDomainResponse = PreCreateConnectedDomainResponse;
|
|
1478
|
+
type index_d$3_Registrar = Registrar;
|
|
1479
|
+
type index_d$3_SubdomainRecords = SubdomainRecords;
|
|
1480
|
+
declare const index_d$3_getConnectedDomainSetupInfo: typeof getConnectedDomainSetupInfo;
|
|
1481
|
+
declare namespace index_d$3 {
|
|
1482
|
+
export { type index_d$3_ARecord as ARecord, type index_d$3_CnameRecord as CnameRecord, type index_d$3_ConnectedDomainSetupInfo as ConnectedDomainSetupInfo, type index_d$3_ConnectedDomainSetupInfoDnsRecordsOneOf as ConnectedDomainSetupInfoDnsRecordsOneOf, index_d$3_ConnectionType as ConnectionType, type index_d$3_GetConnectedDomainSetupInfoRequest as GetConnectedDomainSetupInfoRequest, type index_d$3_GetConnectedDomainSetupInfoResponse as GetConnectedDomainSetupInfoResponse, type index_d$3_GetConnectedDomainSetupInfoResponseNonNullableFields as GetConnectedDomainSetupInfoResponseNonNullableFields, type index_d$3_GetSetupInfoRequest as GetSetupInfoRequest, type index_d$3_GetSetupInfoResponse as GetSetupInfoResponse, type index_d$3_NameserverRecord as NameserverRecord, type index_d$3_NsRecord as NsRecord, type index_d$3_PointingRecords as PointingRecords, type index_d$3_PreCreateConnectedDomainRequest as PreCreateConnectedDomainRequest, type index_d$3_PreCreateConnectedDomainResponse as PreCreateConnectedDomainResponse, type index_d$3_Registrar as Registrar, type index_d$3_SubdomainRecords as SubdomainRecords, index_d$3_getConnectedDomainSetupInfo as getConnectedDomainSetupInfo };
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
1486
|
+
__type: 'host';
|
|
1487
|
+
create(host: H): T;
|
|
1488
|
+
};
|
|
1489
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
1490
|
+
type Host$2<Environment = unknown> = {
|
|
1491
|
+
channel: {
|
|
1492
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1493
|
+
disconnect: () => void;
|
|
1494
|
+
} | Promise<{
|
|
1495
|
+
disconnect: () => void;
|
|
1496
|
+
}>;
|
|
1497
|
+
};
|
|
1498
|
+
environment?: Environment;
|
|
1499
|
+
/**
|
|
1500
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1501
|
+
*/
|
|
1502
|
+
apiBaseUrl?: string;
|
|
1503
|
+
/**
|
|
1504
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1505
|
+
* like internationalization, billing, etc.
|
|
1506
|
+
*/
|
|
1507
|
+
essentials?: {
|
|
1508
|
+
/**
|
|
1509
|
+
* The language of the currently viewed session
|
|
1510
|
+
*/
|
|
1511
|
+
language?: string;
|
|
1512
|
+
/**
|
|
1513
|
+
* The locale of the currently viewed session
|
|
1514
|
+
*/
|
|
1515
|
+
locale?: string;
|
|
1516
|
+
/**
|
|
1517
|
+
* Any headers that should be passed through to the API requests
|
|
1518
|
+
*/
|
|
1519
|
+
passThroughHeaders?: Record<string, string>;
|
|
1520
|
+
};
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
1524
|
+
interface HttpClient$2 {
|
|
1525
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
1526
|
+
fetchWithAuth: typeof fetch;
|
|
1527
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1528
|
+
getActiveToken?: () => string | undefined;
|
|
1529
|
+
}
|
|
1530
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
1531
|
+
type HttpResponse$2<T = any> = {
|
|
1532
|
+
data: T;
|
|
1533
|
+
status: number;
|
|
1534
|
+
statusText: string;
|
|
1535
|
+
headers: any;
|
|
1536
|
+
request?: any;
|
|
1537
|
+
};
|
|
1538
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
1539
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1540
|
+
url: string;
|
|
1541
|
+
data?: Data;
|
|
1542
|
+
params?: URLSearchParams;
|
|
1543
|
+
} & APIMetadata$2;
|
|
1544
|
+
type APIMetadata$2 = {
|
|
1545
|
+
methodFqn?: string;
|
|
1546
|
+
entityFqdn?: string;
|
|
1547
|
+
packageName?: string;
|
|
1548
|
+
};
|
|
1549
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
1550
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
1551
|
+
__type: 'event-definition';
|
|
1552
|
+
type: Type;
|
|
1553
|
+
isDomainEvent?: boolean;
|
|
1554
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1555
|
+
__payload: Payload;
|
|
1556
|
+
};
|
|
1557
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
1558
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
1559
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
1560
|
+
|
|
1561
|
+
type ServicePluginMethodInput$2 = {
|
|
1562
|
+
request: any;
|
|
1563
|
+
metadata: any;
|
|
1564
|
+
};
|
|
1565
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
1566
|
+
type ServicePluginMethodMetadata$2 = {
|
|
1567
|
+
name: string;
|
|
1568
|
+
primaryHttpMappingPath: string;
|
|
1569
|
+
transformations: {
|
|
1570
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
1571
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1572
|
+
};
|
|
1573
|
+
};
|
|
1574
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
1575
|
+
__type: 'service-plugin-definition';
|
|
1576
|
+
componentType: string;
|
|
1577
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
1578
|
+
__contract: Contract;
|
|
1579
|
+
};
|
|
1580
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
1581
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
1582
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
1583
|
+
|
|
1584
|
+
type RequestContext$2 = {
|
|
1585
|
+
isSSR: boolean;
|
|
1586
|
+
host: string;
|
|
1587
|
+
protocol?: string;
|
|
1588
|
+
};
|
|
1589
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
1590
|
+
/**
|
|
1591
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1592
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1593
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1594
|
+
*/
|
|
1595
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1596
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
1597
|
+
_?: T;
|
|
1598
|
+
url?: string;
|
|
1599
|
+
method?: Method$2;
|
|
1600
|
+
params?: any;
|
|
1601
|
+
data?: any;
|
|
1602
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
1603
|
+
};
|
|
1604
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
1605
|
+
__isAmbassador: boolean;
|
|
1606
|
+
};
|
|
1607
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
1608
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1609
|
+
|
|
1610
|
+
declare global {
|
|
1611
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1612
|
+
interface SymbolConstructor {
|
|
1613
|
+
readonly observable: symbol;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1621
|
+
|
|
1622
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
1623
|
+
|
|
1624
|
+
@example
|
|
1625
|
+
```
|
|
1626
|
+
import type {EmptyObject} from 'type-fest';
|
|
1627
|
+
|
|
1628
|
+
// The following illustrates the problem with `{}`.
|
|
1629
|
+
const foo1: {} = {}; // Pass
|
|
1630
|
+
const foo2: {} = []; // Pass
|
|
1631
|
+
const foo3: {} = 42; // Pass
|
|
1632
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1633
|
+
|
|
1634
|
+
// With `EmptyObject` only the first case is valid.
|
|
1635
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1636
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1637
|
+
const bar3: EmptyObject = []; // Fail
|
|
1638
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1639
|
+
```
|
|
1640
|
+
|
|
1641
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
1642
|
+
|
|
1643
|
+
@category Object
|
|
1644
|
+
*/
|
|
1645
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
Returns a boolean for whether the two given types are equal.
|
|
1649
|
+
|
|
1650
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1651
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1652
|
+
|
|
1653
|
+
Use-cases:
|
|
1654
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1655
|
+
|
|
1656
|
+
@example
|
|
1657
|
+
```
|
|
1658
|
+
import type {IsEqual} from 'type-fest';
|
|
1659
|
+
|
|
1660
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1661
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1662
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1663
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1664
|
+
? IsEqual<Value[0], Item> extends true
|
|
1665
|
+
? true
|
|
1666
|
+
: Includes<rest, Item>
|
|
1667
|
+
: false;
|
|
1668
|
+
```
|
|
1669
|
+
|
|
1670
|
+
@category Type Guard
|
|
1671
|
+
@category Utilities
|
|
1672
|
+
*/
|
|
1673
|
+
type IsEqual$2<A, B> =
|
|
1674
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1675
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1676
|
+
? true
|
|
1677
|
+
: false;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
Filter out keys from an object.
|
|
1681
|
+
|
|
1682
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1683
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1684
|
+
Returns `Key` otherwise.
|
|
1685
|
+
|
|
1686
|
+
@example
|
|
1687
|
+
```
|
|
1688
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1689
|
+
//=> never
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
@example
|
|
1693
|
+
```
|
|
1694
|
+
type Filtered = Filter<'bar', string>;
|
|
1695
|
+
//=> never
|
|
1696
|
+
```
|
|
1697
|
+
|
|
1698
|
+
@example
|
|
1699
|
+
```
|
|
1700
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1701
|
+
//=> 'bar'
|
|
1702
|
+
```
|
|
1703
|
+
|
|
1704
|
+
@see {Except}
|
|
1705
|
+
*/
|
|
1706
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1707
|
+
|
|
1708
|
+
type ExceptOptions$2 = {
|
|
1709
|
+
/**
|
|
1710
|
+
Disallow assigning non-specified properties.
|
|
1711
|
+
|
|
1712
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1713
|
+
|
|
1714
|
+
@default false
|
|
1715
|
+
*/
|
|
1716
|
+
requireExactProps?: boolean;
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
Create a type from an object type without certain keys.
|
|
1721
|
+
|
|
1722
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1723
|
+
|
|
1724
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
1725
|
+
|
|
1726
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
1727
|
+
|
|
1728
|
+
@example
|
|
1729
|
+
```
|
|
1730
|
+
import type {Except} from 'type-fest';
|
|
1731
|
+
|
|
1732
|
+
type Foo = {
|
|
1733
|
+
a: number;
|
|
1734
|
+
b: string;
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1738
|
+
//=> {b: string}
|
|
1739
|
+
|
|
1740
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1741
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1742
|
+
|
|
1743
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1744
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1745
|
+
|
|
1746
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1747
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1748
|
+
```
|
|
1749
|
+
|
|
1750
|
+
@category Object
|
|
1751
|
+
*/
|
|
1752
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
1753
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1754
|
+
} & (Options['requireExactProps'] extends true
|
|
1755
|
+
? Partial<Record<KeysType, never>>
|
|
1756
|
+
: {});
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1760
|
+
|
|
1761
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1762
|
+
|
|
1763
|
+
@example
|
|
1764
|
+
```
|
|
1765
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1766
|
+
|
|
1767
|
+
interface Example {
|
|
1768
|
+
a: string;
|
|
1769
|
+
b: string | number;
|
|
1770
|
+
c?: string;
|
|
1771
|
+
d: {};
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1775
|
+
//=> 'a'
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1779
|
+
|
|
1780
|
+
@example
|
|
1781
|
+
```
|
|
1782
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1783
|
+
|
|
1784
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1785
|
+
//=> 'a' | 'c'
|
|
1786
|
+
```
|
|
1787
|
+
|
|
1788
|
+
@category Object
|
|
1789
|
+
*/
|
|
1790
|
+
type ConditionalKeys$2<Base, Condition> = NonNullable<
|
|
1791
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1792
|
+
{
|
|
1793
|
+
// Map through all the keys of the given base type.
|
|
1794
|
+
[Key in keyof Base]:
|
|
1795
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1796
|
+
Base[Key] extends Condition
|
|
1797
|
+
// Retain this key since the condition passes.
|
|
1798
|
+
? Key
|
|
1799
|
+
// Discard this key since the condition fails.
|
|
1800
|
+
: never;
|
|
1801
|
+
|
|
1802
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1803
|
+
}[keyof Base]
|
|
1804
|
+
>;
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1808
|
+
|
|
1809
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
1810
|
+
|
|
1811
|
+
@example
|
|
1812
|
+
```
|
|
1813
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1814
|
+
|
|
1815
|
+
class Awesome {
|
|
1816
|
+
name: string;
|
|
1817
|
+
successes: number;
|
|
1818
|
+
failures: bigint;
|
|
1819
|
+
|
|
1820
|
+
run() {}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1824
|
+
//=> {run: () => void}
|
|
1825
|
+
```
|
|
1826
|
+
|
|
1827
|
+
@example
|
|
1828
|
+
```
|
|
1829
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1830
|
+
|
|
1831
|
+
interface Example {
|
|
1832
|
+
a: string;
|
|
1833
|
+
b: string | number;
|
|
1834
|
+
c: () => void;
|
|
1835
|
+
d: {};
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1839
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1840
|
+
```
|
|
1841
|
+
|
|
1842
|
+
@category Object
|
|
1843
|
+
*/
|
|
1844
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
1845
|
+
Base,
|
|
1846
|
+
ConditionalKeys$2<Base, Condition>
|
|
1847
|
+
>;
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1851
|
+
* can either be a REST module or a host module.
|
|
1852
|
+
* This type is recursive, so it can describe nested modules.
|
|
1853
|
+
*/
|
|
1854
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$2<any> | ServicePluginDefinition$2<any> | {
|
|
1855
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
1856
|
+
};
|
|
1857
|
+
/**
|
|
1858
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1859
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1860
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1861
|
+
* do not match the given host (as they will not work with the given host).
|
|
1862
|
+
*/
|
|
1863
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
1864
|
+
done: T;
|
|
1865
|
+
recurse: T extends {
|
|
1866
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
1867
|
+
} ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
|
|
1868
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
1869
|
+
-1,
|
|
1870
|
+
0,
|
|
1871
|
+
1,
|
|
1872
|
+
2,
|
|
1873
|
+
3,
|
|
1874
|
+
4,
|
|
1875
|
+
5
|
|
1876
|
+
][Depth]> : never;
|
|
1877
|
+
}, EmptyObject$2>;
|
|
1878
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1879
|
+
type PublicMetadata$2 = {
|
|
1880
|
+
PACKAGE_NAME?: string;
|
|
1881
|
+
};
|
|
1882
|
+
|
|
1883
|
+
declare global {
|
|
1884
|
+
interface ContextualClient {
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1889
|
+
* case a contextual client is available.
|
|
1890
|
+
*/
|
|
1891
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
1892
|
+
host: Host$2;
|
|
1893
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
1894
|
+
|
|
1895
|
+
/** DNS zones hold information about the records that map a domain's URL to an IP address. */
|
|
1896
|
+
interface DnsZone {
|
|
1897
|
+
/** Domain name including the TLD. Both root domains and subdomains are supported. */
|
|
1898
|
+
domainName?: string;
|
|
1899
|
+
/**
|
|
1900
|
+
* DNS records. You can only set up a single `record` object per DNS record
|
|
1901
|
+
* type. If you want to specify multiple values for the same record type, you
|
|
1902
|
+
* must save them in the `values` for the relevant type.
|
|
1903
|
+
*
|
|
1904
|
+
* Min: 2 DNS record - a DNS zone file has to have at least two required DNS records: NS and SOA records
|
|
1905
|
+
* Max: 5000 DNS records
|
|
1906
|
+
*/
|
|
1907
|
+
records?: DnsRecord[];
|
|
1908
|
+
/**
|
|
1909
|
+
* ID of the Dns Zone. Identical to the domain name including TLD.
|
|
1910
|
+
* @readonly
|
|
1911
|
+
*/
|
|
1912
|
+
_id?: string;
|
|
1913
|
+
/**
|
|
1914
|
+
* Whether [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions)
|
|
1915
|
+
* are enabled.
|
|
1916
|
+
*
|
|
1917
|
+
* Default: `false`
|
|
1918
|
+
*/
|
|
1919
|
+
dnssecEnabled?: boolean;
|
|
1920
|
+
/**
|
|
1921
|
+
* Information about [DNSSEC](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions).
|
|
1922
|
+
* Available only if `{"dnssecEnabled": true}`.
|
|
1923
|
+
* @readonly
|
|
1924
|
+
*/
|
|
1925
|
+
dnssecInfo?: DnssecInfo;
|
|
1926
|
+
}
|
|
1927
|
+
interface DnsRecord {
|
|
1928
|
+
/**
|
|
1929
|
+
* [DNS record type](https://en.wikipedia.org/wiki/List_of_DNS_record_types).
|
|
1930
|
+
*
|
|
1931
|
+
* + `UNKNOWN`: Default value. Used in case the record type isn't known. You can't set a record type to `UNKNOWN`.
|
|
1932
|
+
* + `A`: Address record. Most fundamental type of DNS record that indicates the IP address of a given domain.
|
|
1933
|
+
* + `AAAA`: Address record in [IPv6 format](https://en.wikipedia.org/wiki/IPv6).
|
|
1934
|
+
* + `NS`: Name server record. Describes which server contains the actual DNS record.
|
|
1935
|
+
* + `SOA`: [Start of authority record](https://en.wikipedia.org/wiki/SOA_record). Holds adminstrative information about the zone.
|
|
1936
|
+
* + `CNAME`: [CNAME record](https://en.wikipedia.org/wiki/CNAME_record). Maps an alias name to the canonical domain name.
|
|
1937
|
+
* + `MX`: MX record. Directs emails to mail servers.
|
|
1938
|
+
* + `TXT`: [TXT record](https://en.wikipedia.org/wiki/TXT_record). Used by domain admins to add human readable descriptions.
|
|
1939
|
+
* + `SPF`: SPF record. Used for email authentication.
|
|
1940
|
+
* + `SRV`: [Service record](https://en.wikipedia.org/wiki/SRV_record). Defines the server location.
|
|
1941
|
+
* + `PTR`: Pointer record. Specifies which host is supported for a given IP address.
|
|
1942
|
+
* + `NAPTR`: [Name Authority Pointer record](https://en.wikipedia.org/wiki/NAPTR_record). Used by Internet telephony applications.
|
|
1943
|
+
*/
|
|
1944
|
+
type?: RecordType;
|
|
1945
|
+
/**
|
|
1946
|
+
* Host name. Can be a subdomain. For example, `domain.com` or
|
|
1947
|
+
* `mail.domain.com`. Equal to the domain name, except for `CNAME` records.
|
|
1948
|
+
*/
|
|
1949
|
+
hostName?: string;
|
|
1950
|
+
/** [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. */
|
|
1951
|
+
ttl?: number;
|
|
1952
|
+
/**
|
|
1953
|
+
* DNS record values. Wix limits DNS records to 50 values per type. External
|
|
1954
|
+
* providers may support a different maximum number of DNS records for a
|
|
1955
|
+
* specific type, Wix doesn't validate that you don't exceed these external
|
|
1956
|
+
* limits.
|
|
1957
|
+
*
|
|
1958
|
+
* Max: 50 records
|
|
1959
|
+
*/
|
|
1960
|
+
values?: string[];
|
|
1961
|
+
}
|
|
1962
|
+
declare enum RecordType {
|
|
1963
|
+
UNKNOWN = "UNKNOWN",
|
|
1964
|
+
A = "A",
|
|
1965
|
+
AAAA = "AAAA",
|
|
1966
|
+
NS = "NS",
|
|
1967
|
+
SOA = "SOA",
|
|
1968
|
+
CNAME = "CNAME",
|
|
1969
|
+
MX = "MX",
|
|
1970
|
+
TXT = "TXT",
|
|
1971
|
+
SPF = "SPF",
|
|
1972
|
+
SRV = "SRV",
|
|
1973
|
+
PTR = "PTR",
|
|
1974
|
+
NAPTR = "NAPTR"
|
|
1975
|
+
}
|
|
1976
|
+
interface DnssecInfo {
|
|
1977
|
+
/**
|
|
1978
|
+
* Unique 16-bit identifier for a [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys)
|
|
1979
|
+
* record that allows efficient DNSSEC validation in zones with multiple keys.
|
|
1980
|
+
*/
|
|
1981
|
+
keyTag?: number;
|
|
1982
|
+
/**
|
|
1983
|
+
* Cryptographic hash of the [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys)
|
|
1984
|
+
* record that's included in the delegation signer (DS) record and ensures secure
|
|
1985
|
+
* DNSSEC validation.
|
|
1986
|
+
*/
|
|
1987
|
+
digest?: string;
|
|
1988
|
+
}
|
|
1989
|
+
interface DnsRecordsChangedEvent {
|
|
1990
|
+
domainName?: string;
|
|
1991
|
+
changeTime?: Date;
|
|
1992
|
+
}
|
|
1993
|
+
interface DomainRemovedEvent {
|
|
1994
|
+
/**
|
|
1995
|
+
* Domain name including TLD.
|
|
1996
|
+
* Both root domains and subdomains are supported.
|
|
1997
|
+
*/
|
|
1998
|
+
domain?: string;
|
|
1999
|
+
}
|
|
2000
|
+
interface CreateDnsZoneRequest {
|
|
2001
|
+
/** DNS zone to create. */
|
|
2002
|
+
dnsZone: DnsZone;
|
|
2003
|
+
}
|
|
2004
|
+
interface CreateDnsZoneResponse {
|
|
2005
|
+
/** Created DNS zone. */
|
|
2006
|
+
dnsZone?: DnsZone;
|
|
2007
|
+
}
|
|
2008
|
+
interface GetDnsZoneRequest {
|
|
2009
|
+
/** Domain to retrieve the DNS zone for. */
|
|
2010
|
+
domainName: string;
|
|
2011
|
+
}
|
|
2012
|
+
interface GetDnsZoneResponse {
|
|
2013
|
+
/** Retrieved DNS zone. */
|
|
2014
|
+
dnsZone?: DnsZone;
|
|
2015
|
+
}
|
|
2016
|
+
interface UpdateDnsZoneRequest {
|
|
2017
|
+
/** Domain to update the DNS zone for. Must include the TLD. */
|
|
2018
|
+
domainName: string;
|
|
2019
|
+
/**
|
|
2020
|
+
* DNS records to add to the DNS zone.
|
|
2021
|
+
*
|
|
2022
|
+
* Max: 10 additions
|
|
1203
2023
|
*/
|
|
1204
2024
|
additions?: DnsRecord[];
|
|
1205
2025
|
/**
|
|
@@ -1349,250 +2169,1070 @@ interface DnsRecordNonNullableFields {
|
|
|
1349
2169
|
ttl: number;
|
|
1350
2170
|
values: string[];
|
|
1351
2171
|
}
|
|
1352
|
-
interface DnssecInfoNonNullableFields {
|
|
1353
|
-
keyTag: number;
|
|
1354
|
-
digest: string;
|
|
2172
|
+
interface DnssecInfoNonNullableFields {
|
|
2173
|
+
keyTag: number;
|
|
2174
|
+
digest: string;
|
|
2175
|
+
}
|
|
2176
|
+
interface DnsZoneNonNullableFields {
|
|
2177
|
+
domainName: string;
|
|
2178
|
+
records: DnsRecordNonNullableFields[];
|
|
2179
|
+
_id: string;
|
|
2180
|
+
dnssecEnabled: boolean;
|
|
2181
|
+
dnssecInfo?: DnssecInfoNonNullableFields;
|
|
2182
|
+
}
|
|
2183
|
+
interface CreateDnsZoneResponseNonNullableFields {
|
|
2184
|
+
dnsZone?: DnsZoneNonNullableFields;
|
|
2185
|
+
}
|
|
2186
|
+
interface GetDnsZoneResponseNonNullableFields {
|
|
2187
|
+
dnsZone?: DnsZoneNonNullableFields;
|
|
2188
|
+
}
|
|
2189
|
+
interface UpdateDnsZoneResponseNonNullableFields {
|
|
2190
|
+
dnsZone?: DnsZoneNonNullableFields;
|
|
2191
|
+
}
|
|
2192
|
+
interface PreviewDnsZoneResponseNonNullableFields {
|
|
2193
|
+
dnsZone?: DnsZoneNonNullableFields;
|
|
2194
|
+
}
|
|
2195
|
+
interface UpdateDnsZoneOptions {
|
|
2196
|
+
/**
|
|
2197
|
+
* DNS records to add to the DNS zone.
|
|
2198
|
+
*
|
|
2199
|
+
* Max: 10 additions
|
|
2200
|
+
*/
|
|
2201
|
+
additions?: DnsRecord[];
|
|
2202
|
+
/**
|
|
2203
|
+
* DNS records to remove from the DNS zone.
|
|
2204
|
+
*
|
|
2205
|
+
* Max: 10 deletions
|
|
2206
|
+
*/
|
|
2207
|
+
deletions?: DnsRecord[];
|
|
2208
|
+
/** Whether you want to enable or disable [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). */
|
|
2209
|
+
dnssecEnabled?: boolean | null;
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
declare function createDnsZone$1(httpClient: HttpClient$2): CreateDnsZoneSignature;
|
|
2213
|
+
interface CreateDnsZoneSignature {
|
|
2214
|
+
/**
|
|
2215
|
+
* Creates a DNS zone in [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
2216
|
+
*
|
|
2217
|
+
*
|
|
2218
|
+
* If there is an existing DNS zone for the domain, it's deleted before
|
|
2219
|
+
* the new zone is created.
|
|
2220
|
+
*
|
|
2221
|
+
* The call is synchronous, that means it fails in case of an error on
|
|
2222
|
+
* Google's side.
|
|
2223
|
+
*
|
|
2224
|
+
* You can only set up a single `record` object per DNS record
|
|
2225
|
+
* type. If you want to specify multiple values for the same record type, you
|
|
2226
|
+
* must save them in the `values` for the relevant type.
|
|
2227
|
+
*
|
|
2228
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
2229
|
+
* @param - DNS zone to create.
|
|
2230
|
+
* @returns Created DNS zone.
|
|
2231
|
+
*/
|
|
2232
|
+
(dnsZone: DnsZone): Promise<DnsZone & DnsZoneNonNullableFields>;
|
|
2233
|
+
}
|
|
2234
|
+
declare function getDnsZone$1(httpClient: HttpClient$2): GetDnsZoneSignature;
|
|
2235
|
+
interface GetDnsZoneSignature {
|
|
2236
|
+
/**
|
|
2237
|
+
* Retrieves the DNS zone belonging to the domain from
|
|
2238
|
+
* [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
2239
|
+
*
|
|
2240
|
+
*
|
|
2241
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
2242
|
+
* @param - Domain to retrieve the DNS zone for.
|
|
2243
|
+
* @returns Retrieved DNS zone.
|
|
2244
|
+
*/
|
|
2245
|
+
(domainName: string): Promise<DnsZone & DnsZoneNonNullableFields>;
|
|
2246
|
+
}
|
|
2247
|
+
declare function updateDnsZone$1(httpClient: HttpClient$2): UpdateDnsZoneSignature;
|
|
2248
|
+
interface UpdateDnsZoneSignature {
|
|
2249
|
+
/**
|
|
2250
|
+
* Adds DNS records to and removes DNS records from a DNS zone in
|
|
2251
|
+
* [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
2252
|
+
*
|
|
2253
|
+
* The call is synchronous, that means it fails in case of an error on
|
|
2254
|
+
* Google's side.
|
|
2255
|
+
*
|
|
2256
|
+
* You can only set up a single `record` object per DNS record
|
|
2257
|
+
* type. If you want to specify multiple values for the same record type, you
|
|
2258
|
+
* must save them in the `values` for the relevant type. This means, you must
|
|
2259
|
+
* delete the relevant record and add a new `addition` object for this type
|
|
2260
|
+
* to the request, in case you want to add values for an existing DNS record
|
|
2261
|
+
* type.
|
|
2262
|
+
*
|
|
2263
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
2264
|
+
* @param - Domain to update the DNS zone for. Must include the TLD.
|
|
2265
|
+
*/
|
|
2266
|
+
(domainName: string, options?: UpdateDnsZoneOptions | undefined): Promise<UpdateDnsZoneResponse & UpdateDnsZoneResponseNonNullableFields>;
|
|
2267
|
+
}
|
|
2268
|
+
declare function deleteDnsZone$1(httpClient: HttpClient$2): DeleteDnsZoneSignature;
|
|
2269
|
+
interface DeleteDnsZoneSignature {
|
|
2270
|
+
/**
|
|
2271
|
+
* Deletes a DNS zone in [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
2272
|
+
*
|
|
2273
|
+
*
|
|
2274
|
+
* The call is synchronous, that means it fails in case of an error on
|
|
2275
|
+
* Google's side.
|
|
2276
|
+
*
|
|
2277
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
2278
|
+
* @param - Domain name to delete the DNS zone for.
|
|
2279
|
+
*/
|
|
2280
|
+
(domainName: string): Promise<void>;
|
|
2281
|
+
}
|
|
2282
|
+
declare function previewDnsZone$1(httpClient: HttpClient$2): PreviewDnsZoneSignature;
|
|
2283
|
+
interface PreviewDnsZoneSignature {
|
|
2284
|
+
/**
|
|
2285
|
+
* Generates a preview for a DNS zone based on
|
|
2286
|
+
* [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
2287
|
+
*
|
|
2288
|
+
*
|
|
2289
|
+
* This includes calculating the `A`, `CNAME`, `NS` and `SOA` records.
|
|
2290
|
+
* You can use this information to configure a domain from an external
|
|
2291
|
+
* provider, before connecting it to a Wix site.
|
|
2292
|
+
*
|
|
2293
|
+
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
2294
|
+
* @param - Domain name to generate a DNS zone preview for.
|
|
2295
|
+
*/
|
|
2296
|
+
(domainName: string): Promise<PreviewDnsZoneResponse & PreviewDnsZoneResponseNonNullableFields>;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
declare const createDnsZone: MaybeContext$2<BuildRESTFunction$2<typeof createDnsZone$1> & typeof createDnsZone$1>;
|
|
2300
|
+
declare const getDnsZone: MaybeContext$2<BuildRESTFunction$2<typeof getDnsZone$1> & typeof getDnsZone$1>;
|
|
2301
|
+
declare const updateDnsZone: MaybeContext$2<BuildRESTFunction$2<typeof updateDnsZone$1> & typeof updateDnsZone$1>;
|
|
2302
|
+
declare const deleteDnsZone: MaybeContext$2<BuildRESTFunction$2<typeof deleteDnsZone$1> & typeof deleteDnsZone$1>;
|
|
2303
|
+
declare const previewDnsZone: MaybeContext$2<BuildRESTFunction$2<typeof previewDnsZone$1> & typeof previewDnsZone$1>;
|
|
2304
|
+
|
|
2305
|
+
type index_d$2_ActionEvent = ActionEvent;
|
|
2306
|
+
type index_d$2_CreateDnsZoneRequest = CreateDnsZoneRequest;
|
|
2307
|
+
type index_d$2_CreateDnsZoneResponse = CreateDnsZoneResponse;
|
|
2308
|
+
type index_d$2_CreateDnsZoneResponseNonNullableFields = CreateDnsZoneResponseNonNullableFields;
|
|
2309
|
+
type index_d$2_DeleteDnsZoneRequest = DeleteDnsZoneRequest;
|
|
2310
|
+
type index_d$2_DeleteDnsZoneResponse = DeleteDnsZoneResponse;
|
|
2311
|
+
type index_d$2_DnsRecord = DnsRecord;
|
|
2312
|
+
type index_d$2_DnsRecordsChangedEvent = DnsRecordsChangedEvent;
|
|
2313
|
+
type index_d$2_DnsZone = DnsZone;
|
|
2314
|
+
type index_d$2_DnsZoneNonNullableFields = DnsZoneNonNullableFields;
|
|
2315
|
+
type index_d$2_DnssecInfo = DnssecInfo;
|
|
2316
|
+
type index_d$2_DomainEvent = DomainEvent;
|
|
2317
|
+
type index_d$2_DomainEventBodyOneOf = DomainEventBodyOneOf;
|
|
2318
|
+
type index_d$2_DomainRemovedEvent = DomainRemovedEvent;
|
|
2319
|
+
type index_d$2_EntityCreatedEvent = EntityCreatedEvent;
|
|
2320
|
+
type index_d$2_EntityDeletedEvent = EntityDeletedEvent;
|
|
2321
|
+
type index_d$2_EntityUpdatedEvent = EntityUpdatedEvent;
|
|
2322
|
+
type index_d$2_GetDnsZoneRequest = GetDnsZoneRequest;
|
|
2323
|
+
type index_d$2_GetDnsZoneResponse = GetDnsZoneResponse;
|
|
2324
|
+
type index_d$2_GetDnsZoneResponseNonNullableFields = GetDnsZoneResponseNonNullableFields;
|
|
2325
|
+
type index_d$2_IdentificationData = IdentificationData;
|
|
2326
|
+
type index_d$2_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
|
|
2327
|
+
type index_d$2_MessageEnvelope = MessageEnvelope;
|
|
2328
|
+
type index_d$2_PreviewDnsZoneRequest = PreviewDnsZoneRequest;
|
|
2329
|
+
type index_d$2_PreviewDnsZoneResponse = PreviewDnsZoneResponse;
|
|
2330
|
+
type index_d$2_PreviewDnsZoneResponseNonNullableFields = PreviewDnsZoneResponseNonNullableFields;
|
|
2331
|
+
type index_d$2_RecordType = RecordType;
|
|
2332
|
+
declare const index_d$2_RecordType: typeof RecordType;
|
|
2333
|
+
type index_d$2_RestoreInfo = RestoreInfo;
|
|
2334
|
+
type index_d$2_UpdateDnsZoneOptions = UpdateDnsZoneOptions;
|
|
2335
|
+
type index_d$2_UpdateDnsZoneRequest = UpdateDnsZoneRequest;
|
|
2336
|
+
type index_d$2_UpdateDnsZoneResponse = UpdateDnsZoneResponse;
|
|
2337
|
+
type index_d$2_UpdateDnsZoneResponseNonNullableFields = UpdateDnsZoneResponseNonNullableFields;
|
|
2338
|
+
type index_d$2_WebhookIdentityType = WebhookIdentityType;
|
|
2339
|
+
declare const index_d$2_WebhookIdentityType: typeof WebhookIdentityType;
|
|
2340
|
+
declare const index_d$2_createDnsZone: typeof createDnsZone;
|
|
2341
|
+
declare const index_d$2_deleteDnsZone: typeof deleteDnsZone;
|
|
2342
|
+
declare const index_d$2_getDnsZone: typeof getDnsZone;
|
|
2343
|
+
declare const index_d$2_previewDnsZone: typeof previewDnsZone;
|
|
2344
|
+
declare const index_d$2_updateDnsZone: typeof updateDnsZone;
|
|
2345
|
+
declare namespace index_d$2 {
|
|
2346
|
+
export { type index_d$2_ActionEvent as ActionEvent, type index_d$2_CreateDnsZoneRequest as CreateDnsZoneRequest, type index_d$2_CreateDnsZoneResponse as CreateDnsZoneResponse, type index_d$2_CreateDnsZoneResponseNonNullableFields as CreateDnsZoneResponseNonNullableFields, type index_d$2_DeleteDnsZoneRequest as DeleteDnsZoneRequest, type index_d$2_DeleteDnsZoneResponse as DeleteDnsZoneResponse, type index_d$2_DnsRecord as DnsRecord, type index_d$2_DnsRecordsChangedEvent as DnsRecordsChangedEvent, type index_d$2_DnsZone as DnsZone, type index_d$2_DnsZoneNonNullableFields as DnsZoneNonNullableFields, type index_d$2_DnssecInfo as DnssecInfo, type index_d$2_DomainEvent as DomainEvent, type index_d$2_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d$2_DomainRemovedEvent as DomainRemovedEvent, type index_d$2_EntityCreatedEvent as EntityCreatedEvent, type index_d$2_EntityDeletedEvent as EntityDeletedEvent, type index_d$2_EntityUpdatedEvent as EntityUpdatedEvent, type index_d$2_GetDnsZoneRequest as GetDnsZoneRequest, type index_d$2_GetDnsZoneResponse as GetDnsZoneResponse, type index_d$2_GetDnsZoneResponseNonNullableFields as GetDnsZoneResponseNonNullableFields, type index_d$2_IdentificationData as IdentificationData, type index_d$2_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d$2_MessageEnvelope as MessageEnvelope, type index_d$2_PreviewDnsZoneRequest as PreviewDnsZoneRequest, type index_d$2_PreviewDnsZoneResponse as PreviewDnsZoneResponse, type index_d$2_PreviewDnsZoneResponseNonNullableFields as PreviewDnsZoneResponseNonNullableFields, index_d$2_RecordType as RecordType, type index_d$2_RestoreInfo as RestoreInfo, type index_d$2_UpdateDnsZoneOptions as UpdateDnsZoneOptions, type index_d$2_UpdateDnsZoneRequest as UpdateDnsZoneRequest, type index_d$2_UpdateDnsZoneResponse as UpdateDnsZoneResponse, type index_d$2_UpdateDnsZoneResponseNonNullableFields as UpdateDnsZoneResponseNonNullableFields, index_d$2_WebhookIdentityType as WebhookIdentityType, index_d$2_createDnsZone as createDnsZone, index_d$2_deleteDnsZone as deleteDnsZone, index_d$2_getDnsZone as getDnsZone, index_d$2_previewDnsZone as previewDnsZone, index_d$2_updateDnsZone as updateDnsZone };
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
2350
|
+
__type: 'host';
|
|
2351
|
+
create(host: H): T;
|
|
2352
|
+
};
|
|
2353
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
2354
|
+
type Host$1<Environment = unknown> = {
|
|
2355
|
+
channel: {
|
|
2356
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
2357
|
+
disconnect: () => void;
|
|
2358
|
+
} | Promise<{
|
|
2359
|
+
disconnect: () => void;
|
|
2360
|
+
}>;
|
|
2361
|
+
};
|
|
2362
|
+
environment?: Environment;
|
|
2363
|
+
/**
|
|
2364
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
2365
|
+
*/
|
|
2366
|
+
apiBaseUrl?: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
2369
|
+
* like internationalization, billing, etc.
|
|
2370
|
+
*/
|
|
2371
|
+
essentials?: {
|
|
2372
|
+
/**
|
|
2373
|
+
* The language of the currently viewed session
|
|
2374
|
+
*/
|
|
2375
|
+
language?: string;
|
|
2376
|
+
/**
|
|
2377
|
+
* The locale of the currently viewed session
|
|
2378
|
+
*/
|
|
2379
|
+
locale?: string;
|
|
2380
|
+
/**
|
|
2381
|
+
* Any headers that should be passed through to the API requests
|
|
2382
|
+
*/
|
|
2383
|
+
passThroughHeaders?: Record<string, string>;
|
|
2384
|
+
};
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2387
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
2388
|
+
interface HttpClient$1 {
|
|
2389
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
2390
|
+
fetchWithAuth: typeof fetch;
|
|
2391
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
2392
|
+
getActiveToken?: () => string | undefined;
|
|
1355
2393
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
2394
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
2395
|
+
type HttpResponse$1<T = any> = {
|
|
2396
|
+
data: T;
|
|
2397
|
+
status: number;
|
|
2398
|
+
statusText: string;
|
|
2399
|
+
headers: any;
|
|
2400
|
+
request?: any;
|
|
2401
|
+
};
|
|
2402
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
2403
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
2404
|
+
url: string;
|
|
2405
|
+
data?: Data;
|
|
2406
|
+
params?: URLSearchParams;
|
|
2407
|
+
} & APIMetadata$1;
|
|
2408
|
+
type APIMetadata$1 = {
|
|
2409
|
+
methodFqn?: string;
|
|
2410
|
+
entityFqdn?: string;
|
|
2411
|
+
packageName?: string;
|
|
2412
|
+
};
|
|
2413
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
2414
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
2415
|
+
__type: 'event-definition';
|
|
2416
|
+
type: Type;
|
|
2417
|
+
isDomainEvent?: boolean;
|
|
2418
|
+
transformations?: (envelope: unknown) => Payload;
|
|
2419
|
+
__payload: Payload;
|
|
2420
|
+
};
|
|
2421
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
2422
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
2423
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
2424
|
+
|
|
2425
|
+
type ServicePluginMethodInput$1 = {
|
|
2426
|
+
request: any;
|
|
2427
|
+
metadata: any;
|
|
2428
|
+
};
|
|
2429
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
2430
|
+
type ServicePluginMethodMetadata$1 = {
|
|
2431
|
+
name: string;
|
|
2432
|
+
primaryHttpMappingPath: string;
|
|
2433
|
+
transformations: {
|
|
2434
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
2435
|
+
toREST: (...args: unknown[]) => unknown;
|
|
2436
|
+
};
|
|
2437
|
+
};
|
|
2438
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
2439
|
+
__type: 'service-plugin-definition';
|
|
2440
|
+
componentType: string;
|
|
2441
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
2442
|
+
__contract: Contract;
|
|
2443
|
+
};
|
|
2444
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
2445
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
2446
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
2447
|
+
|
|
2448
|
+
type RequestContext$1 = {
|
|
2449
|
+
isSSR: boolean;
|
|
2450
|
+
host: string;
|
|
2451
|
+
protocol?: string;
|
|
2452
|
+
};
|
|
2453
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
2454
|
+
/**
|
|
2455
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
2456
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
2457
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
2458
|
+
*/
|
|
2459
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
2460
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
2461
|
+
_?: T;
|
|
2462
|
+
url?: string;
|
|
2463
|
+
method?: Method$1;
|
|
2464
|
+
params?: any;
|
|
2465
|
+
data?: any;
|
|
2466
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
2467
|
+
};
|
|
2468
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
2469
|
+
__isAmbassador: boolean;
|
|
2470
|
+
};
|
|
2471
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
2472
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
2473
|
+
|
|
2474
|
+
declare global {
|
|
2475
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2476
|
+
interface SymbolConstructor {
|
|
2477
|
+
readonly observable: symbol;
|
|
2478
|
+
}
|
|
1362
2479
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
2480
|
+
|
|
2481
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
2482
|
+
|
|
2483
|
+
/**
|
|
2484
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
2485
|
+
|
|
2486
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
2487
|
+
|
|
2488
|
+
@example
|
|
2489
|
+
```
|
|
2490
|
+
import type {EmptyObject} from 'type-fest';
|
|
2491
|
+
|
|
2492
|
+
// The following illustrates the problem with `{}`.
|
|
2493
|
+
const foo1: {} = {}; // Pass
|
|
2494
|
+
const foo2: {} = []; // Pass
|
|
2495
|
+
const foo3: {} = 42; // Pass
|
|
2496
|
+
const foo4: {} = {a: 1}; // Pass
|
|
2497
|
+
|
|
2498
|
+
// With `EmptyObject` only the first case is valid.
|
|
2499
|
+
const bar1: EmptyObject = {}; // Pass
|
|
2500
|
+
const bar2: EmptyObject = 42; // Fail
|
|
2501
|
+
const bar3: EmptyObject = []; // Fail
|
|
2502
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
2503
|
+
```
|
|
2504
|
+
|
|
2505
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
2506
|
+
|
|
2507
|
+
@category Object
|
|
2508
|
+
*/
|
|
2509
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
2510
|
+
|
|
2511
|
+
/**
|
|
2512
|
+
Returns a boolean for whether the two given types are equal.
|
|
2513
|
+
|
|
2514
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
2515
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
2516
|
+
|
|
2517
|
+
Use-cases:
|
|
2518
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
2519
|
+
|
|
2520
|
+
@example
|
|
2521
|
+
```
|
|
2522
|
+
import type {IsEqual} from 'type-fest';
|
|
2523
|
+
|
|
2524
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
2525
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
2526
|
+
type Includes<Value extends readonly any[], Item> =
|
|
2527
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
2528
|
+
? IsEqual<Value[0], Item> extends true
|
|
2529
|
+
? true
|
|
2530
|
+
: Includes<rest, Item>
|
|
2531
|
+
: false;
|
|
2532
|
+
```
|
|
2533
|
+
|
|
2534
|
+
@category Type Guard
|
|
2535
|
+
@category Utilities
|
|
2536
|
+
*/
|
|
2537
|
+
type IsEqual$1<A, B> =
|
|
2538
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
2539
|
+
(<G>() => G extends B ? 1 : 2)
|
|
2540
|
+
? true
|
|
2541
|
+
: false;
|
|
2542
|
+
|
|
2543
|
+
/**
|
|
2544
|
+
Filter out keys from an object.
|
|
2545
|
+
|
|
2546
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
2547
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
2548
|
+
Returns `Key` otherwise.
|
|
2549
|
+
|
|
2550
|
+
@example
|
|
2551
|
+
```
|
|
2552
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
2553
|
+
//=> never
|
|
2554
|
+
```
|
|
2555
|
+
|
|
2556
|
+
@example
|
|
2557
|
+
```
|
|
2558
|
+
type Filtered = Filter<'bar', string>;
|
|
2559
|
+
//=> never
|
|
2560
|
+
```
|
|
2561
|
+
|
|
2562
|
+
@example
|
|
2563
|
+
```
|
|
2564
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
2565
|
+
//=> 'bar'
|
|
2566
|
+
```
|
|
2567
|
+
|
|
2568
|
+
@see {Except}
|
|
2569
|
+
*/
|
|
2570
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
2571
|
+
|
|
2572
|
+
type ExceptOptions$1 = {
|
|
2573
|
+
/**
|
|
2574
|
+
Disallow assigning non-specified properties.
|
|
2575
|
+
|
|
2576
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
2577
|
+
|
|
2578
|
+
@default false
|
|
2579
|
+
*/
|
|
2580
|
+
requireExactProps?: boolean;
|
|
2581
|
+
};
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
Create a type from an object type without certain keys.
|
|
2585
|
+
|
|
2586
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
2587
|
+
|
|
2588
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
2589
|
+
|
|
2590
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
2591
|
+
|
|
2592
|
+
@example
|
|
2593
|
+
```
|
|
2594
|
+
import type {Except} from 'type-fest';
|
|
2595
|
+
|
|
2596
|
+
type Foo = {
|
|
2597
|
+
a: number;
|
|
2598
|
+
b: string;
|
|
2599
|
+
};
|
|
2600
|
+
|
|
2601
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
2602
|
+
//=> {b: string}
|
|
2603
|
+
|
|
2604
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
2605
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
2606
|
+
|
|
2607
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
2608
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
2609
|
+
|
|
2610
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
2611
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
2612
|
+
```
|
|
2613
|
+
|
|
2614
|
+
@category Object
|
|
2615
|
+
*/
|
|
2616
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
2617
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
2618
|
+
} & (Options['requireExactProps'] extends true
|
|
2619
|
+
? Partial<Record<KeysType, never>>
|
|
2620
|
+
: {});
|
|
2621
|
+
|
|
2622
|
+
/**
|
|
2623
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
2624
|
+
|
|
2625
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
2626
|
+
|
|
2627
|
+
@example
|
|
2628
|
+
```
|
|
2629
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2630
|
+
|
|
2631
|
+
interface Example {
|
|
2632
|
+
a: string;
|
|
2633
|
+
b: string | number;
|
|
2634
|
+
c?: string;
|
|
2635
|
+
d: {};
|
|
1365
2636
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
2637
|
+
|
|
2638
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
2639
|
+
//=> 'a'
|
|
2640
|
+
```
|
|
2641
|
+
|
|
2642
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
2643
|
+
|
|
2644
|
+
@example
|
|
2645
|
+
```
|
|
2646
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2647
|
+
|
|
2648
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
2649
|
+
//=> 'a' | 'c'
|
|
2650
|
+
```
|
|
2651
|
+
|
|
2652
|
+
@category Object
|
|
2653
|
+
*/
|
|
2654
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
2655
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
2656
|
+
{
|
|
2657
|
+
// Map through all the keys of the given base type.
|
|
2658
|
+
[Key in keyof Base]:
|
|
2659
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
2660
|
+
Base[Key] extends Condition
|
|
2661
|
+
// Retain this key since the condition passes.
|
|
2662
|
+
? Key
|
|
2663
|
+
// Discard this key since the condition fails.
|
|
2664
|
+
: never;
|
|
2665
|
+
|
|
2666
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
2667
|
+
}[keyof Base]
|
|
2668
|
+
>;
|
|
2669
|
+
|
|
2670
|
+
/**
|
|
2671
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
2672
|
+
|
|
2673
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
2674
|
+
|
|
2675
|
+
@example
|
|
2676
|
+
```
|
|
2677
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
2678
|
+
|
|
2679
|
+
class Awesome {
|
|
2680
|
+
name: string;
|
|
2681
|
+
successes: number;
|
|
2682
|
+
failures: bigint;
|
|
2683
|
+
|
|
2684
|
+
run() {}
|
|
1368
2685
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
2686
|
+
|
|
2687
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
2688
|
+
//=> {run: () => void}
|
|
2689
|
+
```
|
|
2690
|
+
|
|
2691
|
+
@example
|
|
2692
|
+
```
|
|
2693
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
2694
|
+
|
|
2695
|
+
interface Example {
|
|
2696
|
+
a: string;
|
|
2697
|
+
b: string | number;
|
|
2698
|
+
c: () => void;
|
|
2699
|
+
d: {};
|
|
1371
2700
|
}
|
|
1372
|
-
|
|
1373
|
-
|
|
2701
|
+
|
|
2702
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
2703
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
2704
|
+
```
|
|
2705
|
+
|
|
2706
|
+
@category Object
|
|
2707
|
+
*/
|
|
2708
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
2709
|
+
Base,
|
|
2710
|
+
ConditionalKeys$1<Base, Condition>
|
|
2711
|
+
>;
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
2715
|
+
* can either be a REST module or a host module.
|
|
2716
|
+
* This type is recursive, so it can describe nested modules.
|
|
2717
|
+
*/
|
|
2718
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$1<any> | ServicePluginDefinition$1<any> | {
|
|
2719
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
2720
|
+
};
|
|
2721
|
+
/**
|
|
2722
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
2723
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
2724
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
2725
|
+
* do not match the given host (as they will not work with the given host).
|
|
2726
|
+
*/
|
|
2727
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
2728
|
+
done: T;
|
|
2729
|
+
recurse: T extends {
|
|
2730
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
2731
|
+
} ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
|
|
2732
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
2733
|
+
-1,
|
|
2734
|
+
0,
|
|
2735
|
+
1,
|
|
2736
|
+
2,
|
|
2737
|
+
3,
|
|
2738
|
+
4,
|
|
2739
|
+
5
|
|
2740
|
+
][Depth]> : never;
|
|
2741
|
+
}, EmptyObject$1>;
|
|
2742
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
2743
|
+
type PublicMetadata$1 = {
|
|
2744
|
+
PACKAGE_NAME?: string;
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
declare global {
|
|
2748
|
+
interface ContextualClient {
|
|
2749
|
+
}
|
|
1374
2750
|
}
|
|
1375
|
-
|
|
2751
|
+
/**
|
|
2752
|
+
* A type used to create concerete types from SDK descriptors in
|
|
2753
|
+
* case a contextual client is available.
|
|
2754
|
+
*/
|
|
2755
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
2756
|
+
host: Host$1;
|
|
2757
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
2758
|
+
|
|
2759
|
+
interface DomainAvailability {
|
|
2760
|
+
/** Domain name including TLD. For example, `my-new-domain.com`. */
|
|
2761
|
+
domain?: string;
|
|
1376
2762
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
2763
|
+
* Whether the domain is available for purchase. You can purchase the
|
|
2764
|
+
* domain in case the boolean is `true`. The domain is already taken
|
|
2765
|
+
* when `false` is returned.
|
|
1380
2766
|
*/
|
|
1381
|
-
|
|
2767
|
+
available?: boolean;
|
|
2768
|
+
/** Whether the domain has a higher price due to its perceived value or demand. */
|
|
2769
|
+
premium?: boolean;
|
|
2770
|
+
}
|
|
2771
|
+
interface CheckDomainAvailabilityRequest {
|
|
1382
2772
|
/**
|
|
1383
|
-
*
|
|
2773
|
+
* Domain name. Must include the TLD. For example, `my-new-domain.com`. Only
|
|
2774
|
+
* alphanumeric characters, hyphens, and dots are supported.
|
|
1384
2775
|
*
|
|
1385
|
-
*
|
|
2776
|
+
* Min: 3 characters
|
|
2777
|
+
* Max: 63 characters
|
|
1386
2778
|
*/
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
2779
|
+
domain: string;
|
|
2780
|
+
}
|
|
2781
|
+
interface CheckDomainAvailabilityResponse {
|
|
2782
|
+
/** Information about the domain's availability. */
|
|
2783
|
+
availability?: DomainAvailability;
|
|
2784
|
+
}
|
|
2785
|
+
interface DomainAvailabilityNonNullableFields {
|
|
2786
|
+
domain: string;
|
|
2787
|
+
available: boolean;
|
|
2788
|
+
premium: boolean;
|
|
2789
|
+
}
|
|
2790
|
+
interface CheckDomainAvailabilityResponseNonNullableFields {
|
|
2791
|
+
availability?: DomainAvailabilityNonNullableFields;
|
|
1390
2792
|
}
|
|
1391
2793
|
|
|
1392
|
-
declare function
|
|
1393
|
-
interface
|
|
2794
|
+
declare function checkDomainAvailability$1(httpClient: HttpClient$1): CheckDomainAvailabilitySignature;
|
|
2795
|
+
interface CheckDomainAvailabilitySignature {
|
|
1394
2796
|
/**
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
2797
|
+
* Checks whether the given domain is available for purchase.
|
|
1397
2798
|
*
|
|
1398
|
-
* If there is an existing DNS zone for the domain, it's deleted before
|
|
1399
|
-
* the new zone is created.
|
|
1400
2799
|
*
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
2800
|
+
* You can purchase the specified domain in case the returned
|
|
2801
|
+
* `availability.available` boolean is `true`. The domain is already taken
|
|
2802
|
+
* when `false` is returned.
|
|
1403
2803
|
*
|
|
1404
|
-
*
|
|
1405
|
-
* type. If you want to specify multiple values for the same record type, you
|
|
1406
|
-
* must save them in the `values` for the relevant type.
|
|
2804
|
+
* The `domain` field must include the TLD. For example, `my-new-domain.com`.
|
|
1407
2805
|
*
|
|
1408
2806
|
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1409
|
-
* @param -
|
|
1410
|
-
*
|
|
1411
|
-
*/
|
|
1412
|
-
(dnsZone: DnsZone): Promise<DnsZone & DnsZoneNonNullableFields>;
|
|
1413
|
-
}
|
|
1414
|
-
declare function getDnsZone$1(httpClient: HttpClient): GetDnsZoneSignature;
|
|
1415
|
-
interface GetDnsZoneSignature {
|
|
1416
|
-
/**
|
|
1417
|
-
* Retrieves the DNS zone belonging to the domain from
|
|
1418
|
-
* [Google's Cloud DNS](https://cloud.google.com/dns).
|
|
1419
|
-
*
|
|
2807
|
+
* @param - Domain name. Must include the TLD. For example, `my-new-domain.com`. Only
|
|
2808
|
+
* alphanumeric characters, hyphens, and dots are supported.
|
|
1420
2809
|
*
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
* @returns Retrieved DNS zone.
|
|
2810
|
+
* Min: 3 characters
|
|
2811
|
+
* Max: 63 characters
|
|
1424
2812
|
*/
|
|
1425
|
-
(
|
|
2813
|
+
(domain: string): Promise<CheckDomainAvailabilityResponse & CheckDomainAvailabilityResponseNonNullableFields>;
|
|
1426
2814
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
* type. If you want to specify multiple values for the same record type, you
|
|
1438
|
-
* must save them in the `values` for the relevant type. This means, you must
|
|
1439
|
-
* delete the relevant record and add a new `addition` object for this type
|
|
1440
|
-
* to the request, in case you want to add values for an existing DNS record
|
|
1441
|
-
* type.
|
|
1442
|
-
*
|
|
1443
|
-
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1444
|
-
* @param - Domain to update the DNS zone for. Must include the TLD.
|
|
1445
|
-
*/
|
|
1446
|
-
(domainName: string, options?: UpdateDnsZoneOptions | undefined): Promise<UpdateDnsZoneResponse & UpdateDnsZoneResponseNonNullableFields>;
|
|
2815
|
+
|
|
2816
|
+
declare const checkDomainAvailability: MaybeContext$1<BuildRESTFunction$1<typeof checkDomainAvailability$1> & typeof checkDomainAvailability$1>;
|
|
2817
|
+
|
|
2818
|
+
type index_d$1_CheckDomainAvailabilityRequest = CheckDomainAvailabilityRequest;
|
|
2819
|
+
type index_d$1_CheckDomainAvailabilityResponse = CheckDomainAvailabilityResponse;
|
|
2820
|
+
type index_d$1_CheckDomainAvailabilityResponseNonNullableFields = CheckDomainAvailabilityResponseNonNullableFields;
|
|
2821
|
+
type index_d$1_DomainAvailability = DomainAvailability;
|
|
2822
|
+
declare const index_d$1_checkDomainAvailability: typeof checkDomainAvailability;
|
|
2823
|
+
declare namespace index_d$1 {
|
|
2824
|
+
export { type index_d$1_CheckDomainAvailabilityRequest as CheckDomainAvailabilityRequest, type index_d$1_CheckDomainAvailabilityResponse as CheckDomainAvailabilityResponse, type index_d$1_CheckDomainAvailabilityResponseNonNullableFields as CheckDomainAvailabilityResponseNonNullableFields, type index_d$1_DomainAvailability as DomainAvailability, index_d$1_checkDomainAvailability as checkDomainAvailability };
|
|
1447
2825
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
2826
|
+
|
|
2827
|
+
type HostModule<T, H extends Host> = {
|
|
2828
|
+
__type: 'host';
|
|
2829
|
+
create(host: H): T;
|
|
2830
|
+
};
|
|
2831
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
2832
|
+
type Host<Environment = unknown> = {
|
|
2833
|
+
channel: {
|
|
2834
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
2835
|
+
disconnect: () => void;
|
|
2836
|
+
} | Promise<{
|
|
2837
|
+
disconnect: () => void;
|
|
2838
|
+
}>;
|
|
2839
|
+
};
|
|
2840
|
+
environment?: Environment;
|
|
1450
2841
|
/**
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
* The call is synchronous, that means it fails in case of an error on
|
|
1455
|
-
* Google's side.
|
|
1456
|
-
*
|
|
1457
|
-
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1458
|
-
* @param - Domain name to delete the DNS zone for.
|
|
2842
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1459
2843
|
*/
|
|
1460
|
-
|
|
1461
|
-
}
|
|
1462
|
-
declare function previewDnsZone$1(httpClient: HttpClient): PreviewDnsZoneSignature;
|
|
1463
|
-
interface PreviewDnsZoneSignature {
|
|
2844
|
+
apiBaseUrl?: string;
|
|
1464
2845
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
* This includes calculating the `A`, `CNAME`, `NS` and `SOA` records.
|
|
1470
|
-
* You can use this information to configure a domain from an external
|
|
1471
|
-
* provider, before connecting it to a Wix site.
|
|
1472
|
-
*
|
|
1473
|
-
* > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header.
|
|
1474
|
-
* @param - Domain name to generate a DNS zone preview for.
|
|
2846
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
2847
|
+
* like internationalization, billing, etc.
|
|
1475
2848
|
*/
|
|
1476
|
-
|
|
2849
|
+
essentials?: {
|
|
2850
|
+
/**
|
|
2851
|
+
* The language of the currently viewed session
|
|
2852
|
+
*/
|
|
2853
|
+
language?: string;
|
|
2854
|
+
/**
|
|
2855
|
+
* The locale of the currently viewed session
|
|
2856
|
+
*/
|
|
2857
|
+
locale?: string;
|
|
2858
|
+
/**
|
|
2859
|
+
* Any headers that should be passed through to the API requests
|
|
2860
|
+
*/
|
|
2861
|
+
passThroughHeaders?: Record<string, string>;
|
|
2862
|
+
};
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
2866
|
+
interface HttpClient {
|
|
2867
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
2868
|
+
fetchWithAuth: typeof fetch;
|
|
2869
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
2870
|
+
getActiveToken?: () => string | undefined;
|
|
2871
|
+
}
|
|
2872
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
2873
|
+
type HttpResponse<T = any> = {
|
|
2874
|
+
data: T;
|
|
2875
|
+
status: number;
|
|
2876
|
+
statusText: string;
|
|
2877
|
+
headers: any;
|
|
2878
|
+
request?: any;
|
|
2879
|
+
};
|
|
2880
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
2881
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
2882
|
+
url: string;
|
|
2883
|
+
data?: Data;
|
|
2884
|
+
params?: URLSearchParams;
|
|
2885
|
+
} & APIMetadata;
|
|
2886
|
+
type APIMetadata = {
|
|
2887
|
+
methodFqn?: string;
|
|
2888
|
+
entityFqdn?: string;
|
|
2889
|
+
packageName?: string;
|
|
2890
|
+
};
|
|
2891
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
2892
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
2893
|
+
__type: 'event-definition';
|
|
2894
|
+
type: Type;
|
|
2895
|
+
isDomainEvent?: boolean;
|
|
2896
|
+
transformations?: (envelope: unknown) => Payload;
|
|
2897
|
+
__payload: Payload;
|
|
2898
|
+
};
|
|
2899
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
2900
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
2901
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
2902
|
+
|
|
2903
|
+
type ServicePluginMethodInput = {
|
|
2904
|
+
request: any;
|
|
2905
|
+
metadata: any;
|
|
2906
|
+
};
|
|
2907
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
2908
|
+
type ServicePluginMethodMetadata = {
|
|
2909
|
+
name: string;
|
|
2910
|
+
primaryHttpMappingPath: string;
|
|
2911
|
+
transformations: {
|
|
2912
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
2913
|
+
toREST: (...args: unknown[]) => unknown;
|
|
2914
|
+
};
|
|
2915
|
+
};
|
|
2916
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
2917
|
+
__type: 'service-plugin-definition';
|
|
2918
|
+
componentType: string;
|
|
2919
|
+
methods: ServicePluginMethodMetadata[];
|
|
2920
|
+
__contract: Contract;
|
|
2921
|
+
};
|
|
2922
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
2923
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
2924
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
2925
|
+
|
|
2926
|
+
type RequestContext = {
|
|
2927
|
+
isSSR: boolean;
|
|
2928
|
+
host: string;
|
|
2929
|
+
protocol?: string;
|
|
2930
|
+
};
|
|
2931
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
2932
|
+
/**
|
|
2933
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
2934
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
2935
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
2936
|
+
*/
|
|
2937
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
2938
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
2939
|
+
_?: T;
|
|
2940
|
+
url?: string;
|
|
2941
|
+
method?: Method;
|
|
2942
|
+
params?: any;
|
|
2943
|
+
data?: any;
|
|
2944
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
2945
|
+
};
|
|
2946
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
2947
|
+
__isAmbassador: boolean;
|
|
2948
|
+
};
|
|
2949
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
2950
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
2951
|
+
|
|
2952
|
+
declare global {
|
|
2953
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2954
|
+
interface SymbolConstructor {
|
|
2955
|
+
readonly observable: symbol;
|
|
2956
|
+
}
|
|
1477
2957
|
}
|
|
1478
2958
|
|
|
1479
|
-
declare const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
2959
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
2963
|
+
|
|
2964
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
2965
|
+
|
|
2966
|
+
@example
|
|
2967
|
+
```
|
|
2968
|
+
import type {EmptyObject} from 'type-fest';
|
|
2969
|
+
|
|
2970
|
+
// The following illustrates the problem with `{}`.
|
|
2971
|
+
const foo1: {} = {}; // Pass
|
|
2972
|
+
const foo2: {} = []; // Pass
|
|
2973
|
+
const foo3: {} = 42; // Pass
|
|
2974
|
+
const foo4: {} = {a: 1}; // Pass
|
|
2975
|
+
|
|
2976
|
+
// With `EmptyObject` only the first case is valid.
|
|
2977
|
+
const bar1: EmptyObject = {}; // Pass
|
|
2978
|
+
const bar2: EmptyObject = 42; // Fail
|
|
2979
|
+
const bar3: EmptyObject = []; // Fail
|
|
2980
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
2981
|
+
```
|
|
2982
|
+
|
|
2983
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
2984
|
+
|
|
2985
|
+
@category Object
|
|
2986
|
+
*/
|
|
2987
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
2988
|
+
|
|
2989
|
+
/**
|
|
2990
|
+
Returns a boolean for whether the two given types are equal.
|
|
2991
|
+
|
|
2992
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
2993
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
2994
|
+
|
|
2995
|
+
Use-cases:
|
|
2996
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
2997
|
+
|
|
2998
|
+
@example
|
|
2999
|
+
```
|
|
3000
|
+
import type {IsEqual} from 'type-fest';
|
|
3001
|
+
|
|
3002
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
3003
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
3004
|
+
type Includes<Value extends readonly any[], Item> =
|
|
3005
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
3006
|
+
? IsEqual<Value[0], Item> extends true
|
|
3007
|
+
? true
|
|
3008
|
+
: Includes<rest, Item>
|
|
3009
|
+
: false;
|
|
3010
|
+
```
|
|
3011
|
+
|
|
3012
|
+
@category Type Guard
|
|
3013
|
+
@category Utilities
|
|
3014
|
+
*/
|
|
3015
|
+
type IsEqual<A, B> =
|
|
3016
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
3017
|
+
(<G>() => G extends B ? 1 : 2)
|
|
3018
|
+
? true
|
|
3019
|
+
: false;
|
|
3020
|
+
|
|
3021
|
+
/**
|
|
3022
|
+
Filter out keys from an object.
|
|
3023
|
+
|
|
3024
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
3025
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
3026
|
+
Returns `Key` otherwise.
|
|
3027
|
+
|
|
3028
|
+
@example
|
|
3029
|
+
```
|
|
3030
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
3031
|
+
//=> never
|
|
3032
|
+
```
|
|
3033
|
+
|
|
3034
|
+
@example
|
|
3035
|
+
```
|
|
3036
|
+
type Filtered = Filter<'bar', string>;
|
|
3037
|
+
//=> never
|
|
3038
|
+
```
|
|
3039
|
+
|
|
3040
|
+
@example
|
|
3041
|
+
```
|
|
3042
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
3043
|
+
//=> 'bar'
|
|
3044
|
+
```
|
|
3045
|
+
|
|
3046
|
+
@see {Except}
|
|
3047
|
+
*/
|
|
3048
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3049
|
+
|
|
3050
|
+
type ExceptOptions = {
|
|
3051
|
+
/**
|
|
3052
|
+
Disallow assigning non-specified properties.
|
|
3053
|
+
|
|
3054
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3055
|
+
|
|
3056
|
+
@default false
|
|
3057
|
+
*/
|
|
3058
|
+
requireExactProps?: boolean;
|
|
3059
|
+
};
|
|
3060
|
+
|
|
3061
|
+
/**
|
|
3062
|
+
Create a type from an object type without certain keys.
|
|
3063
|
+
|
|
3064
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
3065
|
+
|
|
3066
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
3067
|
+
|
|
3068
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
3069
|
+
|
|
3070
|
+
@example
|
|
3071
|
+
```
|
|
3072
|
+
import type {Except} from 'type-fest';
|
|
3073
|
+
|
|
3074
|
+
type Foo = {
|
|
3075
|
+
a: number;
|
|
3076
|
+
b: string;
|
|
3077
|
+
};
|
|
1484
3078
|
|
|
1485
|
-
type
|
|
1486
|
-
|
|
1487
|
-
type index_d$2_CreateDnsZoneResponse = CreateDnsZoneResponse;
|
|
1488
|
-
type index_d$2_CreateDnsZoneResponseNonNullableFields = CreateDnsZoneResponseNonNullableFields;
|
|
1489
|
-
type index_d$2_DeleteDnsZoneRequest = DeleteDnsZoneRequest;
|
|
1490
|
-
type index_d$2_DeleteDnsZoneResponse = DeleteDnsZoneResponse;
|
|
1491
|
-
type index_d$2_DnsRecord = DnsRecord;
|
|
1492
|
-
type index_d$2_DnsRecordsChangedEvent = DnsRecordsChangedEvent;
|
|
1493
|
-
type index_d$2_DnsZone = DnsZone;
|
|
1494
|
-
type index_d$2_DnsZoneNonNullableFields = DnsZoneNonNullableFields;
|
|
1495
|
-
type index_d$2_DnssecInfo = DnssecInfo;
|
|
1496
|
-
type index_d$2_DomainEvent = DomainEvent;
|
|
1497
|
-
type index_d$2_DomainEventBodyOneOf = DomainEventBodyOneOf;
|
|
1498
|
-
type index_d$2_DomainRemovedEvent = DomainRemovedEvent;
|
|
1499
|
-
type index_d$2_EntityCreatedEvent = EntityCreatedEvent;
|
|
1500
|
-
type index_d$2_EntityDeletedEvent = EntityDeletedEvent;
|
|
1501
|
-
type index_d$2_EntityUpdatedEvent = EntityUpdatedEvent;
|
|
1502
|
-
type index_d$2_GetDnsZoneRequest = GetDnsZoneRequest;
|
|
1503
|
-
type index_d$2_GetDnsZoneResponse = GetDnsZoneResponse;
|
|
1504
|
-
type index_d$2_GetDnsZoneResponseNonNullableFields = GetDnsZoneResponseNonNullableFields;
|
|
1505
|
-
type index_d$2_IdentificationData = IdentificationData;
|
|
1506
|
-
type index_d$2_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
|
|
1507
|
-
type index_d$2_MessageEnvelope = MessageEnvelope;
|
|
1508
|
-
type index_d$2_PreviewDnsZoneRequest = PreviewDnsZoneRequest;
|
|
1509
|
-
type index_d$2_PreviewDnsZoneResponse = PreviewDnsZoneResponse;
|
|
1510
|
-
type index_d$2_PreviewDnsZoneResponseNonNullableFields = PreviewDnsZoneResponseNonNullableFields;
|
|
1511
|
-
type index_d$2_RecordType = RecordType;
|
|
1512
|
-
declare const index_d$2_RecordType: typeof RecordType;
|
|
1513
|
-
type index_d$2_RestoreInfo = RestoreInfo;
|
|
1514
|
-
type index_d$2_UpdateDnsZoneOptions = UpdateDnsZoneOptions;
|
|
1515
|
-
type index_d$2_UpdateDnsZoneRequest = UpdateDnsZoneRequest;
|
|
1516
|
-
type index_d$2_UpdateDnsZoneResponse = UpdateDnsZoneResponse;
|
|
1517
|
-
type index_d$2_UpdateDnsZoneResponseNonNullableFields = UpdateDnsZoneResponseNonNullableFields;
|
|
1518
|
-
type index_d$2_WebhookIdentityType = WebhookIdentityType;
|
|
1519
|
-
declare const index_d$2_WebhookIdentityType: typeof WebhookIdentityType;
|
|
1520
|
-
declare const index_d$2_createDnsZone: typeof createDnsZone;
|
|
1521
|
-
declare const index_d$2_deleteDnsZone: typeof deleteDnsZone;
|
|
1522
|
-
declare const index_d$2_getDnsZone: typeof getDnsZone;
|
|
1523
|
-
declare const index_d$2_previewDnsZone: typeof previewDnsZone;
|
|
1524
|
-
declare const index_d$2_updateDnsZone: typeof updateDnsZone;
|
|
1525
|
-
declare namespace index_d$2 {
|
|
1526
|
-
export { type index_d$2_ActionEvent as ActionEvent, type index_d$2_CreateDnsZoneRequest as CreateDnsZoneRequest, type index_d$2_CreateDnsZoneResponse as CreateDnsZoneResponse, type index_d$2_CreateDnsZoneResponseNonNullableFields as CreateDnsZoneResponseNonNullableFields, type index_d$2_DeleteDnsZoneRequest as DeleteDnsZoneRequest, type index_d$2_DeleteDnsZoneResponse as DeleteDnsZoneResponse, type index_d$2_DnsRecord as DnsRecord, type index_d$2_DnsRecordsChangedEvent as DnsRecordsChangedEvent, type index_d$2_DnsZone as DnsZone, type index_d$2_DnsZoneNonNullableFields as DnsZoneNonNullableFields, type index_d$2_DnssecInfo as DnssecInfo, type index_d$2_DomainEvent as DomainEvent, type index_d$2_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d$2_DomainRemovedEvent as DomainRemovedEvent, type index_d$2_EntityCreatedEvent as EntityCreatedEvent, type index_d$2_EntityDeletedEvent as EntityDeletedEvent, type index_d$2_EntityUpdatedEvent as EntityUpdatedEvent, type index_d$2_GetDnsZoneRequest as GetDnsZoneRequest, type index_d$2_GetDnsZoneResponse as GetDnsZoneResponse, type index_d$2_GetDnsZoneResponseNonNullableFields as GetDnsZoneResponseNonNullableFields, type index_d$2_IdentificationData as IdentificationData, type index_d$2_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d$2_MessageEnvelope as MessageEnvelope, type index_d$2_PreviewDnsZoneRequest as PreviewDnsZoneRequest, type index_d$2_PreviewDnsZoneResponse as PreviewDnsZoneResponse, type index_d$2_PreviewDnsZoneResponseNonNullableFields as PreviewDnsZoneResponseNonNullableFields, index_d$2_RecordType as RecordType, type index_d$2_RestoreInfo as RestoreInfo, type index_d$2_UpdateDnsZoneOptions as UpdateDnsZoneOptions, type index_d$2_UpdateDnsZoneRequest as UpdateDnsZoneRequest, type index_d$2_UpdateDnsZoneResponse as UpdateDnsZoneResponse, type index_d$2_UpdateDnsZoneResponseNonNullableFields as UpdateDnsZoneResponseNonNullableFields, index_d$2_WebhookIdentityType as WebhookIdentityType, index_d$2_createDnsZone as createDnsZone, index_d$2_deleteDnsZone as deleteDnsZone, index_d$2_getDnsZone as getDnsZone, index_d$2_previewDnsZone as previewDnsZone, index_d$2_updateDnsZone as updateDnsZone };
|
|
1527
|
-
}
|
|
3079
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
3080
|
+
//=> {b: string}
|
|
1528
3081
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
3082
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
3083
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
3084
|
+
|
|
3085
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
3086
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
3087
|
+
|
|
3088
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
3089
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
3090
|
+
```
|
|
3091
|
+
|
|
3092
|
+
@category Object
|
|
3093
|
+
*/
|
|
3094
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
3095
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
3096
|
+
} & (Options['requireExactProps'] extends true
|
|
3097
|
+
? Partial<Record<KeysType, never>>
|
|
3098
|
+
: {});
|
|
3099
|
+
|
|
3100
|
+
/**
|
|
3101
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
3102
|
+
|
|
3103
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
3104
|
+
|
|
3105
|
+
@example
|
|
3106
|
+
```
|
|
3107
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3108
|
+
|
|
3109
|
+
interface Example {
|
|
3110
|
+
a: string;
|
|
3111
|
+
b: string | number;
|
|
3112
|
+
c?: string;
|
|
3113
|
+
d: {};
|
|
1559
3114
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
3115
|
+
|
|
3116
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
3117
|
+
//=> 'a'
|
|
3118
|
+
```
|
|
3119
|
+
|
|
3120
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
3121
|
+
|
|
3122
|
+
@example
|
|
3123
|
+
```
|
|
3124
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3125
|
+
|
|
3126
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
3127
|
+
//=> 'a' | 'c'
|
|
3128
|
+
```
|
|
3129
|
+
|
|
3130
|
+
@category Object
|
|
3131
|
+
*/
|
|
3132
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
3133
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
3134
|
+
{
|
|
3135
|
+
// Map through all the keys of the given base type.
|
|
3136
|
+
[Key in keyof Base]:
|
|
3137
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
3138
|
+
Base[Key] extends Condition
|
|
3139
|
+
// Retain this key since the condition passes.
|
|
3140
|
+
? Key
|
|
3141
|
+
// Discard this key since the condition fails.
|
|
3142
|
+
: never;
|
|
3143
|
+
|
|
3144
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
3145
|
+
}[keyof Base]
|
|
3146
|
+
>;
|
|
3147
|
+
|
|
3148
|
+
/**
|
|
3149
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
3150
|
+
|
|
3151
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
3152
|
+
|
|
3153
|
+
@example
|
|
3154
|
+
```
|
|
3155
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3156
|
+
|
|
3157
|
+
class Awesome {
|
|
3158
|
+
name: string;
|
|
3159
|
+
successes: number;
|
|
3160
|
+
failures: bigint;
|
|
3161
|
+
|
|
3162
|
+
run() {}
|
|
1562
3163
|
}
|
|
1563
3164
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
* @param - Domain name. Must include the TLD. For example, `my-new-domain.com`. Only
|
|
1578
|
-
* alphanumeric characters, hyphens, and dots are supported.
|
|
1579
|
-
*
|
|
1580
|
-
* Min: 3 characters
|
|
1581
|
-
* Max: 63 characters
|
|
1582
|
-
*/
|
|
1583
|
-
(domain: string): Promise<CheckDomainAvailabilityResponse & CheckDomainAvailabilityResponseNonNullableFields>;
|
|
3165
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3166
|
+
//=> {run: () => void}
|
|
3167
|
+
```
|
|
3168
|
+
|
|
3169
|
+
@example
|
|
3170
|
+
```
|
|
3171
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3172
|
+
|
|
3173
|
+
interface Example {
|
|
3174
|
+
a: string;
|
|
3175
|
+
b: string | number;
|
|
3176
|
+
c: () => void;
|
|
3177
|
+
d: {};
|
|
1584
3178
|
}
|
|
1585
3179
|
|
|
1586
|
-
|
|
3180
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3181
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3182
|
+
```
|
|
1587
3183
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
type
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
3184
|
+
@category Object
|
|
3185
|
+
*/
|
|
3186
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
3187
|
+
Base,
|
|
3188
|
+
ConditionalKeys<Base, Condition>
|
|
3189
|
+
>;
|
|
3190
|
+
|
|
3191
|
+
/**
|
|
3192
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3193
|
+
* can either be a REST module or a host module.
|
|
3194
|
+
* This type is recursive, so it can describe nested modules.
|
|
3195
|
+
*/
|
|
3196
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
3197
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
3198
|
+
};
|
|
3199
|
+
/**
|
|
3200
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3201
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3202
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3203
|
+
* do not match the given host (as they will not work with the given host).
|
|
3204
|
+
*/
|
|
3205
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
3206
|
+
done: T;
|
|
3207
|
+
recurse: T extends {
|
|
3208
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
3209
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
3210
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
3211
|
+
-1,
|
|
3212
|
+
0,
|
|
3213
|
+
1,
|
|
3214
|
+
2,
|
|
3215
|
+
3,
|
|
3216
|
+
4,
|
|
3217
|
+
5
|
|
3218
|
+
][Depth]> : never;
|
|
3219
|
+
}, EmptyObject>;
|
|
3220
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3221
|
+
type PublicMetadata = {
|
|
3222
|
+
PACKAGE_NAME?: string;
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3225
|
+
declare global {
|
|
3226
|
+
interface ContextualClient {
|
|
3227
|
+
}
|
|
1595
3228
|
}
|
|
3229
|
+
/**
|
|
3230
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3231
|
+
* case a contextual client is available.
|
|
3232
|
+
*/
|
|
3233
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
3234
|
+
host: Host;
|
|
3235
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
1596
3236
|
|
|
1597
3237
|
interface DomainSuggestion {
|
|
1598
3238
|
/** Suggested domain name including TLD. */
|