@wix/blog 1.0.289 → 1.0.290
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/context.js +1 -0
- package/build/cjs/context.js.map +1 -0
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/meta.js +1 -0
- package/build/cjs/meta.js.map +1 -0
- package/package.json +8 -8
- package/type-bundles/context.bundle.d.ts +2637 -149
- package/type-bundles/index.bundle.d.ts +2637 -149
|
@@ -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$9<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$9<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$9<Payload, Type>;
|
|
74
|
+
type EventHandler$9<T extends EventDefinition$9> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$9<T extends EventDefinition$9<any, string>> = (handler: EventHandler$9<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$9<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$9<any> ? BuildEventDefinition$9<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
|
/** BlogCache is the main entity of BlogCacheService */
|
|
46
412
|
interface BlogCache {
|
|
47
413
|
/**
|
|
@@ -748,7 +1114,7 @@ interface GetBlogCacheResponseNonNullableFields {
|
|
|
748
1114
|
blogCache?: BlogCacheNonNullableFields;
|
|
749
1115
|
}
|
|
750
1116
|
|
|
751
|
-
declare function getBlogCache$1(httpClient: HttpClient): GetBlogCacheSignature;
|
|
1117
|
+
declare function getBlogCache$1(httpClient: HttpClient$5): GetBlogCacheSignature;
|
|
752
1118
|
interface GetBlogCacheSignature {
|
|
753
1119
|
/**
|
|
754
1120
|
* Gets blog cache.
|
|
@@ -756,7 +1122,7 @@ interface GetBlogCacheSignature {
|
|
|
756
1122
|
(): Promise<GetBlogCacheResponse & GetBlogCacheResponseNonNullableFields>;
|
|
757
1123
|
}
|
|
758
1124
|
|
|
759
|
-
declare const getBlogCache: BuildRESTFunction<typeof getBlogCache$1> & typeof getBlogCache$1
|
|
1125
|
+
declare const getBlogCache: MaybeContext$5<BuildRESTFunction$5<typeof getBlogCache$1> & typeof getBlogCache$1>;
|
|
760
1126
|
|
|
761
1127
|
type index_d$5_Address = Address;
|
|
762
1128
|
type index_d$5_AddressHint = AddressHint;
|
|
@@ -803,6 +1169,416 @@ declare namespace index_d$5 {
|
|
|
803
1169
|
export { type ActionEvent$4 as ActionEvent, type index_d$5_Address as Address, type index_d$5_AddressHint as AddressHint, type index_d$5_BlogCache as BlogCache, type index_d$5_BusinessSchedule as BusinessSchedule, type index_d$5_Categories as Categories, type index_d$5_ChangeContext as ChangeContext, type index_d$5_ChangeContextPayloadOneOf as ChangeContextPayloadOneOf, type index_d$5_ConsentPolicy as ConsentPolicy, index_d$5_DayOfWeek as DayOfWeek, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type index_d$5_Empty as Empty, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, index_d$5_Flag as Flag, type index_d$5_GeoCoordinates as GeoCoordinates, type index_d$5_GetBlogCacheRequest as GetBlogCacheRequest, type index_d$5_GetBlogCacheResponse as GetBlogCacheResponse, type index_d$5_GetBlogCacheResponseNonNullableFields as GetBlogCacheResponseNonNullableFields, type index_d$5_Locale as Locale, index_d$5_LocaleStatus as LocaleStatus, type index_d$5_Multilingual as Multilingual, type index_d$5_PageInfo as PageInfo, type index_d$5_PagesData as PagesData, index_d$5_PlacementType as PlacementType, type index_d$5_Properties as Properties, type index_d$5_PropertiesChange as PropertiesChange, index_d$5_ResolutionMethod as ResolutionMethod, type RestoreInfo$4 as RestoreInfo, type index_d$5_SiteCloned as SiteCloned, type index_d$5_SiteCreated as SiteCreated, type index_d$5_SiteProperties as SiteProperties, type index_d$5_SitePropertiesEvent as SitePropertiesEvent, type index_d$5_SitePropertiesNotification as SitePropertiesNotification, type index_d$5_SiteSupportedLanguage as SiteSupportedLanguage, type index_d$5_SpecialHourPeriod as SpecialHourPeriod, type index_d$5_SupportedLanguage as SupportedLanguage, type index_d$5_TimePeriod as TimePeriod, type index_d$5_Translation as Translation, type index_d$5_UrlInvalidationNotification as UrlInvalidationNotification, index_d$5_getBlogCache as getBlogCache };
|
|
804
1170
|
}
|
|
805
1171
|
|
|
1172
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
1173
|
+
__type: 'host';
|
|
1174
|
+
create(host: H): T;
|
|
1175
|
+
};
|
|
1176
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
1177
|
+
type Host$4<Environment = unknown> = {
|
|
1178
|
+
channel: {
|
|
1179
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1180
|
+
disconnect: () => void;
|
|
1181
|
+
} | Promise<{
|
|
1182
|
+
disconnect: () => void;
|
|
1183
|
+
}>;
|
|
1184
|
+
};
|
|
1185
|
+
environment?: Environment;
|
|
1186
|
+
/**
|
|
1187
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1188
|
+
*/
|
|
1189
|
+
apiBaseUrl?: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1192
|
+
* like internationalization, billing, etc.
|
|
1193
|
+
*/
|
|
1194
|
+
essentials?: {
|
|
1195
|
+
/**
|
|
1196
|
+
* The language of the currently viewed session
|
|
1197
|
+
*/
|
|
1198
|
+
language?: string;
|
|
1199
|
+
/**
|
|
1200
|
+
* The locale of the currently viewed session
|
|
1201
|
+
*/
|
|
1202
|
+
locale?: string;
|
|
1203
|
+
/**
|
|
1204
|
+
* Any headers that should be passed through to the API requests
|
|
1205
|
+
*/
|
|
1206
|
+
passThroughHeaders?: Record<string, string>;
|
|
1207
|
+
};
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
1211
|
+
interface HttpClient$4 {
|
|
1212
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
1213
|
+
fetchWithAuth: typeof fetch;
|
|
1214
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1215
|
+
getActiveToken?: () => string | undefined;
|
|
1216
|
+
}
|
|
1217
|
+
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
1218
|
+
type HttpResponse$4<T = any> = {
|
|
1219
|
+
data: T;
|
|
1220
|
+
status: number;
|
|
1221
|
+
statusText: string;
|
|
1222
|
+
headers: any;
|
|
1223
|
+
request?: any;
|
|
1224
|
+
};
|
|
1225
|
+
type RequestOptions$4<_TResponse = any, Data = any> = {
|
|
1226
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1227
|
+
url: string;
|
|
1228
|
+
data?: Data;
|
|
1229
|
+
params?: URLSearchParams;
|
|
1230
|
+
} & APIMetadata$4;
|
|
1231
|
+
type APIMetadata$4 = {
|
|
1232
|
+
methodFqn?: string;
|
|
1233
|
+
entityFqdn?: string;
|
|
1234
|
+
packageName?: string;
|
|
1235
|
+
};
|
|
1236
|
+
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
1237
|
+
type EventDefinition$8<Payload = unknown, Type extends string = string> = {
|
|
1238
|
+
__type: 'event-definition';
|
|
1239
|
+
type: Type;
|
|
1240
|
+
isDomainEvent?: boolean;
|
|
1241
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1242
|
+
__payload: Payload;
|
|
1243
|
+
};
|
|
1244
|
+
declare function EventDefinition$8<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$8<Payload, Type>;
|
|
1245
|
+
type EventHandler$8<T extends EventDefinition$8> = (payload: T['__payload']) => void | Promise<void>;
|
|
1246
|
+
type BuildEventDefinition$8<T extends EventDefinition$8<any, string>> = (handler: EventHandler$8<T>) => void;
|
|
1247
|
+
|
|
1248
|
+
type ServicePluginMethodInput$4 = {
|
|
1249
|
+
request: any;
|
|
1250
|
+
metadata: any;
|
|
1251
|
+
};
|
|
1252
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
1253
|
+
type ServicePluginMethodMetadata$4 = {
|
|
1254
|
+
name: string;
|
|
1255
|
+
primaryHttpMappingPath: string;
|
|
1256
|
+
transformations: {
|
|
1257
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
1258
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
1262
|
+
__type: 'service-plugin-definition';
|
|
1263
|
+
componentType: string;
|
|
1264
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
1265
|
+
__contract: Contract;
|
|
1266
|
+
};
|
|
1267
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
1268
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
1269
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
1270
|
+
|
|
1271
|
+
type RequestContext$4 = {
|
|
1272
|
+
isSSR: boolean;
|
|
1273
|
+
host: string;
|
|
1274
|
+
protocol?: string;
|
|
1275
|
+
};
|
|
1276
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
1277
|
+
/**
|
|
1278
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1279
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1280
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1281
|
+
*/
|
|
1282
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1283
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
1284
|
+
_?: T;
|
|
1285
|
+
url?: string;
|
|
1286
|
+
method?: Method$4;
|
|
1287
|
+
params?: any;
|
|
1288
|
+
data?: any;
|
|
1289
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
1290
|
+
};
|
|
1291
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
1292
|
+
__isAmbassador: boolean;
|
|
1293
|
+
};
|
|
1294
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
1295
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1296
|
+
|
|
1297
|
+
declare global {
|
|
1298
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1299
|
+
interface SymbolConstructor {
|
|
1300
|
+
readonly observable: symbol;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1308
|
+
|
|
1309
|
+
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)).
|
|
1310
|
+
|
|
1311
|
+
@example
|
|
1312
|
+
```
|
|
1313
|
+
import type {EmptyObject} from 'type-fest';
|
|
1314
|
+
|
|
1315
|
+
// The following illustrates the problem with `{}`.
|
|
1316
|
+
const foo1: {} = {}; // Pass
|
|
1317
|
+
const foo2: {} = []; // Pass
|
|
1318
|
+
const foo3: {} = 42; // Pass
|
|
1319
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1320
|
+
|
|
1321
|
+
// With `EmptyObject` only the first case is valid.
|
|
1322
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1323
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1324
|
+
const bar3: EmptyObject = []; // Fail
|
|
1325
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
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}.
|
|
1329
|
+
|
|
1330
|
+
@category Object
|
|
1331
|
+
*/
|
|
1332
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
Returns a boolean for whether the two given types are equal.
|
|
1336
|
+
|
|
1337
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1338
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1339
|
+
|
|
1340
|
+
Use-cases:
|
|
1341
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1342
|
+
|
|
1343
|
+
@example
|
|
1344
|
+
```
|
|
1345
|
+
import type {IsEqual} from 'type-fest';
|
|
1346
|
+
|
|
1347
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1348
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1349
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1350
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1351
|
+
? IsEqual<Value[0], Item> extends true
|
|
1352
|
+
? true
|
|
1353
|
+
: Includes<rest, Item>
|
|
1354
|
+
: false;
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
@category Type Guard
|
|
1358
|
+
@category Utilities
|
|
1359
|
+
*/
|
|
1360
|
+
type IsEqual$4<A, B> =
|
|
1361
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1362
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1363
|
+
? true
|
|
1364
|
+
: false;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
Filter out keys from an object.
|
|
1368
|
+
|
|
1369
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1370
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1371
|
+
Returns `Key` otherwise.
|
|
1372
|
+
|
|
1373
|
+
@example
|
|
1374
|
+
```
|
|
1375
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1376
|
+
//=> never
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
@example
|
|
1380
|
+
```
|
|
1381
|
+
type Filtered = Filter<'bar', string>;
|
|
1382
|
+
//=> never
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
@example
|
|
1386
|
+
```
|
|
1387
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1388
|
+
//=> 'bar'
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
@see {Except}
|
|
1392
|
+
*/
|
|
1393
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1394
|
+
|
|
1395
|
+
type ExceptOptions$4 = {
|
|
1396
|
+
/**
|
|
1397
|
+
Disallow assigning non-specified properties.
|
|
1398
|
+
|
|
1399
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1400
|
+
|
|
1401
|
+
@default false
|
|
1402
|
+
*/
|
|
1403
|
+
requireExactProps?: boolean;
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
Create a type from an object type without certain keys.
|
|
1408
|
+
|
|
1409
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1410
|
+
|
|
1411
|
+
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.
|
|
1412
|
+
|
|
1413
|
+
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)).
|
|
1414
|
+
|
|
1415
|
+
@example
|
|
1416
|
+
```
|
|
1417
|
+
import type {Except} from 'type-fest';
|
|
1418
|
+
|
|
1419
|
+
type Foo = {
|
|
1420
|
+
a: number;
|
|
1421
|
+
b: string;
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1425
|
+
//=> {b: string}
|
|
1426
|
+
|
|
1427
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1428
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1429
|
+
|
|
1430
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1431
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1432
|
+
|
|
1433
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1434
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1435
|
+
```
|
|
1436
|
+
|
|
1437
|
+
@category Object
|
|
1438
|
+
*/
|
|
1439
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
1440
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1441
|
+
} & (Options['requireExactProps'] extends true
|
|
1442
|
+
? Partial<Record<KeysType, never>>
|
|
1443
|
+
: {});
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1447
|
+
|
|
1448
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1449
|
+
|
|
1450
|
+
@example
|
|
1451
|
+
```
|
|
1452
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1453
|
+
|
|
1454
|
+
interface Example {
|
|
1455
|
+
a: string;
|
|
1456
|
+
b: string | number;
|
|
1457
|
+
c?: string;
|
|
1458
|
+
d: {};
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1462
|
+
//=> 'a'
|
|
1463
|
+
```
|
|
1464
|
+
|
|
1465
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1466
|
+
|
|
1467
|
+
@example
|
|
1468
|
+
```
|
|
1469
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1470
|
+
|
|
1471
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1472
|
+
//=> 'a' | 'c'
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
@category Object
|
|
1476
|
+
*/
|
|
1477
|
+
type ConditionalKeys$4<Base, Condition> = NonNullable<
|
|
1478
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1479
|
+
{
|
|
1480
|
+
// Map through all the keys of the given base type.
|
|
1481
|
+
[Key in keyof Base]:
|
|
1482
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1483
|
+
Base[Key] extends Condition
|
|
1484
|
+
// Retain this key since the condition passes.
|
|
1485
|
+
? Key
|
|
1486
|
+
// Discard this key since the condition fails.
|
|
1487
|
+
: never;
|
|
1488
|
+
|
|
1489
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1490
|
+
}[keyof Base]
|
|
1491
|
+
>;
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1495
|
+
|
|
1496
|
+
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.
|
|
1497
|
+
|
|
1498
|
+
@example
|
|
1499
|
+
```
|
|
1500
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1501
|
+
|
|
1502
|
+
class Awesome {
|
|
1503
|
+
name: string;
|
|
1504
|
+
successes: number;
|
|
1505
|
+
failures: bigint;
|
|
1506
|
+
|
|
1507
|
+
run() {}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1511
|
+
//=> {run: () => void}
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
@example
|
|
1515
|
+
```
|
|
1516
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1517
|
+
|
|
1518
|
+
interface Example {
|
|
1519
|
+
a: string;
|
|
1520
|
+
b: string | number;
|
|
1521
|
+
c: () => void;
|
|
1522
|
+
d: {};
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1526
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1527
|
+
```
|
|
1528
|
+
|
|
1529
|
+
@category Object
|
|
1530
|
+
*/
|
|
1531
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
1532
|
+
Base,
|
|
1533
|
+
ConditionalKeys$4<Base, Condition>
|
|
1534
|
+
>;
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1538
|
+
* can either be a REST module or a host module.
|
|
1539
|
+
* This type is recursive, so it can describe nested modules.
|
|
1540
|
+
*/
|
|
1541
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$8<any> | ServicePluginDefinition$4<any> | {
|
|
1542
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
1543
|
+
};
|
|
1544
|
+
/**
|
|
1545
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1546
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1547
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1548
|
+
* do not match the given host (as they will not work with the given host).
|
|
1549
|
+
*/
|
|
1550
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
1551
|
+
done: T;
|
|
1552
|
+
recurse: T extends {
|
|
1553
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
1554
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$8<any> ? BuildEventDefinition$8<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
1555
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
1556
|
+
-1,
|
|
1557
|
+
0,
|
|
1558
|
+
1,
|
|
1559
|
+
2,
|
|
1560
|
+
3,
|
|
1561
|
+
4,
|
|
1562
|
+
5
|
|
1563
|
+
][Depth]> : never;
|
|
1564
|
+
}, EmptyObject$4>;
|
|
1565
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1566
|
+
type PublicMetadata$4 = {
|
|
1567
|
+
PACKAGE_NAME?: string;
|
|
1568
|
+
};
|
|
1569
|
+
|
|
1570
|
+
declare global {
|
|
1571
|
+
interface ContextualClient {
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1576
|
+
* case a contextual client is available.
|
|
1577
|
+
*/
|
|
1578
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
1579
|
+
host: Host$4;
|
|
1580
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
1581
|
+
|
|
806
1582
|
interface ImportStatus {
|
|
807
1583
|
/** Import Id. */
|
|
808
1584
|
_id?: string;
|
|
@@ -874,62 +1650,472 @@ interface GetNotImportedPostsResponseNonNullableFields {
|
|
|
874
1650
|
notImportedPosts: PostNonNullableFields$1[];
|
|
875
1651
|
}
|
|
876
1652
|
|
|
877
|
-
declare function startImport$1(httpClient: HttpClient): StartImportSignature;
|
|
878
|
-
interface StartImportSignature {
|
|
879
|
-
/**
|
|
880
|
-
* Starts wordpress import process.
|
|
881
|
-
*/
|
|
882
|
-
(): Promise<void>;
|
|
883
|
-
}
|
|
884
|
-
declare function submitUrlForImport$1(httpClient: HttpClient): SubmitUrlForImportSignature;
|
|
885
|
-
interface SubmitUrlForImportSignature {
|
|
886
|
-
/**
|
|
887
|
-
* Submits wordpress import process from URL.
|
|
888
|
-
* It will prepare wordpress data for import from the given URL.
|
|
889
|
-
* Use "GetImportStatus" to get the status of the import process.
|
|
890
|
-
* Once the import status becomes READY_TO_IMPORT, the import process can be started by invoking "StartImport".
|
|
891
|
-
* @param - Url to wordpress xml file.
|
|
892
|
-
*/
|
|
893
|
-
(url: string): Promise<void>;
|
|
1653
|
+
declare function startImport$1(httpClient: HttpClient$4): StartImportSignature;
|
|
1654
|
+
interface StartImportSignature {
|
|
1655
|
+
/**
|
|
1656
|
+
* Starts wordpress import process.
|
|
1657
|
+
*/
|
|
1658
|
+
(): Promise<void>;
|
|
1659
|
+
}
|
|
1660
|
+
declare function submitUrlForImport$1(httpClient: HttpClient$4): SubmitUrlForImportSignature;
|
|
1661
|
+
interface SubmitUrlForImportSignature {
|
|
1662
|
+
/**
|
|
1663
|
+
* Submits wordpress import process from URL.
|
|
1664
|
+
* It will prepare wordpress data for import from the given URL.
|
|
1665
|
+
* Use "GetImportStatus" to get the status of the import process.
|
|
1666
|
+
* Once the import status becomes READY_TO_IMPORT, the import process can be started by invoking "StartImport".
|
|
1667
|
+
* @param - Url to wordpress xml file.
|
|
1668
|
+
*/
|
|
1669
|
+
(url: string): Promise<void>;
|
|
1670
|
+
}
|
|
1671
|
+
declare function getImportStatus$1(httpClient: HttpClient$4): GetImportStatusSignature;
|
|
1672
|
+
interface GetImportStatusSignature {
|
|
1673
|
+
/**
|
|
1674
|
+
* Gets the status of the import process.
|
|
1675
|
+
*/
|
|
1676
|
+
(): Promise<GetImportStatusResponse & GetImportStatusResponseNonNullableFields>;
|
|
1677
|
+
}
|
|
1678
|
+
declare function getNotImportedPosts$1(httpClient: HttpClient$4): GetNotImportedPostsSignature;
|
|
1679
|
+
interface GetNotImportedPostsSignature {
|
|
1680
|
+
/**
|
|
1681
|
+
* Gets the posts that were not yet imported either because of an error or because import is still in progress.
|
|
1682
|
+
*/
|
|
1683
|
+
(): Promise<GetNotImportedPostsResponse & GetNotImportedPostsResponseNonNullableFields>;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
declare const startImport: MaybeContext$4<BuildRESTFunction$4<typeof startImport$1> & typeof startImport$1>;
|
|
1687
|
+
declare const submitUrlForImport: MaybeContext$4<BuildRESTFunction$4<typeof submitUrlForImport$1> & typeof submitUrlForImport$1>;
|
|
1688
|
+
declare const getImportStatus: MaybeContext$4<BuildRESTFunction$4<typeof getImportStatus$1> & typeof getImportStatus$1>;
|
|
1689
|
+
declare const getNotImportedPosts: MaybeContext$4<BuildRESTFunction$4<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1>;
|
|
1690
|
+
|
|
1691
|
+
type index_d$4_GetImportStatusRequest = GetImportStatusRequest;
|
|
1692
|
+
type index_d$4_GetImportStatusResponse = GetImportStatusResponse;
|
|
1693
|
+
type index_d$4_GetImportStatusResponseNonNullableFields = GetImportStatusResponseNonNullableFields;
|
|
1694
|
+
type index_d$4_GetNotImportedPostsRequest = GetNotImportedPostsRequest;
|
|
1695
|
+
type index_d$4_GetNotImportedPostsResponse = GetNotImportedPostsResponse;
|
|
1696
|
+
type index_d$4_GetNotImportedPostsResponseNonNullableFields = GetNotImportedPostsResponseNonNullableFields;
|
|
1697
|
+
type index_d$4_ImportStatus = ImportStatus;
|
|
1698
|
+
type index_d$4_StartImportRequest = StartImportRequest;
|
|
1699
|
+
type index_d$4_StartImportResponse = StartImportResponse;
|
|
1700
|
+
type index_d$4_SubmitUrlForImportRequest = SubmitUrlForImportRequest;
|
|
1701
|
+
type index_d$4_SubmitUrlForImportResponse = SubmitUrlForImportResponse;
|
|
1702
|
+
declare const index_d$4_getImportStatus: typeof getImportStatus;
|
|
1703
|
+
declare const index_d$4_getNotImportedPosts: typeof getNotImportedPosts;
|
|
1704
|
+
declare const index_d$4_startImport: typeof startImport;
|
|
1705
|
+
declare const index_d$4_submitUrlForImport: typeof submitUrlForImport;
|
|
1706
|
+
declare namespace index_d$4 {
|
|
1707
|
+
export { type index_d$4_GetImportStatusRequest as GetImportStatusRequest, type index_d$4_GetImportStatusResponse as GetImportStatusResponse, type index_d$4_GetImportStatusResponseNonNullableFields as GetImportStatusResponseNonNullableFields, type index_d$4_GetNotImportedPostsRequest as GetNotImportedPostsRequest, type index_d$4_GetNotImportedPostsResponse as GetNotImportedPostsResponse, type index_d$4_GetNotImportedPostsResponseNonNullableFields as GetNotImportedPostsResponseNonNullableFields, type index_d$4_ImportStatus as ImportStatus, type Post$1 as Post, type index_d$4_StartImportRequest as StartImportRequest, type index_d$4_StartImportResponse as StartImportResponse, Status$2 as Status, type index_d$4_SubmitUrlForImportRequest as SubmitUrlForImportRequest, type index_d$4_SubmitUrlForImportResponse as SubmitUrlForImportResponse, index_d$4_getImportStatus as getImportStatus, index_d$4_getNotImportedPosts as getNotImportedPosts, index_d$4_startImport as startImport, index_d$4_submitUrlForImport as submitUrlForImport };
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
1711
|
+
__type: 'host';
|
|
1712
|
+
create(host: H): T;
|
|
1713
|
+
};
|
|
1714
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
1715
|
+
type Host$3<Environment = unknown> = {
|
|
1716
|
+
channel: {
|
|
1717
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1718
|
+
disconnect: () => void;
|
|
1719
|
+
} | Promise<{
|
|
1720
|
+
disconnect: () => void;
|
|
1721
|
+
}>;
|
|
1722
|
+
};
|
|
1723
|
+
environment?: Environment;
|
|
1724
|
+
/**
|
|
1725
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1726
|
+
*/
|
|
1727
|
+
apiBaseUrl?: string;
|
|
1728
|
+
/**
|
|
1729
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1730
|
+
* like internationalization, billing, etc.
|
|
1731
|
+
*/
|
|
1732
|
+
essentials?: {
|
|
1733
|
+
/**
|
|
1734
|
+
* The language of the currently viewed session
|
|
1735
|
+
*/
|
|
1736
|
+
language?: string;
|
|
1737
|
+
/**
|
|
1738
|
+
* The locale of the currently viewed session
|
|
1739
|
+
*/
|
|
1740
|
+
locale?: string;
|
|
1741
|
+
/**
|
|
1742
|
+
* Any headers that should be passed through to the API requests
|
|
1743
|
+
*/
|
|
1744
|
+
passThroughHeaders?: Record<string, string>;
|
|
1745
|
+
};
|
|
1746
|
+
};
|
|
1747
|
+
|
|
1748
|
+
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
1749
|
+
interface HttpClient$3 {
|
|
1750
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
1751
|
+
fetchWithAuth: typeof fetch;
|
|
1752
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1753
|
+
getActiveToken?: () => string | undefined;
|
|
1754
|
+
}
|
|
1755
|
+
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
1756
|
+
type HttpResponse$3<T = any> = {
|
|
1757
|
+
data: T;
|
|
1758
|
+
status: number;
|
|
1759
|
+
statusText: string;
|
|
1760
|
+
headers: any;
|
|
1761
|
+
request?: any;
|
|
1762
|
+
};
|
|
1763
|
+
type RequestOptions$3<_TResponse = any, Data = any> = {
|
|
1764
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1765
|
+
url: string;
|
|
1766
|
+
data?: Data;
|
|
1767
|
+
params?: URLSearchParams;
|
|
1768
|
+
} & APIMetadata$3;
|
|
1769
|
+
type APIMetadata$3 = {
|
|
1770
|
+
methodFqn?: string;
|
|
1771
|
+
entityFqdn?: string;
|
|
1772
|
+
packageName?: string;
|
|
1773
|
+
};
|
|
1774
|
+
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
1775
|
+
type EventDefinition$7<Payload = unknown, Type extends string = string> = {
|
|
1776
|
+
__type: 'event-definition';
|
|
1777
|
+
type: Type;
|
|
1778
|
+
isDomainEvent?: boolean;
|
|
1779
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1780
|
+
__payload: Payload;
|
|
1781
|
+
};
|
|
1782
|
+
declare function EventDefinition$7<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$7<Payload, Type>;
|
|
1783
|
+
type EventHandler$7<T extends EventDefinition$7> = (payload: T['__payload']) => void | Promise<void>;
|
|
1784
|
+
type BuildEventDefinition$7<T extends EventDefinition$7<any, string>> = (handler: EventHandler$7<T>) => void;
|
|
1785
|
+
|
|
1786
|
+
type ServicePluginMethodInput$3 = {
|
|
1787
|
+
request: any;
|
|
1788
|
+
metadata: any;
|
|
1789
|
+
};
|
|
1790
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
1791
|
+
type ServicePluginMethodMetadata$3 = {
|
|
1792
|
+
name: string;
|
|
1793
|
+
primaryHttpMappingPath: string;
|
|
1794
|
+
transformations: {
|
|
1795
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
1796
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1797
|
+
};
|
|
1798
|
+
};
|
|
1799
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
1800
|
+
__type: 'service-plugin-definition';
|
|
1801
|
+
componentType: string;
|
|
1802
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
1803
|
+
__contract: Contract;
|
|
1804
|
+
};
|
|
1805
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
1806
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
1807
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
1808
|
+
|
|
1809
|
+
type RequestContext$3 = {
|
|
1810
|
+
isSSR: boolean;
|
|
1811
|
+
host: string;
|
|
1812
|
+
protocol?: string;
|
|
1813
|
+
};
|
|
1814
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
1815
|
+
/**
|
|
1816
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1817
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1818
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1819
|
+
*/
|
|
1820
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1821
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
1822
|
+
_?: T;
|
|
1823
|
+
url?: string;
|
|
1824
|
+
method?: Method$3;
|
|
1825
|
+
params?: any;
|
|
1826
|
+
data?: any;
|
|
1827
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
1828
|
+
};
|
|
1829
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
1830
|
+
__isAmbassador: boolean;
|
|
1831
|
+
};
|
|
1832
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
1833
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1834
|
+
|
|
1835
|
+
declare global {
|
|
1836
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1837
|
+
interface SymbolConstructor {
|
|
1838
|
+
readonly observable: symbol;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1846
|
+
|
|
1847
|
+
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)).
|
|
1848
|
+
|
|
1849
|
+
@example
|
|
1850
|
+
```
|
|
1851
|
+
import type {EmptyObject} from 'type-fest';
|
|
1852
|
+
|
|
1853
|
+
// The following illustrates the problem with `{}`.
|
|
1854
|
+
const foo1: {} = {}; // Pass
|
|
1855
|
+
const foo2: {} = []; // Pass
|
|
1856
|
+
const foo3: {} = 42; // Pass
|
|
1857
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1858
|
+
|
|
1859
|
+
// With `EmptyObject` only the first case is valid.
|
|
1860
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1861
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1862
|
+
const bar3: EmptyObject = []; // Fail
|
|
1863
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1864
|
+
```
|
|
1865
|
+
|
|
1866
|
+
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}.
|
|
1867
|
+
|
|
1868
|
+
@category Object
|
|
1869
|
+
*/
|
|
1870
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
Returns a boolean for whether the two given types are equal.
|
|
1874
|
+
|
|
1875
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1876
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1877
|
+
|
|
1878
|
+
Use-cases:
|
|
1879
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1880
|
+
|
|
1881
|
+
@example
|
|
1882
|
+
```
|
|
1883
|
+
import type {IsEqual} from 'type-fest';
|
|
1884
|
+
|
|
1885
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1886
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1887
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1888
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1889
|
+
? IsEqual<Value[0], Item> extends true
|
|
1890
|
+
? true
|
|
1891
|
+
: Includes<rest, Item>
|
|
1892
|
+
: false;
|
|
1893
|
+
```
|
|
1894
|
+
|
|
1895
|
+
@category Type Guard
|
|
1896
|
+
@category Utilities
|
|
1897
|
+
*/
|
|
1898
|
+
type IsEqual$3<A, B> =
|
|
1899
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1900
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1901
|
+
? true
|
|
1902
|
+
: false;
|
|
1903
|
+
|
|
1904
|
+
/**
|
|
1905
|
+
Filter out keys from an object.
|
|
1906
|
+
|
|
1907
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1908
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1909
|
+
Returns `Key` otherwise.
|
|
1910
|
+
|
|
1911
|
+
@example
|
|
1912
|
+
```
|
|
1913
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1914
|
+
//=> never
|
|
1915
|
+
```
|
|
1916
|
+
|
|
1917
|
+
@example
|
|
1918
|
+
```
|
|
1919
|
+
type Filtered = Filter<'bar', string>;
|
|
1920
|
+
//=> never
|
|
1921
|
+
```
|
|
1922
|
+
|
|
1923
|
+
@example
|
|
1924
|
+
```
|
|
1925
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1926
|
+
//=> 'bar'
|
|
1927
|
+
```
|
|
1928
|
+
|
|
1929
|
+
@see {Except}
|
|
1930
|
+
*/
|
|
1931
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1932
|
+
|
|
1933
|
+
type ExceptOptions$3 = {
|
|
1934
|
+
/**
|
|
1935
|
+
Disallow assigning non-specified properties.
|
|
1936
|
+
|
|
1937
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1938
|
+
|
|
1939
|
+
@default false
|
|
1940
|
+
*/
|
|
1941
|
+
requireExactProps?: boolean;
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
Create a type from an object type without certain keys.
|
|
1946
|
+
|
|
1947
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1948
|
+
|
|
1949
|
+
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.
|
|
1950
|
+
|
|
1951
|
+
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)).
|
|
1952
|
+
|
|
1953
|
+
@example
|
|
1954
|
+
```
|
|
1955
|
+
import type {Except} from 'type-fest';
|
|
1956
|
+
|
|
1957
|
+
type Foo = {
|
|
1958
|
+
a: number;
|
|
1959
|
+
b: string;
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1962
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1963
|
+
//=> {b: string}
|
|
1964
|
+
|
|
1965
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1966
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1967
|
+
|
|
1968
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1969
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1970
|
+
|
|
1971
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1972
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1973
|
+
```
|
|
1974
|
+
|
|
1975
|
+
@category Object
|
|
1976
|
+
*/
|
|
1977
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
1978
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1979
|
+
} & (Options['requireExactProps'] extends true
|
|
1980
|
+
? Partial<Record<KeysType, never>>
|
|
1981
|
+
: {});
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1985
|
+
|
|
1986
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1987
|
+
|
|
1988
|
+
@example
|
|
1989
|
+
```
|
|
1990
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1991
|
+
|
|
1992
|
+
interface Example {
|
|
1993
|
+
a: string;
|
|
1994
|
+
b: string | number;
|
|
1995
|
+
c?: string;
|
|
1996
|
+
d: {};
|
|
894
1997
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1998
|
+
|
|
1999
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
2000
|
+
//=> 'a'
|
|
2001
|
+
```
|
|
2002
|
+
|
|
2003
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
2004
|
+
|
|
2005
|
+
@example
|
|
2006
|
+
```
|
|
2007
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2008
|
+
|
|
2009
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
2010
|
+
//=> 'a' | 'c'
|
|
2011
|
+
```
|
|
2012
|
+
|
|
2013
|
+
@category Object
|
|
2014
|
+
*/
|
|
2015
|
+
type ConditionalKeys$3<Base, Condition> = NonNullable<
|
|
2016
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
2017
|
+
{
|
|
2018
|
+
// Map through all the keys of the given base type.
|
|
2019
|
+
[Key in keyof Base]:
|
|
2020
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
2021
|
+
Base[Key] extends Condition
|
|
2022
|
+
// Retain this key since the condition passes.
|
|
2023
|
+
? Key
|
|
2024
|
+
// Discard this key since the condition fails.
|
|
2025
|
+
: never;
|
|
2026
|
+
|
|
2027
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
2028
|
+
}[keyof Base]
|
|
2029
|
+
>;
|
|
2030
|
+
|
|
2031
|
+
/**
|
|
2032
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
2033
|
+
|
|
2034
|
+
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.
|
|
2035
|
+
|
|
2036
|
+
@example
|
|
2037
|
+
```
|
|
2038
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
2039
|
+
|
|
2040
|
+
class Awesome {
|
|
2041
|
+
name: string;
|
|
2042
|
+
successes: number;
|
|
2043
|
+
failures: bigint;
|
|
2044
|
+
|
|
2045
|
+
run() {}
|
|
901
2046
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
2047
|
+
|
|
2048
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
2049
|
+
//=> {run: () => void}
|
|
2050
|
+
```
|
|
2051
|
+
|
|
2052
|
+
@example
|
|
2053
|
+
```
|
|
2054
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
2055
|
+
|
|
2056
|
+
interface Example {
|
|
2057
|
+
a: string;
|
|
2058
|
+
b: string | number;
|
|
2059
|
+
c: () => void;
|
|
2060
|
+
d: {};
|
|
908
2061
|
}
|
|
909
2062
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
declare const getNotImportedPosts: BuildRESTFunction<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1;
|
|
2063
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
2064
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
2065
|
+
```
|
|
914
2066
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
type
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
type
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
2067
|
+
@category Object
|
|
2068
|
+
*/
|
|
2069
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
2070
|
+
Base,
|
|
2071
|
+
ConditionalKeys$3<Base, Condition>
|
|
2072
|
+
>;
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
2076
|
+
* can either be a REST module or a host module.
|
|
2077
|
+
* This type is recursive, so it can describe nested modules.
|
|
2078
|
+
*/
|
|
2079
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$7<any> | ServicePluginDefinition$3<any> | {
|
|
2080
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
2081
|
+
};
|
|
2082
|
+
/**
|
|
2083
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
2084
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
2085
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
2086
|
+
* do not match the given host (as they will not work with the given host).
|
|
2087
|
+
*/
|
|
2088
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
2089
|
+
done: T;
|
|
2090
|
+
recurse: T extends {
|
|
2091
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
2092
|
+
} ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$7<any> ? BuildEventDefinition$7<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
|
|
2093
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
2094
|
+
-1,
|
|
2095
|
+
0,
|
|
2096
|
+
1,
|
|
2097
|
+
2,
|
|
2098
|
+
3,
|
|
2099
|
+
4,
|
|
2100
|
+
5
|
|
2101
|
+
][Depth]> : never;
|
|
2102
|
+
}, EmptyObject$3>;
|
|
2103
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
2104
|
+
type PublicMetadata$3 = {
|
|
2105
|
+
PACKAGE_NAME?: string;
|
|
2106
|
+
};
|
|
2107
|
+
|
|
2108
|
+
declare global {
|
|
2109
|
+
interface ContextualClient {
|
|
2110
|
+
}
|
|
932
2111
|
}
|
|
2112
|
+
/**
|
|
2113
|
+
* A type used to create concerete types from SDK descriptors in
|
|
2114
|
+
* case a contextual client is available.
|
|
2115
|
+
*/
|
|
2116
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
2117
|
+
host: Host$3;
|
|
2118
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
933
2119
|
|
|
934
2120
|
interface Category$2 {
|
|
935
2121
|
/** Category ID. */
|
|
@@ -1637,27 +2823,27 @@ interface CategoriesQueryBuilder {
|
|
|
1637
2823
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1638
2824
|
* @param value - Value to compare against.
|
|
1639
2825
|
*/
|
|
1640
|
-
eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | '
|
|
2826
|
+
eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
1641
2827
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1642
2828
|
* @param value - Value to compare against.
|
|
1643
2829
|
*/
|
|
1644
|
-
ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | '
|
|
2830
|
+
ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
1645
2831
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1646
2832
|
* @param value - Value to compare against.
|
|
1647
2833
|
*/
|
|
1648
|
-
ge: (propertyName: 'postCount' | '
|
|
2834
|
+
ge: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
1649
2835
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1650
2836
|
* @param value - Value to compare against.
|
|
1651
2837
|
*/
|
|
1652
|
-
gt: (propertyName: 'postCount' | '
|
|
2838
|
+
gt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
1653
2839
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1654
2840
|
* @param value - Value to compare against.
|
|
1655
2841
|
*/
|
|
1656
|
-
le: (propertyName: 'postCount' | '
|
|
2842
|
+
le: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
1657
2843
|
/** @param propertyName - Property whose value is compared with `value`.
|
|
1658
2844
|
* @param value - Value to compare against.
|
|
1659
2845
|
*/
|
|
1660
|
-
lt: (propertyName: 'postCount' | '
|
|
2846
|
+
lt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
1661
2847
|
/** @param propertyName - Property whose value is compared with `string`.
|
|
1662
2848
|
* @param string - String to compare against. Case-insensitive.
|
|
1663
2849
|
*/
|
|
@@ -1666,12 +2852,12 @@ interface CategoriesQueryBuilder {
|
|
|
1666
2852
|
* @param values - List of values to compare against.
|
|
1667
2853
|
*/
|
|
1668
2854
|
hasSome: (propertyName: '_id' | 'label' | 'title' | 'slug', value: any[]) => CategoriesQueryBuilder;
|
|
1669
|
-
in: (propertyName: 'label' | 'postCount' | 'title' | '
|
|
2855
|
+
in: (propertyName: 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
1670
2856
|
exists: (propertyName: 'label' | 'title' | 'translationId' | 'language', value: boolean) => CategoriesQueryBuilder;
|
|
1671
2857
|
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
|
|
1672
|
-
ascending: (...propertyNames: Array<'label' | 'postCount' | 'title' | '
|
|
2858
|
+
ascending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
|
|
1673
2859
|
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
|
|
1674
|
-
descending: (...propertyNames: Array<'label' | 'postCount' | 'title' | '
|
|
2860
|
+
descending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
|
|
1675
2861
|
/** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
|
|
1676
2862
|
limit: (limit: number) => CategoriesQueryBuilder;
|
|
1677
2863
|
/** @param skip - Number of items to skip in the query results before returning the results. */
|
|
@@ -1679,7 +2865,7 @@ interface CategoriesQueryBuilder {
|
|
|
1679
2865
|
find: () => Promise<CategoriesQueryResult>;
|
|
1680
2866
|
}
|
|
1681
2867
|
|
|
1682
|
-
declare function getCategory$1(httpClient: HttpClient): GetCategorySignature;
|
|
2868
|
+
declare function getCategory$1(httpClient: HttpClient$3): GetCategorySignature;
|
|
1683
2869
|
interface GetCategorySignature {
|
|
1684
2870
|
/**
|
|
1685
2871
|
* Gets a category by the specified ID.
|
|
@@ -1692,7 +2878,7 @@ interface GetCategorySignature {
|
|
|
1692
2878
|
*/
|
|
1693
2879
|
(categoryId: string, options?: GetCategoryOptions | undefined): Promise<GetCategoryResponse & GetCategoryResponseNonNullableFields>;
|
|
1694
2880
|
}
|
|
1695
|
-
declare function getCategoryBySlug$1(httpClient: HttpClient): GetCategoryBySlugSignature;
|
|
2881
|
+
declare function getCategoryBySlug$1(httpClient: HttpClient$3): GetCategoryBySlugSignature;
|
|
1696
2882
|
interface GetCategoryBySlugSignature {
|
|
1697
2883
|
/**
|
|
1698
2884
|
* Gets a category by the specified slug.
|
|
@@ -1709,7 +2895,7 @@ interface GetCategoryBySlugSignature {
|
|
|
1709
2895
|
*/
|
|
1710
2896
|
(slug: string, options?: GetCategoryBySlugOptions | undefined): Promise<GetCategoryBySlugResponse & GetCategoryBySlugResponseNonNullableFields>;
|
|
1711
2897
|
}
|
|
1712
|
-
declare function listCategories$1(httpClient: HttpClient): ListCategoriesSignature;
|
|
2898
|
+
declare function listCategories$1(httpClient: HttpClient$3): ListCategoriesSignature;
|
|
1713
2899
|
interface ListCategoriesSignature {
|
|
1714
2900
|
/**
|
|
1715
2901
|
* Retrieves a list of categories.
|
|
@@ -1720,7 +2906,7 @@ interface ListCategoriesSignature {
|
|
|
1720
2906
|
*/
|
|
1721
2907
|
(options?: ListCategoriesOptions | undefined): Promise<ListCategoriesResponse & ListCategoriesResponseNonNullableFields>;
|
|
1722
2908
|
}
|
|
1723
|
-
declare function queryCategories$1(httpClient: HttpClient): QueryCategoriesSignature;
|
|
2909
|
+
declare function queryCategories$1(httpClient: HttpClient$3): QueryCategoriesSignature;
|
|
1724
2910
|
interface QueryCategoriesSignature {
|
|
1725
2911
|
/**
|
|
1726
2912
|
* Creates a query to retrieve a list of categories.
|
|
@@ -1741,16 +2927,34 @@ interface QueryCategoriesSignature {
|
|
|
1741
2927
|
*/
|
|
1742
2928
|
(options?: QueryCategoriesOptions | undefined): CategoriesQueryBuilder;
|
|
1743
2929
|
}
|
|
1744
|
-
declare const onCategoryCreated$1: EventDefinition<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
|
|
1745
|
-
declare const onCategoryUpdated$1: EventDefinition<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
|
|
1746
|
-
declare const onCategoryDeleted$1: EventDefinition<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
|
|
2930
|
+
declare const onCategoryCreated$1: EventDefinition$7<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
|
|
2931
|
+
declare const onCategoryUpdated$1: EventDefinition$7<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
|
|
2932
|
+
declare const onCategoryDeleted$1: EventDefinition$7<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
|
|
2933
|
+
|
|
2934
|
+
type EventDefinition$6<Payload = unknown, Type extends string = string> = {
|
|
2935
|
+
__type: 'event-definition';
|
|
2936
|
+
type: Type;
|
|
2937
|
+
isDomainEvent?: boolean;
|
|
2938
|
+
transformations?: (envelope: unknown) => Payload;
|
|
2939
|
+
__payload: Payload;
|
|
2940
|
+
};
|
|
2941
|
+
declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
|
|
2942
|
+
type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
|
|
2943
|
+
type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
|
|
2944
|
+
|
|
2945
|
+
declare global {
|
|
2946
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2947
|
+
interface SymbolConstructor {
|
|
2948
|
+
readonly observable: symbol;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
1747
2951
|
|
|
1748
|
-
declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
2952
|
+
declare function createEventModule$3<T extends EventDefinition$6<any, string>>(eventDefinition: T): BuildEventDefinition$6<T> & T;
|
|
1749
2953
|
|
|
1750
|
-
declare const getCategory: BuildRESTFunction<typeof getCategory$1> & typeof getCategory$1
|
|
1751
|
-
declare const getCategoryBySlug: BuildRESTFunction<typeof getCategoryBySlug$1> & typeof getCategoryBySlug$1
|
|
1752
|
-
declare const listCategories: BuildRESTFunction<typeof listCategories$1> & typeof listCategories$1
|
|
1753
|
-
declare const queryCategories: BuildRESTFunction<typeof queryCategories$1> & typeof queryCategories$1
|
|
2954
|
+
declare const getCategory: MaybeContext$3<BuildRESTFunction$3<typeof getCategory$1> & typeof getCategory$1>;
|
|
2955
|
+
declare const getCategoryBySlug: MaybeContext$3<BuildRESTFunction$3<typeof getCategoryBySlug$1> & typeof getCategoryBySlug$1>;
|
|
2956
|
+
declare const listCategories: MaybeContext$3<BuildRESTFunction$3<typeof listCategories$1> & typeof listCategories$1>;
|
|
2957
|
+
declare const queryCategories: MaybeContext$3<BuildRESTFunction$3<typeof queryCategories$1> & typeof queryCategories$1>;
|
|
1754
2958
|
|
|
1755
2959
|
type _publicOnCategoryCreatedType = typeof onCategoryCreated$1;
|
|
1756
2960
|
/**
|
|
@@ -1823,6 +3027,416 @@ declare namespace index_d$3 {
|
|
|
1823
3027
|
export { type ActionEvent$3 as ActionEvent, type ApplicationError$2 as ApplicationError, type BaseEventMetadata$3 as BaseEventMetadata, type BlogPaging$2 as BlogPaging, type BulkActionMetadata$2 as BulkActionMetadata, type index_d$3_BulkCategoryResult as BulkCategoryResult, type index_d$3_BulkCreateCategoriesRequest as BulkCreateCategoriesRequest, type index_d$3_BulkCreateCategoriesResponse as BulkCreateCategoriesResponse, type index_d$3_BulkDeleteCategoryRequest as BulkDeleteCategoryRequest, type index_d$3_BulkDeleteCategoryResponse as BulkDeleteCategoryResponse, type index_d$3_BulkUpdateCategoriesRequest as BulkUpdateCategoriesRequest, type index_d$3_BulkUpdateCategoriesResponse as BulkUpdateCategoriesResponse, type index_d$3_CategoriesQueryBuilder as CategoriesQueryBuilder, type index_d$3_CategoriesQueryResult as CategoriesQueryResult, type Category$2 as Category, type index_d$3_CategoryCreatedEnvelope as CategoryCreatedEnvelope, type index_d$3_CategoryDeletedEnvelope as CategoryDeletedEnvelope, type index_d$3_CategoryLanguageCount as CategoryLanguageCount, type CategoryTranslation$2 as CategoryTranslation, type index_d$3_CategoryUpdatedEnvelope as CategoryUpdatedEnvelope, type index_d$3_CreateCategoryRequest as CreateCategoryRequest, type index_d$3_CreateCategoryResponse as CreateCategoryResponse, type CursorPaging$3 as CursorPaging, type Cursors$3 as Cursors, type index_d$3_DeleteCategoryRequest as DeleteCategoryRequest, type index_d$3_DeleteCategoryResponse as DeleteCategoryResponse, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type EventMetadata$3 as EventMetadata, Field$3 as Field, type index_d$3_GetCategoriesCountByLanguageRequest as GetCategoriesCountByLanguageRequest, type index_d$3_GetCategoriesCountByLanguageResponse as GetCategoriesCountByLanguageResponse, type index_d$3_GetCategoryBySlugOptions as GetCategoryBySlugOptions, type index_d$3_GetCategoryBySlugRequest as GetCategoryBySlugRequest, type index_d$3_GetCategoryBySlugResponse as GetCategoryBySlugResponse, type index_d$3_GetCategoryBySlugResponseNonNullableFields as GetCategoryBySlugResponseNonNullableFields, type index_d$3_GetCategoryOptions as GetCategoryOptions, type index_d$3_GetCategoryRequest as GetCategoryRequest, type index_d$3_GetCategoryResponse as GetCategoryResponse, type index_d$3_GetCategoryResponseNonNullableFields as GetCategoryResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type index_d$3_InitialCategoriesCopied as InitialCategoriesCopied, type ItemMetadata$2 as ItemMetadata, type Keyword$3 as Keyword, type index_d$3_ListCategoriesOptions as ListCategoriesOptions, type index_d$3_ListCategoriesRequest as ListCategoriesRequest, type index_d$3_ListCategoriesResponse as ListCategoriesResponse, type index_d$3_ListCategoriesResponseNonNullableFields as ListCategoriesResponseNonNullableFields, type index_d$3_MaskedCategory as MaskedCategory, type MessageEnvelope$3 as MessageEnvelope, type MetaData$3 as MetaData, type Paging$3 as Paging, type PagingMetadataV2$3 as PagingMetadataV2, type PlatformQuery$3 as PlatformQuery, type PlatformQueryPagingMethodOneOf$3 as PlatformQueryPagingMethodOneOf, type index_d$3_QueryCategoriesOptions as QueryCategoriesOptions, type index_d$3_QueryCategoriesRequest as QueryCategoriesRequest, type index_d$3_QueryCategoriesResponse as QueryCategoriesResponse, type index_d$3_QueryCategoriesResponseNonNullableFields as QueryCategoriesResponseNonNullableFields, type RestoreInfo$3 as RestoreInfo, type SeoSchema$3 as SeoSchema, type Settings$3 as Settings, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, type Tag$3 as Tag, type index_d$3_UpdateCategoryRequest as UpdateCategoryRequest, type index_d$3_UpdateCategoryResponse as UpdateCategoryResponse, WebhookIdentityType$3 as WebhookIdentityType, type index_d$3__publicOnCategoryCreatedType as _publicOnCategoryCreatedType, type index_d$3__publicOnCategoryDeletedType as _publicOnCategoryDeletedType, type index_d$3__publicOnCategoryUpdatedType as _publicOnCategoryUpdatedType, index_d$3_getCategory as getCategory, index_d$3_getCategoryBySlug as getCategoryBySlug, index_d$3_listCategories as listCategories, index_d$3_onCategoryCreated as onCategoryCreated, index_d$3_onCategoryDeleted as onCategoryDeleted, index_d$3_onCategoryUpdated as onCategoryUpdated, onCategoryCreated$1 as publicOnCategoryCreated, onCategoryDeleted$1 as publicOnCategoryDeleted, onCategoryUpdated$1 as publicOnCategoryUpdated, index_d$3_queryCategories as queryCategories };
|
|
1824
3028
|
}
|
|
1825
3029
|
|
|
3030
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
3031
|
+
__type: 'host';
|
|
3032
|
+
create(host: H): T;
|
|
3033
|
+
};
|
|
3034
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
3035
|
+
type Host$2<Environment = unknown> = {
|
|
3036
|
+
channel: {
|
|
3037
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
3038
|
+
disconnect: () => void;
|
|
3039
|
+
} | Promise<{
|
|
3040
|
+
disconnect: () => void;
|
|
3041
|
+
}>;
|
|
3042
|
+
};
|
|
3043
|
+
environment?: Environment;
|
|
3044
|
+
/**
|
|
3045
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3046
|
+
*/
|
|
3047
|
+
apiBaseUrl?: string;
|
|
3048
|
+
/**
|
|
3049
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3050
|
+
* like internationalization, billing, etc.
|
|
3051
|
+
*/
|
|
3052
|
+
essentials?: {
|
|
3053
|
+
/**
|
|
3054
|
+
* The language of the currently viewed session
|
|
3055
|
+
*/
|
|
3056
|
+
language?: string;
|
|
3057
|
+
/**
|
|
3058
|
+
* The locale of the currently viewed session
|
|
3059
|
+
*/
|
|
3060
|
+
locale?: string;
|
|
3061
|
+
/**
|
|
3062
|
+
* Any headers that should be passed through to the API requests
|
|
3063
|
+
*/
|
|
3064
|
+
passThroughHeaders?: Record<string, string>;
|
|
3065
|
+
};
|
|
3066
|
+
};
|
|
3067
|
+
|
|
3068
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
3069
|
+
interface HttpClient$2 {
|
|
3070
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
3071
|
+
fetchWithAuth: typeof fetch;
|
|
3072
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
3073
|
+
getActiveToken?: () => string | undefined;
|
|
3074
|
+
}
|
|
3075
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
3076
|
+
type HttpResponse$2<T = any> = {
|
|
3077
|
+
data: T;
|
|
3078
|
+
status: number;
|
|
3079
|
+
statusText: string;
|
|
3080
|
+
headers: any;
|
|
3081
|
+
request?: any;
|
|
3082
|
+
};
|
|
3083
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
3084
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
3085
|
+
url: string;
|
|
3086
|
+
data?: Data;
|
|
3087
|
+
params?: URLSearchParams;
|
|
3088
|
+
} & APIMetadata$2;
|
|
3089
|
+
type APIMetadata$2 = {
|
|
3090
|
+
methodFqn?: string;
|
|
3091
|
+
entityFqdn?: string;
|
|
3092
|
+
packageName?: string;
|
|
3093
|
+
};
|
|
3094
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
3095
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
3096
|
+
__type: 'event-definition';
|
|
3097
|
+
type: Type;
|
|
3098
|
+
isDomainEvent?: boolean;
|
|
3099
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3100
|
+
__payload: Payload;
|
|
3101
|
+
};
|
|
3102
|
+
declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
|
|
3103
|
+
type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
|
|
3104
|
+
type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
|
|
3105
|
+
|
|
3106
|
+
type ServicePluginMethodInput$2 = {
|
|
3107
|
+
request: any;
|
|
3108
|
+
metadata: any;
|
|
3109
|
+
};
|
|
3110
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
3111
|
+
type ServicePluginMethodMetadata$2 = {
|
|
3112
|
+
name: string;
|
|
3113
|
+
primaryHttpMappingPath: string;
|
|
3114
|
+
transformations: {
|
|
3115
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
3116
|
+
toREST: (...args: unknown[]) => unknown;
|
|
3117
|
+
};
|
|
3118
|
+
};
|
|
3119
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
3120
|
+
__type: 'service-plugin-definition';
|
|
3121
|
+
componentType: string;
|
|
3122
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
3123
|
+
__contract: Contract;
|
|
3124
|
+
};
|
|
3125
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
3126
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
3127
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
3128
|
+
|
|
3129
|
+
type RequestContext$2 = {
|
|
3130
|
+
isSSR: boolean;
|
|
3131
|
+
host: string;
|
|
3132
|
+
protocol?: string;
|
|
3133
|
+
};
|
|
3134
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
3135
|
+
/**
|
|
3136
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
3137
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
3138
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
3139
|
+
*/
|
|
3140
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
3141
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
3142
|
+
_?: T;
|
|
3143
|
+
url?: string;
|
|
3144
|
+
method?: Method$2;
|
|
3145
|
+
params?: any;
|
|
3146
|
+
data?: any;
|
|
3147
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
3148
|
+
};
|
|
3149
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
3150
|
+
__isAmbassador: boolean;
|
|
3151
|
+
};
|
|
3152
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
3153
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3154
|
+
|
|
3155
|
+
declare global {
|
|
3156
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3157
|
+
interface SymbolConstructor {
|
|
3158
|
+
readonly observable: symbol;
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
3163
|
+
|
|
3164
|
+
/**
|
|
3165
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
3166
|
+
|
|
3167
|
+
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)).
|
|
3168
|
+
|
|
3169
|
+
@example
|
|
3170
|
+
```
|
|
3171
|
+
import type {EmptyObject} from 'type-fest';
|
|
3172
|
+
|
|
3173
|
+
// The following illustrates the problem with `{}`.
|
|
3174
|
+
const foo1: {} = {}; // Pass
|
|
3175
|
+
const foo2: {} = []; // Pass
|
|
3176
|
+
const foo3: {} = 42; // Pass
|
|
3177
|
+
const foo4: {} = {a: 1}; // Pass
|
|
3178
|
+
|
|
3179
|
+
// With `EmptyObject` only the first case is valid.
|
|
3180
|
+
const bar1: EmptyObject = {}; // Pass
|
|
3181
|
+
const bar2: EmptyObject = 42; // Fail
|
|
3182
|
+
const bar3: EmptyObject = []; // Fail
|
|
3183
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
3184
|
+
```
|
|
3185
|
+
|
|
3186
|
+
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}.
|
|
3187
|
+
|
|
3188
|
+
@category Object
|
|
3189
|
+
*/
|
|
3190
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
Returns a boolean for whether the two given types are equal.
|
|
3194
|
+
|
|
3195
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
3196
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
3197
|
+
|
|
3198
|
+
Use-cases:
|
|
3199
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
3200
|
+
|
|
3201
|
+
@example
|
|
3202
|
+
```
|
|
3203
|
+
import type {IsEqual} from 'type-fest';
|
|
3204
|
+
|
|
3205
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
3206
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
3207
|
+
type Includes<Value extends readonly any[], Item> =
|
|
3208
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
3209
|
+
? IsEqual<Value[0], Item> extends true
|
|
3210
|
+
? true
|
|
3211
|
+
: Includes<rest, Item>
|
|
3212
|
+
: false;
|
|
3213
|
+
```
|
|
3214
|
+
|
|
3215
|
+
@category Type Guard
|
|
3216
|
+
@category Utilities
|
|
3217
|
+
*/
|
|
3218
|
+
type IsEqual$2<A, B> =
|
|
3219
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
3220
|
+
(<G>() => G extends B ? 1 : 2)
|
|
3221
|
+
? true
|
|
3222
|
+
: false;
|
|
3223
|
+
|
|
3224
|
+
/**
|
|
3225
|
+
Filter out keys from an object.
|
|
3226
|
+
|
|
3227
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
3228
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
3229
|
+
Returns `Key` otherwise.
|
|
3230
|
+
|
|
3231
|
+
@example
|
|
3232
|
+
```
|
|
3233
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
3234
|
+
//=> never
|
|
3235
|
+
```
|
|
3236
|
+
|
|
3237
|
+
@example
|
|
3238
|
+
```
|
|
3239
|
+
type Filtered = Filter<'bar', string>;
|
|
3240
|
+
//=> never
|
|
3241
|
+
```
|
|
3242
|
+
|
|
3243
|
+
@example
|
|
3244
|
+
```
|
|
3245
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
3246
|
+
//=> 'bar'
|
|
3247
|
+
```
|
|
3248
|
+
|
|
3249
|
+
@see {Except}
|
|
3250
|
+
*/
|
|
3251
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3252
|
+
|
|
3253
|
+
type ExceptOptions$2 = {
|
|
3254
|
+
/**
|
|
3255
|
+
Disallow assigning non-specified properties.
|
|
3256
|
+
|
|
3257
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3258
|
+
|
|
3259
|
+
@default false
|
|
3260
|
+
*/
|
|
3261
|
+
requireExactProps?: boolean;
|
|
3262
|
+
};
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
Create a type from an object type without certain keys.
|
|
3266
|
+
|
|
3267
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
3268
|
+
|
|
3269
|
+
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.
|
|
3270
|
+
|
|
3271
|
+
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)).
|
|
3272
|
+
|
|
3273
|
+
@example
|
|
3274
|
+
```
|
|
3275
|
+
import type {Except} from 'type-fest';
|
|
3276
|
+
|
|
3277
|
+
type Foo = {
|
|
3278
|
+
a: number;
|
|
3279
|
+
b: string;
|
|
3280
|
+
};
|
|
3281
|
+
|
|
3282
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
3283
|
+
//=> {b: string}
|
|
3284
|
+
|
|
3285
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
3286
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
3287
|
+
|
|
3288
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
3289
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
3290
|
+
|
|
3291
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
3292
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
3293
|
+
```
|
|
3294
|
+
|
|
3295
|
+
@category Object
|
|
3296
|
+
*/
|
|
3297
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
3298
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
3299
|
+
} & (Options['requireExactProps'] extends true
|
|
3300
|
+
? Partial<Record<KeysType, never>>
|
|
3301
|
+
: {});
|
|
3302
|
+
|
|
3303
|
+
/**
|
|
3304
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
3305
|
+
|
|
3306
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
3307
|
+
|
|
3308
|
+
@example
|
|
3309
|
+
```
|
|
3310
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3311
|
+
|
|
3312
|
+
interface Example {
|
|
3313
|
+
a: string;
|
|
3314
|
+
b: string | number;
|
|
3315
|
+
c?: string;
|
|
3316
|
+
d: {};
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
3320
|
+
//=> 'a'
|
|
3321
|
+
```
|
|
3322
|
+
|
|
3323
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
3324
|
+
|
|
3325
|
+
@example
|
|
3326
|
+
```
|
|
3327
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3328
|
+
|
|
3329
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
3330
|
+
//=> 'a' | 'c'
|
|
3331
|
+
```
|
|
3332
|
+
|
|
3333
|
+
@category Object
|
|
3334
|
+
*/
|
|
3335
|
+
type ConditionalKeys$2<Base, Condition> = NonNullable<
|
|
3336
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
3337
|
+
{
|
|
3338
|
+
// Map through all the keys of the given base type.
|
|
3339
|
+
[Key in keyof Base]:
|
|
3340
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
3341
|
+
Base[Key] extends Condition
|
|
3342
|
+
// Retain this key since the condition passes.
|
|
3343
|
+
? Key
|
|
3344
|
+
// Discard this key since the condition fails.
|
|
3345
|
+
: never;
|
|
3346
|
+
|
|
3347
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
3348
|
+
}[keyof Base]
|
|
3349
|
+
>;
|
|
3350
|
+
|
|
3351
|
+
/**
|
|
3352
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
3353
|
+
|
|
3354
|
+
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.
|
|
3355
|
+
|
|
3356
|
+
@example
|
|
3357
|
+
```
|
|
3358
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3359
|
+
|
|
3360
|
+
class Awesome {
|
|
3361
|
+
name: string;
|
|
3362
|
+
successes: number;
|
|
3363
|
+
failures: bigint;
|
|
3364
|
+
|
|
3365
|
+
run() {}
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3369
|
+
//=> {run: () => void}
|
|
3370
|
+
```
|
|
3371
|
+
|
|
3372
|
+
@example
|
|
3373
|
+
```
|
|
3374
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3375
|
+
|
|
3376
|
+
interface Example {
|
|
3377
|
+
a: string;
|
|
3378
|
+
b: string | number;
|
|
3379
|
+
c: () => void;
|
|
3380
|
+
d: {};
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3384
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3385
|
+
```
|
|
3386
|
+
|
|
3387
|
+
@category Object
|
|
3388
|
+
*/
|
|
3389
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
3390
|
+
Base,
|
|
3391
|
+
ConditionalKeys$2<Base, Condition>
|
|
3392
|
+
>;
|
|
3393
|
+
|
|
3394
|
+
/**
|
|
3395
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3396
|
+
* can either be a REST module or a host module.
|
|
3397
|
+
* This type is recursive, so it can describe nested modules.
|
|
3398
|
+
*/
|
|
3399
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$5<any> | ServicePluginDefinition$2<any> | {
|
|
3400
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
3401
|
+
};
|
|
3402
|
+
/**
|
|
3403
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3404
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3405
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3406
|
+
* do not match the given host (as they will not work with the given host).
|
|
3407
|
+
*/
|
|
3408
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
3409
|
+
done: T;
|
|
3410
|
+
recurse: T extends {
|
|
3411
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
3412
|
+
} ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
|
|
3413
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
3414
|
+
-1,
|
|
3415
|
+
0,
|
|
3416
|
+
1,
|
|
3417
|
+
2,
|
|
3418
|
+
3,
|
|
3419
|
+
4,
|
|
3420
|
+
5
|
|
3421
|
+
][Depth]> : never;
|
|
3422
|
+
}, EmptyObject$2>;
|
|
3423
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3424
|
+
type PublicMetadata$2 = {
|
|
3425
|
+
PACKAGE_NAME?: string;
|
|
3426
|
+
};
|
|
3427
|
+
|
|
3428
|
+
declare global {
|
|
3429
|
+
interface ContextualClient {
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
/**
|
|
3433
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3434
|
+
* case a contextual client is available.
|
|
3435
|
+
*/
|
|
3436
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
3437
|
+
host: Host$2;
|
|
3438
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
3439
|
+
|
|
1826
3440
|
interface DraftPost$1 {
|
|
1827
3441
|
/**
|
|
1828
3442
|
* Draft post ID.
|
|
@@ -5140,7 +6754,7 @@ interface DraftPostsQueryBuilder {
|
|
|
5140
6754
|
find: () => Promise<DraftPostsQueryResult>;
|
|
5141
6755
|
}
|
|
5142
6756
|
|
|
5143
|
-
declare function createDraftPost$1(httpClient: HttpClient): CreateDraftPostSignature;
|
|
6757
|
+
declare function createDraftPost$1(httpClient: HttpClient$2): CreateDraftPostSignature;
|
|
5144
6758
|
interface CreateDraftPostSignature {
|
|
5145
6759
|
/**
|
|
5146
6760
|
* Creates a draft post.
|
|
@@ -5151,7 +6765,7 @@ interface CreateDraftPostSignature {
|
|
|
5151
6765
|
*/
|
|
5152
6766
|
(draftPost: DraftPost$1, options?: CreateDraftPostOptions | undefined): Promise<CreateDraftPostResponse & CreateDraftPostResponseNonNullableFields>;
|
|
5153
6767
|
}
|
|
5154
|
-
declare function bulkCreateDraftPosts$1(httpClient: HttpClient): BulkCreateDraftPostsSignature;
|
|
6768
|
+
declare function bulkCreateDraftPosts$1(httpClient: HttpClient$2): BulkCreateDraftPostsSignature;
|
|
5155
6769
|
interface BulkCreateDraftPostsSignature {
|
|
5156
6770
|
/**
|
|
5157
6771
|
* Creates multiple draft posts.
|
|
@@ -5160,7 +6774,7 @@ interface BulkCreateDraftPostsSignature {
|
|
|
5160
6774
|
*/
|
|
5161
6775
|
(draftPosts: DraftPost$1[], options?: BulkCreateDraftPostsOptions | undefined): Promise<BulkCreateDraftPostsResponse & BulkCreateDraftPostsResponseNonNullableFields>;
|
|
5162
6776
|
}
|
|
5163
|
-
declare function bulkUpdateDraftPosts$1(httpClient: HttpClient): BulkUpdateDraftPostsSignature;
|
|
6777
|
+
declare function bulkUpdateDraftPosts$1(httpClient: HttpClient$2): BulkUpdateDraftPostsSignature;
|
|
5164
6778
|
interface BulkUpdateDraftPostsSignature {
|
|
5165
6779
|
/**
|
|
5166
6780
|
* Updates multiple draft posts.
|
|
@@ -5168,7 +6782,7 @@ interface BulkUpdateDraftPostsSignature {
|
|
|
5168
6782
|
*/
|
|
5169
6783
|
(options?: BulkUpdateDraftPostsOptions | undefined): Promise<BulkUpdateDraftPostsResponse & BulkUpdateDraftPostsResponseNonNullableFields>;
|
|
5170
6784
|
}
|
|
5171
|
-
declare function listDeletedDraftPosts$1(httpClient: HttpClient): ListDeletedDraftPostsSignature;
|
|
6785
|
+
declare function listDeletedDraftPosts$1(httpClient: HttpClient$2): ListDeletedDraftPostsSignature;
|
|
5172
6786
|
interface ListDeletedDraftPostsSignature {
|
|
5173
6787
|
/**
|
|
5174
6788
|
* Retrieves a list of up to 100 deleted draft posts.
|
|
@@ -5181,7 +6795,7 @@ interface ListDeletedDraftPostsSignature {
|
|
|
5181
6795
|
*/
|
|
5182
6796
|
(options?: ListDeletedDraftPostsOptions | undefined): Promise<ListDeletedDraftPostsResponse & ListDeletedDraftPostsResponseNonNullableFields>;
|
|
5183
6797
|
}
|
|
5184
|
-
declare function getDraftPost$1(httpClient: HttpClient): GetDraftPostSignature;
|
|
6798
|
+
declare function getDraftPost$1(httpClient: HttpClient$2): GetDraftPostSignature;
|
|
5185
6799
|
interface GetDraftPostSignature {
|
|
5186
6800
|
/**
|
|
5187
6801
|
* Gets a draft post by the provided ID.
|
|
@@ -5192,7 +6806,7 @@ interface GetDraftPostSignature {
|
|
|
5192
6806
|
*/
|
|
5193
6807
|
(draftPostId: string, options?: GetDraftPostOptions | undefined): Promise<GetDraftPostResponse & GetDraftPostResponseNonNullableFields>;
|
|
5194
6808
|
}
|
|
5195
|
-
declare function updateDraftPost$1(httpClient: HttpClient): UpdateDraftPostSignature;
|
|
6809
|
+
declare function updateDraftPost$1(httpClient: HttpClient$2): UpdateDraftPostSignature;
|
|
5196
6810
|
interface UpdateDraftPostSignature {
|
|
5197
6811
|
/**
|
|
5198
6812
|
* Updates a draft post.
|
|
@@ -5202,7 +6816,7 @@ interface UpdateDraftPostSignature {
|
|
|
5202
6816
|
*/
|
|
5203
6817
|
(_id: string, draftPost: UpdateDraftPost, options?: UpdateDraftPostOptions | undefined): Promise<UpdateDraftPostResponse & UpdateDraftPostResponseNonNullableFields>;
|
|
5204
6818
|
}
|
|
5205
|
-
declare function deleteDraftPost$1(httpClient: HttpClient): DeleteDraftPostSignature;
|
|
6819
|
+
declare function deleteDraftPost$1(httpClient: HttpClient$2): DeleteDraftPostSignature;
|
|
5206
6820
|
interface DeleteDraftPostSignature {
|
|
5207
6821
|
/**
|
|
5208
6822
|
* Moves a draft post with the provided ID to the trash bin.
|
|
@@ -5214,7 +6828,7 @@ interface DeleteDraftPostSignature {
|
|
|
5214
6828
|
*/
|
|
5215
6829
|
(draftPostId: string, options?: DeleteDraftPostOptions | undefined): Promise<void>;
|
|
5216
6830
|
}
|
|
5217
|
-
declare function removeFromTrashBin$1(httpClient: HttpClient): RemoveFromTrashBinSignature;
|
|
6831
|
+
declare function removeFromTrashBin$1(httpClient: HttpClient$2): RemoveFromTrashBinSignature;
|
|
5218
6832
|
interface RemoveFromTrashBinSignature {
|
|
5219
6833
|
/**
|
|
5220
6834
|
* Permanently deletes a draft post by the provided ID from the trash bin.
|
|
@@ -5224,7 +6838,7 @@ interface RemoveFromTrashBinSignature {
|
|
|
5224
6838
|
*/
|
|
5225
6839
|
(draftPostId: string): Promise<void>;
|
|
5226
6840
|
}
|
|
5227
|
-
declare function bulkDeleteDraftPosts$1(httpClient: HttpClient): BulkDeleteDraftPostsSignature;
|
|
6841
|
+
declare function bulkDeleteDraftPosts$1(httpClient: HttpClient$2): BulkDeleteDraftPostsSignature;
|
|
5228
6842
|
interface BulkDeleteDraftPostsSignature {
|
|
5229
6843
|
/**
|
|
5230
6844
|
* Deletes multiple draft posts.
|
|
@@ -5233,7 +6847,7 @@ interface BulkDeleteDraftPostsSignature {
|
|
|
5233
6847
|
*/
|
|
5234
6848
|
(postIds: string[], options?: BulkDeleteDraftPostsOptions | undefined): Promise<BulkDeleteDraftPostsResponse & BulkDeleteDraftPostsResponseNonNullableFields>;
|
|
5235
6849
|
}
|
|
5236
|
-
declare function listDraftPosts$1(httpClient: HttpClient): ListDraftPostsSignature;
|
|
6850
|
+
declare function listDraftPosts$1(httpClient: HttpClient$2): ListDraftPostsSignature;
|
|
5237
6851
|
interface ListDraftPostsSignature {
|
|
5238
6852
|
/**
|
|
5239
6853
|
* Retrieves a list of up to 100 draft posts per request.
|
|
@@ -5246,7 +6860,7 @@ interface ListDraftPostsSignature {
|
|
|
5246
6860
|
*/
|
|
5247
6861
|
(options?: ListDraftPostsOptions | undefined): Promise<ListDraftPostsResponse & ListDraftPostsResponseNonNullableFields>;
|
|
5248
6862
|
}
|
|
5249
|
-
declare function getDeletedDraftPost$1(httpClient: HttpClient): GetDeletedDraftPostSignature;
|
|
6863
|
+
declare function getDeletedDraftPost$1(httpClient: HttpClient$2): GetDeletedDraftPostSignature;
|
|
5250
6864
|
interface GetDeletedDraftPostSignature {
|
|
5251
6865
|
/**
|
|
5252
6866
|
* Gets a deleted draft post from the trash bin by the provided ID.
|
|
@@ -5256,7 +6870,7 @@ interface GetDeletedDraftPostSignature {
|
|
|
5256
6870
|
*/
|
|
5257
6871
|
(draftPostId: string): Promise<GetDeletedDraftPostResponse & GetDeletedDraftPostResponseNonNullableFields>;
|
|
5258
6872
|
}
|
|
5259
|
-
declare function restoreFromTrashBin$1(httpClient: HttpClient): RestoreFromTrashBinSignature;
|
|
6873
|
+
declare function restoreFromTrashBin$1(httpClient: HttpClient$2): RestoreFromTrashBinSignature;
|
|
5260
6874
|
interface RestoreFromTrashBinSignature {
|
|
5261
6875
|
/**
|
|
5262
6876
|
* Restores a deleted draft post from the trash bin by the provided ID.
|
|
@@ -5266,7 +6880,7 @@ interface RestoreFromTrashBinSignature {
|
|
|
5266
6880
|
*/
|
|
5267
6881
|
(draftPostId: string): Promise<RestoreFromTrashBinResponse & RestoreFromTrashBinResponseNonNullableFields>;
|
|
5268
6882
|
}
|
|
5269
|
-
declare function queryDraftPosts$1(httpClient: HttpClient): QueryDraftPostsSignature;
|
|
6883
|
+
declare function queryDraftPosts$1(httpClient: HttpClient$2): QueryDraftPostsSignature;
|
|
5270
6884
|
interface QueryDraftPostsSignature {
|
|
5271
6885
|
/**
|
|
5272
6886
|
* Retrieves a list of up to 100 draft posts, given the provided paging, filtering, and sorting.
|
|
@@ -5279,7 +6893,7 @@ interface QueryDraftPostsSignature {
|
|
|
5279
6893
|
*/
|
|
5280
6894
|
(options?: QueryDraftPostsOptions | undefined): DraftPostsQueryBuilder;
|
|
5281
6895
|
}
|
|
5282
|
-
declare function publishDraftPost$1(httpClient: HttpClient): PublishDraftPostSignature;
|
|
6896
|
+
declare function publishDraftPost$1(httpClient: HttpClient$2): PublishDraftPostSignature;
|
|
5283
6897
|
interface PublishDraftPostSignature {
|
|
5284
6898
|
/**
|
|
5285
6899
|
* Publishes a specified draft post by ID. This creates a new post entity with the data from the draft post.
|
|
@@ -5289,26 +6903,44 @@ interface PublishDraftPostSignature {
|
|
|
5289
6903
|
*/
|
|
5290
6904
|
(draftPostId: string): Promise<PublishDraftPostResponse & PublishDraftPostResponseNonNullableFields>;
|
|
5291
6905
|
}
|
|
5292
|
-
declare const onDraftCreated$1: EventDefinition<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
|
|
5293
|
-
declare const onDraftUpdated$1: EventDefinition<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
|
|
5294
|
-
declare const onDraftDeleted$1: EventDefinition<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
declare
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
declare
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
6906
|
+
declare const onDraftCreated$1: EventDefinition$5<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
|
|
6907
|
+
declare const onDraftUpdated$1: EventDefinition$5<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
|
|
6908
|
+
declare const onDraftDeleted$1: EventDefinition$5<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
|
|
6909
|
+
|
|
6910
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
6911
|
+
__type: 'event-definition';
|
|
6912
|
+
type: Type;
|
|
6913
|
+
isDomainEvent?: boolean;
|
|
6914
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6915
|
+
__payload: Payload;
|
|
6916
|
+
};
|
|
6917
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
6918
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
6919
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
6920
|
+
|
|
6921
|
+
declare global {
|
|
6922
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6923
|
+
interface SymbolConstructor {
|
|
6924
|
+
readonly observable: symbol;
|
|
6925
|
+
}
|
|
6926
|
+
}
|
|
6927
|
+
|
|
6928
|
+
declare function createEventModule$2<T extends EventDefinition$4<any, string>>(eventDefinition: T): BuildEventDefinition$4<T> & T;
|
|
6929
|
+
|
|
6930
|
+
declare const createDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof createDraftPost$1> & typeof createDraftPost$1>;
|
|
6931
|
+
declare const bulkCreateDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkCreateDraftPosts$1> & typeof bulkCreateDraftPosts$1>;
|
|
6932
|
+
declare const bulkUpdateDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkUpdateDraftPosts$1> & typeof bulkUpdateDraftPosts$1>;
|
|
6933
|
+
declare const listDeletedDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof listDeletedDraftPosts$1> & typeof listDeletedDraftPosts$1>;
|
|
6934
|
+
declare const getDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof getDraftPost$1> & typeof getDraftPost$1>;
|
|
6935
|
+
declare const updateDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof updateDraftPost$1> & typeof updateDraftPost$1>;
|
|
6936
|
+
declare const deleteDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof deleteDraftPost$1> & typeof deleteDraftPost$1>;
|
|
6937
|
+
declare const removeFromTrashBin: MaybeContext$2<BuildRESTFunction$2<typeof removeFromTrashBin$1> & typeof removeFromTrashBin$1>;
|
|
6938
|
+
declare const bulkDeleteDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkDeleteDraftPosts$1> & typeof bulkDeleteDraftPosts$1>;
|
|
6939
|
+
declare const listDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof listDraftPosts$1> & typeof listDraftPosts$1>;
|
|
6940
|
+
declare const getDeletedDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof getDeletedDraftPost$1> & typeof getDeletedDraftPost$1>;
|
|
6941
|
+
declare const restoreFromTrashBin: MaybeContext$2<BuildRESTFunction$2<typeof restoreFromTrashBin$1> & typeof restoreFromTrashBin$1>;
|
|
6942
|
+
declare const queryDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof queryDraftPosts$1> & typeof queryDraftPosts$1>;
|
|
6943
|
+
declare const publishDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof publishDraftPost$1> & typeof publishDraftPost$1>;
|
|
5312
6944
|
|
|
5313
6945
|
type _publicOnDraftCreatedType = typeof onDraftCreated$1;
|
|
5314
6946
|
/**
|
|
@@ -5453,6 +7085,416 @@ declare namespace index_d$2 {
|
|
|
5453
7085
|
export { index_d$2_Action as Action, type ActionEvent$2 as ActionEvent, 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 index_d$2_ApproveDraftPostRequest as ApproveDraftPostRequest, type index_d$2_ApproveDraftPostResponse as ApproveDraftPostResponse, type AudioData$1 as AudioData, type Background$1 as Background, type BackgroundBackgroundOneOf$1 as BackgroundBackgroundOneOf, BackgroundType$1 as BackgroundType, type BaseEventMetadata$2 as BaseEventMetadata, type BlockquoteData$1 as BlockquoteData, type BlogPaging$1 as BlogPaging, type BookingData$1 as BookingData, type Border$1 as Border, type BorderColors$1 as BorderColors, type BulkActionMetadata$1 as BulkActionMetadata, type index_d$2_BulkCreateDraftPostsOptions as BulkCreateDraftPostsOptions, type index_d$2_BulkCreateDraftPostsRequest as BulkCreateDraftPostsRequest, type index_d$2_BulkCreateDraftPostsResponse as BulkCreateDraftPostsResponse, type index_d$2_BulkCreateDraftPostsResponseNonNullableFields as BulkCreateDraftPostsResponseNonNullableFields, type index_d$2_BulkDeleteDraftPostsOptions as BulkDeleteDraftPostsOptions, type index_d$2_BulkDeleteDraftPostsRequest as BulkDeleteDraftPostsRequest, type index_d$2_BulkDeleteDraftPostsResponse as BulkDeleteDraftPostsResponse, type index_d$2_BulkDeleteDraftPostsResponseNonNullableFields as BulkDeleteDraftPostsResponseNonNullableFields, type index_d$2_BulkDraftPostResult as BulkDraftPostResult, type index_d$2_BulkRejectDraftPostRequest as BulkRejectDraftPostRequest, type index_d$2_BulkRejectDraftPostResponse as BulkRejectDraftPostResponse, type index_d$2_BulkRevertToUnpublishedRequest as BulkRevertToUnpublishedRequest, type index_d$2_BulkRevertToUnpublishedResponse as BulkRevertToUnpublishedResponse, type index_d$2_BulkUpdateDraftPostLanguageRequest as BulkUpdateDraftPostLanguageRequest, type index_d$2_BulkUpdateDraftPostLanguageResponse as BulkUpdateDraftPostLanguageResponse, type index_d$2_BulkUpdateDraftPostsOptions as BulkUpdateDraftPostsOptions, type index_d$2_BulkUpdateDraftPostsRequest as BulkUpdateDraftPostsRequest, type index_d$2_BulkUpdateDraftPostsResponse as BulkUpdateDraftPostsResponse, type index_d$2_BulkUpdateDraftPostsResponseNonNullableFields as BulkUpdateDraftPostsResponseNonNullableFields, type BulletedListData$1 as BulletedListData, type ButtonData$1 as ButtonData, index_d$2_ButtonDataType as ButtonDataType, type Category$1 as Category, type CategoryTranslation$1 as CategoryTranslation, 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, type CoverMedia$1 as CoverMedia, type CoverMediaMediaOneOf$1 as CoverMediaMediaOneOf, type index_d$2_CreateDraftPostOptions as CreateDraftPostOptions, type index_d$2_CreateDraftPostRequest as CreateDraftPostRequest, type index_d$2_CreateDraftPostResponse as CreateDraftPostResponse, type index_d$2_CreateDraftPostResponseNonNullableFields as CreateDraftPostResponseNonNullableFields, Crop$1 as Crop, type CursorPaging$2 as CursorPaging, type Cursors$2 as Cursors, type Decoration$1 as Decoration, type DecorationDataOneOf$1 as DecorationDataOneOf, DecorationType$1 as DecorationType, type index_d$2_DeleteDraftPostOptions as DeleteDraftPostOptions, type index_d$2_DeleteDraftPostRequest as DeleteDraftPostRequest, type index_d$2_DeleteDraftPostResponse as DeleteDraftPostResponse, 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 DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type index_d$2_DraftCreatedEnvelope as DraftCreatedEnvelope, type index_d$2_DraftDeletedEnvelope as DraftDeletedEnvelope, type DraftPost$1 as DraftPost, type index_d$2_DraftPostOwnerChanged as DraftPostOwnerChanged, type DraftPostTranslation$1 as DraftPostTranslation, type index_d$2_DraftPostsQueryBuilder as DraftPostsQueryBuilder, type index_d$2_DraftPostsQueryResult as DraftPostsQueryResult, type index_d$2_DraftUpdatedEnvelope as DraftUpdatedEnvelope, type EmbedData$1 as EmbedData, type EmbedMedia$1 as EmbedMedia, type EmbedThumbnail$1 as EmbedThumbnail, type EmbedVideo$1 as EmbedVideo, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventData$1 as EventData, type EventMetadata$2 as EventMetadata, Field$2 as Field, type FileData$1 as FileData, type FileSource$1 as FileSource, type FileSourceDataOneOf$1 as FileSourceDataOneOf, type FontSizeData$1 as FontSizeData, FontType$1 as FontType, type GIF$1 as GIF, type GIFData$1 as GIFData, type GalleryData$1 as GalleryData, type GalleryOptions$1 as GalleryOptions, type index_d$2_GetDeletedDraftPostRequest as GetDeletedDraftPostRequest, type index_d$2_GetDeletedDraftPostResponse as GetDeletedDraftPostResponse, type index_d$2_GetDeletedDraftPostResponseNonNullableFields as GetDeletedDraftPostResponseNonNullableFields, type index_d$2_GetDraftPostOptions as GetDraftPostOptions, type index_d$2_GetDraftPostRequest as GetDraftPostRequest, type index_d$2_GetDraftPostResponse as GetDraftPostResponse, type index_d$2_GetDraftPostResponseNonNullableFields as GetDraftPostResponseNonNullableFields, type index_d$2_GetDraftPostTotalsRequest as GetDraftPostTotalsRequest, type index_d$2_GetDraftPostTotalsResponse as GetDraftPostTotalsResponse, index_d$2_GetDraftPostsSort as GetDraftPostsSort, type index_d$2_GetPostAmountsByLanguageRequest as GetPostAmountsByLanguageRequest, type index_d$2_GetPostAmountsByLanguageResponse as GetPostAmountsByLanguageResponse, 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 IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type Image$1 as Image, type ImageData$1 as ImageData, type index_d$2_InitialDraftPostsCopied as InitialDraftPostsCopied, InitialExpandedItems$1 as InitialExpandedItems, type index_d$2_IsDraftPostAutoTranslatableRequest as IsDraftPostAutoTranslatableRequest, type index_d$2_IsDraftPostAutoTranslatableResponse as IsDraftPostAutoTranslatableResponse, type Item$1 as Item, type ItemDataOneOf$1 as ItemDataOneOf, type ItemMetadata$1 as ItemMetadata, type ItemStyle$1 as ItemStyle, type Keyword$2 as Keyword, 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 index_d$2_ListDeletedDraftPostsOptions as ListDeletedDraftPostsOptions, type index_d$2_ListDeletedDraftPostsRequest as ListDeletedDraftPostsRequest, type index_d$2_ListDeletedDraftPostsResponse as ListDeletedDraftPostsResponse, type index_d$2_ListDeletedDraftPostsResponseNonNullableFields as ListDeletedDraftPostsResponseNonNullableFields, type index_d$2_ListDraftPostsOptions as ListDraftPostsOptions, type index_d$2_ListDraftPostsRequest as ListDraftPostsRequest, type index_d$2_ListDraftPostsResponse as ListDraftPostsResponse, type index_d$2_ListDraftPostsResponseNonNullableFields as ListDraftPostsResponseNonNullableFields, type ListValue$1 as ListValue, type MapData$1 as MapData, type MapSettings$1 as MapSettings, MapType$1 as MapType, type index_d$2_MarkPostAsInModerationRequest as MarkPostAsInModerationRequest, type index_d$2_MarkPostAsInModerationResponse as MarkPostAsInModerationResponse, type index_d$2_MaskedDraftPosts as MaskedDraftPosts, type Media$1 as Media, type MediaMediaOneOf$1 as MediaMediaOneOf, type MentionData$1 as MentionData, type MessageEnvelope$2 as MessageEnvelope, type MetaData$2 as MetaData, type Metadata$1 as Metadata, type ModerationDetails$1 as ModerationDetails, ModerationStatusStatus$1 as ModerationStatusStatus, type Node$1 as Node, type NodeDataOneOf$1 as NodeDataOneOf, type NodeStyle$1 as NodeStyle, NodeType$1 as NodeType, 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, Origin$1 as Origin, type PDFSettings$1 as PDFSettings, type Paging$2 as Paging, type PagingMetadataV2$2 as PagingMetadataV2, type ParagraphData$1 as ParagraphData, type Permissions$1 as Permissions, type PlatformQuery$2 as PlatformQuery, type PlatformQueryPagingMethodOneOf$2 as PlatformQueryPagingMethodOneOf, 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 PollSettings$1 as PollSettings, type index_d$2_PostAmountByLanguage as PostAmountByLanguage, type index_d$2_PublishDraftPostRequest as PublishDraftPostRequest, type index_d$2_PublishDraftPostResponse as PublishDraftPostResponse, type index_d$2_PublishDraftPostResponseNonNullableFields as PublishDraftPostResponseNonNullableFields, type index_d$2_QueryDraftPostsOptions as QueryDraftPostsOptions, type index_d$2_QueryDraftPostsRequest as QueryDraftPostsRequest, type index_d$2_QueryDraftPostsResponse as QueryDraftPostsResponse, type index_d$2_QueryDraftPostsResponseNonNullableFields as QueryDraftPostsResponseNonNullableFields, type index_d$2_RejectDraftPostRequest as RejectDraftPostRequest, type index_d$2_RejectDraftPostResponse as RejectDraftPostResponse, type Rel$1 as Rel, type index_d$2_RemoveFromTrashBinRequest as RemoveFromTrashBinRequest, type index_d$2_RemoveFromTrashBinResponse as RemoveFromTrashBinResponse, type index_d$2_RestoreFromTrashBinRequest as RestoreFromTrashBinRequest, type index_d$2_RestoreFromTrashBinResponse as RestoreFromTrashBinResponse, type index_d$2_RestoreFromTrashBinResponseNonNullableFields as RestoreFromTrashBinResponseNonNullableFields, type RestoreInfo$2 as RestoreInfo, type index_d$2_RevertToUnpublishedRequest as RevertToUnpublishedRequest, type index_d$2_RevertToUnpublishedResponse as RevertToUnpublishedResponse, type RichContent$1 as RichContent, type SeoSchema$2 as SeoSchema, type Settings$2 as Settings, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, Source$1 as Source, type Spoiler$1 as Spoiler, type SpoilerData$1 as SpoilerData, Status$1 as Status, type Styles$1 as Styles, type TableCellData$1 as TableCellData, type TableData$1 as TableData, type Tag$2 as Tag, Target$1 as Target, TextAlignment$1 as TextAlignment, type TextData$1 as TextData, type TextNodeStyle$1 as TextNodeStyle, type TextStyle$1 as TextStyle, type Thumbnails$1 as Thumbnails, ThumbnailsAlignment$1 as ThumbnailsAlignment, type index_d$2_TotalDraftPosts as TotalDraftPosts, index_d$2_TotalDraftPostsGroupingField as TotalDraftPostsGroupingField, type index_d$2_TranslateCategoryRequest as TranslateCategoryRequest, type index_d$2_TranslateCategoryResponse as TranslateCategoryResponse, type index_d$2_TranslateDraftRequest as TranslateDraftRequest, type index_d$2_TranslateDraftResponse as TranslateDraftResponse, Type$1 as Type, type index_d$2_UnpublishPostRequest as UnpublishPostRequest, type index_d$2_UnpublishPostResponse as UnpublishPostResponse, type index_d$2_UpdateDraftPost as UpdateDraftPost, type index_d$2_UpdateDraftPostContentRequest as UpdateDraftPostContentRequest, type index_d$2_UpdateDraftPostContentRequestDraftContentOneOf as UpdateDraftPostContentRequestDraftContentOneOf, type index_d$2_UpdateDraftPostContentResponse as UpdateDraftPostContentResponse, type index_d$2_UpdateDraftPostLanguageRequest as UpdateDraftPostLanguageRequest, type index_d$2_UpdateDraftPostLanguageResponse as UpdateDraftPostLanguageResponse, type index_d$2_UpdateDraftPostOptions as UpdateDraftPostOptions, type index_d$2_UpdateDraftPostRequest as UpdateDraftPostRequest, type index_d$2_UpdateDraftPostResponse as UpdateDraftPostResponse, type index_d$2_UpdateDraftPostResponseNonNullableFields as UpdateDraftPostResponseNonNullableFields, type V1Media$1 as V1Media, VerticalAlignment$1 as VerticalAlignment, type Video$1 as Video, type VideoData$1 as VideoData, type VideoResolution$1 as VideoResolution, ViewMode$1 as ViewMode, ViewRole$1 as ViewRole, VoteRole$1 as VoteRole, WebhookIdentityType$2 as WebhookIdentityType, Width$1 as Width, WidthType$1 as WidthType, type WixMedia$1 as WixMedia, type index_d$2__publicOnDraftCreatedType as _publicOnDraftCreatedType, type index_d$2__publicOnDraftDeletedType as _publicOnDraftDeletedType, type index_d$2__publicOnDraftUpdatedType as _publicOnDraftUpdatedType, index_d$2_bulkCreateDraftPosts as bulkCreateDraftPosts, index_d$2_bulkDeleteDraftPosts as bulkDeleteDraftPosts, index_d$2_bulkUpdateDraftPosts as bulkUpdateDraftPosts, index_d$2_createDraftPost as createDraftPost, index_d$2_deleteDraftPost as deleteDraftPost, index_d$2_getDeletedDraftPost as getDeletedDraftPost, index_d$2_getDraftPost as getDraftPost, index_d$2_listDeletedDraftPosts as listDeletedDraftPosts, index_d$2_listDraftPosts as listDraftPosts, index_d$2_onDraftCreated as onDraftCreated, index_d$2_onDraftDeleted as onDraftDeleted, index_d$2_onDraftUpdated as onDraftUpdated, onDraftCreated$1 as publicOnDraftCreated, onDraftDeleted$1 as publicOnDraftDeleted, onDraftUpdated$1 as publicOnDraftUpdated, index_d$2_publishDraftPost as publishDraftPost, index_d$2_queryDraftPosts as queryDraftPosts, index_d$2_removeFromTrashBin as removeFromTrashBin, index_d$2_restoreFromTrashBin as restoreFromTrashBin, index_d$2_updateDraftPost as updateDraftPost };
|
|
5454
7086
|
}
|
|
5455
7087
|
|
|
7088
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
7089
|
+
__type: 'host';
|
|
7090
|
+
create(host: H): T;
|
|
7091
|
+
};
|
|
7092
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
7093
|
+
type Host$1<Environment = unknown> = {
|
|
7094
|
+
channel: {
|
|
7095
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
7096
|
+
disconnect: () => void;
|
|
7097
|
+
} | Promise<{
|
|
7098
|
+
disconnect: () => void;
|
|
7099
|
+
}>;
|
|
7100
|
+
};
|
|
7101
|
+
environment?: Environment;
|
|
7102
|
+
/**
|
|
7103
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
7104
|
+
*/
|
|
7105
|
+
apiBaseUrl?: string;
|
|
7106
|
+
/**
|
|
7107
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
7108
|
+
* like internationalization, billing, etc.
|
|
7109
|
+
*/
|
|
7110
|
+
essentials?: {
|
|
7111
|
+
/**
|
|
7112
|
+
* The language of the currently viewed session
|
|
7113
|
+
*/
|
|
7114
|
+
language?: string;
|
|
7115
|
+
/**
|
|
7116
|
+
* The locale of the currently viewed session
|
|
7117
|
+
*/
|
|
7118
|
+
locale?: string;
|
|
7119
|
+
/**
|
|
7120
|
+
* Any headers that should be passed through to the API requests
|
|
7121
|
+
*/
|
|
7122
|
+
passThroughHeaders?: Record<string, string>;
|
|
7123
|
+
};
|
|
7124
|
+
};
|
|
7125
|
+
|
|
7126
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
7127
|
+
interface HttpClient$1 {
|
|
7128
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
7129
|
+
fetchWithAuth: typeof fetch;
|
|
7130
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
7131
|
+
getActiveToken?: () => string | undefined;
|
|
7132
|
+
}
|
|
7133
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
7134
|
+
type HttpResponse$1<T = any> = {
|
|
7135
|
+
data: T;
|
|
7136
|
+
status: number;
|
|
7137
|
+
statusText: string;
|
|
7138
|
+
headers: any;
|
|
7139
|
+
request?: any;
|
|
7140
|
+
};
|
|
7141
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
7142
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
7143
|
+
url: string;
|
|
7144
|
+
data?: Data;
|
|
7145
|
+
params?: URLSearchParams;
|
|
7146
|
+
} & APIMetadata$1;
|
|
7147
|
+
type APIMetadata$1 = {
|
|
7148
|
+
methodFqn?: string;
|
|
7149
|
+
entityFqdn?: string;
|
|
7150
|
+
packageName?: string;
|
|
7151
|
+
};
|
|
7152
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
7153
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
7154
|
+
__type: 'event-definition';
|
|
7155
|
+
type: Type;
|
|
7156
|
+
isDomainEvent?: boolean;
|
|
7157
|
+
transformations?: (envelope: unknown) => Payload;
|
|
7158
|
+
__payload: Payload;
|
|
7159
|
+
};
|
|
7160
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
7161
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
7162
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
7163
|
+
|
|
7164
|
+
type ServicePluginMethodInput$1 = {
|
|
7165
|
+
request: any;
|
|
7166
|
+
metadata: any;
|
|
7167
|
+
};
|
|
7168
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
7169
|
+
type ServicePluginMethodMetadata$1 = {
|
|
7170
|
+
name: string;
|
|
7171
|
+
primaryHttpMappingPath: string;
|
|
7172
|
+
transformations: {
|
|
7173
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
7174
|
+
toREST: (...args: unknown[]) => unknown;
|
|
7175
|
+
};
|
|
7176
|
+
};
|
|
7177
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
7178
|
+
__type: 'service-plugin-definition';
|
|
7179
|
+
componentType: string;
|
|
7180
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
7181
|
+
__contract: Contract;
|
|
7182
|
+
};
|
|
7183
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
7184
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
7185
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
7186
|
+
|
|
7187
|
+
type RequestContext$1 = {
|
|
7188
|
+
isSSR: boolean;
|
|
7189
|
+
host: string;
|
|
7190
|
+
protocol?: string;
|
|
7191
|
+
};
|
|
7192
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
7193
|
+
/**
|
|
7194
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
7195
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
7196
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
7197
|
+
*/
|
|
7198
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
7199
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
7200
|
+
_?: T;
|
|
7201
|
+
url?: string;
|
|
7202
|
+
method?: Method$1;
|
|
7203
|
+
params?: any;
|
|
7204
|
+
data?: any;
|
|
7205
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
7206
|
+
};
|
|
7207
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
7208
|
+
__isAmbassador: boolean;
|
|
7209
|
+
};
|
|
7210
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
7211
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
7212
|
+
|
|
7213
|
+
declare global {
|
|
7214
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
7215
|
+
interface SymbolConstructor {
|
|
7216
|
+
readonly observable: symbol;
|
|
7217
|
+
}
|
|
7218
|
+
}
|
|
7219
|
+
|
|
7220
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
7221
|
+
|
|
7222
|
+
/**
|
|
7223
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
7224
|
+
|
|
7225
|
+
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)).
|
|
7226
|
+
|
|
7227
|
+
@example
|
|
7228
|
+
```
|
|
7229
|
+
import type {EmptyObject} from 'type-fest';
|
|
7230
|
+
|
|
7231
|
+
// The following illustrates the problem with `{}`.
|
|
7232
|
+
const foo1: {} = {}; // Pass
|
|
7233
|
+
const foo2: {} = []; // Pass
|
|
7234
|
+
const foo3: {} = 42; // Pass
|
|
7235
|
+
const foo4: {} = {a: 1}; // Pass
|
|
7236
|
+
|
|
7237
|
+
// With `EmptyObject` only the first case is valid.
|
|
7238
|
+
const bar1: EmptyObject = {}; // Pass
|
|
7239
|
+
const bar2: EmptyObject = 42; // Fail
|
|
7240
|
+
const bar3: EmptyObject = []; // Fail
|
|
7241
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
7242
|
+
```
|
|
7243
|
+
|
|
7244
|
+
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}.
|
|
7245
|
+
|
|
7246
|
+
@category Object
|
|
7247
|
+
*/
|
|
7248
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
7249
|
+
|
|
7250
|
+
/**
|
|
7251
|
+
Returns a boolean for whether the two given types are equal.
|
|
7252
|
+
|
|
7253
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
7254
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
7255
|
+
|
|
7256
|
+
Use-cases:
|
|
7257
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
7258
|
+
|
|
7259
|
+
@example
|
|
7260
|
+
```
|
|
7261
|
+
import type {IsEqual} from 'type-fest';
|
|
7262
|
+
|
|
7263
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
7264
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
7265
|
+
type Includes<Value extends readonly any[], Item> =
|
|
7266
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
7267
|
+
? IsEqual<Value[0], Item> extends true
|
|
7268
|
+
? true
|
|
7269
|
+
: Includes<rest, Item>
|
|
7270
|
+
: false;
|
|
7271
|
+
```
|
|
7272
|
+
|
|
7273
|
+
@category Type Guard
|
|
7274
|
+
@category Utilities
|
|
7275
|
+
*/
|
|
7276
|
+
type IsEqual$1<A, B> =
|
|
7277
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
7278
|
+
(<G>() => G extends B ? 1 : 2)
|
|
7279
|
+
? true
|
|
7280
|
+
: false;
|
|
7281
|
+
|
|
7282
|
+
/**
|
|
7283
|
+
Filter out keys from an object.
|
|
7284
|
+
|
|
7285
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
7286
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
7287
|
+
Returns `Key` otherwise.
|
|
7288
|
+
|
|
7289
|
+
@example
|
|
7290
|
+
```
|
|
7291
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
7292
|
+
//=> never
|
|
7293
|
+
```
|
|
7294
|
+
|
|
7295
|
+
@example
|
|
7296
|
+
```
|
|
7297
|
+
type Filtered = Filter<'bar', string>;
|
|
7298
|
+
//=> never
|
|
7299
|
+
```
|
|
7300
|
+
|
|
7301
|
+
@example
|
|
7302
|
+
```
|
|
7303
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
7304
|
+
//=> 'bar'
|
|
7305
|
+
```
|
|
7306
|
+
|
|
7307
|
+
@see {Except}
|
|
7308
|
+
*/
|
|
7309
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
7310
|
+
|
|
7311
|
+
type ExceptOptions$1 = {
|
|
7312
|
+
/**
|
|
7313
|
+
Disallow assigning non-specified properties.
|
|
7314
|
+
|
|
7315
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
7316
|
+
|
|
7317
|
+
@default false
|
|
7318
|
+
*/
|
|
7319
|
+
requireExactProps?: boolean;
|
|
7320
|
+
};
|
|
7321
|
+
|
|
7322
|
+
/**
|
|
7323
|
+
Create a type from an object type without certain keys.
|
|
7324
|
+
|
|
7325
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
7326
|
+
|
|
7327
|
+
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.
|
|
7328
|
+
|
|
7329
|
+
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)).
|
|
7330
|
+
|
|
7331
|
+
@example
|
|
7332
|
+
```
|
|
7333
|
+
import type {Except} from 'type-fest';
|
|
7334
|
+
|
|
7335
|
+
type Foo = {
|
|
7336
|
+
a: number;
|
|
7337
|
+
b: string;
|
|
7338
|
+
};
|
|
7339
|
+
|
|
7340
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
7341
|
+
//=> {b: string}
|
|
7342
|
+
|
|
7343
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
7344
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
7345
|
+
|
|
7346
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
7347
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
7348
|
+
|
|
7349
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
7350
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
7351
|
+
```
|
|
7352
|
+
|
|
7353
|
+
@category Object
|
|
7354
|
+
*/
|
|
7355
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
7356
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
7357
|
+
} & (Options['requireExactProps'] extends true
|
|
7358
|
+
? Partial<Record<KeysType, never>>
|
|
7359
|
+
: {});
|
|
7360
|
+
|
|
7361
|
+
/**
|
|
7362
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
7363
|
+
|
|
7364
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
7365
|
+
|
|
7366
|
+
@example
|
|
7367
|
+
```
|
|
7368
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7369
|
+
|
|
7370
|
+
interface Example {
|
|
7371
|
+
a: string;
|
|
7372
|
+
b: string | number;
|
|
7373
|
+
c?: string;
|
|
7374
|
+
d: {};
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
7378
|
+
//=> 'a'
|
|
7379
|
+
```
|
|
7380
|
+
|
|
7381
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
7382
|
+
|
|
7383
|
+
@example
|
|
7384
|
+
```
|
|
7385
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7386
|
+
|
|
7387
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
7388
|
+
//=> 'a' | 'c'
|
|
7389
|
+
```
|
|
7390
|
+
|
|
7391
|
+
@category Object
|
|
7392
|
+
*/
|
|
7393
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
7394
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
7395
|
+
{
|
|
7396
|
+
// Map through all the keys of the given base type.
|
|
7397
|
+
[Key in keyof Base]:
|
|
7398
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
7399
|
+
Base[Key] extends Condition
|
|
7400
|
+
// Retain this key since the condition passes.
|
|
7401
|
+
? Key
|
|
7402
|
+
// Discard this key since the condition fails.
|
|
7403
|
+
: never;
|
|
7404
|
+
|
|
7405
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
7406
|
+
}[keyof Base]
|
|
7407
|
+
>;
|
|
7408
|
+
|
|
7409
|
+
/**
|
|
7410
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
7411
|
+
|
|
7412
|
+
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.
|
|
7413
|
+
|
|
7414
|
+
@example
|
|
7415
|
+
```
|
|
7416
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
7417
|
+
|
|
7418
|
+
class Awesome {
|
|
7419
|
+
name: string;
|
|
7420
|
+
successes: number;
|
|
7421
|
+
failures: bigint;
|
|
7422
|
+
|
|
7423
|
+
run() {}
|
|
7424
|
+
}
|
|
7425
|
+
|
|
7426
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
7427
|
+
//=> {run: () => void}
|
|
7428
|
+
```
|
|
7429
|
+
|
|
7430
|
+
@example
|
|
7431
|
+
```
|
|
7432
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
7433
|
+
|
|
7434
|
+
interface Example {
|
|
7435
|
+
a: string;
|
|
7436
|
+
b: string | number;
|
|
7437
|
+
c: () => void;
|
|
7438
|
+
d: {};
|
|
7439
|
+
}
|
|
7440
|
+
|
|
7441
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
7442
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
7443
|
+
```
|
|
7444
|
+
|
|
7445
|
+
@category Object
|
|
7446
|
+
*/
|
|
7447
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
7448
|
+
Base,
|
|
7449
|
+
ConditionalKeys$1<Base, Condition>
|
|
7450
|
+
>;
|
|
7451
|
+
|
|
7452
|
+
/**
|
|
7453
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
7454
|
+
* can either be a REST module or a host module.
|
|
7455
|
+
* This type is recursive, so it can describe nested modules.
|
|
7456
|
+
*/
|
|
7457
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$3<any> | ServicePluginDefinition$1<any> | {
|
|
7458
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
7459
|
+
};
|
|
7460
|
+
/**
|
|
7461
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
7462
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
7463
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
7464
|
+
* do not match the given host (as they will not work with the given host).
|
|
7465
|
+
*/
|
|
7466
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
7467
|
+
done: T;
|
|
7468
|
+
recurse: T extends {
|
|
7469
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
7470
|
+
} ? 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<{
|
|
7471
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
7472
|
+
-1,
|
|
7473
|
+
0,
|
|
7474
|
+
1,
|
|
7475
|
+
2,
|
|
7476
|
+
3,
|
|
7477
|
+
4,
|
|
7478
|
+
5
|
|
7479
|
+
][Depth]> : never;
|
|
7480
|
+
}, EmptyObject$1>;
|
|
7481
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
7482
|
+
type PublicMetadata$1 = {
|
|
7483
|
+
PACKAGE_NAME?: string;
|
|
7484
|
+
};
|
|
7485
|
+
|
|
7486
|
+
declare global {
|
|
7487
|
+
interface ContextualClient {
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
/**
|
|
7491
|
+
* A type used to create concerete types from SDK descriptors in
|
|
7492
|
+
* case a contextual client is available.
|
|
7493
|
+
*/
|
|
7494
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
7495
|
+
host: Host$1;
|
|
7496
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
7497
|
+
|
|
5456
7498
|
interface Post {
|
|
5457
7499
|
/**
|
|
5458
7500
|
* Post ID.
|
|
@@ -8934,7 +10976,7 @@ interface GetTotalPostsOptions {
|
|
|
8934
10976
|
language?: string | null;
|
|
8935
10977
|
}
|
|
8936
10978
|
|
|
8937
|
-
declare function getPost$1(httpClient: HttpClient): GetPostSignature;
|
|
10979
|
+
declare function getPost$1(httpClient: HttpClient$1): GetPostSignature;
|
|
8938
10980
|
interface GetPostSignature {
|
|
8939
10981
|
/**
|
|
8940
10982
|
* Gets a post by the specified ID.
|
|
@@ -8948,7 +10990,7 @@ interface GetPostSignature {
|
|
|
8948
10990
|
*/
|
|
8949
10991
|
(postId: string, options?: GetPostOptions | undefined): Promise<GetPostResponse & GetPostResponseNonNullableFields>;
|
|
8950
10992
|
}
|
|
8951
|
-
declare function getPostBySlug$1(httpClient: HttpClient): GetPostBySlugSignature;
|
|
10993
|
+
declare function getPostBySlug$1(httpClient: HttpClient$1): GetPostBySlugSignature;
|
|
8952
10994
|
interface GetPostBySlugSignature {
|
|
8953
10995
|
/**
|
|
8954
10996
|
* Gets a post by the provided slug.
|
|
@@ -8965,7 +11007,7 @@ interface GetPostBySlugSignature {
|
|
|
8965
11007
|
*/
|
|
8966
11008
|
(slug: string, options?: GetPostBySlugOptions | undefined): Promise<GetPostBySlugResponse & GetPostBySlugResponseNonNullableFields>;
|
|
8967
11009
|
}
|
|
8968
|
-
declare function listPosts$1(httpClient: HttpClient): ListPostsSignature;
|
|
11010
|
+
declare function listPosts$1(httpClient: HttpClient$1): ListPostsSignature;
|
|
8969
11011
|
interface ListPostsSignature {
|
|
8970
11012
|
/**
|
|
8971
11013
|
* Retrieves a list of published posts.
|
|
@@ -8981,7 +11023,7 @@ interface ListPostsSignature {
|
|
|
8981
11023
|
*/
|
|
8982
11024
|
(options?: ListPostsOptions | undefined): Promise<ListPostsResponse & ListPostsResponseNonNullableFields>;
|
|
8983
11025
|
}
|
|
8984
|
-
declare function queryPosts$1(httpClient: HttpClient): QueryPostsSignature;
|
|
11026
|
+
declare function queryPosts$1(httpClient: HttpClient$1): QueryPostsSignature;
|
|
8985
11027
|
interface QueryPostsSignature {
|
|
8986
11028
|
/**
|
|
8987
11029
|
* Creates a query to retrieve a list of posts.
|
|
@@ -9006,7 +11048,7 @@ interface QueryPostsSignature {
|
|
|
9006
11048
|
*/
|
|
9007
11049
|
(options?: QueryPostsOptions | undefined): PostsQueryBuilder;
|
|
9008
11050
|
}
|
|
9009
|
-
declare function getPostMetrics$1(httpClient: HttpClient): GetPostMetricsSignature;
|
|
11051
|
+
declare function getPostMetrics$1(httpClient: HttpClient$1): GetPostMetricsSignature;
|
|
9010
11052
|
interface GetPostMetricsSignature {
|
|
9011
11053
|
/**
|
|
9012
11054
|
* Gets a specified post's metrics.
|
|
@@ -9020,7 +11062,7 @@ interface GetPostMetricsSignature {
|
|
|
9020
11062
|
*/
|
|
9021
11063
|
(postId: string): Promise<GetPostMetricsResponse & GetPostMetricsResponseNonNullableFields>;
|
|
9022
11064
|
}
|
|
9023
|
-
declare function queryPostCountStats$1(httpClient: HttpClient): QueryPostCountStatsSignature;
|
|
11065
|
+
declare function queryPostCountStats$1(httpClient: HttpClient$1): QueryPostCountStatsSignature;
|
|
9024
11066
|
interface QueryPostCountStatsSignature {
|
|
9025
11067
|
/**
|
|
9026
11068
|
* Retrieves the number of published posts per month within a specified time range.
|
|
@@ -9036,7 +11078,7 @@ interface QueryPostCountStatsSignature {
|
|
|
9036
11078
|
*/
|
|
9037
11079
|
(options?: QueryPostCountStatsOptions | undefined): Promise<QueryPostCountStatsResponse & QueryPostCountStatsResponseNonNullableFields>;
|
|
9038
11080
|
}
|
|
9039
|
-
declare function getTotalPosts$1(httpClient: HttpClient): GetTotalPostsSignature;
|
|
11081
|
+
declare function getTotalPosts$1(httpClient: HttpClient$1): GetTotalPostsSignature;
|
|
9040
11082
|
interface GetTotalPostsSignature {
|
|
9041
11083
|
/**
|
|
9042
11084
|
* Gets the total amount of published posts on the blog.
|
|
@@ -9051,21 +11093,39 @@ interface GetTotalPostsSignature {
|
|
|
9051
11093
|
*/
|
|
9052
11094
|
(options?: GetTotalPostsOptions | undefined): Promise<GetTotalPostsResponse & GetTotalPostsResponseNonNullableFields>;
|
|
9053
11095
|
}
|
|
9054
|
-
declare const onPostCreated$1: EventDefinition<PostCreatedEnvelope, "wix.blog.v3.post_created">;
|
|
9055
|
-
declare const onPostUpdated$1: EventDefinition<PostUpdatedEnvelope, "wix.blog.v3.post_updated">;
|
|
9056
|
-
declare const onPostDeleted$1: EventDefinition<PostDeletedEnvelope, "wix.blog.v3.post_deleted">;
|
|
9057
|
-
declare const onPostLiked$1: EventDefinition<PostLikedEnvelope, "wix.blog.v3.post_liked">;
|
|
9058
|
-
declare const onPostUnliked$1: EventDefinition<PostUnlikedEnvelope, "wix.blog.v3.post_unliked">;
|
|
11096
|
+
declare const onPostCreated$1: EventDefinition$3<PostCreatedEnvelope, "wix.blog.v3.post_created">;
|
|
11097
|
+
declare const onPostUpdated$1: EventDefinition$3<PostUpdatedEnvelope, "wix.blog.v3.post_updated">;
|
|
11098
|
+
declare const onPostDeleted$1: EventDefinition$3<PostDeletedEnvelope, "wix.blog.v3.post_deleted">;
|
|
11099
|
+
declare const onPostLiked$1: EventDefinition$3<PostLikedEnvelope, "wix.blog.v3.post_liked">;
|
|
11100
|
+
declare const onPostUnliked$1: EventDefinition$3<PostUnlikedEnvelope, "wix.blog.v3.post_unliked">;
|
|
11101
|
+
|
|
11102
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
11103
|
+
__type: 'event-definition';
|
|
11104
|
+
type: Type;
|
|
11105
|
+
isDomainEvent?: boolean;
|
|
11106
|
+
transformations?: (envelope: unknown) => Payload;
|
|
11107
|
+
__payload: Payload;
|
|
11108
|
+
};
|
|
11109
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
11110
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
11111
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
11112
|
+
|
|
11113
|
+
declare global {
|
|
11114
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
11115
|
+
interface SymbolConstructor {
|
|
11116
|
+
readonly observable: symbol;
|
|
11117
|
+
}
|
|
11118
|
+
}
|
|
9059
11119
|
|
|
9060
|
-
declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
11120
|
+
declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
9061
11121
|
|
|
9062
|
-
declare const getPost: BuildRESTFunction<typeof getPost$1> & typeof getPost$1
|
|
9063
|
-
declare const getPostBySlug: BuildRESTFunction<typeof getPostBySlug$1> & typeof getPostBySlug$1
|
|
9064
|
-
declare const listPosts: BuildRESTFunction<typeof listPosts$1> & typeof listPosts$1
|
|
9065
|
-
declare const queryPosts: BuildRESTFunction<typeof queryPosts$1> & typeof queryPosts$1
|
|
9066
|
-
declare const getPostMetrics: BuildRESTFunction<typeof getPostMetrics$1> & typeof getPostMetrics$1
|
|
9067
|
-
declare const queryPostCountStats: BuildRESTFunction<typeof queryPostCountStats$1> & typeof queryPostCountStats$1
|
|
9068
|
-
declare const getTotalPosts: BuildRESTFunction<typeof getTotalPosts$1> & typeof getTotalPosts$1
|
|
11122
|
+
declare const getPost: MaybeContext$1<BuildRESTFunction$1<typeof getPost$1> & typeof getPost$1>;
|
|
11123
|
+
declare const getPostBySlug: MaybeContext$1<BuildRESTFunction$1<typeof getPostBySlug$1> & typeof getPostBySlug$1>;
|
|
11124
|
+
declare const listPosts: MaybeContext$1<BuildRESTFunction$1<typeof listPosts$1> & typeof listPosts$1>;
|
|
11125
|
+
declare const queryPosts: MaybeContext$1<BuildRESTFunction$1<typeof queryPosts$1> & typeof queryPosts$1>;
|
|
11126
|
+
declare const getPostMetrics: MaybeContext$1<BuildRESTFunction$1<typeof getPostMetrics$1> & typeof getPostMetrics$1>;
|
|
11127
|
+
declare const queryPostCountStats: MaybeContext$1<BuildRESTFunction$1<typeof queryPostCountStats$1> & typeof queryPostCountStats$1>;
|
|
11128
|
+
declare const getTotalPosts: MaybeContext$1<BuildRESTFunction$1<typeof getTotalPosts$1> & typeof getTotalPosts$1>;
|
|
9069
11129
|
|
|
9070
11130
|
type _publicOnPostCreatedType = typeof onPostCreated$1;
|
|
9071
11131
|
/**
|
|
@@ -9380,6 +11440,416 @@ declare namespace index_d$1 {
|
|
|
9380
11440
|
export { type ActionEvent$1 as ActionEvent, index_d$1_Alignment as Alignment, type index_d$1_AnchorData as AnchorData, type index_d$1_AppEmbedData as AppEmbedData, type index_d$1_AppEmbedDataAppDataOneOf as AppEmbedDataAppDataOneOf, index_d$1_AppType as AppType, type index_d$1_AudioData as AudioData, type index_d$1_Background as Background, type index_d$1_BackgroundBackgroundOneOf as BackgroundBackgroundOneOf, index_d$1_BackgroundType as BackgroundType, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$1_BlockquoteData as BlockquoteData, type index_d$1_BlogPaging as BlogPaging, type index_d$1_BookingData as BookingData, type index_d$1_Border as Border, type index_d$1_BorderColors as BorderColors, type index_d$1_BulkGetPostMetricsRequest as BulkGetPostMetricsRequest, type index_d$1_BulkGetPostMetricsResponse as BulkGetPostMetricsResponse, type index_d$1_BulkGetPostReactionsRequest as BulkGetPostReactionsRequest, type index_d$1_BulkGetPostReactionsResponse as BulkGetPostReactionsResponse, type index_d$1_BulletedListData as BulletedListData, type index_d$1_ButtonData as ButtonData, type index_d$1_Category as Category, type index_d$1_CategoryTranslation as CategoryTranslation, type index_d$1_CellStyle as CellStyle, type index_d$1_CodeBlockData as CodeBlockData, type index_d$1_CollapsibleListData as CollapsibleListData, type index_d$1_ColorData as ColorData, type index_d$1_Colors as Colors, type index_d$1_ConvertDraftJsToRichContentRequest as ConvertDraftJsToRichContentRequest, type index_d$1_ConvertDraftJsToRichContentResponse as ConvertDraftJsToRichContentResponse, type index_d$1_ConvertRichContentToDraftJsRequest as ConvertRichContentToDraftJsRequest, type index_d$1_ConvertRichContentToDraftJsResponse as ConvertRichContentToDraftJsResponse, type index_d$1_CoverMedia as CoverMedia, type index_d$1_CoverMediaMediaOneOf as CoverMediaMediaOneOf, type index_d$1_CreateDraftPostFromTemplateRequest as CreateDraftPostFromTemplateRequest, type index_d$1_CreateDraftPostFromTemplateResponse as CreateDraftPostFromTemplateResponse, index_d$1_Crop as Crop, type CursorPaging$1 as CursorPaging, type Cursors$1 as Cursors, type index_d$1_Decoration as Decoration, type index_d$1_DecorationDataOneOf as DecorationDataOneOf, index_d$1_DecorationType as DecorationType, type index_d$1_Design as Design, type index_d$1_Dimensions as Dimensions, index_d$1_Direction as Direction, type index_d$1_DividerData as DividerData, type index_d$1_DocumentStyle as DocumentStyle, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type index_d$1_DraftPost as DraftPost, type index_d$1_DraftPostTranslation as DraftPostTranslation, type index_d$1_EmbedData as EmbedData, type index_d$1_EmbedMedia as EmbedMedia, type index_d$1_EmbedThumbnail as EmbedThumbnail, type index_d$1_EmbedVideo as EmbedVideo, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type index_d$1_EventData as EventData, type EventMetadata$1 as EventMetadata, Field$1 as Field, type index_d$1_FileData as FileData, type index_d$1_FileSource as FileSource, type index_d$1_FileSourceDataOneOf as FileSourceDataOneOf, type index_d$1_FontSizeData as FontSizeData, index_d$1_FontType as FontType, type index_d$1_GIF as GIF, type index_d$1_GIFData as GIFData, type index_d$1_GalleryData as GalleryData, type index_d$1_GalleryOptions as GalleryOptions, type index_d$1_GetPostBySlugOptions as GetPostBySlugOptions, type index_d$1_GetPostBySlugRequest as GetPostBySlugRequest, type index_d$1_GetPostBySlugResponse as GetPostBySlugResponse, type index_d$1_GetPostBySlugResponseNonNullableFields as GetPostBySlugResponseNonNullableFields, type index_d$1_GetPostMetricsRequest as GetPostMetricsRequest, type index_d$1_GetPostMetricsResponse as GetPostMetricsResponse, type index_d$1_GetPostMetricsResponseNonNullableFields as GetPostMetricsResponseNonNullableFields, type index_d$1_GetPostOptions as GetPostOptions, type index_d$1_GetPostRequest as GetPostRequest, type index_d$1_GetPostResponse as GetPostResponse, type index_d$1_GetPostResponseNonNullableFields as GetPostResponseNonNullableFields, index_d$1_GetPostTemplatesSort as GetPostTemplatesSort, index_d$1_GetPostsSort as GetPostsSort, type index_d$1_GetTemplateRequest as GetTemplateRequest, type index_d$1_GetTemplateResponse as GetTemplateResponse, type index_d$1_GetTotalLikesPerMemberRequest as GetTotalLikesPerMemberRequest, type index_d$1_GetTotalLikesPerMemberResponse as GetTotalLikesPerMemberResponse, type index_d$1_GetTotalPostsOptions as GetTotalPostsOptions, type index_d$1_GetTotalPostsRequest as GetTotalPostsRequest, type index_d$1_GetTotalPostsResponse as GetTotalPostsResponse, type index_d$1_GetTotalPostsResponseNonNullableFields as GetTotalPostsResponseNonNullableFields, type index_d$1_GetTotalPublicationsRequest as GetTotalPublicationsRequest, type index_d$1_GetTotalPublicationsResponse as GetTotalPublicationsResponse, type index_d$1_Gradient as Gradient, type index_d$1_HTMLData as HTMLData, type index_d$1_HTMLDataDataOneOf as HTMLDataDataOneOf, type index_d$1_HeadingData as HeadingData, type index_d$1_Height as Height, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$1_Image as Image, type index_d$1_ImageData as ImageData, index_d$1_InitialExpandedItems as InitialExpandedItems, type index_d$1_InitialPostsCopied as InitialPostsCopied, type index_d$1_Item as Item, type index_d$1_ItemDataOneOf as ItemDataOneOf, type index_d$1_ItemStyle as ItemStyle, type Keyword$1 as Keyword, type index_d$1_Layout as Layout, index_d$1_LayoutType as LayoutType, type index_d$1_LikePostRequest as LikePostRequest, type index_d$1_LikePostResponse as LikePostResponse, index_d$1_LineStyle as LineStyle, type index_d$1_Link as Link, type index_d$1_LinkData as LinkData, type index_d$1_LinkDataOneOf as LinkDataOneOf, type index_d$1_LinkPreviewData as LinkPreviewData, type index_d$1_ListDemoPostsRequest as ListDemoPostsRequest, type index_d$1_ListDemoPostsResponse as ListDemoPostsResponse, type index_d$1_ListPostsArchiveRequest as ListPostsArchiveRequest, type index_d$1_ListPostsArchiveResponse as ListPostsArchiveResponse, type index_d$1_ListPostsOptions as ListPostsOptions, type index_d$1_ListPostsRequest as ListPostsRequest, type index_d$1_ListPostsResponse as ListPostsResponse, type index_d$1_ListPostsResponseNonNullableFields as ListPostsResponseNonNullableFields, type index_d$1_ListTemplatesRequest as ListTemplatesRequest, type index_d$1_ListTemplatesResponse as ListTemplatesResponse, type index_d$1_ListValue as ListValue, type index_d$1_MapData as MapData, type index_d$1_MapSettings as MapSettings, index_d$1_MapType as MapType, type index_d$1_Media as Media, type index_d$1_MediaMediaOneOf as MediaMediaOneOf, type index_d$1_MentionData as MentionData, type MessageEnvelope$1 as MessageEnvelope, type MetaData$1 as MetaData, type index_d$1_Metadata as Metadata, type index_d$1_Metrics as Metrics, type index_d$1_ModerationDetails as ModerationDetails, index_d$1_ModerationStatusStatus as ModerationStatusStatus, type index_d$1_Node as Node, type index_d$1_NodeDataOneOf as NodeDataOneOf, type index_d$1_NodeStyle as NodeStyle, index_d$1_NodeType as NodeType, index_d$1_NullValue as NullValue, type index_d$1_Oembed as Oembed, type index_d$1_OldBlogMigratedEvent as OldBlogMigratedEvent, type index_d$1_Option as Option, type index_d$1_OptionDesign as OptionDesign, type index_d$1_OptionLayout as OptionLayout, index_d$1_Order as Order, type index_d$1_OrderedListData as OrderedListData, index_d$1_Orientation as Orientation, index_d$1_Origin as Origin, type index_d$1_PDFSettings as PDFSettings, type Paging$1 as Paging, type PagingMetadataV2$1 as PagingMetadataV2, type index_d$1_ParagraphData as ParagraphData, type index_d$1_PeriodPostCount as PeriodPostCount, type index_d$1_PeriodPublicationsCount as PeriodPublicationsCount, type index_d$1_Permissions as Permissions, type index_d$1_PinPostRequest as PinPostRequest, type index_d$1_PinPostResponse as PinPostResponse, type PlatformQuery$1 as PlatformQuery, type PlatformQueryPagingMethodOneOf$1 as PlatformQueryPagingMethodOneOf, type index_d$1_PlaybackOptions as PlaybackOptions, type index_d$1_PluginContainerData as PluginContainerData, index_d$1_PluginContainerDataAlignment as PluginContainerDataAlignment, type index_d$1_PluginContainerDataWidth as PluginContainerDataWidth, type index_d$1_PluginContainerDataWidthDataOneOf as PluginContainerDataWidthDataOneOf, type index_d$1_Poll as Poll, type index_d$1_PollData as PollData, type index_d$1_PollDataLayout as PollDataLayout, type index_d$1_PollDesign as PollDesign, type index_d$1_PollLayout as PollLayout, index_d$1_PollLayoutDirection as PollLayoutDirection, index_d$1_PollLayoutType as PollLayoutType, type index_d$1_PollSettings as PollSettings, type index_d$1_Post as Post, type index_d$1_PostCountInfo as PostCountInfo, type index_d$1_PostCountersUpdated as PostCountersUpdated, type index_d$1_PostCountersUpdatedInitiatorOneOf as PostCountersUpdatedInitiatorOneOf, type index_d$1_PostCreatedEnvelope as PostCreatedEnvelope, type index_d$1_PostDeletedEnvelope as PostDeletedEnvelope, index_d$1_PostFieldField as PostFieldField, type index_d$1_PostLiked as PostLiked, type index_d$1_PostLikedEnvelope as PostLikedEnvelope, type index_d$1_PostLikedInitiatorOneOf as PostLikedInitiatorOneOf, type index_d$1_PostOwnerChanged as PostOwnerChanged, type index_d$1_PostTranslation as PostTranslation, type index_d$1_PostUnliked as PostUnliked, type index_d$1_PostUnlikedEnvelope as PostUnlikedEnvelope, type index_d$1_PostUnlikedInitiatorOneOf as PostUnlikedInitiatorOneOf, type index_d$1_PostUpdatedEnvelope as PostUpdatedEnvelope, type index_d$1_PostsQueryBuilder as PostsQueryBuilder, type index_d$1_PostsQueryResult as PostsQueryResult, type index_d$1_QueryPostCountStatsOptions as QueryPostCountStatsOptions, type index_d$1_QueryPostCountStatsRequest as QueryPostCountStatsRequest, type index_d$1_QueryPostCountStatsResponse as QueryPostCountStatsResponse, type index_d$1_QueryPostCountStatsResponseNonNullableFields as QueryPostCountStatsResponseNonNullableFields, type index_d$1_QueryPostsOptions as QueryPostsOptions, type index_d$1_QueryPostsRequest as QueryPostsRequest, type index_d$1_QueryPostsResponse as QueryPostsResponse, type index_d$1_QueryPostsResponseNonNullableFields as QueryPostsResponseNonNullableFields, type index_d$1_QueryPublicationsCountStatsRequest as QueryPublicationsCountStatsRequest, index_d$1_QueryPublicationsCountStatsRequestOrder as QueryPublicationsCountStatsRequestOrder, type index_d$1_QueryPublicationsCountStatsResponse as QueryPublicationsCountStatsResponse, type index_d$1_Reactions as Reactions, type index_d$1_Rel as Rel, type RestoreInfo$1 as RestoreInfo, type index_d$1_RichContent as RichContent, type index_d$1_SendActionEventRequest as SendActionEventRequest, type index_d$1_SendActionEventRequestActionOneOf as SendActionEventRequestActionOneOf, type index_d$1_SendActionEventResponse as SendActionEventResponse, type SeoSchema$1 as SeoSchema, type Settings$1 as Settings, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, index_d$1_Source as Source, type index_d$1_Spoiler as Spoiler, type index_d$1_SpoilerData as SpoilerData, index_d$1_Status as Status, type index_d$1_Styles as Styles, type index_d$1_TableCellData as TableCellData, type index_d$1_TableData as TableData, type Tag$1 as Tag, index_d$1_Target as Target, index_d$1_TextAlignment as TextAlignment, type index_d$1_TextData as TextData, type index_d$1_TextNodeStyle as TextNodeStyle, type index_d$1_TextStyle as TextStyle, type index_d$1_Thumbnails as Thumbnails, index_d$1_ThumbnailsAlignment as ThumbnailsAlignment, index_d$1_Type as Type, type index_d$1_UnlikePostRequest as UnlikePostRequest, type index_d$1_UnlikePostResponse as UnlikePostResponse, type index_d$1_UnpinPostRequest as UnpinPostRequest, type index_d$1_UnpinPostResponse as UnpinPostResponse, type index_d$1_V1Media as V1Media, index_d$1_VerticalAlignment as VerticalAlignment, type index_d$1_Video as Video, type index_d$1_VideoData as VideoData, type index_d$1_VideoResolution as VideoResolution, index_d$1_ViewMode as ViewMode, type index_d$1_ViewPostRequest as ViewPostRequest, type index_d$1_ViewPostResponse as ViewPostResponse, index_d$1_ViewRole as ViewRole, index_d$1_VoteRole as VoteRole, WebhookIdentityType$1 as WebhookIdentityType, index_d$1_Width as Width, index_d$1_WidthType as WidthType, type index_d$1_WixMedia as WixMedia, type index_d$1__publicOnPostCreatedType as _publicOnPostCreatedType, type index_d$1__publicOnPostDeletedType as _publicOnPostDeletedType, type index_d$1__publicOnPostLikedType as _publicOnPostLikedType, type index_d$1__publicOnPostUnlikedType as _publicOnPostUnlikedType, type index_d$1__publicOnPostUpdatedType as _publicOnPostUpdatedType, index_d$1_getPost as getPost, index_d$1_getPostBySlug as getPostBySlug, index_d$1_getPostMetrics as getPostMetrics, index_d$1_getTotalPosts as getTotalPosts, index_d$1_listPosts as listPosts, index_d$1_onPostCreated as onPostCreated, index_d$1_onPostDeleted as onPostDeleted, index_d$1_onPostLiked as onPostLiked, index_d$1_onPostUnliked as onPostUnliked, index_d$1_onPostUpdated as onPostUpdated, onPostCreated$1 as publicOnPostCreated, onPostDeleted$1 as publicOnPostDeleted, onPostLiked$1 as publicOnPostLiked, onPostUnliked$1 as publicOnPostUnliked, onPostUpdated$1 as publicOnPostUpdated, index_d$1_queryPostCountStats as queryPostCountStats, index_d$1_queryPosts as queryPosts };
|
|
9381
11441
|
}
|
|
9382
11442
|
|
|
11443
|
+
type HostModule<T, H extends Host> = {
|
|
11444
|
+
__type: 'host';
|
|
11445
|
+
create(host: H): T;
|
|
11446
|
+
};
|
|
11447
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
11448
|
+
type Host<Environment = unknown> = {
|
|
11449
|
+
channel: {
|
|
11450
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
11451
|
+
disconnect: () => void;
|
|
11452
|
+
} | Promise<{
|
|
11453
|
+
disconnect: () => void;
|
|
11454
|
+
}>;
|
|
11455
|
+
};
|
|
11456
|
+
environment?: Environment;
|
|
11457
|
+
/**
|
|
11458
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
11459
|
+
*/
|
|
11460
|
+
apiBaseUrl?: string;
|
|
11461
|
+
/**
|
|
11462
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
11463
|
+
* like internationalization, billing, etc.
|
|
11464
|
+
*/
|
|
11465
|
+
essentials?: {
|
|
11466
|
+
/**
|
|
11467
|
+
* The language of the currently viewed session
|
|
11468
|
+
*/
|
|
11469
|
+
language?: string;
|
|
11470
|
+
/**
|
|
11471
|
+
* The locale of the currently viewed session
|
|
11472
|
+
*/
|
|
11473
|
+
locale?: string;
|
|
11474
|
+
/**
|
|
11475
|
+
* Any headers that should be passed through to the API requests
|
|
11476
|
+
*/
|
|
11477
|
+
passThroughHeaders?: Record<string, string>;
|
|
11478
|
+
};
|
|
11479
|
+
};
|
|
11480
|
+
|
|
11481
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
11482
|
+
interface HttpClient {
|
|
11483
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
11484
|
+
fetchWithAuth: typeof fetch;
|
|
11485
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
11486
|
+
getActiveToken?: () => string | undefined;
|
|
11487
|
+
}
|
|
11488
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
11489
|
+
type HttpResponse<T = any> = {
|
|
11490
|
+
data: T;
|
|
11491
|
+
status: number;
|
|
11492
|
+
statusText: string;
|
|
11493
|
+
headers: any;
|
|
11494
|
+
request?: any;
|
|
11495
|
+
};
|
|
11496
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
11497
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
11498
|
+
url: string;
|
|
11499
|
+
data?: Data;
|
|
11500
|
+
params?: URLSearchParams;
|
|
11501
|
+
} & APIMetadata;
|
|
11502
|
+
type APIMetadata = {
|
|
11503
|
+
methodFqn?: string;
|
|
11504
|
+
entityFqdn?: string;
|
|
11505
|
+
packageName?: string;
|
|
11506
|
+
};
|
|
11507
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
11508
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
11509
|
+
__type: 'event-definition';
|
|
11510
|
+
type: Type;
|
|
11511
|
+
isDomainEvent?: boolean;
|
|
11512
|
+
transformations?: (envelope: unknown) => Payload;
|
|
11513
|
+
__payload: Payload;
|
|
11514
|
+
};
|
|
11515
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
11516
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
11517
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
11518
|
+
|
|
11519
|
+
type ServicePluginMethodInput = {
|
|
11520
|
+
request: any;
|
|
11521
|
+
metadata: any;
|
|
11522
|
+
};
|
|
11523
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
11524
|
+
type ServicePluginMethodMetadata = {
|
|
11525
|
+
name: string;
|
|
11526
|
+
primaryHttpMappingPath: string;
|
|
11527
|
+
transformations: {
|
|
11528
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
11529
|
+
toREST: (...args: unknown[]) => unknown;
|
|
11530
|
+
};
|
|
11531
|
+
};
|
|
11532
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
11533
|
+
__type: 'service-plugin-definition';
|
|
11534
|
+
componentType: string;
|
|
11535
|
+
methods: ServicePluginMethodMetadata[];
|
|
11536
|
+
__contract: Contract;
|
|
11537
|
+
};
|
|
11538
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
11539
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
11540
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
11541
|
+
|
|
11542
|
+
type RequestContext = {
|
|
11543
|
+
isSSR: boolean;
|
|
11544
|
+
host: string;
|
|
11545
|
+
protocol?: string;
|
|
11546
|
+
};
|
|
11547
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
11548
|
+
/**
|
|
11549
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
11550
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
11551
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
11552
|
+
*/
|
|
11553
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
11554
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
11555
|
+
_?: T;
|
|
11556
|
+
url?: string;
|
|
11557
|
+
method?: Method;
|
|
11558
|
+
params?: any;
|
|
11559
|
+
data?: any;
|
|
11560
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
11561
|
+
};
|
|
11562
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
11563
|
+
__isAmbassador: boolean;
|
|
11564
|
+
};
|
|
11565
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
11566
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
11567
|
+
|
|
11568
|
+
declare global {
|
|
11569
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
11570
|
+
interface SymbolConstructor {
|
|
11571
|
+
readonly observable: symbol;
|
|
11572
|
+
}
|
|
11573
|
+
}
|
|
11574
|
+
|
|
11575
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
11576
|
+
|
|
11577
|
+
/**
|
|
11578
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
11579
|
+
|
|
11580
|
+
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)).
|
|
11581
|
+
|
|
11582
|
+
@example
|
|
11583
|
+
```
|
|
11584
|
+
import type {EmptyObject} from 'type-fest';
|
|
11585
|
+
|
|
11586
|
+
// The following illustrates the problem with `{}`.
|
|
11587
|
+
const foo1: {} = {}; // Pass
|
|
11588
|
+
const foo2: {} = []; // Pass
|
|
11589
|
+
const foo3: {} = 42; // Pass
|
|
11590
|
+
const foo4: {} = {a: 1}; // Pass
|
|
11591
|
+
|
|
11592
|
+
// With `EmptyObject` only the first case is valid.
|
|
11593
|
+
const bar1: EmptyObject = {}; // Pass
|
|
11594
|
+
const bar2: EmptyObject = 42; // Fail
|
|
11595
|
+
const bar3: EmptyObject = []; // Fail
|
|
11596
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
11597
|
+
```
|
|
11598
|
+
|
|
11599
|
+
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}.
|
|
11600
|
+
|
|
11601
|
+
@category Object
|
|
11602
|
+
*/
|
|
11603
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
11604
|
+
|
|
11605
|
+
/**
|
|
11606
|
+
Returns a boolean for whether the two given types are equal.
|
|
11607
|
+
|
|
11608
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
11609
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
11610
|
+
|
|
11611
|
+
Use-cases:
|
|
11612
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
11613
|
+
|
|
11614
|
+
@example
|
|
11615
|
+
```
|
|
11616
|
+
import type {IsEqual} from 'type-fest';
|
|
11617
|
+
|
|
11618
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
11619
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
11620
|
+
type Includes<Value extends readonly any[], Item> =
|
|
11621
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
11622
|
+
? IsEqual<Value[0], Item> extends true
|
|
11623
|
+
? true
|
|
11624
|
+
: Includes<rest, Item>
|
|
11625
|
+
: false;
|
|
11626
|
+
```
|
|
11627
|
+
|
|
11628
|
+
@category Type Guard
|
|
11629
|
+
@category Utilities
|
|
11630
|
+
*/
|
|
11631
|
+
type IsEqual<A, B> =
|
|
11632
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
11633
|
+
(<G>() => G extends B ? 1 : 2)
|
|
11634
|
+
? true
|
|
11635
|
+
: false;
|
|
11636
|
+
|
|
11637
|
+
/**
|
|
11638
|
+
Filter out keys from an object.
|
|
11639
|
+
|
|
11640
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
11641
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
11642
|
+
Returns `Key` otherwise.
|
|
11643
|
+
|
|
11644
|
+
@example
|
|
11645
|
+
```
|
|
11646
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
11647
|
+
//=> never
|
|
11648
|
+
```
|
|
11649
|
+
|
|
11650
|
+
@example
|
|
11651
|
+
```
|
|
11652
|
+
type Filtered = Filter<'bar', string>;
|
|
11653
|
+
//=> never
|
|
11654
|
+
```
|
|
11655
|
+
|
|
11656
|
+
@example
|
|
11657
|
+
```
|
|
11658
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
11659
|
+
//=> 'bar'
|
|
11660
|
+
```
|
|
11661
|
+
|
|
11662
|
+
@see {Except}
|
|
11663
|
+
*/
|
|
11664
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
11665
|
+
|
|
11666
|
+
type ExceptOptions = {
|
|
11667
|
+
/**
|
|
11668
|
+
Disallow assigning non-specified properties.
|
|
11669
|
+
|
|
11670
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
11671
|
+
|
|
11672
|
+
@default false
|
|
11673
|
+
*/
|
|
11674
|
+
requireExactProps?: boolean;
|
|
11675
|
+
};
|
|
11676
|
+
|
|
11677
|
+
/**
|
|
11678
|
+
Create a type from an object type without certain keys.
|
|
11679
|
+
|
|
11680
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
11681
|
+
|
|
11682
|
+
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.
|
|
11683
|
+
|
|
11684
|
+
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)).
|
|
11685
|
+
|
|
11686
|
+
@example
|
|
11687
|
+
```
|
|
11688
|
+
import type {Except} from 'type-fest';
|
|
11689
|
+
|
|
11690
|
+
type Foo = {
|
|
11691
|
+
a: number;
|
|
11692
|
+
b: string;
|
|
11693
|
+
};
|
|
11694
|
+
|
|
11695
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
11696
|
+
//=> {b: string}
|
|
11697
|
+
|
|
11698
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
11699
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
11700
|
+
|
|
11701
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
11702
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
11703
|
+
|
|
11704
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
11705
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
11706
|
+
```
|
|
11707
|
+
|
|
11708
|
+
@category Object
|
|
11709
|
+
*/
|
|
11710
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
11711
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
11712
|
+
} & (Options['requireExactProps'] extends true
|
|
11713
|
+
? Partial<Record<KeysType, never>>
|
|
11714
|
+
: {});
|
|
11715
|
+
|
|
11716
|
+
/**
|
|
11717
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
11718
|
+
|
|
11719
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
11720
|
+
|
|
11721
|
+
@example
|
|
11722
|
+
```
|
|
11723
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
11724
|
+
|
|
11725
|
+
interface Example {
|
|
11726
|
+
a: string;
|
|
11727
|
+
b: string | number;
|
|
11728
|
+
c?: string;
|
|
11729
|
+
d: {};
|
|
11730
|
+
}
|
|
11731
|
+
|
|
11732
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
11733
|
+
//=> 'a'
|
|
11734
|
+
```
|
|
11735
|
+
|
|
11736
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
11737
|
+
|
|
11738
|
+
@example
|
|
11739
|
+
```
|
|
11740
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
11741
|
+
|
|
11742
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
11743
|
+
//=> 'a' | 'c'
|
|
11744
|
+
```
|
|
11745
|
+
|
|
11746
|
+
@category Object
|
|
11747
|
+
*/
|
|
11748
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
11749
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
11750
|
+
{
|
|
11751
|
+
// Map through all the keys of the given base type.
|
|
11752
|
+
[Key in keyof Base]:
|
|
11753
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
11754
|
+
Base[Key] extends Condition
|
|
11755
|
+
// Retain this key since the condition passes.
|
|
11756
|
+
? Key
|
|
11757
|
+
// Discard this key since the condition fails.
|
|
11758
|
+
: never;
|
|
11759
|
+
|
|
11760
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
11761
|
+
}[keyof Base]
|
|
11762
|
+
>;
|
|
11763
|
+
|
|
11764
|
+
/**
|
|
11765
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
11766
|
+
|
|
11767
|
+
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.
|
|
11768
|
+
|
|
11769
|
+
@example
|
|
11770
|
+
```
|
|
11771
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
11772
|
+
|
|
11773
|
+
class Awesome {
|
|
11774
|
+
name: string;
|
|
11775
|
+
successes: number;
|
|
11776
|
+
failures: bigint;
|
|
11777
|
+
|
|
11778
|
+
run() {}
|
|
11779
|
+
}
|
|
11780
|
+
|
|
11781
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
11782
|
+
//=> {run: () => void}
|
|
11783
|
+
```
|
|
11784
|
+
|
|
11785
|
+
@example
|
|
11786
|
+
```
|
|
11787
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
11788
|
+
|
|
11789
|
+
interface Example {
|
|
11790
|
+
a: string;
|
|
11791
|
+
b: string | number;
|
|
11792
|
+
c: () => void;
|
|
11793
|
+
d: {};
|
|
11794
|
+
}
|
|
11795
|
+
|
|
11796
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
11797
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
11798
|
+
```
|
|
11799
|
+
|
|
11800
|
+
@category Object
|
|
11801
|
+
*/
|
|
11802
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
11803
|
+
Base,
|
|
11804
|
+
ConditionalKeys<Base, Condition>
|
|
11805
|
+
>;
|
|
11806
|
+
|
|
11807
|
+
/**
|
|
11808
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
11809
|
+
* can either be a REST module or a host module.
|
|
11810
|
+
* This type is recursive, so it can describe nested modules.
|
|
11811
|
+
*/
|
|
11812
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
11813
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
11814
|
+
};
|
|
11815
|
+
/**
|
|
11816
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
11817
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
11818
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
11819
|
+
* do not match the given host (as they will not work with the given host).
|
|
11820
|
+
*/
|
|
11821
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
11822
|
+
done: T;
|
|
11823
|
+
recurse: T extends {
|
|
11824
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
11825
|
+
} ? 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<{
|
|
11826
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
11827
|
+
-1,
|
|
11828
|
+
0,
|
|
11829
|
+
1,
|
|
11830
|
+
2,
|
|
11831
|
+
3,
|
|
11832
|
+
4,
|
|
11833
|
+
5
|
|
11834
|
+
][Depth]> : never;
|
|
11835
|
+
}, EmptyObject>;
|
|
11836
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
11837
|
+
type PublicMetadata = {
|
|
11838
|
+
PACKAGE_NAME?: string;
|
|
11839
|
+
};
|
|
11840
|
+
|
|
11841
|
+
declare global {
|
|
11842
|
+
interface ContextualClient {
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11845
|
+
/**
|
|
11846
|
+
* A type used to create concerete types from SDK descriptors in
|
|
11847
|
+
* case a contextual client is available.
|
|
11848
|
+
*/
|
|
11849
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
11850
|
+
host: Host;
|
|
11851
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
11852
|
+
|
|
9383
11853
|
interface BlogTag {
|
|
9384
11854
|
/**
|
|
9385
11855
|
* Tag ID.
|
|
@@ -10389,18 +12859,36 @@ interface DeleteTagSignature {
|
|
|
10389
12859
|
*/
|
|
10390
12860
|
(tagId: string): Promise<void>;
|
|
10391
12861
|
}
|
|
10392
|
-
declare const onTagCreated$1: EventDefinition<TagCreatedEnvelope, "wix.blog.v3.tag_created">;
|
|
10393
|
-
declare const onTagUpdated$1: EventDefinition<TagUpdatedEnvelope, "wix.blog.v3.tag_updated">;
|
|
10394
|
-
declare const onTagDeleted$1: EventDefinition<TagDeletedEnvelope, "wix.blog.v3.tag_deleted">;
|
|
12862
|
+
declare const onTagCreated$1: EventDefinition$1<TagCreatedEnvelope, "wix.blog.v3.tag_created">;
|
|
12863
|
+
declare const onTagUpdated$1: EventDefinition$1<TagUpdatedEnvelope, "wix.blog.v3.tag_updated">;
|
|
12864
|
+
declare const onTagDeleted$1: EventDefinition$1<TagDeletedEnvelope, "wix.blog.v3.tag_deleted">;
|
|
12865
|
+
|
|
12866
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
12867
|
+
__type: 'event-definition';
|
|
12868
|
+
type: Type;
|
|
12869
|
+
isDomainEvent?: boolean;
|
|
12870
|
+
transformations?: (envelope: unknown) => Payload;
|
|
12871
|
+
__payload: Payload;
|
|
12872
|
+
};
|
|
12873
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
12874
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
12875
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
12876
|
+
|
|
12877
|
+
declare global {
|
|
12878
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
12879
|
+
interface SymbolConstructor {
|
|
12880
|
+
readonly observable: symbol;
|
|
12881
|
+
}
|
|
12882
|
+
}
|
|
10395
12883
|
|
|
10396
12884
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
10397
12885
|
|
|
10398
|
-
declare const createTag: BuildRESTFunction<typeof createTag$1> & typeof createTag$1
|
|
10399
|
-
declare const getTagByLabel: BuildRESTFunction<typeof getTagByLabel$1> & typeof getTagByLabel$1
|
|
10400
|
-
declare const getTag: BuildRESTFunction<typeof getTag$1> & typeof getTag$1
|
|
10401
|
-
declare const getTagBySlug: BuildRESTFunction<typeof getTagBySlug$1> & typeof getTagBySlug$1
|
|
10402
|
-
declare const queryTags: BuildRESTFunction<typeof queryTags$1> & typeof queryTags$1
|
|
10403
|
-
declare const deleteTag: BuildRESTFunction<typeof deleteTag$1> & typeof deleteTag$1
|
|
12886
|
+
declare const createTag: MaybeContext<BuildRESTFunction<typeof createTag$1> & typeof createTag$1>;
|
|
12887
|
+
declare const getTagByLabel: MaybeContext<BuildRESTFunction<typeof getTagByLabel$1> & typeof getTagByLabel$1>;
|
|
12888
|
+
declare const getTag: MaybeContext<BuildRESTFunction<typeof getTag$1> & typeof getTag$1>;
|
|
12889
|
+
declare const getTagBySlug: MaybeContext<BuildRESTFunction<typeof getTagBySlug$1> & typeof getTagBySlug$1>;
|
|
12890
|
+
declare const queryTags: MaybeContext<BuildRESTFunction<typeof queryTags$1> & typeof queryTags$1>;
|
|
12891
|
+
declare const deleteTag: MaybeContext<BuildRESTFunction<typeof deleteTag$1> & typeof deleteTag$1>;
|
|
10404
12892
|
|
|
10405
12893
|
type _publicOnTagCreatedType = typeof onTagCreated$1;
|
|
10406
12894
|
/**
|