@wix/multilingual 1.0.50 → 1.0.52
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 +8 -8
- package/type-bundles/context.bundle.d.ts +2674 -168
- package/type-bundles/index.bundle.d.ts +2674 -168
- package/type-bundles/meta.bundle.d.ts +116 -88
|
@@ -1,39 +1,127 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type HostModule$5<T, H extends Host$5> = {
|
|
2
|
+
__type: 'host';
|
|
3
|
+
create(host: H): T;
|
|
4
|
+
};
|
|
5
|
+
type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
|
|
6
|
+
type Host$5<Environment = unknown> = {
|
|
7
|
+
channel: {
|
|
8
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
|
+
disconnect: () => void;
|
|
10
|
+
} | Promise<{
|
|
11
|
+
disconnect: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
|
+
*/
|
|
18
|
+
apiBaseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
21
|
+
* like internationalization, billing, etc.
|
|
22
|
+
*/
|
|
23
|
+
essentials?: {
|
|
24
|
+
/**
|
|
25
|
+
* The language of the currently viewed session
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The locale of the currently viewed session
|
|
30
|
+
*/
|
|
31
|
+
locale?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Any headers that should be passed through to the API requests
|
|
34
|
+
*/
|
|
35
|
+
passThroughHeaders?: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
|
|
40
|
+
interface HttpClient$5 {
|
|
41
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
|
|
4
42
|
fetchWithAuth: typeof fetch;
|
|
5
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
|
+
getActiveToken?: () => string | undefined;
|
|
6
45
|
}
|
|
7
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
8
|
-
type HttpResponse<T = any> = {
|
|
46
|
+
type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
|
|
47
|
+
type HttpResponse$5<T = any> = {
|
|
9
48
|
data: T;
|
|
10
49
|
status: number;
|
|
11
50
|
statusText: string;
|
|
12
51
|
headers: any;
|
|
13
52
|
request?: any;
|
|
14
53
|
};
|
|
15
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
54
|
+
type RequestOptions$5<_TResponse = any, Data = any> = {
|
|
16
55
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
17
56
|
url: string;
|
|
18
57
|
data?: Data;
|
|
19
58
|
params?: URLSearchParams;
|
|
20
|
-
} & APIMetadata;
|
|
21
|
-
type APIMetadata = {
|
|
59
|
+
} & APIMetadata$5;
|
|
60
|
+
type APIMetadata$5 = {
|
|
22
61
|
methodFqn?: string;
|
|
23
62
|
entityFqdn?: string;
|
|
24
63
|
packageName?: string;
|
|
25
64
|
};
|
|
26
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
27
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
65
|
+
type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
|
|
66
|
+
type EventDefinition$8<Payload = unknown, Type extends string = string> = {
|
|
28
67
|
__type: 'event-definition';
|
|
29
68
|
type: Type;
|
|
30
69
|
isDomainEvent?: boolean;
|
|
31
70
|
transformations?: (envelope: unknown) => Payload;
|
|
32
71
|
__payload: Payload;
|
|
33
72
|
};
|
|
34
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
35
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
36
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
73
|
+
declare function EventDefinition$8<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$8<Payload, Type>;
|
|
74
|
+
type EventHandler$8<T extends EventDefinition$8> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$8<T extends EventDefinition$8<any, string>> = (handler: EventHandler$8<T>) => void;
|
|
76
|
+
|
|
77
|
+
type ServicePluginMethodInput$5 = {
|
|
78
|
+
request: any;
|
|
79
|
+
metadata: any;
|
|
80
|
+
};
|
|
81
|
+
type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata$5 = {
|
|
83
|
+
name: string;
|
|
84
|
+
primaryHttpMappingPath: string;
|
|
85
|
+
transformations: {
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
|
|
87
|
+
toREST: (...args: unknown[]) => unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
|
|
91
|
+
__type: 'service-plugin-definition';
|
|
92
|
+
componentType: string;
|
|
93
|
+
methods: ServicePluginMethodMetadata$5[];
|
|
94
|
+
__contract: Contract;
|
|
95
|
+
};
|
|
96
|
+
declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
|
|
99
|
+
|
|
100
|
+
type RequestContext$5 = {
|
|
101
|
+
isSSR: boolean;
|
|
102
|
+
host: string;
|
|
103
|
+
protocol?: string;
|
|
104
|
+
};
|
|
105
|
+
type ResponseTransformer$5 = (data: any, headers?: any) => any;
|
|
106
|
+
/**
|
|
107
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
|
+
*/
|
|
111
|
+
type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions$5<T = any> = {
|
|
113
|
+
_?: T;
|
|
114
|
+
url?: string;
|
|
115
|
+
method?: Method$5;
|
|
116
|
+
params?: any;
|
|
117
|
+
data?: any;
|
|
118
|
+
transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
|
|
119
|
+
};
|
|
120
|
+
type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
|
|
121
|
+
__isAmbassador: boolean;
|
|
122
|
+
};
|
|
123
|
+
type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
37
125
|
|
|
38
126
|
declare global {
|
|
39
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -42,6 +130,284 @@ declare global {
|
|
|
42
130
|
}
|
|
43
131
|
}
|
|
44
132
|
|
|
133
|
+
declare const emptyObjectSymbol$5: unique symbol;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
137
|
+
|
|
138
|
+
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)).
|
|
139
|
+
|
|
140
|
+
@example
|
|
141
|
+
```
|
|
142
|
+
import type {EmptyObject} from 'type-fest';
|
|
143
|
+
|
|
144
|
+
// The following illustrates the problem with `{}`.
|
|
145
|
+
const foo1: {} = {}; // Pass
|
|
146
|
+
const foo2: {} = []; // Pass
|
|
147
|
+
const foo3: {} = 42; // Pass
|
|
148
|
+
const foo4: {} = {a: 1}; // Pass
|
|
149
|
+
|
|
150
|
+
// With `EmptyObject` only the first case is valid.
|
|
151
|
+
const bar1: EmptyObject = {}; // Pass
|
|
152
|
+
const bar2: EmptyObject = 42; // Fail
|
|
153
|
+
const bar3: EmptyObject = []; // Fail
|
|
154
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
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}.
|
|
158
|
+
|
|
159
|
+
@category Object
|
|
160
|
+
*/
|
|
161
|
+
type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Returns a boolean for whether the two given types are equal.
|
|
165
|
+
|
|
166
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
167
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
168
|
+
|
|
169
|
+
Use-cases:
|
|
170
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
171
|
+
|
|
172
|
+
@example
|
|
173
|
+
```
|
|
174
|
+
import type {IsEqual} from 'type-fest';
|
|
175
|
+
|
|
176
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
177
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
178
|
+
type Includes<Value extends readonly any[], Item> =
|
|
179
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
180
|
+
? IsEqual<Value[0], Item> extends true
|
|
181
|
+
? true
|
|
182
|
+
: Includes<rest, Item>
|
|
183
|
+
: false;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
@category Type Guard
|
|
187
|
+
@category Utilities
|
|
188
|
+
*/
|
|
189
|
+
type IsEqual$5<A, B> =
|
|
190
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
191
|
+
(<G>() => G extends B ? 1 : 2)
|
|
192
|
+
? true
|
|
193
|
+
: false;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
Filter out keys from an object.
|
|
197
|
+
|
|
198
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
199
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
200
|
+
Returns `Key` otherwise.
|
|
201
|
+
|
|
202
|
+
@example
|
|
203
|
+
```
|
|
204
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
205
|
+
//=> never
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
@example
|
|
209
|
+
```
|
|
210
|
+
type Filtered = Filter<'bar', string>;
|
|
211
|
+
//=> never
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
@example
|
|
215
|
+
```
|
|
216
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
217
|
+
//=> 'bar'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
@see {Except}
|
|
221
|
+
*/
|
|
222
|
+
type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
|
+
|
|
224
|
+
type ExceptOptions$5 = {
|
|
225
|
+
/**
|
|
226
|
+
Disallow assigning non-specified properties.
|
|
227
|
+
|
|
228
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
229
|
+
|
|
230
|
+
@default false
|
|
231
|
+
*/
|
|
232
|
+
requireExactProps?: boolean;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
Create a type from an object type without certain keys.
|
|
237
|
+
|
|
238
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
239
|
+
|
|
240
|
+
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.
|
|
241
|
+
|
|
242
|
+
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)).
|
|
243
|
+
|
|
244
|
+
@example
|
|
245
|
+
```
|
|
246
|
+
import type {Except} from 'type-fest';
|
|
247
|
+
|
|
248
|
+
type Foo = {
|
|
249
|
+
a: number;
|
|
250
|
+
b: string;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
254
|
+
//=> {b: string}
|
|
255
|
+
|
|
256
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
257
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
258
|
+
|
|
259
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
260
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
261
|
+
|
|
262
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
263
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
@category Object
|
|
267
|
+
*/
|
|
268
|
+
type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
|
+
} & (Options['requireExactProps'] extends true
|
|
271
|
+
? Partial<Record<KeysType, never>>
|
|
272
|
+
: {});
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
|
+
|
|
277
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
278
|
+
|
|
279
|
+
@example
|
|
280
|
+
```
|
|
281
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
282
|
+
|
|
283
|
+
interface Example {
|
|
284
|
+
a: string;
|
|
285
|
+
b: string | number;
|
|
286
|
+
c?: string;
|
|
287
|
+
d: {};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
291
|
+
//=> 'a'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
295
|
+
|
|
296
|
+
@example
|
|
297
|
+
```
|
|
298
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
299
|
+
|
|
300
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
301
|
+
//=> 'a' | 'c'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
@category Object
|
|
305
|
+
*/
|
|
306
|
+
type ConditionalKeys$5<Base, Condition> = NonNullable<
|
|
307
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
|
+
{
|
|
309
|
+
// Map through all the keys of the given base type.
|
|
310
|
+
[Key in keyof Base]:
|
|
311
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
312
|
+
Base[Key] extends Condition
|
|
313
|
+
// Retain this key since the condition passes.
|
|
314
|
+
? Key
|
|
315
|
+
// Discard this key since the condition fails.
|
|
316
|
+
: never;
|
|
317
|
+
|
|
318
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
+
}[keyof Base]
|
|
320
|
+
>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
324
|
+
|
|
325
|
+
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.
|
|
326
|
+
|
|
327
|
+
@example
|
|
328
|
+
```
|
|
329
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
330
|
+
|
|
331
|
+
class Awesome {
|
|
332
|
+
name: string;
|
|
333
|
+
successes: number;
|
|
334
|
+
failures: bigint;
|
|
335
|
+
|
|
336
|
+
run() {}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
340
|
+
//=> {run: () => void}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
@example
|
|
344
|
+
```
|
|
345
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
346
|
+
|
|
347
|
+
interface Example {
|
|
348
|
+
a: string;
|
|
349
|
+
b: string | number;
|
|
350
|
+
c: () => void;
|
|
351
|
+
d: {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
355
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
@category Object
|
|
359
|
+
*/
|
|
360
|
+
type ConditionalExcept$5<Base, Condition> = Except$5<
|
|
361
|
+
Base,
|
|
362
|
+
ConditionalKeys$5<Base, Condition>
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
367
|
+
* can either be a REST module or a host module.
|
|
368
|
+
* This type is recursive, so it can describe nested modules.
|
|
369
|
+
*/
|
|
370
|
+
type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$8<any> | ServicePluginDefinition$5<any> | {
|
|
371
|
+
[key: string]: Descriptors$5 | PublicMetadata$5 | any;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
375
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
376
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
|
+
* do not match the given host (as they will not work with the given host).
|
|
378
|
+
*/
|
|
379
|
+
type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
|
|
380
|
+
done: T;
|
|
381
|
+
recurse: T extends {
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$8<any> ? BuildEventDefinition$8<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
|
|
385
|
+
-1,
|
|
386
|
+
0,
|
|
387
|
+
1,
|
|
388
|
+
2,
|
|
389
|
+
3,
|
|
390
|
+
4,
|
|
391
|
+
5
|
|
392
|
+
][Depth]> : never;
|
|
393
|
+
}, EmptyObject$5>;
|
|
394
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
+
type PublicMetadata$5 = {
|
|
396
|
+
PACKAGE_NAME?: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare global {
|
|
400
|
+
interface ContextualClient {
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A type used to create concerete types from SDK descriptors in
|
|
405
|
+
* case a contextual client is available.
|
|
406
|
+
*/
|
|
407
|
+
type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host$5;
|
|
409
|
+
} ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
|
|
410
|
+
|
|
45
411
|
interface Mapper {
|
|
46
412
|
_id?: string | null;
|
|
47
413
|
/** The FQDN of the entity the mapper refer to of exist */
|
|
@@ -476,7 +842,7 @@ interface SyncEditorDataOptions {
|
|
|
476
842
|
syncFilter?: SyncFilter;
|
|
477
843
|
}
|
|
478
844
|
|
|
479
|
-
declare function syncEditorData$1(httpClient: HttpClient): SyncEditorDataSignature;
|
|
845
|
+
declare function syncEditorData$1(httpClient: HttpClient$5): SyncEditorDataSignature;
|
|
480
846
|
interface SyncEditorDataSignature {
|
|
481
847
|
/**
|
|
482
848
|
* Update localization content with editor data
|
|
@@ -484,7 +850,7 @@ interface SyncEditorDataSignature {
|
|
|
484
850
|
(options?: SyncEditorDataOptions | undefined): Promise<void>;
|
|
485
851
|
}
|
|
486
852
|
|
|
487
|
-
declare const syncEditorData: BuildRESTFunction<typeof syncEditorData$1> & typeof syncEditorData$1
|
|
853
|
+
declare const syncEditorData: MaybeContext$5<BuildRESTFunction$5<typeof syncEditorData$1> & typeof syncEditorData$1>;
|
|
488
854
|
|
|
489
855
|
type context$5_ChangedPages = ChangedPages;
|
|
490
856
|
type context$5_CreateOrUpdateAction = CreateOrUpdateAction;
|
|
@@ -536,10 +902,419 @@ declare namespace context$5 {
|
|
|
536
902
|
export { type ActionEvent$3 as ActionEvent, type context$5_ChangedPages as ChangedPages, type context$5_CreateOrUpdateAction as CreateOrUpdateAction, type context$5_CreateOrUpdateEditorMapperRequest as CreateOrUpdateEditorMapperRequest, type context$5_CreateOrUpdateEditorMapperResponse as CreateOrUpdateEditorMapperResponse, type context$5_CreateOrUpdateNileMapperRequest as CreateOrUpdateNileMapperRequest, type context$5_CreateOrUpdateNileMapperResponse as CreateOrUpdateNileMapperResponse, type context$5_DeleteAction as DeleteAction, type context$5_DeleteEntityMapperRequest as DeleteEntityMapperRequest, type context$5_DeleteEntityMapperResponse as DeleteEntityMapperResponse, type context$5_DeleteMapperRequest as DeleteMapperRequest, type context$5_DeleteMapperResponse as DeleteMapperResponse, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type Empty$2 as Empty, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type context$5_FieldSequence as FieldSequence, FieldType$1 as FieldType, type context$5_GetEntityMapperRequest as GetEntityMapperRequest, type context$5_GetEntityMapperResponse as GetEntityMapperResponse, type context$5_GetMapperRequest as GetMapperRequest, type context$5_GetMapperResponse as GetMapperResponse, type context$5_GetSubscribedTopicsRequest as GetSubscribedTopicsRequest, type context$5_GetSubscribedTopicsResponse as GetSubscribedTopicsResponse, type context$5_HtmlNewRevisionSavedMessage as HtmlNewRevisionSavedMessage, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$5_ListEntityMapperRequest as ListEntityMapperRequest, type context$5_ListEntityMapperResponse as ListEntityMapperResponse, type context$5_ListMappersRequest as ListMappersRequest, type context$5_ListMappersResponse as ListMappersResponse, type context$5_LocalizationPublicAction as LocalizationPublicAction, type context$5_LocalizationPublicActionActionOneOf as LocalizationPublicActionActionOneOf, type context$5_LocalizedContentKey as LocalizedContentKey, type context$5_LocalizedPublishedContent as LocalizedPublishedContent, type context$5_LocalizedPublishedContentField as LocalizedPublishedContentField, type context$5_LocalizedPublishedContentFieldValueOneOf as LocalizedPublishedContentFieldValueOneOf, type context$5_LocalizedPublishedLanguageContentChanged as LocalizedPublishedLanguageContentChanged, type context$5_Mapper as Mapper, type context$5_MapperField as MapperField, type context$5_MediaItem as MediaItem, type context$5_MediaItemMediaOneOf as MediaItemMediaOneOf, type MessageEnvelope$3 as MessageEnvelope, type context$5_Page as Page, type context$5_PublishSiteTranslationsRequest as PublishSiteTranslationsRequest, type context$5_PublishSiteTranslationsResponse as PublishSiteTranslationsResponse, type RestoreInfo$3 as RestoreInfo, type context$5_RevisionInfo as RevisionInfo, type SchemaKey$2 as SchemaKey, SchemaScope$2 as SchemaScope, type context$5_SequencePath as SequencePath, type context$5_StressDMRequest as StressDMRequest, type context$5_StressDMResponse as StressDMResponse, type context$5_SyncEditorDataOptions as SyncEditorDataOptions, type context$5_SyncEditorDataRequest as SyncEditorDataRequest, type context$5_SyncEditorDataResponse as SyncEditorDataResponse, type context$5_SyncFilter as SyncFilter, type VideoResolution$2 as VideoResolution, WebhookIdentityType$3 as WebhookIdentityType, context$5_syncEditorData as syncEditorData };
|
|
537
903
|
}
|
|
538
904
|
|
|
539
|
-
|
|
905
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
906
|
+
__type: 'host';
|
|
907
|
+
create(host: H): T;
|
|
908
|
+
};
|
|
909
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
910
|
+
type Host$4<Environment = unknown> = {
|
|
911
|
+
channel: {
|
|
912
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
913
|
+
disconnect: () => void;
|
|
914
|
+
} | Promise<{
|
|
915
|
+
disconnect: () => void;
|
|
916
|
+
}>;
|
|
917
|
+
};
|
|
918
|
+
environment?: Environment;
|
|
919
|
+
/**
|
|
920
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
921
|
+
*/
|
|
922
|
+
apiBaseUrl?: string;
|
|
923
|
+
/**
|
|
924
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
925
|
+
* like internationalization, billing, etc.
|
|
926
|
+
*/
|
|
927
|
+
essentials?: {
|
|
928
|
+
/**
|
|
929
|
+
* The language of the currently viewed session
|
|
930
|
+
*/
|
|
931
|
+
language?: string;
|
|
932
|
+
/**
|
|
933
|
+
* The locale of the currently viewed session
|
|
934
|
+
*/
|
|
935
|
+
locale?: string;
|
|
936
|
+
/**
|
|
937
|
+
* Any headers that should be passed through to the API requests
|
|
938
|
+
*/
|
|
939
|
+
passThroughHeaders?: Record<string, string>;
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
944
|
+
interface HttpClient$4 {
|
|
945
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
946
|
+
fetchWithAuth: typeof fetch;
|
|
947
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
948
|
+
getActiveToken?: () => string | undefined;
|
|
949
|
+
}
|
|
950
|
+
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
951
|
+
type HttpResponse$4<T = any> = {
|
|
952
|
+
data: T;
|
|
953
|
+
status: number;
|
|
954
|
+
statusText: string;
|
|
955
|
+
headers: any;
|
|
956
|
+
request?: any;
|
|
957
|
+
};
|
|
958
|
+
type RequestOptions$4<_TResponse = any, Data = any> = {
|
|
959
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
960
|
+
url: string;
|
|
961
|
+
data?: Data;
|
|
962
|
+
params?: URLSearchParams;
|
|
963
|
+
} & APIMetadata$4;
|
|
964
|
+
type APIMetadata$4 = {
|
|
965
|
+
methodFqn?: string;
|
|
966
|
+
entityFqdn?: string;
|
|
967
|
+
packageName?: string;
|
|
968
|
+
};
|
|
969
|
+
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
970
|
+
type EventDefinition$7<Payload = unknown, Type extends string = string> = {
|
|
971
|
+
__type: 'event-definition';
|
|
972
|
+
type: Type;
|
|
973
|
+
isDomainEvent?: boolean;
|
|
974
|
+
transformations?: (envelope: unknown) => Payload;
|
|
975
|
+
__payload: Payload;
|
|
976
|
+
};
|
|
977
|
+
declare function EventDefinition$7<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$7<Payload, Type>;
|
|
978
|
+
type EventHandler$7<T extends EventDefinition$7> = (payload: T['__payload']) => void | Promise<void>;
|
|
979
|
+
type BuildEventDefinition$7<T extends EventDefinition$7<any, string>> = (handler: EventHandler$7<T>) => void;
|
|
980
|
+
|
|
981
|
+
type ServicePluginMethodInput$4 = {
|
|
982
|
+
request: any;
|
|
983
|
+
metadata: any;
|
|
984
|
+
};
|
|
985
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
986
|
+
type ServicePluginMethodMetadata$4 = {
|
|
987
|
+
name: string;
|
|
988
|
+
primaryHttpMappingPath: string;
|
|
989
|
+
transformations: {
|
|
990
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
991
|
+
toREST: (...args: unknown[]) => unknown;
|
|
992
|
+
};
|
|
993
|
+
};
|
|
994
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
995
|
+
__type: 'service-plugin-definition';
|
|
996
|
+
componentType: string;
|
|
997
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
998
|
+
__contract: Contract;
|
|
999
|
+
};
|
|
1000
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
1001
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
1002
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
1003
|
+
|
|
1004
|
+
type RequestContext$4 = {
|
|
1005
|
+
isSSR: boolean;
|
|
1006
|
+
host: string;
|
|
1007
|
+
protocol?: string;
|
|
1008
|
+
};
|
|
1009
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
1010
|
+
/**
|
|
1011
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1012
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1013
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1014
|
+
*/
|
|
1015
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1016
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
1017
|
+
_?: T;
|
|
1018
|
+
url?: string;
|
|
1019
|
+
method?: Method$4;
|
|
1020
|
+
params?: any;
|
|
1021
|
+
data?: any;
|
|
1022
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
1023
|
+
};
|
|
1024
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
1025
|
+
__isAmbassador: boolean;
|
|
1026
|
+
};
|
|
1027
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
1028
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1029
|
+
|
|
1030
|
+
declare global {
|
|
1031
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1032
|
+
interface SymbolConstructor {
|
|
1033
|
+
readonly observable: symbol;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1041
|
+
|
|
1042
|
+
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)).
|
|
1043
|
+
|
|
1044
|
+
@example
|
|
1045
|
+
```
|
|
1046
|
+
import type {EmptyObject} from 'type-fest';
|
|
1047
|
+
|
|
1048
|
+
// The following illustrates the problem with `{}`.
|
|
1049
|
+
const foo1: {} = {}; // Pass
|
|
1050
|
+
const foo2: {} = []; // Pass
|
|
1051
|
+
const foo3: {} = 42; // Pass
|
|
1052
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1053
|
+
|
|
1054
|
+
// With `EmptyObject` only the first case is valid.
|
|
1055
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1056
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1057
|
+
const bar3: EmptyObject = []; // Fail
|
|
1058
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
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}.
|
|
1062
|
+
|
|
1063
|
+
@category Object
|
|
1064
|
+
*/
|
|
1065
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
Returns a boolean for whether the two given types are equal.
|
|
1069
|
+
|
|
1070
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1071
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1072
|
+
|
|
1073
|
+
Use-cases:
|
|
1074
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1075
|
+
|
|
1076
|
+
@example
|
|
1077
|
+
```
|
|
1078
|
+
import type {IsEqual} from 'type-fest';
|
|
1079
|
+
|
|
1080
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1081
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1082
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1083
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1084
|
+
? IsEqual<Value[0], Item> extends true
|
|
1085
|
+
? true
|
|
1086
|
+
: Includes<rest, Item>
|
|
1087
|
+
: false;
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
@category Type Guard
|
|
1091
|
+
@category Utilities
|
|
1092
|
+
*/
|
|
1093
|
+
type IsEqual$4<A, B> =
|
|
1094
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1095
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1096
|
+
? true
|
|
1097
|
+
: false;
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
Filter out keys from an object.
|
|
1101
|
+
|
|
1102
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1103
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1104
|
+
Returns `Key` otherwise.
|
|
1105
|
+
|
|
1106
|
+
@example
|
|
1107
|
+
```
|
|
1108
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1109
|
+
//=> never
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
@example
|
|
1113
|
+
```
|
|
1114
|
+
type Filtered = Filter<'bar', string>;
|
|
1115
|
+
//=> never
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
@example
|
|
1119
|
+
```
|
|
1120
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1121
|
+
//=> 'bar'
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
@see {Except}
|
|
1125
|
+
*/
|
|
1126
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1127
|
+
|
|
1128
|
+
type ExceptOptions$4 = {
|
|
1129
|
+
/**
|
|
1130
|
+
Disallow assigning non-specified properties.
|
|
1131
|
+
|
|
1132
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1133
|
+
|
|
1134
|
+
@default false
|
|
1135
|
+
*/
|
|
1136
|
+
requireExactProps?: boolean;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
Create a type from an object type without certain keys.
|
|
1141
|
+
|
|
1142
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1143
|
+
|
|
1144
|
+
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.
|
|
1145
|
+
|
|
1146
|
+
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)).
|
|
1147
|
+
|
|
1148
|
+
@example
|
|
1149
|
+
```
|
|
1150
|
+
import type {Except} from 'type-fest';
|
|
1151
|
+
|
|
1152
|
+
type Foo = {
|
|
1153
|
+
a: number;
|
|
1154
|
+
b: string;
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1158
|
+
//=> {b: string}
|
|
1159
|
+
|
|
1160
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1161
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1162
|
+
|
|
1163
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1164
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1165
|
+
|
|
1166
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1167
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
@category Object
|
|
1171
|
+
*/
|
|
1172
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
1173
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1174
|
+
} & (Options['requireExactProps'] extends true
|
|
1175
|
+
? Partial<Record<KeysType, never>>
|
|
1176
|
+
: {});
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1180
|
+
|
|
1181
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1182
|
+
|
|
1183
|
+
@example
|
|
1184
|
+
```
|
|
1185
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1186
|
+
|
|
1187
|
+
interface Example {
|
|
1188
|
+
a: string;
|
|
1189
|
+
b: string | number;
|
|
1190
|
+
c?: string;
|
|
1191
|
+
d: {};
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1195
|
+
//=> 'a'
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1199
|
+
|
|
1200
|
+
@example
|
|
1201
|
+
```
|
|
1202
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1203
|
+
|
|
1204
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1205
|
+
//=> 'a' | 'c'
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
@category Object
|
|
1209
|
+
*/
|
|
1210
|
+
type ConditionalKeys$4<Base, Condition> = NonNullable<
|
|
1211
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1212
|
+
{
|
|
1213
|
+
// Map through all the keys of the given base type.
|
|
1214
|
+
[Key in keyof Base]:
|
|
1215
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1216
|
+
Base[Key] extends Condition
|
|
1217
|
+
// Retain this key since the condition passes.
|
|
1218
|
+
? Key
|
|
1219
|
+
// Discard this key since the condition fails.
|
|
1220
|
+
: never;
|
|
1221
|
+
|
|
1222
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1223
|
+
}[keyof Base]
|
|
1224
|
+
>;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1228
|
+
|
|
1229
|
+
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.
|
|
1230
|
+
|
|
1231
|
+
@example
|
|
1232
|
+
```
|
|
1233
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1234
|
+
|
|
1235
|
+
class Awesome {
|
|
1236
|
+
name: string;
|
|
1237
|
+
successes: number;
|
|
1238
|
+
failures: bigint;
|
|
1239
|
+
|
|
1240
|
+
run() {}
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1244
|
+
//=> {run: () => void}
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
@example
|
|
1248
|
+
```
|
|
1249
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1250
|
+
|
|
1251
|
+
interface Example {
|
|
1252
|
+
a: string;
|
|
1253
|
+
b: string | number;
|
|
1254
|
+
c: () => void;
|
|
1255
|
+
d: {};
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1259
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
@category Object
|
|
1263
|
+
*/
|
|
1264
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
1265
|
+
Base,
|
|
1266
|
+
ConditionalKeys$4<Base, Condition>
|
|
1267
|
+
>;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1271
|
+
* can either be a REST module or a host module.
|
|
1272
|
+
* This type is recursive, so it can describe nested modules.
|
|
1273
|
+
*/
|
|
1274
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$7<any> | ServicePluginDefinition$4<any> | {
|
|
1275
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
1276
|
+
};
|
|
1277
|
+
/**
|
|
1278
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1279
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1280
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1281
|
+
* do not match the given host (as they will not work with the given host).
|
|
1282
|
+
*/
|
|
1283
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
1284
|
+
done: T;
|
|
1285
|
+
recurse: T extends {
|
|
1286
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
1287
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$7<any> ? BuildEventDefinition$7<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
1288
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
1289
|
+
-1,
|
|
1290
|
+
0,
|
|
1291
|
+
1,
|
|
1292
|
+
2,
|
|
1293
|
+
3,
|
|
1294
|
+
4,
|
|
1295
|
+
5
|
|
1296
|
+
][Depth]> : never;
|
|
1297
|
+
}, EmptyObject$4>;
|
|
1298
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1299
|
+
type PublicMetadata$4 = {
|
|
1300
|
+
PACKAGE_NAME?: string;
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
declare global {
|
|
1304
|
+
interface ContextualClient {
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1309
|
+
* case a contextual client is available.
|
|
1310
|
+
*/
|
|
1311
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
1312
|
+
host: Host$4;
|
|
1313
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
1314
|
+
|
|
540
1315
|
interface PublishedContent {
|
|
541
1316
|
/**
|
|
542
|
-
*
|
|
1317
|
+
* Published content ID.
|
|
543
1318
|
* @readonly
|
|
544
1319
|
*/
|
|
545
1320
|
_id?: string | null;
|
|
@@ -557,14 +1332,14 @@ interface PublishedContent {
|
|
|
557
1332
|
locale?: string;
|
|
558
1333
|
/** List of fields that have been translated and published for the given locale. */
|
|
559
1334
|
fields?: PublishedContentField[];
|
|
560
|
-
/** A reference to the parent content
|
|
1335
|
+
/** A reference to the parent content. For example, if the content is a menu item, this property would contain the `entityId` of the menu it belongs to. */
|
|
561
1336
|
parentEntityId?: string | null;
|
|
562
1337
|
/** Custom field data for the published content object. */
|
|
563
1338
|
extendedFields?: ExtendedFields;
|
|
564
1339
|
}
|
|
565
1340
|
interface SchemaKey$1 {
|
|
566
1341
|
/**
|
|
567
|
-
* ID of app that created the schema.
|
|
1342
|
+
* ID of the app that created the schema.
|
|
568
1343
|
* @readonly
|
|
569
1344
|
*/
|
|
570
1345
|
appId?: string;
|
|
@@ -2448,7 +3223,7 @@ interface PublishedContentQueryBuilder {
|
|
|
2448
3223
|
find: () => Promise<PublishedContentQueryResult>;
|
|
2449
3224
|
}
|
|
2450
3225
|
|
|
2451
|
-
declare function queryPublishedContent$1(httpClient: HttpClient): QueryPublishedContentSignature;
|
|
3226
|
+
declare function queryPublishedContent$1(httpClient: HttpClient$4): QueryPublishedContentSignature;
|
|
2452
3227
|
interface QueryPublishedContentSignature {
|
|
2453
3228
|
/**
|
|
2454
3229
|
* Retrieves a list of published translation content given the provided paging, filtering, and sorting. Up to 100 published content items can be returned per request.
|
|
@@ -2467,13 +3242,31 @@ interface QueryPublishedContentSignature {
|
|
|
2467
3242
|
*/
|
|
2468
3243
|
(): PublishedContentQueryBuilder;
|
|
2469
3244
|
}
|
|
2470
|
-
declare const onPublishedContentCreated$1: EventDefinition<PublishedContentCreatedEnvelope, "wix.multilingual.localization_public.v3.published_content_created">;
|
|
2471
|
-
declare const onPublishedContentUpdated$1: EventDefinition<PublishedContentUpdatedEnvelope, "wix.multilingual.localization_public.v3.published_content_updated">;
|
|
2472
|
-
declare const onPublishedContentDeleted$1: EventDefinition<PublishedContentDeletedEnvelope, "wix.multilingual.localization_public.v3.published_content_deleted">;
|
|
3245
|
+
declare const onPublishedContentCreated$1: EventDefinition$7<PublishedContentCreatedEnvelope, "wix.multilingual.localization_public.v3.published_content_created">;
|
|
3246
|
+
declare const onPublishedContentUpdated$1: EventDefinition$7<PublishedContentUpdatedEnvelope, "wix.multilingual.localization_public.v3.published_content_updated">;
|
|
3247
|
+
declare const onPublishedContentDeleted$1: EventDefinition$7<PublishedContentDeletedEnvelope, "wix.multilingual.localization_public.v3.published_content_deleted">;
|
|
3248
|
+
|
|
3249
|
+
type EventDefinition$6<Payload = unknown, Type extends string = string> = {
|
|
3250
|
+
__type: 'event-definition';
|
|
3251
|
+
type: Type;
|
|
3252
|
+
isDomainEvent?: boolean;
|
|
3253
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3254
|
+
__payload: Payload;
|
|
3255
|
+
};
|
|
3256
|
+
declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
|
|
3257
|
+
type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
|
|
3258
|
+
type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
|
|
3259
|
+
|
|
3260
|
+
declare global {
|
|
3261
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3262
|
+
interface SymbolConstructor {
|
|
3263
|
+
readonly observable: symbol;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
2473
3266
|
|
|
2474
|
-
declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
3267
|
+
declare function createEventModule$2<T extends EventDefinition$6<any, string>>(eventDefinition: T): BuildEventDefinition$6<T> & T;
|
|
2475
3268
|
|
|
2476
|
-
declare const queryPublishedContent: BuildRESTFunction<typeof queryPublishedContent$1> & typeof queryPublishedContent$1
|
|
3269
|
+
declare const queryPublishedContent: MaybeContext$4<BuildRESTFunction$4<typeof queryPublishedContent$1> & typeof queryPublishedContent$1>;
|
|
2477
3270
|
|
|
2478
3271
|
type _publicOnPublishedContentCreatedType = typeof onPublishedContentCreated$1;
|
|
2479
3272
|
/**
|
|
@@ -2518,20 +3311,430 @@ declare namespace context$4 {
|
|
|
2518
3311
|
export { type ActionEvent$2 as ActionEvent, Alignment$2 as Alignment, type AnchorData$2 as AnchorData, type AppEmbedData$2 as AppEmbedData, type AppEmbedDataAppDataOneOf$2 as AppEmbedDataAppDataOneOf, AppType$2 as AppType, type AudioData$2 as AudioData, type Background$2 as Background, type BackgroundBackgroundOneOf$2 as BackgroundBackgroundOneOf, BackgroundType$2 as BackgroundType, type BaseEventMetadata$2 as BaseEventMetadata, type BlockquoteData$2 as BlockquoteData, type BookingData$2 as BookingData, type Border$2 as Border, type BorderColors$2 as BorderColors, type BulletedListData$2 as BulletedListData, type ButtonData$2 as ButtonData, type CellStyle$2 as CellStyle, type CodeBlockData$2 as CodeBlockData, type CollapsibleListData$2 as CollapsibleListData, type ColorData$2 as ColorData, type Colors$2 as Colors, Crop$2 as Crop, type CursorPaging$2 as CursorPaging, type CursorPagingMetadata$2 as CursorPagingMetadata, type CursorQuery$2 as CursorQuery, type CursorQueryPagingMethodOneOf$2 as CursorQueryPagingMethodOneOf, type Cursors$2 as Cursors, type Decoration$2 as Decoration, type DecorationDataOneOf$2 as DecorationDataOneOf, DecorationType$2 as DecorationType, type Design$2 as Design, type Dimensions$2 as Dimensions, Direction$2 as Direction, type DividerData$2 as DividerData, type DocumentStyle$2 as DocumentStyle, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EmbedData$2 as EmbedData, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventData$2 as EventData, type EventMetadata$2 as EventMetadata, type context$4_ExtendedFields as ExtendedFields, type FileData$2 as FileData, type FileSource$2 as FileSource, type FileSourceDataOneOf$2 as FileSourceDataOneOf, type FontSizeData$2 as FontSizeData, FontType$2 as FontType, type GIF$2 as GIF, type GIFData$2 as GIFData, type GalleryData$2 as GalleryData, type GalleryOptions$2 as GalleryOptions, type context$4_GetPublishedContentRequest as GetPublishedContentRequest, type context$4_GetPublishedContentResponse as GetPublishedContentResponse, type Gradient$2 as Gradient, type HTMLData$2 as HTMLData, type HTMLDataDataOneOf$2 as HTMLDataDataOneOf, type HeadingData$2 as HeadingData, type Height$2 as Height, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type Image$2 as Image, type ImageData$2 as ImageData, InitialExpandedItems$2 as InitialExpandedItems, type Item$2 as Item, type ItemDataOneOf$2 as ItemDataOneOf, type ItemStyle$2 as ItemStyle, type Layout$2 as Layout, LayoutType$2 as LayoutType, LineStyle$2 as LineStyle, type Link$2 as Link, type LinkData$2 as LinkData, type LinkDataOneOf$2 as LinkDataOneOf, type LinkPreviewData$2 as LinkPreviewData, type ListValue$2 as ListValue, type MapData$2 as MapData, type MapSettings$2 as MapSettings, MapType$2 as MapType, type Media$2 as Media, type MentionData$2 as MentionData, type MessageEnvelope$2 as MessageEnvelope, type Metadata$2 as Metadata, type Node$2 as Node, type NodeDataOneOf$2 as NodeDataOneOf, type NodeStyle$2 as NodeStyle, NodeType$2 as NodeType, NullValue$2 as NullValue, type Oembed$2 as Oembed, type Option$2 as Option, type OptionDesign$2 as OptionDesign, type OptionLayout$2 as OptionLayout, type OrderedListData$2 as OrderedListData, Orientation$2 as Orientation, type PDFSettings$2 as PDFSettings, type ParagraphData$2 as ParagraphData, type Permissions$2 as Permissions, type PlaybackOptions$2 as PlaybackOptions, type PluginContainerData$2 as PluginContainerData, PluginContainerDataAlignment$2 as PluginContainerDataAlignment, type PluginContainerDataWidth$2 as PluginContainerDataWidth, type PluginContainerDataWidthDataOneOf$2 as PluginContainerDataWidthDataOneOf, type Poll$2 as Poll, type PollData$2 as PollData, type PollDataLayout$2 as PollDataLayout, type PollDesign$2 as PollDesign, type PollLayout$2 as PollLayout, PollLayoutDirection$2 as PollLayoutDirection, PollLayoutType$2 as PollLayoutType, type context$4_PublishedContent as PublishedContent, type context$4_PublishedContentCreatedEnvelope as PublishedContentCreatedEnvelope, type context$4_PublishedContentDeletedEnvelope as PublishedContentDeletedEnvelope, type context$4_PublishedContentField as PublishedContentField, type context$4_PublishedContentFieldValueOneOf as PublishedContentFieldValueOneOf, type context$4_PublishedContentQueryBuilder as PublishedContentQueryBuilder, type context$4_PublishedContentQueryResult as PublishedContentQueryResult, type context$4_PublishedContentUpdatedEnvelope as PublishedContentUpdatedEnvelope, type context$4_QueryPublishedContentRequest as QueryPublishedContentRequest, type context$4_QueryPublishedContentResponse as QueryPublishedContentResponse, type context$4_QueryPublishedContentResponseNonNullableFields as QueryPublishedContentResponseNonNullableFields, type Rel$2 as Rel, type RestoreInfo$2 as RestoreInfo, type RichContent$2 as RichContent, type SchemaKey$1 as SchemaKey, SchemaScope$1 as SchemaScope, type Settings$2 as Settings, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, Source$2 as Source, type Spoiler$2 as Spoiler, type SpoilerData$2 as SpoilerData, type Styles$2 as Styles, type TableCellData$2 as TableCellData, type TableData$2 as TableData, Target$2 as Target, TextAlignment$2 as TextAlignment, type TextData$2 as TextData, type TextNodeStyle$2 as TextNodeStyle, type TextStyle$2 as TextStyle, type Thumbnails$2 as Thumbnails, ThumbnailsAlignment$2 as ThumbnailsAlignment, Type$2 as Type, VerticalAlignment$2 as VerticalAlignment, type Video$2 as Video, type VideoData$2 as VideoData, type VideoResolution$1 as VideoResolution, ViewMode$2 as ViewMode, ViewRole$2 as ViewRole, VoteRole$2 as VoteRole, WebhookIdentityType$2 as WebhookIdentityType, Width$2 as Width, WidthType$2 as WidthType, type context$4__publicOnPublishedContentCreatedType as _publicOnPublishedContentCreatedType, type context$4__publicOnPublishedContentDeletedType as _publicOnPublishedContentDeletedType, type context$4__publicOnPublishedContentUpdatedType as _publicOnPublishedContentUpdatedType, context$4_onPublishedContentCreated as onPublishedContentCreated, context$4_onPublishedContentDeleted as onPublishedContentDeleted, context$4_onPublishedContentUpdated as onPublishedContentUpdated, onPublishedContentCreated$1 as publicOnPublishedContentCreated, onPublishedContentDeleted$1 as publicOnPublishedContentDeleted, onPublishedContentUpdated$1 as publicOnPublishedContentUpdated, context$4_queryPublishedContent as queryPublishedContent };
|
|
2519
3312
|
}
|
|
2520
3313
|
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
3314
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
3315
|
+
__type: 'host';
|
|
3316
|
+
create(host: H): T;
|
|
3317
|
+
};
|
|
3318
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
3319
|
+
type Host$3<Environment = unknown> = {
|
|
3320
|
+
channel: {
|
|
3321
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
3322
|
+
disconnect: () => void;
|
|
3323
|
+
} | Promise<{
|
|
3324
|
+
disconnect: () => void;
|
|
3325
|
+
}>;
|
|
3326
|
+
};
|
|
3327
|
+
environment?: Environment;
|
|
3328
|
+
/**
|
|
3329
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3330
|
+
*/
|
|
3331
|
+
apiBaseUrl?: string;
|
|
3332
|
+
/**
|
|
3333
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3334
|
+
* like internationalization, billing, etc.
|
|
3335
|
+
*/
|
|
3336
|
+
essentials?: {
|
|
3337
|
+
/**
|
|
3338
|
+
* The language of the currently viewed session
|
|
3339
|
+
*/
|
|
3340
|
+
language?: string;
|
|
3341
|
+
/**
|
|
3342
|
+
* The locale of the currently viewed session
|
|
3343
|
+
*/
|
|
3344
|
+
locale?: string;
|
|
3345
|
+
/**
|
|
3346
|
+
* Any headers that should be passed through to the API requests
|
|
3347
|
+
*/
|
|
3348
|
+
passThroughHeaders?: Record<string, string>;
|
|
3349
|
+
};
|
|
3350
|
+
};
|
|
3351
|
+
|
|
3352
|
+
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
3353
|
+
interface HttpClient$3 {
|
|
3354
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
3355
|
+
fetchWithAuth: typeof fetch;
|
|
3356
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
3357
|
+
getActiveToken?: () => string | undefined;
|
|
3358
|
+
}
|
|
3359
|
+
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
3360
|
+
type HttpResponse$3<T = any> = {
|
|
3361
|
+
data: T;
|
|
3362
|
+
status: number;
|
|
3363
|
+
statusText: string;
|
|
3364
|
+
headers: any;
|
|
3365
|
+
request?: any;
|
|
3366
|
+
};
|
|
3367
|
+
type RequestOptions$3<_TResponse = any, Data = any> = {
|
|
3368
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
3369
|
+
url: string;
|
|
3370
|
+
data?: Data;
|
|
3371
|
+
params?: URLSearchParams;
|
|
3372
|
+
} & APIMetadata$3;
|
|
3373
|
+
type APIMetadata$3 = {
|
|
3374
|
+
methodFqn?: string;
|
|
3375
|
+
entityFqdn?: string;
|
|
3376
|
+
packageName?: string;
|
|
3377
|
+
};
|
|
3378
|
+
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
3379
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
3380
|
+
__type: 'event-definition';
|
|
3381
|
+
type: Type;
|
|
3382
|
+
isDomainEvent?: boolean;
|
|
3383
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3384
|
+
__payload: Payload;
|
|
3385
|
+
};
|
|
3386
|
+
declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
|
|
3387
|
+
type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
|
|
3388
|
+
type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
|
|
3389
|
+
|
|
3390
|
+
type ServicePluginMethodInput$3 = {
|
|
3391
|
+
request: any;
|
|
3392
|
+
metadata: any;
|
|
3393
|
+
};
|
|
3394
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
3395
|
+
type ServicePluginMethodMetadata$3 = {
|
|
3396
|
+
name: string;
|
|
3397
|
+
primaryHttpMappingPath: string;
|
|
3398
|
+
transformations: {
|
|
3399
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
3400
|
+
toREST: (...args: unknown[]) => unknown;
|
|
3401
|
+
};
|
|
3402
|
+
};
|
|
3403
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
3404
|
+
__type: 'service-plugin-definition';
|
|
3405
|
+
componentType: string;
|
|
3406
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
3407
|
+
__contract: Contract;
|
|
3408
|
+
};
|
|
3409
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
3410
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
3411
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
3412
|
+
|
|
3413
|
+
type RequestContext$3 = {
|
|
3414
|
+
isSSR: boolean;
|
|
3415
|
+
host: string;
|
|
3416
|
+
protocol?: string;
|
|
3417
|
+
};
|
|
3418
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
3419
|
+
/**
|
|
3420
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
3421
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
3422
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
3423
|
+
*/
|
|
3424
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
3425
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
3426
|
+
_?: T;
|
|
3427
|
+
url?: string;
|
|
3428
|
+
method?: Method$3;
|
|
3429
|
+
params?: any;
|
|
3430
|
+
data?: any;
|
|
3431
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
3432
|
+
};
|
|
3433
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
3434
|
+
__isAmbassador: boolean;
|
|
3435
|
+
};
|
|
3436
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
3437
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3438
|
+
|
|
3439
|
+
declare global {
|
|
3440
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3441
|
+
interface SymbolConstructor {
|
|
3442
|
+
readonly observable: symbol;
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
3447
|
+
|
|
3448
|
+
/**
|
|
3449
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
3450
|
+
|
|
3451
|
+
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)).
|
|
3452
|
+
|
|
3453
|
+
@example
|
|
3454
|
+
```
|
|
3455
|
+
import type {EmptyObject} from 'type-fest';
|
|
3456
|
+
|
|
3457
|
+
// The following illustrates the problem with `{}`.
|
|
3458
|
+
const foo1: {} = {}; // Pass
|
|
3459
|
+
const foo2: {} = []; // Pass
|
|
3460
|
+
const foo3: {} = 42; // Pass
|
|
3461
|
+
const foo4: {} = {a: 1}; // Pass
|
|
3462
|
+
|
|
3463
|
+
// With `EmptyObject` only the first case is valid.
|
|
3464
|
+
const bar1: EmptyObject = {}; // Pass
|
|
3465
|
+
const bar2: EmptyObject = 42; // Fail
|
|
3466
|
+
const bar3: EmptyObject = []; // Fail
|
|
3467
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
3468
|
+
```
|
|
3469
|
+
|
|
3470
|
+
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}.
|
|
3471
|
+
|
|
3472
|
+
@category Object
|
|
3473
|
+
*/
|
|
3474
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
3475
|
+
|
|
3476
|
+
/**
|
|
3477
|
+
Returns a boolean for whether the two given types are equal.
|
|
3478
|
+
|
|
3479
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
3480
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
3481
|
+
|
|
3482
|
+
Use-cases:
|
|
3483
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
3484
|
+
|
|
3485
|
+
@example
|
|
3486
|
+
```
|
|
3487
|
+
import type {IsEqual} from 'type-fest';
|
|
3488
|
+
|
|
3489
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
3490
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
3491
|
+
type Includes<Value extends readonly any[], Item> =
|
|
3492
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
3493
|
+
? IsEqual<Value[0], Item> extends true
|
|
3494
|
+
? true
|
|
3495
|
+
: Includes<rest, Item>
|
|
3496
|
+
: false;
|
|
3497
|
+
```
|
|
3498
|
+
|
|
3499
|
+
@category Type Guard
|
|
3500
|
+
@category Utilities
|
|
3501
|
+
*/
|
|
3502
|
+
type IsEqual$3<A, B> =
|
|
3503
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
3504
|
+
(<G>() => G extends B ? 1 : 2)
|
|
3505
|
+
? true
|
|
3506
|
+
: false;
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
Filter out keys from an object.
|
|
3510
|
+
|
|
3511
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
3512
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
3513
|
+
Returns `Key` otherwise.
|
|
3514
|
+
|
|
3515
|
+
@example
|
|
3516
|
+
```
|
|
3517
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
3518
|
+
//=> never
|
|
3519
|
+
```
|
|
3520
|
+
|
|
3521
|
+
@example
|
|
3522
|
+
```
|
|
3523
|
+
type Filtered = Filter<'bar', string>;
|
|
3524
|
+
//=> never
|
|
3525
|
+
```
|
|
3526
|
+
|
|
3527
|
+
@example
|
|
3528
|
+
```
|
|
3529
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
3530
|
+
//=> 'bar'
|
|
3531
|
+
```
|
|
3532
|
+
|
|
3533
|
+
@see {Except}
|
|
3534
|
+
*/
|
|
3535
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3536
|
+
|
|
3537
|
+
type ExceptOptions$3 = {
|
|
3538
|
+
/**
|
|
3539
|
+
Disallow assigning non-specified properties.
|
|
3540
|
+
|
|
3541
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3542
|
+
|
|
3543
|
+
@default false
|
|
3544
|
+
*/
|
|
3545
|
+
requireExactProps?: boolean;
|
|
3546
|
+
};
|
|
3547
|
+
|
|
3548
|
+
/**
|
|
3549
|
+
Create a type from an object type without certain keys.
|
|
3550
|
+
|
|
3551
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
3552
|
+
|
|
3553
|
+
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.
|
|
3554
|
+
|
|
3555
|
+
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)).
|
|
3556
|
+
|
|
3557
|
+
@example
|
|
3558
|
+
```
|
|
3559
|
+
import type {Except} from 'type-fest';
|
|
3560
|
+
|
|
3561
|
+
type Foo = {
|
|
3562
|
+
a: number;
|
|
3563
|
+
b: string;
|
|
3564
|
+
};
|
|
3565
|
+
|
|
3566
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
3567
|
+
//=> {b: string}
|
|
3568
|
+
|
|
3569
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
3570
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
3571
|
+
|
|
3572
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
3573
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
3574
|
+
|
|
3575
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
3576
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
3577
|
+
```
|
|
3578
|
+
|
|
3579
|
+
@category Object
|
|
3580
|
+
*/
|
|
3581
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
3582
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
3583
|
+
} & (Options['requireExactProps'] extends true
|
|
3584
|
+
? Partial<Record<KeysType, never>>
|
|
3585
|
+
: {});
|
|
3586
|
+
|
|
3587
|
+
/**
|
|
3588
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
3589
|
+
|
|
3590
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
3591
|
+
|
|
3592
|
+
@example
|
|
3593
|
+
```
|
|
3594
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3595
|
+
|
|
3596
|
+
interface Example {
|
|
3597
|
+
a: string;
|
|
3598
|
+
b: string | number;
|
|
3599
|
+
c?: string;
|
|
3600
|
+
d: {};
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
3604
|
+
//=> 'a'
|
|
3605
|
+
```
|
|
3606
|
+
|
|
3607
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
3608
|
+
|
|
3609
|
+
@example
|
|
3610
|
+
```
|
|
3611
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3612
|
+
|
|
3613
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
3614
|
+
//=> 'a' | 'c'
|
|
3615
|
+
```
|
|
3616
|
+
|
|
3617
|
+
@category Object
|
|
3618
|
+
*/
|
|
3619
|
+
type ConditionalKeys$3<Base, Condition> = NonNullable<
|
|
3620
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
3621
|
+
{
|
|
3622
|
+
// Map through all the keys of the given base type.
|
|
3623
|
+
[Key in keyof Base]:
|
|
3624
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
3625
|
+
Base[Key] extends Condition
|
|
3626
|
+
// Retain this key since the condition passes.
|
|
3627
|
+
? Key
|
|
3628
|
+
// Discard this key since the condition fails.
|
|
3629
|
+
: never;
|
|
3630
|
+
|
|
3631
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
3632
|
+
}[keyof Base]
|
|
3633
|
+
>;
|
|
3634
|
+
|
|
3635
|
+
/**
|
|
3636
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
3637
|
+
|
|
3638
|
+
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.
|
|
3639
|
+
|
|
3640
|
+
@example
|
|
3641
|
+
```
|
|
3642
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3643
|
+
|
|
3644
|
+
class Awesome {
|
|
3645
|
+
name: string;
|
|
3646
|
+
successes: number;
|
|
3647
|
+
failures: bigint;
|
|
3648
|
+
|
|
3649
|
+
run() {}
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3653
|
+
//=> {run: () => void}
|
|
3654
|
+
```
|
|
3655
|
+
|
|
3656
|
+
@example
|
|
3657
|
+
```
|
|
3658
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3659
|
+
|
|
3660
|
+
interface Example {
|
|
3661
|
+
a: string;
|
|
3662
|
+
b: string | number;
|
|
3663
|
+
c: () => void;
|
|
3664
|
+
d: {};
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3668
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3669
|
+
```
|
|
3670
|
+
|
|
3671
|
+
@category Object
|
|
3672
|
+
*/
|
|
3673
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
3674
|
+
Base,
|
|
3675
|
+
ConditionalKeys$3<Base, Condition>
|
|
3676
|
+
>;
|
|
3677
|
+
|
|
3678
|
+
/**
|
|
3679
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3680
|
+
* can either be a REST module or a host module.
|
|
3681
|
+
* This type is recursive, so it can describe nested modules.
|
|
3682
|
+
*/
|
|
3683
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$5<any> | ServicePluginDefinition$3<any> | {
|
|
3684
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
3685
|
+
};
|
|
3686
|
+
/**
|
|
3687
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3688
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3689
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3690
|
+
* do not match the given host (as they will not work with the given host).
|
|
3691
|
+
*/
|
|
3692
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
3693
|
+
done: T;
|
|
3694
|
+
recurse: T extends {
|
|
3695
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
3696
|
+
} ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
|
|
3697
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
3698
|
+
-1,
|
|
3699
|
+
0,
|
|
3700
|
+
1,
|
|
3701
|
+
2,
|
|
3702
|
+
3,
|
|
3703
|
+
4,
|
|
3704
|
+
5
|
|
3705
|
+
][Depth]> : never;
|
|
3706
|
+
}, EmptyObject$3>;
|
|
3707
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3708
|
+
type PublicMetadata$3 = {
|
|
3709
|
+
PACKAGE_NAME?: string;
|
|
3710
|
+
};
|
|
3711
|
+
|
|
3712
|
+
declare global {
|
|
3713
|
+
interface ContextualClient {
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
/**
|
|
3717
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3718
|
+
* case a contextual client is available.
|
|
3719
|
+
*/
|
|
3720
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
3721
|
+
host: Host$3;
|
|
3722
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
3723
|
+
|
|
3724
|
+
/**
|
|
3725
|
+
* A translatable content is a unit of content to translate.
|
|
3726
|
+
*
|
|
3727
|
+
* Use [Machine Translate](/machine-translation/machine-translate) to translate a single unit of translatable content, or [Bulk Machine Translate](/machine-translation/bulk-machine-translate)
|
|
3728
|
+
* to translate many.
|
|
3729
|
+
*/
|
|
3730
|
+
interface TranslatableContent extends TranslatableContentContentOneOf {
|
|
3731
|
+
/** Plain text. */
|
|
3732
|
+
plainTextContent?: string;
|
|
3733
|
+
/** HTML-encoded. */
|
|
3734
|
+
htmlContent?: string;
|
|
3735
|
+
/** Rich content. */
|
|
3736
|
+
richContent?: RichContent$1;
|
|
3737
|
+
/** Translatable content ID. The ID should be unique to this content and doesn't need to match the ID used by any other service. */
|
|
2535
3738
|
_id?: string | null;
|
|
2536
3739
|
/** Format of the translatable content. */
|
|
2537
3740
|
format?: Format;
|
|
@@ -4421,7 +5624,7 @@ interface BulkMachineTranslateOptions {
|
|
|
4421
5624
|
contentToTranslate?: TranslatableContent[];
|
|
4422
5625
|
}
|
|
4423
5626
|
|
|
4424
|
-
declare function machineTranslate$1(httpClient: HttpClient): MachineTranslateSignature;
|
|
5627
|
+
declare function machineTranslate$1(httpClient: HttpClient$3): MachineTranslateSignature;
|
|
4425
5628
|
interface MachineTranslateSignature {
|
|
4426
5629
|
/**
|
|
4427
5630
|
* Translates the text of a translatable unit of content from one supported language to another.
|
|
@@ -4448,7 +5651,7 @@ interface MachineTranslateSignature {
|
|
|
4448
5651
|
*/
|
|
4449
5652
|
(sourceLanguage: SupportedLanguage, options: MachineTranslateOptions): Promise<MachineTranslateResponse & MachineTranslateResponseNonNullableFields>;
|
|
4450
5653
|
}
|
|
4451
|
-
declare function bulkMachineTranslate$1(httpClient: HttpClient): BulkMachineTranslateSignature;
|
|
5654
|
+
declare function bulkMachineTranslate$1(httpClient: HttpClient$3): BulkMachineTranslateSignature;
|
|
4452
5655
|
interface BulkMachineTranslateSignature {
|
|
4453
5656
|
/**
|
|
4454
5657
|
* Translates the text of multiple units of translatable content from one supported language to another.
|
|
@@ -4478,8 +5681,8 @@ interface BulkMachineTranslateSignature {
|
|
|
4478
5681
|
(sourceLanguage: SupportedLanguage, options?: BulkMachineTranslateOptions | undefined): Promise<BulkMachineTranslateResponse & BulkMachineTranslateResponseNonNullableFields>;
|
|
4479
5682
|
}
|
|
4480
5683
|
|
|
4481
|
-
declare const machineTranslate: BuildRESTFunction<typeof machineTranslate$1> & typeof machineTranslate$1
|
|
4482
|
-
declare const bulkMachineTranslate: BuildRESTFunction<typeof bulkMachineTranslate$1> & typeof bulkMachineTranslate$1
|
|
5684
|
+
declare const machineTranslate: MaybeContext$3<BuildRESTFunction$3<typeof machineTranslate$1> & typeof machineTranslate$1>;
|
|
5685
|
+
declare const bulkMachineTranslate: MaybeContext$3<BuildRESTFunction$3<typeof bulkMachineTranslate$1> & typeof bulkMachineTranslate$1>;
|
|
4483
5686
|
|
|
4484
5687
|
type context$3_BulkMachineTranslateOptions = BulkMachineTranslateOptions;
|
|
4485
5688
|
type context$3_BulkMachineTranslateRequest = BulkMachineTranslateRequest;
|
|
@@ -4506,6 +5709,416 @@ declare namespace context$3 {
|
|
|
4506
5709
|
export { Alignment$1 as Alignment, type AnchorData$1 as AnchorData, type AppEmbedData$1 as AppEmbedData, type AppEmbedDataAppDataOneOf$1 as AppEmbedDataAppDataOneOf, AppType$1 as AppType, type ApplicationError$1 as ApplicationError, type AudioData$1 as AudioData, type Background$1 as Background, type BackgroundBackgroundOneOf$1 as BackgroundBackgroundOneOf, BackgroundType$1 as BackgroundType, type BlockquoteData$1 as BlockquoteData, type BookingData$1 as BookingData, type Border$1 as Border, type BorderColors$1 as BorderColors, type BulkActionMetadata$1 as BulkActionMetadata, type context$3_BulkMachineTranslateOptions as BulkMachineTranslateOptions, type context$3_BulkMachineTranslateRequest as BulkMachineTranslateRequest, type context$3_BulkMachineTranslateResponse as BulkMachineTranslateResponse, type context$3_BulkMachineTranslateResponseNonNullableFields as BulkMachineTranslateResponseNonNullableFields, type context$3_BulkTranslateResult as BulkTranslateResult, type BulletedListData$1 as BulletedListData, type ButtonData$1 as ButtonData, type CellStyle$1 as CellStyle, type CodeBlockData$1 as CodeBlockData, type CollapsibleListData$1 as CollapsibleListData, type ColorData$1 as ColorData, type Colors$1 as Colors, Crop$1 as Crop, type Decoration$1 as Decoration, type DecorationDataOneOf$1 as DecorationDataOneOf, DecorationType$1 as DecorationType, type Design$1 as Design, type Dimensions$1 as Dimensions, Direction$1 as Direction, type DividerData$1 as DividerData, type DocumentStyle$1 as DocumentStyle, type EmbedData$1 as EmbedData, type EventData$1 as EventData, type FileData$1 as FileData, type FileSource$1 as FileSource, type FileSourceDataOneOf$1 as FileSourceDataOneOf, type FontSizeData$1 as FontSizeData, FontType$1 as FontType, context$3_Format as Format, type GIF$1 as GIF, type GIFData$1 as GIFData, type GalleryData$1 as GalleryData, type GalleryOptions$1 as GalleryOptions, type Gradient$1 as Gradient, type HTMLData$1 as HTMLData, type HTMLDataDataOneOf$1 as HTMLDataDataOneOf, type HeadingData$1 as HeadingData, type Height$1 as Height, type Image$1 as Image, type ImageData$1 as ImageData, InitialExpandedItems$1 as InitialExpandedItems, type Item$1 as Item, type ItemDataOneOf$1 as ItemDataOneOf, type ItemMetadata$1 as ItemMetadata, type ItemStyle$1 as ItemStyle, type Layout$1 as Layout, LayoutType$1 as LayoutType, LineStyle$1 as LineStyle, type Link$1 as Link, type LinkData$1 as LinkData, type LinkDataOneOf$1 as LinkDataOneOf, type LinkPreviewData$1 as LinkPreviewData, type ListValue$1 as ListValue, type context$3_MachineTranslateOptions as MachineTranslateOptions, type context$3_MachineTranslateRequest as MachineTranslateRequest, type context$3_MachineTranslateResponse as MachineTranslateResponse, type context$3_MachineTranslateResponseNonNullableFields as MachineTranslateResponseNonNullableFields, type MapData$1 as MapData, type MapSettings$1 as MapSettings, MapType$1 as MapType, type Media$1 as Media, type MentionData$1 as MentionData, type Metadata$1 as Metadata, type Node$1 as Node, type NodeDataOneOf$1 as NodeDataOneOf, type NodeStyle$1 as NodeStyle, NodeType$1 as NodeType, type context$3_NotEnoughCreditsError as NotEnoughCreditsError, NullValue$1 as NullValue, type Oembed$1 as Oembed, type Option$1 as Option, type OptionDesign$1 as OptionDesign, type OptionLayout$1 as OptionLayout, type OrderedListData$1 as OrderedListData, Orientation$1 as Orientation, type PDFSettings$1 as PDFSettings, type ParagraphData$1 as ParagraphData, type Permissions$1 as Permissions, type PlaybackOptions$1 as PlaybackOptions, type PluginContainerData$1 as PluginContainerData, PluginContainerDataAlignment$1 as PluginContainerDataAlignment, type PluginContainerDataWidth$1 as PluginContainerDataWidth, type PluginContainerDataWidthDataOneOf$1 as PluginContainerDataWidthDataOneOf, type Poll$1 as Poll, type PollData$1 as PollData, type PollDataLayout$1 as PollDataLayout, type PollDesign$1 as PollDesign, type PollLayout$1 as PollLayout, PollLayoutDirection$1 as PollLayoutDirection, PollLayoutType$1 as PollLayoutType, type Rel$1 as Rel, type RichContent$1 as RichContent, type context$3_SameLanguageArgumentsError as SameLanguageArgumentsError, type Settings$1 as Settings, Source$1 as Source, type Spoiler$1 as Spoiler, type SpoilerData$1 as SpoilerData, type Styles$1 as Styles, context$3_SupportedLanguage as SupportedLanguage, type TableCellData$1 as TableCellData, type TableData$1 as TableData, Target$1 as Target, TextAlignment$1 as TextAlignment, type TextData$1 as TextData, type TextNodeStyle$1 as TextNodeStyle, type TextStyle$1 as TextStyle, type context$3_TextTooLongError as TextTooLongError, type Thumbnails$1 as Thumbnails, ThumbnailsAlignment$1 as ThumbnailsAlignment, type context$3_TranslatableContent as TranslatableContent, type context$3_TranslatableContentContentOneOf as TranslatableContentContentOneOf, Type$1 as Type, type context$3_UnknownFormatError as UnknownFormatError, VerticalAlignment$1 as VerticalAlignment, type Video$1 as Video, type VideoData$1 as VideoData, ViewMode$1 as ViewMode, ViewRole$1 as ViewRole, VoteRole$1 as VoteRole, Width$1 as Width, WidthType$1 as WidthType, context$3_bulkMachineTranslate as bulkMachineTranslate, context$3_machineTranslate as machineTranslate };
|
|
4507
5710
|
}
|
|
4508
5711
|
|
|
5712
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
5713
|
+
__type: 'host';
|
|
5714
|
+
create(host: H): T;
|
|
5715
|
+
};
|
|
5716
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
5717
|
+
type Host$2<Environment = unknown> = {
|
|
5718
|
+
channel: {
|
|
5719
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
5720
|
+
disconnect: () => void;
|
|
5721
|
+
} | Promise<{
|
|
5722
|
+
disconnect: () => void;
|
|
5723
|
+
}>;
|
|
5724
|
+
};
|
|
5725
|
+
environment?: Environment;
|
|
5726
|
+
/**
|
|
5727
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
5728
|
+
*/
|
|
5729
|
+
apiBaseUrl?: string;
|
|
5730
|
+
/**
|
|
5731
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
5732
|
+
* like internationalization, billing, etc.
|
|
5733
|
+
*/
|
|
5734
|
+
essentials?: {
|
|
5735
|
+
/**
|
|
5736
|
+
* The language of the currently viewed session
|
|
5737
|
+
*/
|
|
5738
|
+
language?: string;
|
|
5739
|
+
/**
|
|
5740
|
+
* The locale of the currently viewed session
|
|
5741
|
+
*/
|
|
5742
|
+
locale?: string;
|
|
5743
|
+
/**
|
|
5744
|
+
* Any headers that should be passed through to the API requests
|
|
5745
|
+
*/
|
|
5746
|
+
passThroughHeaders?: Record<string, string>;
|
|
5747
|
+
};
|
|
5748
|
+
};
|
|
5749
|
+
|
|
5750
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
5751
|
+
interface HttpClient$2 {
|
|
5752
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
5753
|
+
fetchWithAuth: typeof fetch;
|
|
5754
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
5755
|
+
getActiveToken?: () => string | undefined;
|
|
5756
|
+
}
|
|
5757
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
5758
|
+
type HttpResponse$2<T = any> = {
|
|
5759
|
+
data: T;
|
|
5760
|
+
status: number;
|
|
5761
|
+
statusText: string;
|
|
5762
|
+
headers: any;
|
|
5763
|
+
request?: any;
|
|
5764
|
+
};
|
|
5765
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
5766
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
5767
|
+
url: string;
|
|
5768
|
+
data?: Data;
|
|
5769
|
+
params?: URLSearchParams;
|
|
5770
|
+
} & APIMetadata$2;
|
|
5771
|
+
type APIMetadata$2 = {
|
|
5772
|
+
methodFqn?: string;
|
|
5773
|
+
entityFqdn?: string;
|
|
5774
|
+
packageName?: string;
|
|
5775
|
+
};
|
|
5776
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
5777
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
5778
|
+
__type: 'event-definition';
|
|
5779
|
+
type: Type;
|
|
5780
|
+
isDomainEvent?: boolean;
|
|
5781
|
+
transformations?: (envelope: unknown) => Payload;
|
|
5782
|
+
__payload: Payload;
|
|
5783
|
+
};
|
|
5784
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
5785
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
5786
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
5787
|
+
|
|
5788
|
+
type ServicePluginMethodInput$2 = {
|
|
5789
|
+
request: any;
|
|
5790
|
+
metadata: any;
|
|
5791
|
+
};
|
|
5792
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
5793
|
+
type ServicePluginMethodMetadata$2 = {
|
|
5794
|
+
name: string;
|
|
5795
|
+
primaryHttpMappingPath: string;
|
|
5796
|
+
transformations: {
|
|
5797
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
5798
|
+
toREST: (...args: unknown[]) => unknown;
|
|
5799
|
+
};
|
|
5800
|
+
};
|
|
5801
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
5802
|
+
__type: 'service-plugin-definition';
|
|
5803
|
+
componentType: string;
|
|
5804
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
5805
|
+
__contract: Contract;
|
|
5806
|
+
};
|
|
5807
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
5808
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
5809
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
5810
|
+
|
|
5811
|
+
type RequestContext$2 = {
|
|
5812
|
+
isSSR: boolean;
|
|
5813
|
+
host: string;
|
|
5814
|
+
protocol?: string;
|
|
5815
|
+
};
|
|
5816
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
5817
|
+
/**
|
|
5818
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
5819
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
5820
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
5821
|
+
*/
|
|
5822
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
5823
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
5824
|
+
_?: T;
|
|
5825
|
+
url?: string;
|
|
5826
|
+
method?: Method$2;
|
|
5827
|
+
params?: any;
|
|
5828
|
+
data?: any;
|
|
5829
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
5830
|
+
};
|
|
5831
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
5832
|
+
__isAmbassador: boolean;
|
|
5833
|
+
};
|
|
5834
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
5835
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
5836
|
+
|
|
5837
|
+
declare global {
|
|
5838
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
5839
|
+
interface SymbolConstructor {
|
|
5840
|
+
readonly observable: symbol;
|
|
5841
|
+
}
|
|
5842
|
+
}
|
|
5843
|
+
|
|
5844
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
5845
|
+
|
|
5846
|
+
/**
|
|
5847
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
5848
|
+
|
|
5849
|
+
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)).
|
|
5850
|
+
|
|
5851
|
+
@example
|
|
5852
|
+
```
|
|
5853
|
+
import type {EmptyObject} from 'type-fest';
|
|
5854
|
+
|
|
5855
|
+
// The following illustrates the problem with `{}`.
|
|
5856
|
+
const foo1: {} = {}; // Pass
|
|
5857
|
+
const foo2: {} = []; // Pass
|
|
5858
|
+
const foo3: {} = 42; // Pass
|
|
5859
|
+
const foo4: {} = {a: 1}; // Pass
|
|
5860
|
+
|
|
5861
|
+
// With `EmptyObject` only the first case is valid.
|
|
5862
|
+
const bar1: EmptyObject = {}; // Pass
|
|
5863
|
+
const bar2: EmptyObject = 42; // Fail
|
|
5864
|
+
const bar3: EmptyObject = []; // Fail
|
|
5865
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
5866
|
+
```
|
|
5867
|
+
|
|
5868
|
+
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}.
|
|
5869
|
+
|
|
5870
|
+
@category Object
|
|
5871
|
+
*/
|
|
5872
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
5873
|
+
|
|
5874
|
+
/**
|
|
5875
|
+
Returns a boolean for whether the two given types are equal.
|
|
5876
|
+
|
|
5877
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
5878
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
5879
|
+
|
|
5880
|
+
Use-cases:
|
|
5881
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
5882
|
+
|
|
5883
|
+
@example
|
|
5884
|
+
```
|
|
5885
|
+
import type {IsEqual} from 'type-fest';
|
|
5886
|
+
|
|
5887
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
5888
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
5889
|
+
type Includes<Value extends readonly any[], Item> =
|
|
5890
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
5891
|
+
? IsEqual<Value[0], Item> extends true
|
|
5892
|
+
? true
|
|
5893
|
+
: Includes<rest, Item>
|
|
5894
|
+
: false;
|
|
5895
|
+
```
|
|
5896
|
+
|
|
5897
|
+
@category Type Guard
|
|
5898
|
+
@category Utilities
|
|
5899
|
+
*/
|
|
5900
|
+
type IsEqual$2<A, B> =
|
|
5901
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
5902
|
+
(<G>() => G extends B ? 1 : 2)
|
|
5903
|
+
? true
|
|
5904
|
+
: false;
|
|
5905
|
+
|
|
5906
|
+
/**
|
|
5907
|
+
Filter out keys from an object.
|
|
5908
|
+
|
|
5909
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
5910
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
5911
|
+
Returns `Key` otherwise.
|
|
5912
|
+
|
|
5913
|
+
@example
|
|
5914
|
+
```
|
|
5915
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
5916
|
+
//=> never
|
|
5917
|
+
```
|
|
5918
|
+
|
|
5919
|
+
@example
|
|
5920
|
+
```
|
|
5921
|
+
type Filtered = Filter<'bar', string>;
|
|
5922
|
+
//=> never
|
|
5923
|
+
```
|
|
5924
|
+
|
|
5925
|
+
@example
|
|
5926
|
+
```
|
|
5927
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
5928
|
+
//=> 'bar'
|
|
5929
|
+
```
|
|
5930
|
+
|
|
5931
|
+
@see {Except}
|
|
5932
|
+
*/
|
|
5933
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
5934
|
+
|
|
5935
|
+
type ExceptOptions$2 = {
|
|
5936
|
+
/**
|
|
5937
|
+
Disallow assigning non-specified properties.
|
|
5938
|
+
|
|
5939
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
5940
|
+
|
|
5941
|
+
@default false
|
|
5942
|
+
*/
|
|
5943
|
+
requireExactProps?: boolean;
|
|
5944
|
+
};
|
|
5945
|
+
|
|
5946
|
+
/**
|
|
5947
|
+
Create a type from an object type without certain keys.
|
|
5948
|
+
|
|
5949
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
5950
|
+
|
|
5951
|
+
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.
|
|
5952
|
+
|
|
5953
|
+
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)).
|
|
5954
|
+
|
|
5955
|
+
@example
|
|
5956
|
+
```
|
|
5957
|
+
import type {Except} from 'type-fest';
|
|
5958
|
+
|
|
5959
|
+
type Foo = {
|
|
5960
|
+
a: number;
|
|
5961
|
+
b: string;
|
|
5962
|
+
};
|
|
5963
|
+
|
|
5964
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
5965
|
+
//=> {b: string}
|
|
5966
|
+
|
|
5967
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
5968
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
5969
|
+
|
|
5970
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
5971
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
5972
|
+
|
|
5973
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
5974
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
5975
|
+
```
|
|
5976
|
+
|
|
5977
|
+
@category Object
|
|
5978
|
+
*/
|
|
5979
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
5980
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
5981
|
+
} & (Options['requireExactProps'] extends true
|
|
5982
|
+
? Partial<Record<KeysType, never>>
|
|
5983
|
+
: {});
|
|
5984
|
+
|
|
5985
|
+
/**
|
|
5986
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
5987
|
+
|
|
5988
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
5989
|
+
|
|
5990
|
+
@example
|
|
5991
|
+
```
|
|
5992
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5993
|
+
|
|
5994
|
+
interface Example {
|
|
5995
|
+
a: string;
|
|
5996
|
+
b: string | number;
|
|
5997
|
+
c?: string;
|
|
5998
|
+
d: {};
|
|
5999
|
+
}
|
|
6000
|
+
|
|
6001
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
6002
|
+
//=> 'a'
|
|
6003
|
+
```
|
|
6004
|
+
|
|
6005
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
6006
|
+
|
|
6007
|
+
@example
|
|
6008
|
+
```
|
|
6009
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6010
|
+
|
|
6011
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
6012
|
+
//=> 'a' | 'c'
|
|
6013
|
+
```
|
|
6014
|
+
|
|
6015
|
+
@category Object
|
|
6016
|
+
*/
|
|
6017
|
+
type ConditionalKeys$2<Base, Condition> = NonNullable<
|
|
6018
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
6019
|
+
{
|
|
6020
|
+
// Map through all the keys of the given base type.
|
|
6021
|
+
[Key in keyof Base]:
|
|
6022
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
6023
|
+
Base[Key] extends Condition
|
|
6024
|
+
// Retain this key since the condition passes.
|
|
6025
|
+
? Key
|
|
6026
|
+
// Discard this key since the condition fails.
|
|
6027
|
+
: never;
|
|
6028
|
+
|
|
6029
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
6030
|
+
}[keyof Base]
|
|
6031
|
+
>;
|
|
6032
|
+
|
|
6033
|
+
/**
|
|
6034
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
6035
|
+
|
|
6036
|
+
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.
|
|
6037
|
+
|
|
6038
|
+
@example
|
|
6039
|
+
```
|
|
6040
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
6041
|
+
|
|
6042
|
+
class Awesome {
|
|
6043
|
+
name: string;
|
|
6044
|
+
successes: number;
|
|
6045
|
+
failures: bigint;
|
|
6046
|
+
|
|
6047
|
+
run() {}
|
|
6048
|
+
}
|
|
6049
|
+
|
|
6050
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
6051
|
+
//=> {run: () => void}
|
|
6052
|
+
```
|
|
6053
|
+
|
|
6054
|
+
@example
|
|
6055
|
+
```
|
|
6056
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
6057
|
+
|
|
6058
|
+
interface Example {
|
|
6059
|
+
a: string;
|
|
6060
|
+
b: string | number;
|
|
6061
|
+
c: () => void;
|
|
6062
|
+
d: {};
|
|
6063
|
+
}
|
|
6064
|
+
|
|
6065
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
6066
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
6067
|
+
```
|
|
6068
|
+
|
|
6069
|
+
@category Object
|
|
6070
|
+
*/
|
|
6071
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
6072
|
+
Base,
|
|
6073
|
+
ConditionalKeys$2<Base, Condition>
|
|
6074
|
+
>;
|
|
6075
|
+
|
|
6076
|
+
/**
|
|
6077
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
6078
|
+
* can either be a REST module or a host module.
|
|
6079
|
+
* This type is recursive, so it can describe nested modules.
|
|
6080
|
+
*/
|
|
6081
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
|
|
6082
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
6083
|
+
};
|
|
6084
|
+
/**
|
|
6085
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
6086
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
6087
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
6088
|
+
* do not match the given host (as they will not work with the given host).
|
|
6089
|
+
*/
|
|
6090
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
6091
|
+
done: T;
|
|
6092
|
+
recurse: T extends {
|
|
6093
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
6094
|
+
} ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
|
|
6095
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
6096
|
+
-1,
|
|
6097
|
+
0,
|
|
6098
|
+
1,
|
|
6099
|
+
2,
|
|
6100
|
+
3,
|
|
6101
|
+
4,
|
|
6102
|
+
5
|
|
6103
|
+
][Depth]> : never;
|
|
6104
|
+
}, EmptyObject$2>;
|
|
6105
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
6106
|
+
type PublicMetadata$2 = {
|
|
6107
|
+
PACKAGE_NAME?: string;
|
|
6108
|
+
};
|
|
6109
|
+
|
|
6110
|
+
declare global {
|
|
6111
|
+
interface ContextualClient {
|
|
6112
|
+
}
|
|
6113
|
+
}
|
|
6114
|
+
/**
|
|
6115
|
+
* A type used to create concerete types from SDK descriptors in
|
|
6116
|
+
* case a contextual client is available.
|
|
6117
|
+
*/
|
|
6118
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
6119
|
+
host: Host$2;
|
|
6120
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
6121
|
+
|
|
4509
6122
|
interface SiteTranslatableProperties {
|
|
4510
6123
|
/** Total number of words that exist in the main_language */
|
|
4511
6124
|
totalWords?: number;
|
|
@@ -4827,7 +6440,7 @@ interface GetSiteTranslatablesPropertiesOptions {
|
|
|
4827
6440
|
translatedLanguage?: Locale;
|
|
4828
6441
|
}
|
|
4829
6442
|
|
|
4830
|
-
declare function translateSite$1(httpClient: HttpClient): TranslateSiteSignature;
|
|
6443
|
+
declare function translateSite$1(httpClient: HttpClient$2): TranslateSiteSignature;
|
|
4831
6444
|
interface TranslateSiteSignature {
|
|
4832
6445
|
/**
|
|
4833
6446
|
* Start a task to auto-translate all site content that hasn't been translated yet
|
|
@@ -4835,35 +6448,445 @@ interface TranslateSiteSignature {
|
|
|
4835
6448
|
*/
|
|
4836
6449
|
(mainLanguage: Locale, options: TranslateSiteOptions): Promise<void>;
|
|
4837
6450
|
}
|
|
4838
|
-
declare function getSiteTranslatablesProperties$1(httpClient: HttpClient): GetSiteTranslatablesPropertiesSignature;
|
|
4839
|
-
interface GetSiteTranslatablesPropertiesSignature {
|
|
4840
|
-
/**
|
|
4841
|
-
* Receive the site's translation status
|
|
4842
|
-
* @param - Number of words included in main_language
|
|
4843
|
-
*/
|
|
4844
|
-
(mainLanguage: Locale, options?: GetSiteTranslatablesPropertiesOptions | undefined): Promise<GetSiteTranslatablesPropertiesResponse & GetSiteTranslatablesPropertiesResponseNonNullableFields>;
|
|
6451
|
+
declare function getSiteTranslatablesProperties$1(httpClient: HttpClient$2): GetSiteTranslatablesPropertiesSignature;
|
|
6452
|
+
interface GetSiteTranslatablesPropertiesSignature {
|
|
6453
|
+
/**
|
|
6454
|
+
* Receive the site's translation status
|
|
6455
|
+
* @param - Number of words included in main_language
|
|
6456
|
+
*/
|
|
6457
|
+
(mainLanguage: Locale, options?: GetSiteTranslatablesPropertiesOptions | undefined): Promise<GetSiteTranslatablesPropertiesResponse & GetSiteTranslatablesPropertiesResponseNonNullableFields>;
|
|
6458
|
+
}
|
|
6459
|
+
|
|
6460
|
+
declare const translateSite: MaybeContext$2<BuildRESTFunction$2<typeof translateSite$1> & typeof translateSite$1>;
|
|
6461
|
+
declare const getSiteTranslatablesProperties: MaybeContext$2<BuildRESTFunction$2<typeof getSiteTranslatablesProperties$1> & typeof getSiteTranslatablesProperties$1>;
|
|
6462
|
+
|
|
6463
|
+
type context$2_ApplicationTranslatableProperties = ApplicationTranslatableProperties;
|
|
6464
|
+
type context$2_Flag = Flag;
|
|
6465
|
+
declare const context$2_Flag: typeof Flag;
|
|
6466
|
+
type context$2_GetSiteTranslatablesPropertiesOptions = GetSiteTranslatablesPropertiesOptions;
|
|
6467
|
+
type context$2_GetSiteTranslatablesPropertiesRequest = GetSiteTranslatablesPropertiesRequest;
|
|
6468
|
+
type context$2_GetSiteTranslatablesPropertiesResponse = GetSiteTranslatablesPropertiesResponse;
|
|
6469
|
+
type context$2_GetSiteTranslatablesPropertiesResponseNonNullableFields = GetSiteTranslatablesPropertiesResponseNonNullableFields;
|
|
6470
|
+
type context$2_Locale = Locale;
|
|
6471
|
+
type context$2_SiteTranslatableProperties = SiteTranslatableProperties;
|
|
6472
|
+
type context$2_TranslateSiteOptions = TranslateSiteOptions;
|
|
6473
|
+
type context$2_TranslateSiteRequest = TranslateSiteRequest;
|
|
6474
|
+
type context$2_TranslateSiteResponse = TranslateSiteResponse;
|
|
6475
|
+
declare const context$2_getSiteTranslatablesProperties: typeof getSiteTranslatablesProperties;
|
|
6476
|
+
declare const context$2_translateSite: typeof translateSite;
|
|
6477
|
+
declare namespace context$2 {
|
|
6478
|
+
export { type context$2_ApplicationTranslatableProperties as ApplicationTranslatableProperties, context$2_Flag as Flag, type context$2_GetSiteTranslatablesPropertiesOptions as GetSiteTranslatablesPropertiesOptions, type context$2_GetSiteTranslatablesPropertiesRequest as GetSiteTranslatablesPropertiesRequest, type context$2_GetSiteTranslatablesPropertiesResponse as GetSiteTranslatablesPropertiesResponse, type context$2_GetSiteTranslatablesPropertiesResponseNonNullableFields as GetSiteTranslatablesPropertiesResponseNonNullableFields, type context$2_Locale as Locale, type context$2_SiteTranslatableProperties as SiteTranslatableProperties, type context$2_TranslateSiteOptions as TranslateSiteOptions, type context$2_TranslateSiteRequest as TranslateSiteRequest, type context$2_TranslateSiteResponse as TranslateSiteResponse, context$2_getSiteTranslatablesProperties as getSiteTranslatablesProperties, context$2_translateSite as translateSite };
|
|
6479
|
+
}
|
|
6480
|
+
|
|
6481
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
6482
|
+
__type: 'host';
|
|
6483
|
+
create(host: H): T;
|
|
6484
|
+
};
|
|
6485
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
6486
|
+
type Host$1<Environment = unknown> = {
|
|
6487
|
+
channel: {
|
|
6488
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
6489
|
+
disconnect: () => void;
|
|
6490
|
+
} | Promise<{
|
|
6491
|
+
disconnect: () => void;
|
|
6492
|
+
}>;
|
|
6493
|
+
};
|
|
6494
|
+
environment?: Environment;
|
|
6495
|
+
/**
|
|
6496
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
6497
|
+
*/
|
|
6498
|
+
apiBaseUrl?: string;
|
|
6499
|
+
/**
|
|
6500
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
6501
|
+
* like internationalization, billing, etc.
|
|
6502
|
+
*/
|
|
6503
|
+
essentials?: {
|
|
6504
|
+
/**
|
|
6505
|
+
* The language of the currently viewed session
|
|
6506
|
+
*/
|
|
6507
|
+
language?: string;
|
|
6508
|
+
/**
|
|
6509
|
+
* The locale of the currently viewed session
|
|
6510
|
+
*/
|
|
6511
|
+
locale?: string;
|
|
6512
|
+
/**
|
|
6513
|
+
* Any headers that should be passed through to the API requests
|
|
6514
|
+
*/
|
|
6515
|
+
passThroughHeaders?: Record<string, string>;
|
|
6516
|
+
};
|
|
6517
|
+
};
|
|
6518
|
+
|
|
6519
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
6520
|
+
interface HttpClient$1 {
|
|
6521
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
6522
|
+
fetchWithAuth: typeof fetch;
|
|
6523
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
6524
|
+
getActiveToken?: () => string | undefined;
|
|
6525
|
+
}
|
|
6526
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
6527
|
+
type HttpResponse$1<T = any> = {
|
|
6528
|
+
data: T;
|
|
6529
|
+
status: number;
|
|
6530
|
+
statusText: string;
|
|
6531
|
+
headers: any;
|
|
6532
|
+
request?: any;
|
|
6533
|
+
};
|
|
6534
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
6535
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
6536
|
+
url: string;
|
|
6537
|
+
data?: Data;
|
|
6538
|
+
params?: URLSearchParams;
|
|
6539
|
+
} & APIMetadata$1;
|
|
6540
|
+
type APIMetadata$1 = {
|
|
6541
|
+
methodFqn?: string;
|
|
6542
|
+
entityFqdn?: string;
|
|
6543
|
+
packageName?: string;
|
|
6544
|
+
};
|
|
6545
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
6546
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
6547
|
+
__type: 'event-definition';
|
|
6548
|
+
type: Type;
|
|
6549
|
+
isDomainEvent?: boolean;
|
|
6550
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6551
|
+
__payload: Payload;
|
|
6552
|
+
};
|
|
6553
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
6554
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
6555
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
6556
|
+
|
|
6557
|
+
type ServicePluginMethodInput$1 = {
|
|
6558
|
+
request: any;
|
|
6559
|
+
metadata: any;
|
|
6560
|
+
};
|
|
6561
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
6562
|
+
type ServicePluginMethodMetadata$1 = {
|
|
6563
|
+
name: string;
|
|
6564
|
+
primaryHttpMappingPath: string;
|
|
6565
|
+
transformations: {
|
|
6566
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
6567
|
+
toREST: (...args: unknown[]) => unknown;
|
|
6568
|
+
};
|
|
6569
|
+
};
|
|
6570
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
6571
|
+
__type: 'service-plugin-definition';
|
|
6572
|
+
componentType: string;
|
|
6573
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
6574
|
+
__contract: Contract;
|
|
6575
|
+
};
|
|
6576
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
6577
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
6578
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
6579
|
+
|
|
6580
|
+
type RequestContext$1 = {
|
|
6581
|
+
isSSR: boolean;
|
|
6582
|
+
host: string;
|
|
6583
|
+
protocol?: string;
|
|
6584
|
+
};
|
|
6585
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
6586
|
+
/**
|
|
6587
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
6588
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
6589
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
6590
|
+
*/
|
|
6591
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6592
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
6593
|
+
_?: T;
|
|
6594
|
+
url?: string;
|
|
6595
|
+
method?: Method$1;
|
|
6596
|
+
params?: any;
|
|
6597
|
+
data?: any;
|
|
6598
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
6599
|
+
};
|
|
6600
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
6601
|
+
__isAmbassador: boolean;
|
|
6602
|
+
};
|
|
6603
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
6604
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
6605
|
+
|
|
6606
|
+
declare global {
|
|
6607
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6608
|
+
interface SymbolConstructor {
|
|
6609
|
+
readonly observable: symbol;
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
|
|
6613
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
6614
|
+
|
|
6615
|
+
/**
|
|
6616
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
6617
|
+
|
|
6618
|
+
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)).
|
|
6619
|
+
|
|
6620
|
+
@example
|
|
6621
|
+
```
|
|
6622
|
+
import type {EmptyObject} from 'type-fest';
|
|
6623
|
+
|
|
6624
|
+
// The following illustrates the problem with `{}`.
|
|
6625
|
+
const foo1: {} = {}; // Pass
|
|
6626
|
+
const foo2: {} = []; // Pass
|
|
6627
|
+
const foo3: {} = 42; // Pass
|
|
6628
|
+
const foo4: {} = {a: 1}; // Pass
|
|
6629
|
+
|
|
6630
|
+
// With `EmptyObject` only the first case is valid.
|
|
6631
|
+
const bar1: EmptyObject = {}; // Pass
|
|
6632
|
+
const bar2: EmptyObject = 42; // Fail
|
|
6633
|
+
const bar3: EmptyObject = []; // Fail
|
|
6634
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
6635
|
+
```
|
|
6636
|
+
|
|
6637
|
+
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}.
|
|
6638
|
+
|
|
6639
|
+
@category Object
|
|
6640
|
+
*/
|
|
6641
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
6642
|
+
|
|
6643
|
+
/**
|
|
6644
|
+
Returns a boolean for whether the two given types are equal.
|
|
6645
|
+
|
|
6646
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
6647
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
6648
|
+
|
|
6649
|
+
Use-cases:
|
|
6650
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
6651
|
+
|
|
6652
|
+
@example
|
|
6653
|
+
```
|
|
6654
|
+
import type {IsEqual} from 'type-fest';
|
|
6655
|
+
|
|
6656
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
6657
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
6658
|
+
type Includes<Value extends readonly any[], Item> =
|
|
6659
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
6660
|
+
? IsEqual<Value[0], Item> extends true
|
|
6661
|
+
? true
|
|
6662
|
+
: Includes<rest, Item>
|
|
6663
|
+
: false;
|
|
6664
|
+
```
|
|
6665
|
+
|
|
6666
|
+
@category Type Guard
|
|
6667
|
+
@category Utilities
|
|
6668
|
+
*/
|
|
6669
|
+
type IsEqual$1<A, B> =
|
|
6670
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
6671
|
+
(<G>() => G extends B ? 1 : 2)
|
|
6672
|
+
? true
|
|
6673
|
+
: false;
|
|
6674
|
+
|
|
6675
|
+
/**
|
|
6676
|
+
Filter out keys from an object.
|
|
6677
|
+
|
|
6678
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
6679
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
6680
|
+
Returns `Key` otherwise.
|
|
6681
|
+
|
|
6682
|
+
@example
|
|
6683
|
+
```
|
|
6684
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
6685
|
+
//=> never
|
|
6686
|
+
```
|
|
6687
|
+
|
|
6688
|
+
@example
|
|
6689
|
+
```
|
|
6690
|
+
type Filtered = Filter<'bar', string>;
|
|
6691
|
+
//=> never
|
|
6692
|
+
```
|
|
6693
|
+
|
|
6694
|
+
@example
|
|
6695
|
+
```
|
|
6696
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
6697
|
+
//=> 'bar'
|
|
6698
|
+
```
|
|
6699
|
+
|
|
6700
|
+
@see {Except}
|
|
6701
|
+
*/
|
|
6702
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
6703
|
+
|
|
6704
|
+
type ExceptOptions$1 = {
|
|
6705
|
+
/**
|
|
6706
|
+
Disallow assigning non-specified properties.
|
|
6707
|
+
|
|
6708
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
6709
|
+
|
|
6710
|
+
@default false
|
|
6711
|
+
*/
|
|
6712
|
+
requireExactProps?: boolean;
|
|
6713
|
+
};
|
|
6714
|
+
|
|
6715
|
+
/**
|
|
6716
|
+
Create a type from an object type without certain keys.
|
|
6717
|
+
|
|
6718
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
6719
|
+
|
|
6720
|
+
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.
|
|
6721
|
+
|
|
6722
|
+
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)).
|
|
6723
|
+
|
|
6724
|
+
@example
|
|
6725
|
+
```
|
|
6726
|
+
import type {Except} from 'type-fest';
|
|
6727
|
+
|
|
6728
|
+
type Foo = {
|
|
6729
|
+
a: number;
|
|
6730
|
+
b: string;
|
|
6731
|
+
};
|
|
6732
|
+
|
|
6733
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
6734
|
+
//=> {b: string}
|
|
6735
|
+
|
|
6736
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
6737
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
6738
|
+
|
|
6739
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
6740
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
6741
|
+
|
|
6742
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
6743
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
6744
|
+
```
|
|
6745
|
+
|
|
6746
|
+
@category Object
|
|
6747
|
+
*/
|
|
6748
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
6749
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
6750
|
+
} & (Options['requireExactProps'] extends true
|
|
6751
|
+
? Partial<Record<KeysType, never>>
|
|
6752
|
+
: {});
|
|
6753
|
+
|
|
6754
|
+
/**
|
|
6755
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
6756
|
+
|
|
6757
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
6758
|
+
|
|
6759
|
+
@example
|
|
6760
|
+
```
|
|
6761
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6762
|
+
|
|
6763
|
+
interface Example {
|
|
6764
|
+
a: string;
|
|
6765
|
+
b: string | number;
|
|
6766
|
+
c?: string;
|
|
6767
|
+
d: {};
|
|
6768
|
+
}
|
|
6769
|
+
|
|
6770
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
6771
|
+
//=> 'a'
|
|
6772
|
+
```
|
|
6773
|
+
|
|
6774
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
6775
|
+
|
|
6776
|
+
@example
|
|
6777
|
+
```
|
|
6778
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6779
|
+
|
|
6780
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
6781
|
+
//=> 'a' | 'c'
|
|
6782
|
+
```
|
|
6783
|
+
|
|
6784
|
+
@category Object
|
|
6785
|
+
*/
|
|
6786
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
6787
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
6788
|
+
{
|
|
6789
|
+
// Map through all the keys of the given base type.
|
|
6790
|
+
[Key in keyof Base]:
|
|
6791
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
6792
|
+
Base[Key] extends Condition
|
|
6793
|
+
// Retain this key since the condition passes.
|
|
6794
|
+
? Key
|
|
6795
|
+
// Discard this key since the condition fails.
|
|
6796
|
+
: never;
|
|
6797
|
+
|
|
6798
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
6799
|
+
}[keyof Base]
|
|
6800
|
+
>;
|
|
6801
|
+
|
|
6802
|
+
/**
|
|
6803
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
6804
|
+
|
|
6805
|
+
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.
|
|
6806
|
+
|
|
6807
|
+
@example
|
|
6808
|
+
```
|
|
6809
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
6810
|
+
|
|
6811
|
+
class Awesome {
|
|
6812
|
+
name: string;
|
|
6813
|
+
successes: number;
|
|
6814
|
+
failures: bigint;
|
|
6815
|
+
|
|
6816
|
+
run() {}
|
|
6817
|
+
}
|
|
6818
|
+
|
|
6819
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
6820
|
+
//=> {run: () => void}
|
|
6821
|
+
```
|
|
6822
|
+
|
|
6823
|
+
@example
|
|
6824
|
+
```
|
|
6825
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
6826
|
+
|
|
6827
|
+
interface Example {
|
|
6828
|
+
a: string;
|
|
6829
|
+
b: string | number;
|
|
6830
|
+
c: () => void;
|
|
6831
|
+
d: {};
|
|
4845
6832
|
}
|
|
4846
6833
|
|
|
4847
|
-
|
|
4848
|
-
|
|
6834
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
6835
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
6836
|
+
```
|
|
4849
6837
|
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
type
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
6838
|
+
@category Object
|
|
6839
|
+
*/
|
|
6840
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
6841
|
+
Base,
|
|
6842
|
+
ConditionalKeys$1<Base, Condition>
|
|
6843
|
+
>;
|
|
6844
|
+
|
|
6845
|
+
/**
|
|
6846
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
6847
|
+
* can either be a REST module or a host module.
|
|
6848
|
+
* This type is recursive, so it can describe nested modules.
|
|
6849
|
+
*/
|
|
6850
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$3<any> | ServicePluginDefinition$1<any> | {
|
|
6851
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
6852
|
+
};
|
|
6853
|
+
/**
|
|
6854
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
6855
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
6856
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
6857
|
+
* do not match the given host (as they will not work with the given host).
|
|
6858
|
+
*/
|
|
6859
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
6860
|
+
done: T;
|
|
6861
|
+
recurse: T extends {
|
|
6862
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
6863
|
+
} ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
|
|
6864
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
6865
|
+
-1,
|
|
6866
|
+
0,
|
|
6867
|
+
1,
|
|
6868
|
+
2,
|
|
6869
|
+
3,
|
|
6870
|
+
4,
|
|
6871
|
+
5
|
|
6872
|
+
][Depth]> : never;
|
|
6873
|
+
}, EmptyObject$1>;
|
|
6874
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
6875
|
+
type PublicMetadata$1 = {
|
|
6876
|
+
PACKAGE_NAME?: string;
|
|
6877
|
+
};
|
|
6878
|
+
|
|
6879
|
+
declare global {
|
|
6880
|
+
interface ContextualClient {
|
|
6881
|
+
}
|
|
4866
6882
|
}
|
|
6883
|
+
/**
|
|
6884
|
+
* A type used to create concerete types from SDK descriptors in
|
|
6885
|
+
* case a contextual client is available.
|
|
6886
|
+
*/
|
|
6887
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
6888
|
+
host: Host$1;
|
|
6889
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
4867
6890
|
|
|
4868
6891
|
interface Content {
|
|
4869
6892
|
/**
|
|
@@ -4879,20 +6902,20 @@ interface Content {
|
|
|
4879
6902
|
locale?: string;
|
|
4880
6903
|
/** List of fields for the translation content. This property uses a string to map to a `ContentField` (`Map<string, ContentField>`). The string serves as a key, which you'll need to access each field in the content and when referencing a translation schema. */
|
|
4881
6904
|
fields?: Record<string, ContentField>;
|
|
4882
|
-
/** A reference to the parent content
|
|
6905
|
+
/** A reference to the parent content. For example, if the content is a menu item, this property would contain the `entityId` of the menu it belongs to. */
|
|
4883
6906
|
parentEntityId?: string | null;
|
|
4884
6907
|
/**
|
|
4885
6908
|
* The aggregated published status across all content fields.
|
|
4886
6909
|
*
|
|
4887
6910
|
* Supported values:
|
|
4888
|
-
* + `UNPUBLISHED`: None of the fields have been
|
|
4889
|
-
* + `PUBLISHED`: All of the fields have been
|
|
4890
|
-
* + `PARTIALLY_PUBLISHED`: Some of the fields have been
|
|
6911
|
+
* + `UNPUBLISHED`: None of the fields have been sent for publication.
|
|
6912
|
+
* + `PUBLISHED`: All of the fields have been sent for publication.
|
|
6913
|
+
* + `PARTIALLY_PUBLISHED`: Some of the fields have been sent for publication.
|
|
4891
6914
|
* @readonly
|
|
4892
6915
|
*/
|
|
4893
6916
|
publishStatus?: PublishStatus;
|
|
4894
6917
|
/**
|
|
4895
|
-
* Contains the value of the preview field
|
|
6918
|
+
* Contains the value of the preview field if the schema defines one.
|
|
4896
6919
|
* @readonly
|
|
4897
6920
|
*/
|
|
4898
6921
|
previewField?: string | null;
|
|
@@ -4919,18 +6942,22 @@ interface ContentField extends ContentFieldValueOneOf {
|
|
|
4919
6942
|
/** Wix Media Manager document. */
|
|
4920
6943
|
document?: string;
|
|
4921
6944
|
/**
|
|
4922
|
-
* Field unique identifier. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field IDs may contain
|
|
6945
|
+
* Field unique identifier. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field IDs may contain parentheses to reference repeated items, such as images. These parentheses can't be nested and each opening parenthesis must be followed by a closing one. For example, `title()()` is valid, while `title)(` and `title(())` aren't valid. The value inside the parenthesis is validated according to Regex `^[^)(\\]\\[\\.]+$`.
|
|
4923
6946
|
* @readonly
|
|
4924
6947
|
*/
|
|
4925
6948
|
_id?: string;
|
|
4926
|
-
/**
|
|
6949
|
+
/**
|
|
6950
|
+
* Whether to publish the translation content to the live site, making it visible to site visitors.
|
|
6951
|
+
*
|
|
6952
|
+
* Default: `false`
|
|
6953
|
+
*/
|
|
4927
6954
|
published?: boolean;
|
|
4928
6955
|
/**
|
|
4929
|
-
* The source that updated the translation content.
|
|
6956
|
+
* *Required.** The source that updated the translation content.
|
|
4930
6957
|
* Supported values:
|
|
4931
|
-
* + `USER`: The
|
|
4932
|
-
* + `EXTERNAL_APP`: An external translation app.
|
|
4933
|
-
* + `
|
|
6958
|
+
* + `USER`: The Wix user.
|
|
6959
|
+
* + `EXTERNAL_APP`: An external translation app.
|
|
6960
|
+
* + `MACHINE`: Machine translaton service.
|
|
4934
6961
|
*/
|
|
4935
6962
|
updatedBy?: UpdaterIdentity;
|
|
4936
6963
|
/**
|
|
@@ -6241,7 +8268,7 @@ interface UpdateContentResponse {
|
|
|
6241
8268
|
content?: Content;
|
|
6242
8269
|
}
|
|
6243
8270
|
interface UpdateContentByKeyRequest {
|
|
6244
|
-
/** Content to
|
|
8271
|
+
/** Content to update. */
|
|
6245
8272
|
content: Content;
|
|
6246
8273
|
}
|
|
6247
8274
|
interface UpdateContentByKeyResponse {
|
|
@@ -6391,7 +8418,7 @@ interface PagingMetadataV2 {
|
|
|
6391
8418
|
cursors?: Cursors$1;
|
|
6392
8419
|
}
|
|
6393
8420
|
interface SearchContentsRequest {
|
|
6394
|
-
/**
|
|
8421
|
+
/** Search query and aggregation information. */
|
|
6395
8422
|
search?: CursorSearch;
|
|
6396
8423
|
}
|
|
6397
8424
|
interface CursorSearch extends CursorSearchPagingMethodOneOf {
|
|
@@ -6849,7 +8876,7 @@ interface ApplicationError {
|
|
|
6849
8876
|
interface BulkContentResult {
|
|
6850
8877
|
/** Item metadata. */
|
|
6851
8878
|
itemMetadata?: ItemMetadata;
|
|
6852
|
-
/** Translation
|
|
8879
|
+
/** Translation content. This field is only returned if the operation was successful and `returnEntity` was set to true in the request. */
|
|
6853
8880
|
item?: Content;
|
|
6854
8881
|
}
|
|
6855
8882
|
interface BulkActionMetadata {
|
|
@@ -6861,7 +8888,7 @@ interface BulkActionMetadata {
|
|
|
6861
8888
|
undetailedFailures?: number;
|
|
6862
8889
|
}
|
|
6863
8890
|
interface BulkUpdateContentRequest {
|
|
6864
|
-
/**
|
|
8891
|
+
/** Translation content items to update. */
|
|
6865
8892
|
contents: BulkUpdateContentRequestMaskedContent[];
|
|
6866
8893
|
/** Whether to include the updated translation content items in the response. Set to `true` to receive the translation content items in the response. */
|
|
6867
8894
|
returnEntity?: boolean;
|
|
@@ -6879,29 +8906,29 @@ interface BulkUpdateContentResponse {
|
|
|
6879
8906
|
interface BulkUpdateContentResponseBulkContentResult {
|
|
6880
8907
|
/** Item metadata. */
|
|
6881
8908
|
itemMetadata?: ItemMetadata;
|
|
6882
|
-
/** Translation
|
|
8909
|
+
/** Translation content. This field is only returned if the operation was successful and `returnEntity` was set to true in the request. */
|
|
6883
8910
|
item?: Content;
|
|
6884
8911
|
}
|
|
6885
8912
|
interface BulkUpdateContentByKeyRequest {
|
|
6886
|
-
/**
|
|
8913
|
+
/** Translation content items to update. */
|
|
6887
8914
|
contents: MaskedContent[];
|
|
6888
|
-
/**
|
|
8915
|
+
/** Whether to include the created translation content items in the response. Set to `true` to receive the translation content items in the response. */
|
|
6889
8916
|
returnEntity?: boolean;
|
|
6890
8917
|
}
|
|
6891
8918
|
interface MaskedContent {
|
|
6892
|
-
/**
|
|
8919
|
+
/** Translation content to update. */
|
|
6893
8920
|
content?: Content;
|
|
6894
8921
|
}
|
|
6895
8922
|
interface BulkUpdateContentByKeyResponse {
|
|
6896
|
-
/**
|
|
8923
|
+
/** Items created by bulk action. */
|
|
6897
8924
|
results?: BulkUpdateContentByKeyResponseBulkContentResult[];
|
|
6898
|
-
/** metadata */
|
|
8925
|
+
/** Bulk action metadata. */
|
|
6899
8926
|
bulkActionMetadata?: BulkActionMetadata;
|
|
6900
8927
|
}
|
|
6901
8928
|
interface BulkUpdateContentByKeyResponseBulkContentResult {
|
|
6902
|
-
/** metadata */
|
|
8929
|
+
/** Item metadata. */
|
|
6903
8930
|
itemMetadata?: ItemMetadata;
|
|
6904
|
-
/**
|
|
8931
|
+
/** Translation content. This field is only returned if the operation was successful and `returnEntity` was set to true in the request. */
|
|
6905
8932
|
item?: Content;
|
|
6906
8933
|
}
|
|
6907
8934
|
interface PermissiveBulkUpdateContentRequest {
|
|
@@ -6921,13 +8948,13 @@ interface PermissiveBulkUpdateContentResponse {
|
|
|
6921
8948
|
bulkActionMetadata?: BulkActionMetadata;
|
|
6922
8949
|
}
|
|
6923
8950
|
interface PermissiveBulkUpdateContentResponseBulkContentResult {
|
|
6924
|
-
/** metadata */
|
|
8951
|
+
/** Item metadata. */
|
|
6925
8952
|
itemMetadata?: ItemMetadata;
|
|
6926
|
-
/**
|
|
8953
|
+
/** Translation content. This field is only returned if the operation was successful and `returnEntity` was set to true in the request. */
|
|
6927
8954
|
item?: Content;
|
|
6928
8955
|
}
|
|
6929
8956
|
interface BulkDeleteContentRequest {
|
|
6930
|
-
/**
|
|
8957
|
+
/** IDs of the translation content items to delete. */
|
|
6931
8958
|
contentIds: string[];
|
|
6932
8959
|
}
|
|
6933
8960
|
interface BulkDeleteContentResponse {
|
|
@@ -7540,20 +9567,20 @@ interface UpdateContent {
|
|
|
7540
9567
|
locale?: string;
|
|
7541
9568
|
/** List of fields for the translation content. This property uses a string to map to a `ContentField` (`Map<string, ContentField>`). The string serves as a key, which you'll need to access each field in the content and when referencing a translation schema. */
|
|
7542
9569
|
fields?: Record<string, ContentField>;
|
|
7543
|
-
/** A reference to the parent content
|
|
9570
|
+
/** A reference to the parent content. For example, if the content is a menu item, this property would contain the `entityId` of the menu it belongs to. */
|
|
7544
9571
|
parentEntityId?: string | null;
|
|
7545
9572
|
/**
|
|
7546
9573
|
* The aggregated published status across all content fields.
|
|
7547
9574
|
*
|
|
7548
9575
|
* Supported values:
|
|
7549
|
-
* + `UNPUBLISHED`: None of the fields have been
|
|
7550
|
-
* + `PUBLISHED`: All of the fields have been
|
|
7551
|
-
* + `PARTIALLY_PUBLISHED`: Some of the fields have been
|
|
9576
|
+
* + `UNPUBLISHED`: None of the fields have been sent for publication.
|
|
9577
|
+
* + `PUBLISHED`: All of the fields have been sent for publication.
|
|
9578
|
+
* + `PARTIALLY_PUBLISHED`: Some of the fields have been sent for publication.
|
|
7552
9579
|
* @readonly
|
|
7553
9580
|
*/
|
|
7554
9581
|
publishStatus?: PublishStatus;
|
|
7555
9582
|
/**
|
|
7556
|
-
* Contains the value of the preview field
|
|
9583
|
+
* Contains the value of the preview field if the schema defines one.
|
|
7557
9584
|
* @readonly
|
|
7558
9585
|
*/
|
|
7559
9586
|
previewField?: string | null;
|
|
@@ -7628,7 +9655,7 @@ interface ContentsQueryBuilder {
|
|
|
7628
9655
|
find: () => Promise<ContentsQueryResult>;
|
|
7629
9656
|
}
|
|
7630
9657
|
interface SearchContentsOptions {
|
|
7631
|
-
/**
|
|
9658
|
+
/** Search query and aggregation information. */
|
|
7632
9659
|
search?: CursorSearch;
|
|
7633
9660
|
}
|
|
7634
9661
|
interface BulkCreateContentOptions {
|
|
@@ -7640,11 +9667,11 @@ interface BulkUpdateContentOptions {
|
|
|
7640
9667
|
returnEntity?: boolean;
|
|
7641
9668
|
}
|
|
7642
9669
|
interface BulkUpdateContentByKeyOptions {
|
|
7643
|
-
/**
|
|
9670
|
+
/** Whether to include the created translation content items in the response. Set to `true` to receive the translation content items in the response. */
|
|
7644
9671
|
returnEntity?: boolean;
|
|
7645
9672
|
}
|
|
7646
9673
|
|
|
7647
|
-
declare function createContent$1(httpClient: HttpClient): CreateContentSignature;
|
|
9674
|
+
declare function createContent$1(httpClient: HttpClient$1): CreateContentSignature;
|
|
7648
9675
|
interface CreateContentSignature {
|
|
7649
9676
|
/**
|
|
7650
9677
|
* Creates a translation content item.
|
|
@@ -7655,7 +9682,7 @@ interface CreateContentSignature {
|
|
|
7655
9682
|
*/
|
|
7656
9683
|
(content: Content): Promise<Content & ContentNonNullableFields>;
|
|
7657
9684
|
}
|
|
7658
|
-
declare function getContent$1(httpClient: HttpClient): GetContentSignature;
|
|
9685
|
+
declare function getContent$1(httpClient: HttpClient$1): GetContentSignature;
|
|
7659
9686
|
interface GetContentSignature {
|
|
7660
9687
|
/**
|
|
7661
9688
|
* Retrieves a translation content item.
|
|
@@ -7664,10 +9691,10 @@ interface GetContentSignature {
|
|
|
7664
9691
|
*/
|
|
7665
9692
|
(contentId: string): Promise<Content & ContentNonNullableFields>;
|
|
7666
9693
|
}
|
|
7667
|
-
declare function updateContent$1(httpClient: HttpClient): UpdateContentSignature;
|
|
9694
|
+
declare function updateContent$1(httpClient: HttpClient$1): UpdateContentSignature;
|
|
7668
9695
|
interface UpdateContentSignature {
|
|
7669
9696
|
/**
|
|
7670
|
-
* Updates a translation content item.
|
|
9697
|
+
* Updates a translation content item by ID.
|
|
7671
9698
|
*
|
|
7672
9699
|
* To remove a field, pass the field key with an empty object as the value. For example:
|
|
7673
9700
|
*
|
|
@@ -7681,10 +9708,10 @@ interface UpdateContentSignature {
|
|
|
7681
9708
|
*/
|
|
7682
9709
|
(_id: string | null, content: UpdateContent): Promise<Content & ContentNonNullableFields>;
|
|
7683
9710
|
}
|
|
7684
|
-
declare function updateContentByKey$1(httpClient: HttpClient): UpdateContentByKeySignature;
|
|
9711
|
+
declare function updateContentByKey$1(httpClient: HttpClient$1): UpdateContentByKeySignature;
|
|
7685
9712
|
interface UpdateContentByKeySignature {
|
|
7686
9713
|
/**
|
|
7687
|
-
* Updates a translation content item
|
|
9714
|
+
* Updates a translation content item using a unique key, which is a combination of `content.schemaId`, `content.entityId`, and `content.locale`.
|
|
7688
9715
|
*
|
|
7689
9716
|
* To remove a field, pass the field key with an empty object as the value. For example:
|
|
7690
9717
|
*
|
|
@@ -7693,11 +9720,11 @@ interface UpdateContentByKeySignature {
|
|
|
7693
9720
|
* "title": {}
|
|
7694
9721
|
* }
|
|
7695
9722
|
* ```
|
|
7696
|
-
* @param - Content to
|
|
9723
|
+
* @param - Content to update.
|
|
7697
9724
|
*/
|
|
7698
9725
|
(content: Content): Promise<UpdateContentByKeyResponse & UpdateContentByKeyResponseNonNullableFields>;
|
|
7699
9726
|
}
|
|
7700
|
-
declare function deleteContent$1(httpClient: HttpClient): DeleteContentSignature;
|
|
9727
|
+
declare function deleteContent$1(httpClient: HttpClient$1): DeleteContentSignature;
|
|
7701
9728
|
interface DeleteContentSignature {
|
|
7702
9729
|
/**
|
|
7703
9730
|
* Deletes a translation content item.
|
|
@@ -7705,10 +9732,10 @@ interface DeleteContentSignature {
|
|
|
7705
9732
|
*/
|
|
7706
9733
|
(contentId: string): Promise<void>;
|
|
7707
9734
|
}
|
|
7708
|
-
declare function queryContents$1(httpClient: HttpClient): QueryContentsSignature;
|
|
9735
|
+
declare function queryContents$1(httpClient: HttpClient$1): QueryContentsSignature;
|
|
7709
9736
|
interface QueryContentsSignature {
|
|
7710
9737
|
/**
|
|
7711
|
-
* Retrieves a list of translation content given the provided paging, filtering, and sorting. Up to 100 translation content items can be returned per request.
|
|
9738
|
+
* Retrieves a list of translation content items given the provided paging, filtering, and sorting. Up to 100 translation content items can be returned per request.
|
|
7712
9739
|
*
|
|
7713
9740
|
* The default `sort` is `id` in `ASC`.
|
|
7714
9741
|
*
|
|
@@ -7718,12 +9745,12 @@ interface QueryContentsSignature {
|
|
|
7718
9745
|
*/
|
|
7719
9746
|
(options?: QueryContentsOptions | undefined): ContentsQueryBuilder;
|
|
7720
9747
|
}
|
|
7721
|
-
declare function searchContents$1(httpClient: HttpClient): SearchContentsSignature;
|
|
9748
|
+
declare function searchContents$1(httpClient: HttpClient$1): SearchContentsSignature;
|
|
7722
9749
|
interface SearchContentsSignature {
|
|
7723
9750
|
/**
|
|
7724
9751
|
* Retrieves a list of all translation content associated with a site that matches the search query, with optional data aggregation.
|
|
7725
9752
|
*
|
|
7726
|
-
* Note that this method
|
|
9753
|
+
* Note that this method allows you to retrieve all translation content for a site, regardless of which app created it.
|
|
7727
9754
|
*
|
|
7728
9755
|
* Use this method to search translation content fields on a site for a given expression, and/or to perform data aggregations on a site's translation content fields.
|
|
7729
9756
|
*
|
|
@@ -7733,7 +9760,7 @@ interface SearchContentsSignature {
|
|
|
7733
9760
|
*/
|
|
7734
9761
|
(options?: SearchContentsOptions | undefined): Promise<SearchContentsResponse & SearchContentsResponseNonNullableFields>;
|
|
7735
9762
|
}
|
|
7736
|
-
declare function bulkCreateContent$1(httpClient: HttpClient): BulkCreateContentSignature;
|
|
9763
|
+
declare function bulkCreateContent$1(httpClient: HttpClient$1): BulkCreateContentSignature;
|
|
7737
9764
|
interface BulkCreateContentSignature {
|
|
7738
9765
|
/**
|
|
7739
9766
|
* Creates multiple translation content items.
|
|
@@ -7743,58 +9770,98 @@ interface BulkCreateContentSignature {
|
|
|
7743
9770
|
*/
|
|
7744
9771
|
(contents: Content[], options?: BulkCreateContentOptions | undefined): Promise<BulkCreateContentResponse & BulkCreateContentResponseNonNullableFields>;
|
|
7745
9772
|
}
|
|
7746
|
-
declare function bulkUpdateContent$1(httpClient: HttpClient): BulkUpdateContentSignature;
|
|
9773
|
+
declare function bulkUpdateContent$1(httpClient: HttpClient$1): BulkUpdateContentSignature;
|
|
7747
9774
|
interface BulkUpdateContentSignature {
|
|
7748
9775
|
/**
|
|
7749
|
-
* Updates multiple translation content items.
|
|
7750
|
-
*
|
|
9776
|
+
* Updates multiple translation content items by ID.
|
|
9777
|
+
*
|
|
9778
|
+
* To remove a field, pass the field key with an empty object as the value. For example:
|
|
9779
|
+
*
|
|
9780
|
+
* ```json
|
|
9781
|
+
* "fields": {
|
|
9782
|
+
* "title": {}
|
|
9783
|
+
* }
|
|
9784
|
+
* ```
|
|
9785
|
+
* @param - Translation content items to update.
|
|
7751
9786
|
*/
|
|
7752
9787
|
(contents: BulkUpdateContentRequestMaskedContent[], options?: BulkUpdateContentOptions | undefined): Promise<BulkUpdateContentResponse & BulkUpdateContentResponseNonNullableFields>;
|
|
7753
9788
|
}
|
|
7754
|
-
declare function bulkUpdateContentByKey$1(httpClient: HttpClient): BulkUpdateContentByKeySignature;
|
|
9789
|
+
declare function bulkUpdateContentByKey$1(httpClient: HttpClient$1): BulkUpdateContentByKeySignature;
|
|
7755
9790
|
interface BulkUpdateContentByKeySignature {
|
|
7756
9791
|
/**
|
|
7757
|
-
*
|
|
7758
|
-
*
|
|
9792
|
+
* Updates multiple translation content items using a unique key, which is a combination of `contents.content.schemaId`, `contents.content.entityId`, and `contents.content.locale`.
|
|
9793
|
+
*
|
|
9794
|
+
* To remove a field, pass the field key with an empty object as the value. For example:
|
|
9795
|
+
*
|
|
9796
|
+
* ```json
|
|
9797
|
+
* "fields": {
|
|
9798
|
+
* "title": {}
|
|
9799
|
+
* }
|
|
9800
|
+
* ```
|
|
9801
|
+
* @param - Translation content items to update.
|
|
7759
9802
|
*/
|
|
7760
9803
|
(contents: MaskedContent[], options?: BulkUpdateContentByKeyOptions | undefined): Promise<BulkUpdateContentByKeyResponse & BulkUpdateContentByKeyResponseNonNullableFields>;
|
|
7761
9804
|
}
|
|
7762
|
-
declare function bulkDeleteContent$1(httpClient: HttpClient): BulkDeleteContentSignature;
|
|
9805
|
+
declare function bulkDeleteContent$1(httpClient: HttpClient$1): BulkDeleteContentSignature;
|
|
7763
9806
|
interface BulkDeleteContentSignature {
|
|
7764
9807
|
/**
|
|
7765
9808
|
* Deletes multiple translation content items.
|
|
7766
|
-
* @param -
|
|
9809
|
+
* @param - IDs of the translation content items to delete.
|
|
7767
9810
|
*/
|
|
7768
9811
|
(contentIds: string[]): Promise<BulkDeleteContentResponse & BulkDeleteContentResponseNonNullableFields>;
|
|
7769
9812
|
}
|
|
7770
|
-
declare const onContentCreated$1: EventDefinition<ContentCreatedEnvelope, "wix.multilingual.translation.v1.content_created">;
|
|
7771
|
-
declare const onContentUpdated$1: EventDefinition<ContentUpdatedEnvelope, "wix.multilingual.translation.v1.content_updated">;
|
|
7772
|
-
declare const onContentDeleted$1: EventDefinition<ContentDeletedEnvelope, "wix.multilingual.translation.v1.content_deleted">;
|
|
9813
|
+
declare const onContentCreated$1: EventDefinition$3<ContentCreatedEnvelope, "wix.multilingual.translation.v1.content_created">;
|
|
9814
|
+
declare const onContentUpdated$1: EventDefinition$3<ContentUpdatedEnvelope, "wix.multilingual.translation.v1.content_updated">;
|
|
9815
|
+
declare const onContentDeleted$1: EventDefinition$3<ContentDeletedEnvelope, "wix.multilingual.translation.v1.content_deleted">;
|
|
9816
|
+
|
|
9817
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
9818
|
+
__type: 'event-definition';
|
|
9819
|
+
type: Type;
|
|
9820
|
+
isDomainEvent?: boolean;
|
|
9821
|
+
transformations?: (envelope: unknown) => Payload;
|
|
9822
|
+
__payload: Payload;
|
|
9823
|
+
};
|
|
9824
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
9825
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
9826
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
9827
|
+
|
|
9828
|
+
declare global {
|
|
9829
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
9830
|
+
interface SymbolConstructor {
|
|
9831
|
+
readonly observable: symbol;
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
7773
9834
|
|
|
7774
|
-
declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
9835
|
+
declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
7775
9836
|
|
|
7776
|
-
declare const createContent: BuildRESTFunction<typeof createContent$1> & typeof createContent$1
|
|
7777
|
-
declare const getContent: BuildRESTFunction<typeof getContent$1> & typeof getContent$1
|
|
7778
|
-
declare const updateContent: BuildRESTFunction<typeof updateContent$1> & typeof updateContent$1
|
|
7779
|
-
declare const updateContentByKey: BuildRESTFunction<typeof updateContentByKey$1> & typeof updateContentByKey$1
|
|
7780
|
-
declare const deleteContent: BuildRESTFunction<typeof deleteContent$1> & typeof deleteContent$1
|
|
7781
|
-
declare const queryContents: BuildRESTFunction<typeof queryContents$1> & typeof queryContents$1
|
|
7782
|
-
declare const searchContents: BuildRESTFunction<typeof searchContents$1> & typeof searchContents$1
|
|
7783
|
-
declare const bulkCreateContent: BuildRESTFunction<typeof bulkCreateContent$1> & typeof bulkCreateContent$1
|
|
7784
|
-
declare const bulkUpdateContent: BuildRESTFunction<typeof bulkUpdateContent$1> & typeof bulkUpdateContent$1
|
|
7785
|
-
declare const bulkUpdateContentByKey: BuildRESTFunction<typeof bulkUpdateContentByKey$1> & typeof bulkUpdateContentByKey$1
|
|
7786
|
-
declare const bulkDeleteContent: BuildRESTFunction<typeof bulkDeleteContent$1> & typeof bulkDeleteContent$1
|
|
9837
|
+
declare const createContent: MaybeContext$1<BuildRESTFunction$1<typeof createContent$1> & typeof createContent$1>;
|
|
9838
|
+
declare const getContent: MaybeContext$1<BuildRESTFunction$1<typeof getContent$1> & typeof getContent$1>;
|
|
9839
|
+
declare const updateContent: MaybeContext$1<BuildRESTFunction$1<typeof updateContent$1> & typeof updateContent$1>;
|
|
9840
|
+
declare const updateContentByKey: MaybeContext$1<BuildRESTFunction$1<typeof updateContentByKey$1> & typeof updateContentByKey$1>;
|
|
9841
|
+
declare const deleteContent: MaybeContext$1<BuildRESTFunction$1<typeof deleteContent$1> & typeof deleteContent$1>;
|
|
9842
|
+
declare const queryContents: MaybeContext$1<BuildRESTFunction$1<typeof queryContents$1> & typeof queryContents$1>;
|
|
9843
|
+
declare const searchContents: MaybeContext$1<BuildRESTFunction$1<typeof searchContents$1> & typeof searchContents$1>;
|
|
9844
|
+
declare const bulkCreateContent: MaybeContext$1<BuildRESTFunction$1<typeof bulkCreateContent$1> & typeof bulkCreateContent$1>;
|
|
9845
|
+
declare const bulkUpdateContent: MaybeContext$1<BuildRESTFunction$1<typeof bulkUpdateContent$1> & typeof bulkUpdateContent$1>;
|
|
9846
|
+
declare const bulkUpdateContentByKey: MaybeContext$1<BuildRESTFunction$1<typeof bulkUpdateContentByKey$1> & typeof bulkUpdateContentByKey$1>;
|
|
9847
|
+
declare const bulkDeleteContent: MaybeContext$1<BuildRESTFunction$1<typeof bulkDeleteContent$1> & typeof bulkDeleteContent$1>;
|
|
7787
9848
|
|
|
7788
9849
|
type _publicOnContentCreatedType = typeof onContentCreated$1;
|
|
7789
|
-
/**
|
|
9850
|
+
/**
|
|
9851
|
+
* Triggered when translation content is created.
|
|
9852
|
+
*/
|
|
7790
9853
|
declare const onContentCreated: ReturnType<typeof createEventModule$1<_publicOnContentCreatedType>>;
|
|
7791
9854
|
|
|
7792
9855
|
type _publicOnContentUpdatedType = typeof onContentUpdated$1;
|
|
7793
|
-
/**
|
|
9856
|
+
/**
|
|
9857
|
+
* Triggered when translation content is updated.
|
|
9858
|
+
*/
|
|
7794
9859
|
declare const onContentUpdated: ReturnType<typeof createEventModule$1<_publicOnContentUpdatedType>>;
|
|
7795
9860
|
|
|
7796
9861
|
type _publicOnContentDeletedType = typeof onContentDeleted$1;
|
|
7797
|
-
/**
|
|
9862
|
+
/**
|
|
9863
|
+
* Triggered when translation content is deleted.
|
|
9864
|
+
*/
|
|
7798
9865
|
declare const onContentDeleted: ReturnType<typeof createEventModule$1<_publicOnContentDeletedType>>;
|
|
7799
9866
|
|
|
7800
9867
|
type context$1_Aggregation = Aggregation;
|
|
@@ -8091,6 +10158,416 @@ declare namespace context$1 {
|
|
|
8091
10158
|
export { type ActionEvent$1 as ActionEvent, type context$1_Aggregation as Aggregation, type context$1_AggregationData as AggregationData, type context$1_AggregationKindOneOf as AggregationKindOneOf, type context$1_AggregationResults as AggregationResults, type context$1_AggregationResultsResultOneOf as AggregationResultsResultOneOf, type context$1_AggregationResultsScalarResult as AggregationResultsScalarResult, context$1_AggregationType as AggregationType, context$1_Alignment as Alignment, type context$1_AnchorData as AnchorData, type context$1_AppEmbedData as AppEmbedData, type context$1_AppEmbedDataAppDataOneOf as AppEmbedDataAppDataOneOf, context$1_AppType as AppType, type context$1_ApplicationError as ApplicationError, type Asset$1 as Asset, type context$1_AudioData as AudioData, type context$1_Background as Background, type context$1_BackgroundBackgroundOneOf as BackgroundBackgroundOneOf, context$1_BackgroundType as BackgroundType, type BaseEventMetadata$1 as BaseEventMetadata, type context$1_BlockquoteData as BlockquoteData, type context$1_BookingData as BookingData, type context$1_Border as Border, type context$1_BorderColors as BorderColors, type context$1_BulkActionMetadata as BulkActionMetadata, type context$1_BulkContentResult as BulkContentResult, type context$1_BulkCreateContentOptions as BulkCreateContentOptions, type context$1_BulkCreateContentRequest as BulkCreateContentRequest, type context$1_BulkCreateContentResponse as BulkCreateContentResponse, type context$1_BulkCreateContentResponseNonNullableFields as BulkCreateContentResponseNonNullableFields, type context$1_BulkDeleteContentRequest as BulkDeleteContentRequest, type context$1_BulkDeleteContentResponse as BulkDeleteContentResponse, type context$1_BulkDeleteContentResponseBulkContentResult as BulkDeleteContentResponseBulkContentResult, type context$1_BulkDeleteContentResponseNonNullableFields as BulkDeleteContentResponseNonNullableFields, type context$1_BulkUpdateContentByKeyOptions as BulkUpdateContentByKeyOptions, type context$1_BulkUpdateContentByKeyRequest as BulkUpdateContentByKeyRequest, type context$1_BulkUpdateContentByKeyResponse as BulkUpdateContentByKeyResponse, type context$1_BulkUpdateContentByKeyResponseBulkContentResult as BulkUpdateContentByKeyResponseBulkContentResult, type context$1_BulkUpdateContentByKeyResponseNonNullableFields as BulkUpdateContentByKeyResponseNonNullableFields, type context$1_BulkUpdateContentOptions as BulkUpdateContentOptions, type context$1_BulkUpdateContentRequest as BulkUpdateContentRequest, type context$1_BulkUpdateContentRequestMaskedContent as BulkUpdateContentRequestMaskedContent, type context$1_BulkUpdateContentResponse as BulkUpdateContentResponse, type context$1_BulkUpdateContentResponseBulkContentResult as BulkUpdateContentResponseBulkContentResult, type context$1_BulkUpdateContentResponseNonNullableFields as BulkUpdateContentResponseNonNullableFields, type context$1_BulletedListData as BulletedListData, type context$1_ButtonData as ButtonData, type context$1_CellStyle as CellStyle, type context$1_CodeBlockData as CodeBlockData, type context$1_CollapsibleListData as CollapsibleListData, type context$1_ColorData as ColorData, type context$1_Colors as Colors, type context$1_Content as Content, type context$1_ContentCreatedEnvelope as ContentCreatedEnvelope, type context$1_ContentDeletedEnvelope as ContentDeletedEnvelope, type context$1_ContentField as ContentField, type context$1_ContentFieldValueOneOf as ContentFieldValueOneOf, type context$1_ContentNonNullableFields as ContentNonNullableFields, type context$1_ContentUpdatedEnvelope as ContentUpdatedEnvelope, type context$1_ContentsQueryBuilder as ContentsQueryBuilder, type context$1_ContentsQueryResult as ContentsQueryResult, type context$1_CreateContentRequest as CreateContentRequest, type context$1_CreateContentResponse as CreateContentResponse, type context$1_CreateContentResponseNonNullableFields as CreateContentResponseNonNullableFields, context$1_Crop as Crop, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type CursorQuery$1 as CursorQuery, type CursorQueryPagingMethodOneOf$1 as CursorQueryPagingMethodOneOf, type context$1_CursorSearch as CursorSearch, type context$1_CursorSearchPagingMethodOneOf as CursorSearchPagingMethodOneOf, type Cursors$1 as Cursors, type context$1_DateHistogramAggregation as DateHistogramAggregation, type context$1_DateHistogramResult as DateHistogramResult, type context$1_DateHistogramResults as DateHistogramResults, type context$1_Decoration as Decoration, type context$1_DecorationDataOneOf as DecorationDataOneOf, context$1_DecorationType as DecorationType, type context$1_DeleteContentRequest as DeleteContentRequest, type context$1_DeleteContentResponse as DeleteContentResponse, type DeleteContext$1 as DeleteContext, DeleteStatus$1 as DeleteStatus, type context$1_Design as Design, type context$1_Dimensions as Dimensions, context$1_Direction as Direction, type context$1_DividerData as DividerData, type context$1_DocumentStyle as DocumentStyle, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_EmbedData as EmbedData, type Empty$1 as Empty, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventData as EventData, type EventMetadata$1 as EventMetadata, type context$1_FileData as FileData, type context$1_FileSource as FileSource, type context$1_FileSourceDataOneOf as FileSourceDataOneOf, type context$1_FontSizeData as FontSizeData, context$1_FontType as FontType, type context$1_GIF as GIF, type context$1_GIFData as GIFData, type context$1_GalleryData as GalleryData, type context$1_GalleryOptions as GalleryOptions, type context$1_GetContentRequest as GetContentRequest, type context$1_GetContentResponse as GetContentResponse, type context$1_GetContentResponseNonNullableFields as GetContentResponseNonNullableFields, type context$1_Gradient as Gradient, type context$1_GroupByAggregation as GroupByAggregation, type context$1_GroupByAggregationKindOneOf as GroupByAggregationKindOneOf, type context$1_GroupByValueResults as GroupByValueResults, type context$1_HTMLData as HTMLData, type context$1_HTMLDataDataOneOf as HTMLDataDataOneOf, type context$1_HeadingData as HeadingData, type context$1_Height as Height, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$1_Image as Image, type context$1_ImageData as ImageData, type context$1_IncludeMissingValuesOptions as IncludeMissingValuesOptions, context$1_InitialExpandedItems as InitialExpandedItems, context$1_Interval as Interval, type context$1_Item as Item, type context$1_ItemDataOneOf as ItemDataOneOf, type context$1_ItemMetadata as ItemMetadata, type context$1_ItemStyle as ItemStyle, type context$1_Layout as Layout, context$1_LayoutType as LayoutType, context$1_LineStyle as LineStyle, type context$1_Link as Link, type context$1_LinkData as LinkData, type context$1_LinkDataOneOf as LinkDataOneOf, type context$1_LinkPreviewData as LinkPreviewData, type context$1_ListValue as ListValue, type context$1_MapData as MapData, type context$1_MapSettings as MapSettings, context$1_MapType as MapType, type context$1_MaskedContent as MaskedContent, type context$1_Media as Media, type context$1_MentionData as MentionData, type MessageEnvelope$1 as MessageEnvelope, type MetaSiteSpecialEvent$1 as MetaSiteSpecialEvent, type MetaSiteSpecialEventPayloadOneOf$1 as MetaSiteSpecialEventPayloadOneOf, type context$1_Metadata as Metadata, context$1_MissingValues as MissingValues, context$1_Mode as Mode, Namespace$1 as Namespace, type NamespaceChanged$1 as NamespaceChanged, type context$1_NestedAggregation as NestedAggregation, type context$1_NestedAggregationItem as NestedAggregationItem, type context$1_NestedAggregationItemKindOneOf as NestedAggregationItemKindOneOf, type context$1_NestedAggregationResults as NestedAggregationResults, type context$1_NestedAggregationResultsResultOneOf as NestedAggregationResultsResultOneOf, context$1_NestedAggregationType as NestedAggregationType, type context$1_NestedResultValue as NestedResultValue, type context$1_NestedResultValueResultOneOf as NestedResultValueResultOneOf, type context$1_NestedResults as NestedResults, type context$1_NestedValueAggregationResult as NestedValueAggregationResult, type context$1_Node as Node, type context$1_NodeDataOneOf as NodeDataOneOf, type context$1_NodeStyle as NodeStyle, context$1_NodeType as NodeType, context$1_NullValue as NullValue, type context$1_Oembed as Oembed, type context$1_Option as Option, type context$1_OptionDesign as OptionDesign, type context$1_OptionLayout as OptionLayout, type context$1_OrderedListData as OrderedListData, context$1_Orientation as Orientation, type context$1_PDFSettings as PDFSettings, type context$1_Paging as Paging, type context$1_PagingMetadataV2 as PagingMetadataV2, type context$1_ParagraphData as ParagraphData, type context$1_Permissions as Permissions, type context$1_PermissiveBulkUpdateContentRequest as PermissiveBulkUpdateContentRequest, type context$1_PermissiveBulkUpdateContentRequestMaskedContent as PermissiveBulkUpdateContentRequestMaskedContent, type context$1_PermissiveBulkUpdateContentResponse as PermissiveBulkUpdateContentResponse, type context$1_PermissiveBulkUpdateContentResponseBulkContentResult as PermissiveBulkUpdateContentResponseBulkContentResult, type context$1_PlaybackOptions as PlaybackOptions, type context$1_PluginContainerData as PluginContainerData, context$1_PluginContainerDataAlignment as PluginContainerDataAlignment, type context$1_PluginContainerDataWidth as PluginContainerDataWidth, type context$1_PluginContainerDataWidthDataOneOf as PluginContainerDataWidthDataOneOf, type context$1_Poll as Poll, type context$1_PollData as PollData, type context$1_PollDataLayout as PollDataLayout, type context$1_PollDesign as PollDesign, type context$1_PollLayout as PollLayout, context$1_PollLayoutDirection as PollLayoutDirection, context$1_PollLayoutType as PollLayoutType, context$1_PublishStatus as PublishStatus, type context$1_QueryContentsLegacyRequest as QueryContentsLegacyRequest, type context$1_QueryContentsLegacyResponse as QueryContentsLegacyResponse, type context$1_QueryContentsOptions as QueryContentsOptions, type context$1_QueryContentsRequest as QueryContentsRequest, type context$1_QueryContentsResponse as QueryContentsResponse, type context$1_QueryContentsResponseNonNullableFields as QueryContentsResponseNonNullableFields, type context$1_QueryV2 as QueryV2, type context$1_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type context$1_RangeAggregation as RangeAggregation, type context$1_RangeAggregationResult as RangeAggregationResult, type context$1_RangeBucket as RangeBucket, type context$1_RangeResult as RangeResult, type context$1_RangeResults as RangeResults, type context$1_Rel as Rel, type context$1_RemoveContentsByFilterRequest as RemoveContentsByFilterRequest, type context$1_RemoveContentsByFilterResponse as RemoveContentsByFilterResponse, type context$1_RepublishContentByFilterRequest as RepublishContentByFilterRequest, type context$1_RepublishContentByFilterResponse as RepublishContentByFilterResponse, type RestoreInfo$1 as RestoreInfo, type context$1_Results as Results, type context$1_RichContent as RichContent, type context$1_ScalarAggregation as ScalarAggregation, type context$1_ScalarResult as ScalarResult, context$1_ScalarType as ScalarType, type context$1_SearchContentsOptions as SearchContentsOptions, type context$1_SearchContentsRequest as SearchContentsRequest, type context$1_SearchContentsResponse as SearchContentsResponse, type context$1_SearchContentsResponseNonNullableFields as SearchContentsResponseNonNullableFields, type context$1_SearchDetails as SearchDetails, type ServiceProvisioned$1 as ServiceProvisioned, type ServiceRemoved$1 as ServiceRemoved, type context$1_Settings as Settings, type SiteCreated$1 as SiteCreated, SiteCreatedContext$1 as SiteCreatedContext, type SiteDeleted$1 as SiteDeleted, type SiteHardDeleted$1 as SiteHardDeleted, type SiteMarkedAsTemplate$1 as SiteMarkedAsTemplate, type SiteMarkedAsWixSite$1 as SiteMarkedAsWixSite, type SitePublished$1 as SitePublished, type SiteRenamed$1 as SiteRenamed, type SiteTransferred$1 as SiteTransferred, type SiteUndeleted$1 as SiteUndeleted, type SiteUnpublished$1 as SiteUnpublished, context$1_SortDirection as SortDirection, SortOrder$1 as SortOrder, context$1_SortType as SortType, type Sorting$1 as Sorting, context$1_Source as Source, type context$1_Spoiler as Spoiler, type context$1_SpoilerData as SpoilerData, State$1 as State, type StudioAssigned$1 as StudioAssigned, type StudioUnassigned$1 as StudioUnassigned, type context$1_Styles as Styles, type context$1_TableCellData as TableCellData, type context$1_TableData as TableData, context$1_Target as Target, context$1_TextAlignment as TextAlignment, type context$1_TextData as TextData, type context$1_TextNodeStyle as TextNodeStyle, type context$1_TextStyle as TextStyle, type context$1_Thumbnails as Thumbnails, context$1_ThumbnailsAlignment as ThumbnailsAlignment, context$1_Type as Type, type context$1_UpdateContent as UpdateContent, type context$1_UpdateContentByKeyRequest as UpdateContentByKeyRequest, type context$1_UpdateContentByKeyResponse as UpdateContentByKeyResponse, type context$1_UpdateContentByKeyResponseNonNullableFields as UpdateContentByKeyResponseNonNullableFields, type context$1_UpdateContentRequest as UpdateContentRequest, type context$1_UpdateContentResponse as UpdateContentResponse, type context$1_UpdateContentResponseNonNullableFields as UpdateContentResponseNonNullableFields, context$1_UpdaterIdentity as UpdaterIdentity, type context$1_ValueAggregation as ValueAggregation, type context$1_ValueAggregationOptionsOneOf as ValueAggregationOptionsOneOf, type context$1_ValueAggregationResult as ValueAggregationResult, type context$1_ValueResult as ValueResult, type context$1_ValueResults as ValueResults, context$1_VerticalAlignment as VerticalAlignment, type context$1_Video as Video, type context$1_VideoData as VideoData, type context$1_VideoResolution as VideoResolution, context$1_ViewMode as ViewMode, context$1_ViewRole as ViewRole, context$1_VoteRole as VoteRole, WebhookIdentityType$1 as WebhookIdentityType, context$1_Width as Width, context$1_WidthType as WidthType, type context$1__publicOnContentCreatedType as _publicOnContentCreatedType, type context$1__publicOnContentDeletedType as _publicOnContentDeletedType, type context$1__publicOnContentUpdatedType as _publicOnContentUpdatedType, context$1_bulkCreateContent as bulkCreateContent, context$1_bulkDeleteContent as bulkDeleteContent, context$1_bulkUpdateContent as bulkUpdateContent, context$1_bulkUpdateContentByKey as bulkUpdateContentByKey, context$1_createContent as createContent, context$1_deleteContent as deleteContent, context$1_getContent as getContent, context$1_onContentCreated as onContentCreated, context$1_onContentDeleted as onContentDeleted, context$1_onContentUpdated as onContentUpdated, onContentCreated$1 as publicOnContentCreated, onContentDeleted$1 as publicOnContentDeleted, onContentUpdated$1 as publicOnContentUpdated, context$1_queryContents as queryContents, context$1_searchContents as searchContents, context$1_updateContent as updateContent, context$1_updateContentByKey as updateContentByKey };
|
|
8092
10159
|
}
|
|
8093
10160
|
|
|
10161
|
+
type HostModule<T, H extends Host> = {
|
|
10162
|
+
__type: 'host';
|
|
10163
|
+
create(host: H): T;
|
|
10164
|
+
};
|
|
10165
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
10166
|
+
type Host<Environment = unknown> = {
|
|
10167
|
+
channel: {
|
|
10168
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
10169
|
+
disconnect: () => void;
|
|
10170
|
+
} | Promise<{
|
|
10171
|
+
disconnect: () => void;
|
|
10172
|
+
}>;
|
|
10173
|
+
};
|
|
10174
|
+
environment?: Environment;
|
|
10175
|
+
/**
|
|
10176
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
10177
|
+
*/
|
|
10178
|
+
apiBaseUrl?: string;
|
|
10179
|
+
/**
|
|
10180
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
10181
|
+
* like internationalization, billing, etc.
|
|
10182
|
+
*/
|
|
10183
|
+
essentials?: {
|
|
10184
|
+
/**
|
|
10185
|
+
* The language of the currently viewed session
|
|
10186
|
+
*/
|
|
10187
|
+
language?: string;
|
|
10188
|
+
/**
|
|
10189
|
+
* The locale of the currently viewed session
|
|
10190
|
+
*/
|
|
10191
|
+
locale?: string;
|
|
10192
|
+
/**
|
|
10193
|
+
* Any headers that should be passed through to the API requests
|
|
10194
|
+
*/
|
|
10195
|
+
passThroughHeaders?: Record<string, string>;
|
|
10196
|
+
};
|
|
10197
|
+
};
|
|
10198
|
+
|
|
10199
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
10200
|
+
interface HttpClient {
|
|
10201
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
10202
|
+
fetchWithAuth: typeof fetch;
|
|
10203
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
10204
|
+
getActiveToken?: () => string | undefined;
|
|
10205
|
+
}
|
|
10206
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
10207
|
+
type HttpResponse<T = any> = {
|
|
10208
|
+
data: T;
|
|
10209
|
+
status: number;
|
|
10210
|
+
statusText: string;
|
|
10211
|
+
headers: any;
|
|
10212
|
+
request?: any;
|
|
10213
|
+
};
|
|
10214
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
10215
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
10216
|
+
url: string;
|
|
10217
|
+
data?: Data;
|
|
10218
|
+
params?: URLSearchParams;
|
|
10219
|
+
} & APIMetadata;
|
|
10220
|
+
type APIMetadata = {
|
|
10221
|
+
methodFqn?: string;
|
|
10222
|
+
entityFqdn?: string;
|
|
10223
|
+
packageName?: string;
|
|
10224
|
+
};
|
|
10225
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
10226
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
10227
|
+
__type: 'event-definition';
|
|
10228
|
+
type: Type;
|
|
10229
|
+
isDomainEvent?: boolean;
|
|
10230
|
+
transformations?: (envelope: unknown) => Payload;
|
|
10231
|
+
__payload: Payload;
|
|
10232
|
+
};
|
|
10233
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
10234
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
10235
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
10236
|
+
|
|
10237
|
+
type ServicePluginMethodInput = {
|
|
10238
|
+
request: any;
|
|
10239
|
+
metadata: any;
|
|
10240
|
+
};
|
|
10241
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
10242
|
+
type ServicePluginMethodMetadata = {
|
|
10243
|
+
name: string;
|
|
10244
|
+
primaryHttpMappingPath: string;
|
|
10245
|
+
transformations: {
|
|
10246
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
10247
|
+
toREST: (...args: unknown[]) => unknown;
|
|
10248
|
+
};
|
|
10249
|
+
};
|
|
10250
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
10251
|
+
__type: 'service-plugin-definition';
|
|
10252
|
+
componentType: string;
|
|
10253
|
+
methods: ServicePluginMethodMetadata[];
|
|
10254
|
+
__contract: Contract;
|
|
10255
|
+
};
|
|
10256
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
10257
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
10258
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
10259
|
+
|
|
10260
|
+
type RequestContext = {
|
|
10261
|
+
isSSR: boolean;
|
|
10262
|
+
host: string;
|
|
10263
|
+
protocol?: string;
|
|
10264
|
+
};
|
|
10265
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
10266
|
+
/**
|
|
10267
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
10268
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
10269
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
10270
|
+
*/
|
|
10271
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
10272
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
10273
|
+
_?: T;
|
|
10274
|
+
url?: string;
|
|
10275
|
+
method?: Method;
|
|
10276
|
+
params?: any;
|
|
10277
|
+
data?: any;
|
|
10278
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
10279
|
+
};
|
|
10280
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
10281
|
+
__isAmbassador: boolean;
|
|
10282
|
+
};
|
|
10283
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
10284
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
10285
|
+
|
|
10286
|
+
declare global {
|
|
10287
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
10288
|
+
interface SymbolConstructor {
|
|
10289
|
+
readonly observable: symbol;
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
|
|
10293
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
10294
|
+
|
|
10295
|
+
/**
|
|
10296
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
10297
|
+
|
|
10298
|
+
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)).
|
|
10299
|
+
|
|
10300
|
+
@example
|
|
10301
|
+
```
|
|
10302
|
+
import type {EmptyObject} from 'type-fest';
|
|
10303
|
+
|
|
10304
|
+
// The following illustrates the problem with `{}`.
|
|
10305
|
+
const foo1: {} = {}; // Pass
|
|
10306
|
+
const foo2: {} = []; // Pass
|
|
10307
|
+
const foo3: {} = 42; // Pass
|
|
10308
|
+
const foo4: {} = {a: 1}; // Pass
|
|
10309
|
+
|
|
10310
|
+
// With `EmptyObject` only the first case is valid.
|
|
10311
|
+
const bar1: EmptyObject = {}; // Pass
|
|
10312
|
+
const bar2: EmptyObject = 42; // Fail
|
|
10313
|
+
const bar3: EmptyObject = []; // Fail
|
|
10314
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
10315
|
+
```
|
|
10316
|
+
|
|
10317
|
+
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}.
|
|
10318
|
+
|
|
10319
|
+
@category Object
|
|
10320
|
+
*/
|
|
10321
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
10322
|
+
|
|
10323
|
+
/**
|
|
10324
|
+
Returns a boolean for whether the two given types are equal.
|
|
10325
|
+
|
|
10326
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
10327
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
10328
|
+
|
|
10329
|
+
Use-cases:
|
|
10330
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
10331
|
+
|
|
10332
|
+
@example
|
|
10333
|
+
```
|
|
10334
|
+
import type {IsEqual} from 'type-fest';
|
|
10335
|
+
|
|
10336
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
10337
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
10338
|
+
type Includes<Value extends readonly any[], Item> =
|
|
10339
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
10340
|
+
? IsEqual<Value[0], Item> extends true
|
|
10341
|
+
? true
|
|
10342
|
+
: Includes<rest, Item>
|
|
10343
|
+
: false;
|
|
10344
|
+
```
|
|
10345
|
+
|
|
10346
|
+
@category Type Guard
|
|
10347
|
+
@category Utilities
|
|
10348
|
+
*/
|
|
10349
|
+
type IsEqual<A, B> =
|
|
10350
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
10351
|
+
(<G>() => G extends B ? 1 : 2)
|
|
10352
|
+
? true
|
|
10353
|
+
: false;
|
|
10354
|
+
|
|
10355
|
+
/**
|
|
10356
|
+
Filter out keys from an object.
|
|
10357
|
+
|
|
10358
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
10359
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
10360
|
+
Returns `Key` otherwise.
|
|
10361
|
+
|
|
10362
|
+
@example
|
|
10363
|
+
```
|
|
10364
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
10365
|
+
//=> never
|
|
10366
|
+
```
|
|
10367
|
+
|
|
10368
|
+
@example
|
|
10369
|
+
```
|
|
10370
|
+
type Filtered = Filter<'bar', string>;
|
|
10371
|
+
//=> never
|
|
10372
|
+
```
|
|
10373
|
+
|
|
10374
|
+
@example
|
|
10375
|
+
```
|
|
10376
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
10377
|
+
//=> 'bar'
|
|
10378
|
+
```
|
|
10379
|
+
|
|
10380
|
+
@see {Except}
|
|
10381
|
+
*/
|
|
10382
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
10383
|
+
|
|
10384
|
+
type ExceptOptions = {
|
|
10385
|
+
/**
|
|
10386
|
+
Disallow assigning non-specified properties.
|
|
10387
|
+
|
|
10388
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
10389
|
+
|
|
10390
|
+
@default false
|
|
10391
|
+
*/
|
|
10392
|
+
requireExactProps?: boolean;
|
|
10393
|
+
};
|
|
10394
|
+
|
|
10395
|
+
/**
|
|
10396
|
+
Create a type from an object type without certain keys.
|
|
10397
|
+
|
|
10398
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
10399
|
+
|
|
10400
|
+
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.
|
|
10401
|
+
|
|
10402
|
+
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)).
|
|
10403
|
+
|
|
10404
|
+
@example
|
|
10405
|
+
```
|
|
10406
|
+
import type {Except} from 'type-fest';
|
|
10407
|
+
|
|
10408
|
+
type Foo = {
|
|
10409
|
+
a: number;
|
|
10410
|
+
b: string;
|
|
10411
|
+
};
|
|
10412
|
+
|
|
10413
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
10414
|
+
//=> {b: string}
|
|
10415
|
+
|
|
10416
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
10417
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
10418
|
+
|
|
10419
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
10420
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
10421
|
+
|
|
10422
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
10423
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
10424
|
+
```
|
|
10425
|
+
|
|
10426
|
+
@category Object
|
|
10427
|
+
*/
|
|
10428
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
10429
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
10430
|
+
} & (Options['requireExactProps'] extends true
|
|
10431
|
+
? Partial<Record<KeysType, never>>
|
|
10432
|
+
: {});
|
|
10433
|
+
|
|
10434
|
+
/**
|
|
10435
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
10436
|
+
|
|
10437
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
10438
|
+
|
|
10439
|
+
@example
|
|
10440
|
+
```
|
|
10441
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
10442
|
+
|
|
10443
|
+
interface Example {
|
|
10444
|
+
a: string;
|
|
10445
|
+
b: string | number;
|
|
10446
|
+
c?: string;
|
|
10447
|
+
d: {};
|
|
10448
|
+
}
|
|
10449
|
+
|
|
10450
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
10451
|
+
//=> 'a'
|
|
10452
|
+
```
|
|
10453
|
+
|
|
10454
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
10455
|
+
|
|
10456
|
+
@example
|
|
10457
|
+
```
|
|
10458
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
10459
|
+
|
|
10460
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
10461
|
+
//=> 'a' | 'c'
|
|
10462
|
+
```
|
|
10463
|
+
|
|
10464
|
+
@category Object
|
|
10465
|
+
*/
|
|
10466
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
10467
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
10468
|
+
{
|
|
10469
|
+
// Map through all the keys of the given base type.
|
|
10470
|
+
[Key in keyof Base]:
|
|
10471
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
10472
|
+
Base[Key] extends Condition
|
|
10473
|
+
// Retain this key since the condition passes.
|
|
10474
|
+
? Key
|
|
10475
|
+
// Discard this key since the condition fails.
|
|
10476
|
+
: never;
|
|
10477
|
+
|
|
10478
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
10479
|
+
}[keyof Base]
|
|
10480
|
+
>;
|
|
10481
|
+
|
|
10482
|
+
/**
|
|
10483
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
10484
|
+
|
|
10485
|
+
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.
|
|
10486
|
+
|
|
10487
|
+
@example
|
|
10488
|
+
```
|
|
10489
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
10490
|
+
|
|
10491
|
+
class Awesome {
|
|
10492
|
+
name: string;
|
|
10493
|
+
successes: number;
|
|
10494
|
+
failures: bigint;
|
|
10495
|
+
|
|
10496
|
+
run() {}
|
|
10497
|
+
}
|
|
10498
|
+
|
|
10499
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
10500
|
+
//=> {run: () => void}
|
|
10501
|
+
```
|
|
10502
|
+
|
|
10503
|
+
@example
|
|
10504
|
+
```
|
|
10505
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
10506
|
+
|
|
10507
|
+
interface Example {
|
|
10508
|
+
a: string;
|
|
10509
|
+
b: string | number;
|
|
10510
|
+
c: () => void;
|
|
10511
|
+
d: {};
|
|
10512
|
+
}
|
|
10513
|
+
|
|
10514
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
10515
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
10516
|
+
```
|
|
10517
|
+
|
|
10518
|
+
@category Object
|
|
10519
|
+
*/
|
|
10520
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
10521
|
+
Base,
|
|
10522
|
+
ConditionalKeys<Base, Condition>
|
|
10523
|
+
>;
|
|
10524
|
+
|
|
10525
|
+
/**
|
|
10526
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
10527
|
+
* can either be a REST module or a host module.
|
|
10528
|
+
* This type is recursive, so it can describe nested modules.
|
|
10529
|
+
*/
|
|
10530
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
10531
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
10532
|
+
};
|
|
10533
|
+
/**
|
|
10534
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
10535
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
10536
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
10537
|
+
* do not match the given host (as they will not work with the given host).
|
|
10538
|
+
*/
|
|
10539
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
10540
|
+
done: T;
|
|
10541
|
+
recurse: T extends {
|
|
10542
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
10543
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
10544
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
10545
|
+
-1,
|
|
10546
|
+
0,
|
|
10547
|
+
1,
|
|
10548
|
+
2,
|
|
10549
|
+
3,
|
|
10550
|
+
4,
|
|
10551
|
+
5
|
|
10552
|
+
][Depth]> : never;
|
|
10553
|
+
}, EmptyObject>;
|
|
10554
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
10555
|
+
type PublicMetadata = {
|
|
10556
|
+
PACKAGE_NAME?: string;
|
|
10557
|
+
};
|
|
10558
|
+
|
|
10559
|
+
declare global {
|
|
10560
|
+
interface ContextualClient {
|
|
10561
|
+
}
|
|
10562
|
+
}
|
|
10563
|
+
/**
|
|
10564
|
+
* A type used to create concerete types from SDK descriptors in
|
|
10565
|
+
* case a contextual client is available.
|
|
10566
|
+
*/
|
|
10567
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
10568
|
+
host: Host;
|
|
10569
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
10570
|
+
|
|
8094
10571
|
interface Schema {
|
|
8095
10572
|
/**
|
|
8096
10573
|
* Translation schema ID.
|
|
@@ -8103,13 +10580,20 @@ interface Schema {
|
|
|
8103
10580
|
fields?: Record<string, SchemaField>;
|
|
8104
10581
|
/** Fields displayed in content previews. For example, a product name for a product translation schema. */
|
|
8105
10582
|
previewFields?: PreviewFields;
|
|
8106
|
-
/**
|
|
10583
|
+
/**
|
|
10584
|
+
* Whether the translation schema is hidden from the site.
|
|
10585
|
+
*
|
|
10586
|
+
* Default: `false`
|
|
10587
|
+
*/
|
|
8107
10588
|
hidden?: boolean | null;
|
|
8108
|
-
/** Translation schema name. */
|
|
10589
|
+
/** Translation schema name displayed in the https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager. */
|
|
8109
10590
|
displayName?: string | null;
|
|
8110
|
-
/** A reference to the parent schema
|
|
10591
|
+
/** A reference to the parent schema. For example, if the schema is for a menu item, this property would contain the schema ID of the menu it belongs to. */
|
|
8111
10592
|
parentId?: string | null;
|
|
8112
|
-
/**
|
|
10593
|
+
/**
|
|
10594
|
+
* Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing `revision` must be used when updating a schema.
|
|
10595
|
+
* @readonly
|
|
10596
|
+
*/
|
|
8113
10597
|
revision?: string | null;
|
|
8114
10598
|
/**
|
|
8115
10599
|
* Date and time the translation schema was created.
|
|
@@ -8121,12 +10605,16 @@ interface Schema {
|
|
|
8121
10605
|
* @readonly
|
|
8122
10606
|
*/
|
|
8123
10607
|
_updatedDate?: Date;
|
|
8124
|
-
/**
|
|
10608
|
+
/**
|
|
10609
|
+
* Whether to duplicate the translated content when a site containing the translation schema and content is duplicated.
|
|
10610
|
+
*
|
|
10611
|
+
* Default: `false`
|
|
10612
|
+
*/
|
|
8125
10613
|
duplicateContent?: boolean | null;
|
|
8126
10614
|
}
|
|
8127
10615
|
interface SchemaKey {
|
|
8128
10616
|
/**
|
|
8129
|
-
* ID of app that created the schema.
|
|
10617
|
+
* ID of the app that created the schema.
|
|
8130
10618
|
* @readonly
|
|
8131
10619
|
*/
|
|
8132
10620
|
appId?: string;
|
|
@@ -8149,24 +10637,24 @@ declare enum SchemaScope {
|
|
|
8149
10637
|
}
|
|
8150
10638
|
interface SchemaField {
|
|
8151
10639
|
/**
|
|
8152
|
-
* Field ID. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field IDs may contain
|
|
10640
|
+
* Field ID. Validated according to Regex `^[A-Za-z0-9-_)(]+$`. Field IDs may contain parentheses to reference repeated items, such as images. These parentheses can't be nested and each opening parenthesis must be followed by a closing one. For example, `title()()` is valid, while `title)(` and `title(())` aren't valid. The value inside the parenthesis is validated according to Regex `^[^)(\\]\\[\\.]+$`.
|
|
8153
10641
|
* @readonly
|
|
8154
10642
|
*/
|
|
8155
10643
|
_id?: string;
|
|
8156
10644
|
/**
|
|
8157
|
-
* Field type.
|
|
10645
|
+
* *Required.** Field type.
|
|
8158
10646
|
* Supported values:
|
|
8159
|
-
* + `SHORT_TEXT`: Short plain text.
|
|
8160
|
-
* + `LONG_TEXT`: Long plain text.
|
|
10647
|
+
* + `SHORT_TEXT`: Short plain text displayed as a single line in the UI.
|
|
10648
|
+
* + `LONG_TEXT`: Long plain text displayed as multiple lines in the UI.
|
|
8161
10649
|
* + `HTML`: Long text including styles, images, and links.
|
|
8162
|
-
* + `RICH_CONTENT`: Rich-Content using the [Wix Ricos
|
|
10650
|
+
* + `RICH_CONTENT`: Rich-Content using the [Wix Ricos](https://dev.wix.com/docs/go-headless/tutorials-templates/other-tutorials/working-with-rich-content) format.
|
|
8163
10651
|
* + `IMAGE`: Wix Media Manager image.
|
|
8164
10652
|
* + `IMAGE_LINK`: Image URL without metadata.
|
|
8165
10653
|
* + `VIDEO`: Wix Media Manager video.
|
|
8166
10654
|
* + `DOCUMENT`: Wix Media Manager document.
|
|
8167
10655
|
*/
|
|
8168
10656
|
type?: FieldType;
|
|
8169
|
-
/** Field name. */
|
|
10657
|
+
/** Field name displayed in the https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager. */
|
|
8170
10658
|
displayName?: string | null;
|
|
8171
10659
|
/** Field group name. */
|
|
8172
10660
|
groupName?: string | null;
|
|
@@ -8174,11 +10662,11 @@ interface SchemaField {
|
|
|
8174
10662
|
minLength?: number | null;
|
|
8175
10663
|
/** Field maximum text length. */
|
|
8176
10664
|
maxLength?: number | null;
|
|
8177
|
-
/** Field format.
|
|
10665
|
+
/** Field format. Content is validated based on the format set here in the field schema. For example, if the format is `EMAIL`, then the content for this field must be a valid email address. */
|
|
8178
10666
|
format?: string | null;
|
|
8179
10667
|
/** Whether the field is hidden from the site. Hidden fields are still validated. */
|
|
8180
10668
|
hidden?: boolean;
|
|
8181
|
-
/** Whether the field is read-only, and
|
|
10669
|
+
/** Whether the field is read-only, and not intended to be translated. For example, an image. Use this field when you want an image to remain in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) for context, but without being translated. */
|
|
8182
10670
|
displayOnly?: boolean;
|
|
8183
10671
|
/** Field index. Use for cases where the order of the fields are relevant. */
|
|
8184
10672
|
index?: number | null;
|
|
@@ -8206,9 +10694,9 @@ declare enum FieldType {
|
|
|
8206
10694
|
DOCUMENT = "DOCUMENT"
|
|
8207
10695
|
}
|
|
8208
10696
|
interface PreviewFields {
|
|
8209
|
-
/** ID of field representing the schema's title. */
|
|
10697
|
+
/** ID of the field representing the schema's title. */
|
|
8210
10698
|
titleFieldId?: string | null;
|
|
8211
|
-
/** ID of field representing the schema's image. */
|
|
10699
|
+
/** ID of the field representing the schema's image. */
|
|
8212
10700
|
imageFieldId?: string | null;
|
|
8213
10701
|
}
|
|
8214
10702
|
interface CreateSchemaRequest {
|
|
@@ -8822,7 +11310,7 @@ interface GetSchemaByKey {
|
|
|
8822
11310
|
}
|
|
8823
11311
|
interface GetSchemaByKeyIdentifiers {
|
|
8824
11312
|
/**
|
|
8825
|
-
* ID of app that created the schema.
|
|
11313
|
+
* ID of the app that created the schema.
|
|
8826
11314
|
* @readonly
|
|
8827
11315
|
*/
|
|
8828
11316
|
keyAppId?: string;
|
|
@@ -8914,7 +11402,7 @@ interface ListSiteSchemasOptions {
|
|
|
8914
11402
|
declare function getSchema$1(httpClient: HttpClient): GetSchemaSignature;
|
|
8915
11403
|
interface GetSchemaSignature {
|
|
8916
11404
|
/**
|
|
8917
|
-
* Retrieves a translation schema.
|
|
11405
|
+
* Retrieves a translation schema by ID.
|
|
8918
11406
|
* @param - ID of the translation schema to retrieve.
|
|
8919
11407
|
* @returns The requested translation schema.
|
|
8920
11408
|
*/
|
|
@@ -8934,7 +11422,7 @@ interface QuerySchemasSignature {
|
|
|
8934
11422
|
*
|
|
8935
11423
|
* > **Note:**
|
|
8936
11424
|
* >
|
|
8937
|
-
* > This method can retrieve all schemas with a `GLOBAL` scope and `SITE` scope
|
|
11425
|
+
* > This method can retrieve all schemas with a `GLOBAL` scope and schemas with a `SITE` scope for the site the API request is authorized to access.
|
|
8938
11426
|
*
|
|
8939
11427
|
* The default `sort` is `id` in `ASC`.
|
|
8940
11428
|
*
|
|
@@ -8946,20 +11434,38 @@ interface QuerySchemasSignature {
|
|
|
8946
11434
|
declare function listSiteSchemas$1(httpClient: HttpClient): ListSiteSchemasSignature;
|
|
8947
11435
|
interface ListSiteSchemasSignature {
|
|
8948
11436
|
/**
|
|
8949
|
-
* Retrieves a list of all translation schemas associated with a site,
|
|
11437
|
+
* Retrieves a list of all translation schemas associated with a site, regardless of which app created them.
|
|
8950
11438
|
*/
|
|
8951
11439
|
(options?: ListSiteSchemasOptions | undefined): Promise<ListSiteSchemasResponse & ListSiteSchemasResponseNonNullableFields>;
|
|
8952
11440
|
}
|
|
8953
|
-
declare const onSchemaCreated$1: EventDefinition<SchemaCreatedEnvelope, "wix.multilingual.translation.v1.schema_created">;
|
|
8954
|
-
declare const onSchemaUpdated$1: EventDefinition<SchemaUpdatedEnvelope, "wix.multilingual.translation.v1.schema_updated">;
|
|
8955
|
-
declare const onSchemaDeleted$1: EventDefinition<SchemaDeletedEnvelope, "wix.multilingual.translation.v1.schema_deleted">;
|
|
11441
|
+
declare const onSchemaCreated$1: EventDefinition$1<SchemaCreatedEnvelope, "wix.multilingual.translation.v1.schema_created">;
|
|
11442
|
+
declare const onSchemaUpdated$1: EventDefinition$1<SchemaUpdatedEnvelope, "wix.multilingual.translation.v1.schema_updated">;
|
|
11443
|
+
declare const onSchemaDeleted$1: EventDefinition$1<SchemaDeletedEnvelope, "wix.multilingual.translation.v1.schema_deleted">;
|
|
11444
|
+
|
|
11445
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
11446
|
+
__type: 'event-definition';
|
|
11447
|
+
type: Type;
|
|
11448
|
+
isDomainEvent?: boolean;
|
|
11449
|
+
transformations?: (envelope: unknown) => Payload;
|
|
11450
|
+
__payload: Payload;
|
|
11451
|
+
};
|
|
11452
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
11453
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
11454
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
11455
|
+
|
|
11456
|
+
declare global {
|
|
11457
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
11458
|
+
interface SymbolConstructor {
|
|
11459
|
+
readonly observable: symbol;
|
|
11460
|
+
}
|
|
11461
|
+
}
|
|
8956
11462
|
|
|
8957
11463
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
8958
11464
|
|
|
8959
|
-
declare const getSchema: BuildRESTFunction<typeof getSchema$1> & typeof getSchema$1
|
|
8960
|
-
declare const getSchemaByKey: BuildRESTFunction<typeof getSchemaByKey$1> & typeof getSchemaByKey$1
|
|
8961
|
-
declare const querySchemas: BuildRESTFunction<typeof querySchemas$1> & typeof querySchemas$1
|
|
8962
|
-
declare const listSiteSchemas: BuildRESTFunction<typeof listSiteSchemas$1> & typeof listSiteSchemas$1
|
|
11465
|
+
declare const getSchema: MaybeContext<BuildRESTFunction<typeof getSchema$1> & typeof getSchema$1>;
|
|
11466
|
+
declare const getSchemaByKey: MaybeContext<BuildRESTFunction<typeof getSchemaByKey$1> & typeof getSchemaByKey$1>;
|
|
11467
|
+
declare const querySchemas: MaybeContext<BuildRESTFunction<typeof querySchemas$1> & typeof querySchemas$1>;
|
|
11468
|
+
declare const listSiteSchemas: MaybeContext<BuildRESTFunction<typeof listSiteSchemas$1> & typeof listSiteSchemas$1>;
|
|
8963
11469
|
|
|
8964
11470
|
type _publicOnSchemaCreatedType = typeof onSchemaCreated$1;
|
|
8965
11471
|
/**
|