@wix/blog 1.0.305 → 1.0.306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/type-bundles/context.bundle.d.ts +3108 -748
- package/type-bundles/index.bundle.d.ts +3108 -748
- package/type-bundles/meta.bundle.d.ts +8 -60
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type HostModule<T, H extends Host> = {
|
|
1
|
+
type HostModule$5<T, H extends Host$5> = {
|
|
2
2
|
__type: 'host';
|
|
3
3
|
create(host: H): T;
|
|
4
4
|
};
|
|
5
|
-
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
-
type Host<Environment = unknown> = {
|
|
5
|
+
type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
|
|
6
|
+
type Host$5<Environment = unknown> = {
|
|
7
7
|
channel: {
|
|
8
8
|
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
9
|
disconnect: () => void;
|
|
@@ -12,6 +12,10 @@ type Host<Environment = unknown> = {
|
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional name of the environment, use for logging
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
15
19
|
/**
|
|
16
20
|
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
21
|
*/
|
|
@@ -36,92 +40,92 @@ type Host<Environment = unknown> = {
|
|
|
36
40
|
};
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
40
|
-
interface HttpClient {
|
|
41
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
43
|
+
type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
|
|
44
|
+
interface HttpClient$5 {
|
|
45
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
|
|
42
46
|
fetchWithAuth: typeof fetch;
|
|
43
47
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
48
|
getActiveToken?: () => string | undefined;
|
|
45
49
|
}
|
|
46
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
47
|
-
type HttpResponse<T = any> = {
|
|
50
|
+
type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
|
|
51
|
+
type HttpResponse$5<T = any> = {
|
|
48
52
|
data: T;
|
|
49
53
|
status: number;
|
|
50
54
|
statusText: string;
|
|
51
55
|
headers: any;
|
|
52
56
|
request?: any;
|
|
53
57
|
};
|
|
54
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
58
|
+
type RequestOptions$5<_TResponse = any, Data = any> = {
|
|
55
59
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
56
60
|
url: string;
|
|
57
61
|
data?: Data;
|
|
58
62
|
params?: URLSearchParams;
|
|
59
|
-
} & APIMetadata;
|
|
60
|
-
type APIMetadata = {
|
|
63
|
+
} & APIMetadata$5;
|
|
64
|
+
type APIMetadata$5 = {
|
|
61
65
|
methodFqn?: string;
|
|
62
66
|
entityFqdn?: string;
|
|
63
67
|
packageName?: string;
|
|
64
68
|
};
|
|
65
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
-
type EventDefinition$
|
|
69
|
+
type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
|
|
70
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
67
71
|
__type: 'event-definition';
|
|
68
72
|
type: Type;
|
|
69
73
|
isDomainEvent?: boolean;
|
|
70
74
|
transformations?: (envelope: unknown) => Payload;
|
|
71
75
|
__payload: Payload;
|
|
72
76
|
};
|
|
73
|
-
declare function EventDefinition$
|
|
74
|
-
type EventHandler$
|
|
75
|
-
type BuildEventDefinition$
|
|
77
|
+
declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
|
|
78
|
+
type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
|
|
79
|
+
type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
|
|
76
80
|
|
|
77
|
-
type ServicePluginMethodInput = {
|
|
81
|
+
type ServicePluginMethodInput$5 = {
|
|
78
82
|
request: any;
|
|
79
83
|
metadata: any;
|
|
80
84
|
};
|
|
81
|
-
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
82
|
-
type ServicePluginMethodMetadata = {
|
|
85
|
+
type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
|
|
86
|
+
type ServicePluginMethodMetadata$5 = {
|
|
83
87
|
name: string;
|
|
84
88
|
primaryHttpMappingPath: string;
|
|
85
89
|
transformations: {
|
|
86
|
-
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
90
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
|
|
87
91
|
toREST: (...args: unknown[]) => unknown;
|
|
88
92
|
};
|
|
89
93
|
};
|
|
90
|
-
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
94
|
+
type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
|
|
91
95
|
__type: 'service-plugin-definition';
|
|
92
96
|
componentType: string;
|
|
93
|
-
methods: ServicePluginMethodMetadata[];
|
|
97
|
+
methods: ServicePluginMethodMetadata$5[];
|
|
94
98
|
__contract: Contract;
|
|
95
99
|
};
|
|
96
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
97
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
98
|
-
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
100
|
+
declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
|
|
101
|
+
type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
|
|
102
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
|
|
99
103
|
|
|
100
|
-
type RequestContext = {
|
|
104
|
+
type RequestContext$5 = {
|
|
101
105
|
isSSR: boolean;
|
|
102
106
|
host: string;
|
|
103
107
|
protocol?: string;
|
|
104
108
|
};
|
|
105
|
-
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
109
|
+
type ResponseTransformer$5 = (data: any, headers?: any) => any;
|
|
106
110
|
/**
|
|
107
111
|
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
112
|
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
113
|
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
114
|
*/
|
|
111
|
-
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
-
type AmbassadorRequestOptions<T = any> = {
|
|
115
|
+
type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
116
|
+
type AmbassadorRequestOptions$5<T = any> = {
|
|
113
117
|
_?: T;
|
|
114
118
|
url?: string;
|
|
115
|
-
method?: Method;
|
|
119
|
+
method?: Method$5;
|
|
116
120
|
params?: any;
|
|
117
121
|
data?: any;
|
|
118
|
-
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
122
|
+
transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
|
|
119
123
|
};
|
|
120
|
-
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
124
|
+
type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
|
|
121
125
|
__isAmbassador: boolean;
|
|
122
126
|
};
|
|
123
|
-
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
124
|
-
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
127
|
+
type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
|
|
128
|
+
type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
125
129
|
|
|
126
130
|
declare global {
|
|
127
131
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -130,7 +134,7 @@ declare global {
|
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
declare const emptyObjectSymbol: unique symbol;
|
|
137
|
+
declare const emptyObjectSymbol$5: unique symbol;
|
|
134
138
|
|
|
135
139
|
/**
|
|
136
140
|
Represents a strictly empty plain object, the `{}` value.
|
|
@@ -158,7 +162,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
|
|
|
158
162
|
|
|
159
163
|
@category Object
|
|
160
164
|
*/
|
|
161
|
-
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
165
|
+
type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
|
|
162
166
|
|
|
163
167
|
/**
|
|
164
168
|
Returns a boolean for whether the two given types are equal.
|
|
@@ -186,7 +190,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
186
190
|
@category Type Guard
|
|
187
191
|
@category Utilities
|
|
188
192
|
*/
|
|
189
|
-
type IsEqual<A, B> =
|
|
193
|
+
type IsEqual$5<A, B> =
|
|
190
194
|
(<G>() => G extends A ? 1 : 2) extends
|
|
191
195
|
(<G>() => G extends B ? 1 : 2)
|
|
192
196
|
? true
|
|
@@ -219,9 +223,9 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
219
223
|
|
|
220
224
|
@see {Except}
|
|
221
225
|
*/
|
|
222
|
-
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
226
|
+
type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
227
|
|
|
224
|
-
type ExceptOptions = {
|
|
228
|
+
type ExceptOptions$5 = {
|
|
225
229
|
/**
|
|
226
230
|
Disallow assigning non-specified properties.
|
|
227
231
|
|
|
@@ -265,12 +269,78 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
|
265
269
|
|
|
266
270
|
@category Object
|
|
267
271
|
*/
|
|
268
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
269
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
272
|
+
type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
|
|
273
|
+
[KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
274
|
} & (Options['requireExactProps'] extends true
|
|
271
275
|
? Partial<Record<KeysType, never>>
|
|
272
276
|
: {});
|
|
273
277
|
|
|
278
|
+
/**
|
|
279
|
+
Returns a boolean for whether the given type is `never`.
|
|
280
|
+
|
|
281
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
282
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
283
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
284
|
+
|
|
285
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
286
|
+
|
|
287
|
+
@example
|
|
288
|
+
```
|
|
289
|
+
import type {IsNever, And} from 'type-fest';
|
|
290
|
+
|
|
291
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
292
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
293
|
+
And<
|
|
294
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
295
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
296
|
+
>;
|
|
297
|
+
|
|
298
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
299
|
+
AreStringsEqual<I, O> extends true
|
|
300
|
+
? never
|
|
301
|
+
: void;
|
|
302
|
+
|
|
303
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
304
|
+
if (input === output) {
|
|
305
|
+
process.exit(0);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
endIfEqual('abc', 'abc');
|
|
310
|
+
//=> never
|
|
311
|
+
|
|
312
|
+
endIfEqual('abc', '123');
|
|
313
|
+
//=> void
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
@category Type Guard
|
|
317
|
+
@category Utilities
|
|
318
|
+
*/
|
|
319
|
+
type IsNever$5<T> = [T] extends [never] ? true : false;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
323
|
+
|
|
324
|
+
@see {@link IsNever}
|
|
325
|
+
|
|
326
|
+
@example
|
|
327
|
+
```
|
|
328
|
+
import type {IfNever} from 'type-fest';
|
|
329
|
+
|
|
330
|
+
type ShouldBeTrue = IfNever<never>;
|
|
331
|
+
//=> true
|
|
332
|
+
|
|
333
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
334
|
+
//=> 'bar'
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
@category Type Guard
|
|
338
|
+
@category Utilities
|
|
339
|
+
*/
|
|
340
|
+
type IfNever$5<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
341
|
+
IsNever$5<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
342
|
+
);
|
|
343
|
+
|
|
274
344
|
/**
|
|
275
345
|
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
346
|
|
|
@@ -303,21 +373,19 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
|
303
373
|
|
|
304
374
|
@category Object
|
|
305
375
|
*/
|
|
306
|
-
type ConditionalKeys<Base, Condition> =
|
|
307
|
-
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
376
|
+
type ConditionalKeys$5<Base, Condition> =
|
|
308
377
|
{
|
|
309
378
|
// Map through all the keys of the given base type.
|
|
310
|
-
[Key in keyof Base]
|
|
379
|
+
[Key in keyof Base]-?:
|
|
311
380
|
// Pick only keys with types extending the given `Condition` type.
|
|
312
381
|
Base[Key] extends Condition
|
|
313
|
-
// Retain this key
|
|
314
|
-
|
|
382
|
+
// Retain this key
|
|
383
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
384
|
+
? IfNever$5<Base[Key], IfNever$5<Condition, Key, never>, Key>
|
|
315
385
|
// Discard this key since the condition fails.
|
|
316
386
|
: never;
|
|
317
|
-
|
|
318
387
|
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
-
}[keyof Base]
|
|
320
|
-
>;
|
|
388
|
+
}[keyof Base];
|
|
321
389
|
|
|
322
390
|
/**
|
|
323
391
|
Exclude keys from a shape that matches the given `Condition`.
|
|
@@ -357,9 +425,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
|
357
425
|
|
|
358
426
|
@category Object
|
|
359
427
|
*/
|
|
360
|
-
type ConditionalExcept<Base, Condition> = Except<
|
|
428
|
+
type ConditionalExcept$5<Base, Condition> = Except$5<
|
|
361
429
|
Base,
|
|
362
|
-
ConditionalKeys<Base, Condition>
|
|
430
|
+
ConditionalKeys$5<Base, Condition>
|
|
363
431
|
>;
|
|
364
432
|
|
|
365
433
|
/**
|
|
@@ -367,8 +435,8 @@ ConditionalKeys<Base, Condition>
|
|
|
367
435
|
* can either be a REST module or a host module.
|
|
368
436
|
* This type is recursive, so it can describe nested modules.
|
|
369
437
|
*/
|
|
370
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$
|
|
371
|
-
[key: string]: Descriptors | PublicMetadata | any;
|
|
438
|
+
type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$5<any> | ServicePluginDefinition$5<any> | {
|
|
439
|
+
[key: string]: Descriptors$5 | PublicMetadata$5 | any;
|
|
372
440
|
};
|
|
373
441
|
/**
|
|
374
442
|
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
@@ -376,12 +444,12 @@ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostM
|
|
|
376
444
|
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
445
|
* do not match the given host (as they will not work with the given host).
|
|
378
446
|
*/
|
|
379
|
-
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
447
|
+
type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
|
|
380
448
|
done: T;
|
|
381
449
|
recurse: T extends {
|
|
382
|
-
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$
|
|
384
|
-
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
450
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
|
|
451
|
+
} ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
|
|
452
|
+
[Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
|
|
385
453
|
-1,
|
|
386
454
|
0,
|
|
387
455
|
1,
|
|
@@ -390,9 +458,9 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
|
|
|
390
458
|
4,
|
|
391
459
|
5
|
|
392
460
|
][Depth]> : never;
|
|
393
|
-
}, EmptyObject>;
|
|
461
|
+
}, EmptyObject$5>;
|
|
394
462
|
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
-
type PublicMetadata = {
|
|
463
|
+
type PublicMetadata$5 = {
|
|
396
464
|
PACKAGE_NAME?: string;
|
|
397
465
|
};
|
|
398
466
|
|
|
@@ -404,9 +472,9 @@ declare global {
|
|
|
404
472
|
* A type used to create concerete types from SDK descriptors in
|
|
405
473
|
* case a contextual client is available.
|
|
406
474
|
*/
|
|
407
|
-
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
408
|
-
host: Host;
|
|
409
|
-
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
475
|
+
type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
|
|
476
|
+
host: Host$5;
|
|
477
|
+
} ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
|
|
410
478
|
|
|
411
479
|
/** BlogCache is the main entity of BlogCacheService */
|
|
412
480
|
interface BlogCache {
|
|
@@ -1114,7 +1182,7 @@ interface GetBlogCacheResponseNonNullableFields {
|
|
|
1114
1182
|
blogCache?: BlogCacheNonNullableFields;
|
|
1115
1183
|
}
|
|
1116
1184
|
|
|
1117
|
-
declare function getBlogCache$1(httpClient: HttpClient): GetBlogCacheSignature;
|
|
1185
|
+
declare function getBlogCache$1(httpClient: HttpClient$5): GetBlogCacheSignature;
|
|
1118
1186
|
interface GetBlogCacheSignature {
|
|
1119
1187
|
/**
|
|
1120
1188
|
* Gets blog cache.
|
|
@@ -1122,7 +1190,7 @@ interface GetBlogCacheSignature {
|
|
|
1122
1190
|
(): Promise<GetBlogCacheResponse & GetBlogCacheResponseNonNullableFields>;
|
|
1123
1191
|
}
|
|
1124
1192
|
|
|
1125
|
-
declare const getBlogCache: MaybeContext<BuildRESTFunction<typeof getBlogCache$1> & typeof getBlogCache$1>;
|
|
1193
|
+
declare const getBlogCache: MaybeContext$5<BuildRESTFunction$5<typeof getBlogCache$1> & typeof getBlogCache$1>;
|
|
1126
1194
|
|
|
1127
1195
|
type context$5_Address = Address;
|
|
1128
1196
|
type context$5_AddressHint = AddressHint;
|
|
@@ -1169,187 +1237,1143 @@ declare namespace context$5 {
|
|
|
1169
1237
|
export { type ActionEvent$4 as ActionEvent, type context$5_Address as Address, type context$5_AddressHint as AddressHint, type context$5_BlogCache as BlogCache, type context$5_BusinessSchedule as BusinessSchedule, type context$5_Categories as Categories, type context$5_ChangeContext as ChangeContext, type context$5_ChangeContextPayloadOneOf as ChangeContextPayloadOneOf, type context$5_ConsentPolicy as ConsentPolicy, context$5_DayOfWeek as DayOfWeek, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type context$5_Empty as Empty, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, context$5_Flag as Flag, type context$5_GeoCoordinates as GeoCoordinates, type context$5_GetBlogCacheRequest as GetBlogCacheRequest, type context$5_GetBlogCacheResponse as GetBlogCacheResponse, type context$5_GetBlogCacheResponseNonNullableFields as GetBlogCacheResponseNonNullableFields, type context$5_Locale as Locale, context$5_LocaleStatus as LocaleStatus, type context$5_Multilingual as Multilingual, type context$5_PageInfo as PageInfo, type context$5_PagesData as PagesData, context$5_PlacementType as PlacementType, type context$5_Properties as Properties, type context$5_PropertiesChange as PropertiesChange, context$5_ResolutionMethod as ResolutionMethod, type RestoreInfo$4 as RestoreInfo, type context$5_SiteCloned as SiteCloned, type context$5_SiteCreated as SiteCreated, type context$5_SiteProperties as SiteProperties, type context$5_SitePropertiesEvent as SitePropertiesEvent, type context$5_SitePropertiesNotification as SitePropertiesNotification, type context$5_SiteSupportedLanguage as SiteSupportedLanguage, type context$5_SpecialHourPeriod as SpecialHourPeriod, type context$5_SupportedLanguage as SupportedLanguage, type context$5_TimePeriod as TimePeriod, type context$5_Translation as Translation, type context$5_UrlInvalidationNotification as UrlInvalidationNotification, context$5_getBlogCache as getBlogCache };
|
|
1170
1238
|
}
|
|
1171
1239
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
url?: string | null;
|
|
1187
|
-
}
|
|
1188
|
-
declare enum Status$2 {
|
|
1189
|
-
UNKNOWN = "UNKNOWN",
|
|
1190
|
-
READY_TO_IMPORT = "READY_TO_IMPORT",
|
|
1191
|
-
STARTED = "STARTED",
|
|
1192
|
-
FAILED = "FAILED",
|
|
1193
|
-
DONE = "DONE"
|
|
1194
|
-
}
|
|
1195
|
-
interface StartImportRequest {
|
|
1196
|
-
/** Should publish the posts after import. */
|
|
1197
|
-
shouldPublish?: boolean | null;
|
|
1198
|
-
}
|
|
1199
|
-
interface StartImportResponse {
|
|
1200
|
-
}
|
|
1201
|
-
interface UploadFileForImportRequest {
|
|
1202
|
-
/** The content of the WordPress XML file. */
|
|
1203
|
-
fileContent?: Uint8Array | null;
|
|
1204
|
-
/** The name of the uploaded file. */
|
|
1205
|
-
fileName?: string | null;
|
|
1206
|
-
}
|
|
1207
|
-
interface UploadFileForImportResponse {
|
|
1208
|
-
/** Number of posts. */
|
|
1209
|
-
totalPosts?: number | null;
|
|
1210
|
-
}
|
|
1211
|
-
interface SubmitUrlForImportRequest {
|
|
1212
|
-
/** Url to wordpress xml file. */
|
|
1213
|
-
url: string;
|
|
1214
|
-
}
|
|
1215
|
-
interface SubmitUrlForImportResponse {
|
|
1216
|
-
}
|
|
1217
|
-
interface ValidateUrlForImportRequest {
|
|
1218
|
-
/** Url for wordpress site. */
|
|
1219
|
-
url: string | null;
|
|
1220
|
-
}
|
|
1221
|
-
interface ValidateUrlForImportResponse {
|
|
1222
|
-
/** Number of posts. */
|
|
1223
|
-
totalPosts?: number | null;
|
|
1224
|
-
/** Blog title. */
|
|
1225
|
-
blogTitle?: string | null;
|
|
1226
|
-
}
|
|
1227
|
-
interface GetImportStatusRequest {
|
|
1228
|
-
}
|
|
1229
|
-
interface GetImportStatusResponse {
|
|
1230
|
-
/** Details of import progress. */
|
|
1231
|
-
importStatus?: ImportStatus;
|
|
1232
|
-
}
|
|
1233
|
-
interface GetNotImportedPostsRequest {
|
|
1234
|
-
}
|
|
1235
|
-
interface GetNotImportedPostsResponse {
|
|
1236
|
-
/** Failed entities. */
|
|
1237
|
-
notImportedPosts?: Post$1[];
|
|
1238
|
-
}
|
|
1239
|
-
interface Post$1 {
|
|
1240
|
-
/** The id of the post. */
|
|
1241
|
-
_id?: string;
|
|
1242
|
-
/** Title of the post. */
|
|
1243
|
-
title?: string;
|
|
1244
|
-
/** Url to posts in wordpress. */
|
|
1245
|
-
url?: string;
|
|
1246
|
-
}
|
|
1247
|
-
interface ImportStatusNonNullableFields {
|
|
1248
|
-
_id: string;
|
|
1249
|
-
fileName: string;
|
|
1250
|
-
status: Status$2;
|
|
1251
|
-
importAmount: number;
|
|
1252
|
-
alreadyImportedAmount: number;
|
|
1253
|
-
processedAmount: number;
|
|
1254
|
-
}
|
|
1255
|
-
interface GetImportStatusResponseNonNullableFields {
|
|
1256
|
-
importStatus?: ImportStatusNonNullableFields;
|
|
1257
|
-
}
|
|
1258
|
-
interface PostNonNullableFields$1 {
|
|
1259
|
-
_id: string;
|
|
1260
|
-
title: string;
|
|
1261
|
-
url: string;
|
|
1262
|
-
}
|
|
1263
|
-
interface GetNotImportedPostsResponseNonNullableFields {
|
|
1264
|
-
notImportedPosts: PostNonNullableFields$1[];
|
|
1265
|
-
}
|
|
1266
|
-
interface StartImportOptions {
|
|
1267
|
-
/** Should publish the posts after import. */
|
|
1268
|
-
shouldPublish?: boolean | null;
|
|
1269
|
-
}
|
|
1270
|
-
interface UploadFileForImportOptions {
|
|
1271
|
-
/** The content of the WordPress XML file. */
|
|
1272
|
-
fileContent?: Uint8Array | null;
|
|
1273
|
-
/** The name of the uploaded file. */
|
|
1274
|
-
fileName?: string | null;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
declare function startImport$1(httpClient: HttpClient): StartImportSignature;
|
|
1278
|
-
interface StartImportSignature {
|
|
1240
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
1241
|
+
__type: 'host';
|
|
1242
|
+
create(host: H): T;
|
|
1243
|
+
};
|
|
1244
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
1245
|
+
type Host$4<Environment = unknown> = {
|
|
1246
|
+
channel: {
|
|
1247
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1248
|
+
disconnect: () => void;
|
|
1249
|
+
} | Promise<{
|
|
1250
|
+
disconnect: () => void;
|
|
1251
|
+
}>;
|
|
1252
|
+
};
|
|
1253
|
+
environment?: Environment;
|
|
1279
1254
|
/**
|
|
1280
|
-
*
|
|
1255
|
+
* Optional name of the environment, use for logging
|
|
1281
1256
|
*/
|
|
1282
|
-
|
|
1283
|
-
}
|
|
1284
|
-
declare function uploadFileForImport$1(httpClient: HttpClient): UploadFileForImportSignature;
|
|
1285
|
-
interface UploadFileForImportSignature {
|
|
1286
|
-
/** */
|
|
1287
|
-
(options?: UploadFileForImportOptions | undefined): Promise<UploadFileForImportResponse>;
|
|
1288
|
-
}
|
|
1289
|
-
declare function submitUrlForImport$1(httpClient: HttpClient): SubmitUrlForImportSignature;
|
|
1290
|
-
interface SubmitUrlForImportSignature {
|
|
1257
|
+
name?: string;
|
|
1291
1258
|
/**
|
|
1292
|
-
*
|
|
1293
|
-
* It will prepare wordpress data for import from the given URL.
|
|
1294
|
-
* Use "GetImportStatus" to get the status of the import process.
|
|
1295
|
-
* Once the import status becomes READY_TO_IMPORT, the import process can be started by invoking "StartImport".
|
|
1296
|
-
* @param - Url to wordpress xml file.
|
|
1259
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1297
1260
|
*/
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
declare function validateUrlForImport$1(httpClient: HttpClient): ValidateUrlForImportSignature;
|
|
1301
|
-
interface ValidateUrlForImportSignature {
|
|
1302
|
-
/** @param - Url for wordpress site. */
|
|
1303
|
-
(url: string | null): Promise<ValidateUrlForImportResponse>;
|
|
1304
|
-
}
|
|
1305
|
-
declare function getImportStatus$1(httpClient: HttpClient): GetImportStatusSignature;
|
|
1306
|
-
interface GetImportStatusSignature {
|
|
1261
|
+
apiBaseUrl?: string;
|
|
1307
1262
|
/**
|
|
1308
|
-
*
|
|
1263
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1264
|
+
* like internationalization, billing, etc.
|
|
1309
1265
|
*/
|
|
1310
|
-
|
|
1266
|
+
essentials?: {
|
|
1267
|
+
/**
|
|
1268
|
+
* The language of the currently viewed session
|
|
1269
|
+
*/
|
|
1270
|
+
language?: string;
|
|
1271
|
+
/**
|
|
1272
|
+
* The locale of the currently viewed session
|
|
1273
|
+
*/
|
|
1274
|
+
locale?: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* Any headers that should be passed through to the API requests
|
|
1277
|
+
*/
|
|
1278
|
+
passThroughHeaders?: Record<string, string>;
|
|
1279
|
+
};
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
1283
|
+
interface HttpClient$4 {
|
|
1284
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
1285
|
+
fetchWithAuth: typeof fetch;
|
|
1286
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1287
|
+
getActiveToken?: () => string | undefined;
|
|
1311
1288
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1289
|
+
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
1290
|
+
type HttpResponse$4<T = any> = {
|
|
1291
|
+
data: T;
|
|
1292
|
+
status: number;
|
|
1293
|
+
statusText: string;
|
|
1294
|
+
headers: any;
|
|
1295
|
+
request?: any;
|
|
1296
|
+
};
|
|
1297
|
+
type RequestOptions$4<_TResponse = any, Data = any> = {
|
|
1298
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1299
|
+
url: string;
|
|
1300
|
+
data?: Data;
|
|
1301
|
+
params?: URLSearchParams;
|
|
1302
|
+
} & APIMetadata$4;
|
|
1303
|
+
type APIMetadata$4 = {
|
|
1304
|
+
methodFqn?: string;
|
|
1305
|
+
entityFqdn?: string;
|
|
1306
|
+
packageName?: string;
|
|
1307
|
+
};
|
|
1308
|
+
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
1309
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
1310
|
+
__type: 'event-definition';
|
|
1311
|
+
type: Type;
|
|
1312
|
+
isDomainEvent?: boolean;
|
|
1313
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1314
|
+
__payload: Payload;
|
|
1315
|
+
};
|
|
1316
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
1317
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
1318
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
1319
|
+
|
|
1320
|
+
type ServicePluginMethodInput$4 = {
|
|
1321
|
+
request: any;
|
|
1322
|
+
metadata: any;
|
|
1323
|
+
};
|
|
1324
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
1325
|
+
type ServicePluginMethodMetadata$4 = {
|
|
1326
|
+
name: string;
|
|
1327
|
+
primaryHttpMappingPath: string;
|
|
1328
|
+
transformations: {
|
|
1329
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
1330
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1333
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
1334
|
+
__type: 'service-plugin-definition';
|
|
1335
|
+
componentType: string;
|
|
1336
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
1337
|
+
__contract: Contract;
|
|
1338
|
+
};
|
|
1339
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
1340
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
1341
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
1342
|
+
|
|
1343
|
+
type RequestContext$4 = {
|
|
1344
|
+
isSSR: boolean;
|
|
1345
|
+
host: string;
|
|
1346
|
+
protocol?: string;
|
|
1347
|
+
};
|
|
1348
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
1349
|
+
/**
|
|
1350
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1351
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1352
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1353
|
+
*/
|
|
1354
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1355
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
1356
|
+
_?: T;
|
|
1357
|
+
url?: string;
|
|
1358
|
+
method?: Method$4;
|
|
1359
|
+
params?: any;
|
|
1360
|
+
data?: any;
|
|
1361
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
1362
|
+
};
|
|
1363
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
1364
|
+
__isAmbassador: boolean;
|
|
1365
|
+
};
|
|
1366
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
1367
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1368
|
+
|
|
1369
|
+
declare global {
|
|
1370
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1371
|
+
interface SymbolConstructor {
|
|
1372
|
+
readonly observable: symbol;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1380
|
+
|
|
1381
|
+
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)).
|
|
1382
|
+
|
|
1383
|
+
@example
|
|
1384
|
+
```
|
|
1385
|
+
import type {EmptyObject} from 'type-fest';
|
|
1386
|
+
|
|
1387
|
+
// The following illustrates the problem with `{}`.
|
|
1388
|
+
const foo1: {} = {}; // Pass
|
|
1389
|
+
const foo2: {} = []; // Pass
|
|
1390
|
+
const foo3: {} = 42; // Pass
|
|
1391
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1392
|
+
|
|
1393
|
+
// With `EmptyObject` only the first case is valid.
|
|
1394
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1395
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1396
|
+
const bar3: EmptyObject = []; // Fail
|
|
1397
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1398
|
+
```
|
|
1399
|
+
|
|
1400
|
+
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}.
|
|
1401
|
+
|
|
1402
|
+
@category Object
|
|
1403
|
+
*/
|
|
1404
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
Returns a boolean for whether the two given types are equal.
|
|
1408
|
+
|
|
1409
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1410
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1411
|
+
|
|
1412
|
+
Use-cases:
|
|
1413
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1414
|
+
|
|
1415
|
+
@example
|
|
1416
|
+
```
|
|
1417
|
+
import type {IsEqual} from 'type-fest';
|
|
1418
|
+
|
|
1419
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1420
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1421
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1422
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1423
|
+
? IsEqual<Value[0], Item> extends true
|
|
1424
|
+
? true
|
|
1425
|
+
: Includes<rest, Item>
|
|
1426
|
+
: false;
|
|
1427
|
+
```
|
|
1428
|
+
|
|
1429
|
+
@category Type Guard
|
|
1430
|
+
@category Utilities
|
|
1431
|
+
*/
|
|
1432
|
+
type IsEqual$4<A, B> =
|
|
1433
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1434
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1435
|
+
? true
|
|
1436
|
+
: false;
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
Filter out keys from an object.
|
|
1440
|
+
|
|
1441
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1442
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1443
|
+
Returns `Key` otherwise.
|
|
1444
|
+
|
|
1445
|
+
@example
|
|
1446
|
+
```
|
|
1447
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1448
|
+
//=> never
|
|
1449
|
+
```
|
|
1450
|
+
|
|
1451
|
+
@example
|
|
1452
|
+
```
|
|
1453
|
+
type Filtered = Filter<'bar', string>;
|
|
1454
|
+
//=> never
|
|
1455
|
+
```
|
|
1456
|
+
|
|
1457
|
+
@example
|
|
1458
|
+
```
|
|
1459
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1460
|
+
//=> 'bar'
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
@see {Except}
|
|
1464
|
+
*/
|
|
1465
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1466
|
+
|
|
1467
|
+
type ExceptOptions$4 = {
|
|
1468
|
+
/**
|
|
1469
|
+
Disallow assigning non-specified properties.
|
|
1470
|
+
|
|
1471
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1472
|
+
|
|
1473
|
+
@default false
|
|
1474
|
+
*/
|
|
1475
|
+
requireExactProps?: boolean;
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
Create a type from an object type without certain keys.
|
|
1480
|
+
|
|
1481
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1482
|
+
|
|
1483
|
+
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.
|
|
1484
|
+
|
|
1485
|
+
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)).
|
|
1486
|
+
|
|
1487
|
+
@example
|
|
1488
|
+
```
|
|
1489
|
+
import type {Except} from 'type-fest';
|
|
1490
|
+
|
|
1491
|
+
type Foo = {
|
|
1492
|
+
a: number;
|
|
1493
|
+
b: string;
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1497
|
+
//=> {b: string}
|
|
1498
|
+
|
|
1499
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1500
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1501
|
+
|
|
1502
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1503
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1504
|
+
|
|
1505
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1506
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
@category Object
|
|
1510
|
+
*/
|
|
1511
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
1512
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1513
|
+
} & (Options['requireExactProps'] extends true
|
|
1514
|
+
? Partial<Record<KeysType, never>>
|
|
1515
|
+
: {});
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
Returns a boolean for whether the given type is `never`.
|
|
1519
|
+
|
|
1520
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
1521
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
1522
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
1523
|
+
|
|
1524
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
1525
|
+
|
|
1526
|
+
@example
|
|
1527
|
+
```
|
|
1528
|
+
import type {IsNever, And} from 'type-fest';
|
|
1529
|
+
|
|
1530
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
1531
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
1532
|
+
And<
|
|
1533
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
1534
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
1535
|
+
>;
|
|
1536
|
+
|
|
1537
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
1538
|
+
AreStringsEqual<I, O> extends true
|
|
1539
|
+
? never
|
|
1540
|
+
: void;
|
|
1541
|
+
|
|
1542
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
1543
|
+
if (input === output) {
|
|
1544
|
+
process.exit(0);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
endIfEqual('abc', 'abc');
|
|
1549
|
+
//=> never
|
|
1550
|
+
|
|
1551
|
+
endIfEqual('abc', '123');
|
|
1552
|
+
//=> void
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
@category Type Guard
|
|
1556
|
+
@category Utilities
|
|
1557
|
+
*/
|
|
1558
|
+
type IsNever$4<T> = [T] extends [never] ? true : false;
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
1562
|
+
|
|
1563
|
+
@see {@link IsNever}
|
|
1564
|
+
|
|
1565
|
+
@example
|
|
1566
|
+
```
|
|
1567
|
+
import type {IfNever} from 'type-fest';
|
|
1568
|
+
|
|
1569
|
+
type ShouldBeTrue = IfNever<never>;
|
|
1570
|
+
//=> true
|
|
1571
|
+
|
|
1572
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
1573
|
+
//=> 'bar'
|
|
1574
|
+
```
|
|
1575
|
+
|
|
1576
|
+
@category Type Guard
|
|
1577
|
+
@category Utilities
|
|
1578
|
+
*/
|
|
1579
|
+
type IfNever$4<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
1580
|
+
IsNever$4<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
1581
|
+
);
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1585
|
+
|
|
1586
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1587
|
+
|
|
1588
|
+
@example
|
|
1589
|
+
```
|
|
1590
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1591
|
+
|
|
1592
|
+
interface Example {
|
|
1593
|
+
a: string;
|
|
1594
|
+
b: string | number;
|
|
1595
|
+
c?: string;
|
|
1596
|
+
d: {};
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1600
|
+
//=> 'a'
|
|
1601
|
+
```
|
|
1602
|
+
|
|
1603
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1604
|
+
|
|
1605
|
+
@example
|
|
1606
|
+
```
|
|
1607
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1608
|
+
|
|
1609
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1610
|
+
//=> 'a' | 'c'
|
|
1611
|
+
```
|
|
1612
|
+
|
|
1613
|
+
@category Object
|
|
1614
|
+
*/
|
|
1615
|
+
type ConditionalKeys$4<Base, Condition> =
|
|
1616
|
+
{
|
|
1617
|
+
// Map through all the keys of the given base type.
|
|
1618
|
+
[Key in keyof Base]-?:
|
|
1619
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1620
|
+
Base[Key] extends Condition
|
|
1621
|
+
// Retain this key
|
|
1622
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
1623
|
+
? IfNever$4<Base[Key], IfNever$4<Condition, Key, never>, Key>
|
|
1624
|
+
// Discard this key since the condition fails.
|
|
1625
|
+
: never;
|
|
1626
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1627
|
+
}[keyof Base];
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1631
|
+
|
|
1632
|
+
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.
|
|
1633
|
+
|
|
1634
|
+
@example
|
|
1635
|
+
```
|
|
1636
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1637
|
+
|
|
1638
|
+
class Awesome {
|
|
1639
|
+
name: string;
|
|
1640
|
+
successes: number;
|
|
1641
|
+
failures: bigint;
|
|
1642
|
+
|
|
1643
|
+
run() {}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1647
|
+
//=> {run: () => void}
|
|
1648
|
+
```
|
|
1649
|
+
|
|
1650
|
+
@example
|
|
1651
|
+
```
|
|
1652
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1653
|
+
|
|
1654
|
+
interface Example {
|
|
1655
|
+
a: string;
|
|
1656
|
+
b: string | number;
|
|
1657
|
+
c: () => void;
|
|
1658
|
+
d: {};
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1662
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
@category Object
|
|
1666
|
+
*/
|
|
1667
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
1668
|
+
Base,
|
|
1669
|
+
ConditionalKeys$4<Base, Condition>
|
|
1670
|
+
>;
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1674
|
+
* can either be a REST module or a host module.
|
|
1675
|
+
* This type is recursive, so it can describe nested modules.
|
|
1676
|
+
*/
|
|
1677
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$4<any> | ServicePluginDefinition$4<any> | {
|
|
1678
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
1679
|
+
};
|
|
1680
|
+
/**
|
|
1681
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1682
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1683
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1684
|
+
* do not match the given host (as they will not work with the given host).
|
|
1685
|
+
*/
|
|
1686
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
1687
|
+
done: T;
|
|
1688
|
+
recurse: T extends {
|
|
1689
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
1690
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
1691
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
1692
|
+
-1,
|
|
1693
|
+
0,
|
|
1694
|
+
1,
|
|
1695
|
+
2,
|
|
1696
|
+
3,
|
|
1697
|
+
4,
|
|
1698
|
+
5
|
|
1699
|
+
][Depth]> : never;
|
|
1700
|
+
}, EmptyObject$4>;
|
|
1701
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1702
|
+
type PublicMetadata$4 = {
|
|
1703
|
+
PACKAGE_NAME?: string;
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
declare global {
|
|
1707
|
+
interface ContextualClient {
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1712
|
+
* case a contextual client is available.
|
|
1713
|
+
*/
|
|
1714
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
1715
|
+
host: Host$4;
|
|
1716
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
1717
|
+
|
|
1718
|
+
interface ImportStatus {
|
|
1719
|
+
/** Import Id. */
|
|
1720
|
+
_id?: string;
|
|
1721
|
+
/** File name of wordpress xml file that is being imported. */
|
|
1722
|
+
fileName?: string;
|
|
1723
|
+
/** Status of the latest import. */
|
|
1724
|
+
status?: Status$2;
|
|
1725
|
+
/** Total amount of entities to be imported. */
|
|
1726
|
+
importAmount?: number;
|
|
1727
|
+
/** Amount of entities imported successfully. */
|
|
1728
|
+
alreadyImportedAmount?: number;
|
|
1729
|
+
/** Amount of entities processed. */
|
|
1730
|
+
processedAmount?: number;
|
|
1731
|
+
/** Url for the page that is being imported. */
|
|
1732
|
+
url?: string | null;
|
|
1733
|
+
}
|
|
1734
|
+
declare enum Status$2 {
|
|
1735
|
+
UNKNOWN = "UNKNOWN",
|
|
1736
|
+
READY_TO_IMPORT = "READY_TO_IMPORT",
|
|
1737
|
+
STARTED = "STARTED",
|
|
1738
|
+
FAILED = "FAILED",
|
|
1739
|
+
DONE = "DONE"
|
|
1740
|
+
}
|
|
1741
|
+
interface StartImportRequest {
|
|
1742
|
+
/** Should publish the posts after import. */
|
|
1743
|
+
shouldPublish?: boolean | null;
|
|
1744
|
+
}
|
|
1745
|
+
interface StartImportResponse {
|
|
1746
|
+
}
|
|
1747
|
+
interface UploadFileForImportRequest {
|
|
1748
|
+
/** The content of the WordPress XML file. */
|
|
1749
|
+
fileContent?: Uint8Array | null;
|
|
1750
|
+
/** The name of the uploaded file. */
|
|
1751
|
+
fileName?: string | null;
|
|
1752
|
+
}
|
|
1753
|
+
interface UploadFileForImportResponse {
|
|
1754
|
+
/** Number of posts. */
|
|
1755
|
+
totalPosts?: number | null;
|
|
1756
|
+
}
|
|
1757
|
+
interface SubmitUrlForImportRequest {
|
|
1758
|
+
/** Url to wordpress xml file. */
|
|
1759
|
+
url: string;
|
|
1760
|
+
}
|
|
1761
|
+
interface SubmitUrlForImportResponse {
|
|
1762
|
+
}
|
|
1763
|
+
interface ValidateUrlForImportRequest {
|
|
1764
|
+
/** Url for wordpress site. */
|
|
1765
|
+
url: string | null;
|
|
1766
|
+
}
|
|
1767
|
+
interface ValidateUrlForImportResponse {
|
|
1768
|
+
/** Number of posts. */
|
|
1769
|
+
totalPosts?: number | null;
|
|
1770
|
+
/** Blog title. */
|
|
1771
|
+
blogTitle?: string | null;
|
|
1772
|
+
}
|
|
1773
|
+
interface GetImportStatusRequest {
|
|
1774
|
+
}
|
|
1775
|
+
interface GetImportStatusResponse {
|
|
1776
|
+
/** Details of import progress. */
|
|
1777
|
+
importStatus?: ImportStatus;
|
|
1778
|
+
}
|
|
1779
|
+
interface GetNotImportedPostsRequest {
|
|
1780
|
+
}
|
|
1781
|
+
interface GetNotImportedPostsResponse {
|
|
1782
|
+
/** Failed entities. */
|
|
1783
|
+
notImportedPosts?: Post$1[];
|
|
1784
|
+
}
|
|
1785
|
+
interface Post$1 {
|
|
1786
|
+
/** The id of the post. */
|
|
1787
|
+
_id?: string;
|
|
1788
|
+
/** Title of the post. */
|
|
1789
|
+
title?: string;
|
|
1790
|
+
/** Url to posts in wordpress. */
|
|
1791
|
+
url?: string;
|
|
1792
|
+
}
|
|
1793
|
+
interface ImportStatusNonNullableFields {
|
|
1794
|
+
_id: string;
|
|
1795
|
+
fileName: string;
|
|
1796
|
+
status: Status$2;
|
|
1797
|
+
importAmount: number;
|
|
1798
|
+
alreadyImportedAmount: number;
|
|
1799
|
+
processedAmount: number;
|
|
1800
|
+
}
|
|
1801
|
+
interface GetImportStatusResponseNonNullableFields {
|
|
1802
|
+
importStatus?: ImportStatusNonNullableFields;
|
|
1803
|
+
}
|
|
1804
|
+
interface PostNonNullableFields$1 {
|
|
1805
|
+
_id: string;
|
|
1806
|
+
title: string;
|
|
1807
|
+
url: string;
|
|
1808
|
+
}
|
|
1809
|
+
interface GetNotImportedPostsResponseNonNullableFields {
|
|
1810
|
+
notImportedPosts: PostNonNullableFields$1[];
|
|
1811
|
+
}
|
|
1812
|
+
interface StartImportOptions {
|
|
1813
|
+
/** Should publish the posts after import. */
|
|
1814
|
+
shouldPublish?: boolean | null;
|
|
1815
|
+
}
|
|
1816
|
+
interface UploadFileForImportOptions {
|
|
1817
|
+
/** The content of the WordPress XML file. */
|
|
1818
|
+
fileContent?: Uint8Array | null;
|
|
1819
|
+
/** The name of the uploaded file. */
|
|
1820
|
+
fileName?: string | null;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
declare function startImport$1(httpClient: HttpClient$4): StartImportSignature;
|
|
1824
|
+
interface StartImportSignature {
|
|
1825
|
+
/**
|
|
1826
|
+
* Starts wordpress import process.
|
|
1827
|
+
*/
|
|
1828
|
+
(options?: StartImportOptions | undefined): Promise<void>;
|
|
1829
|
+
}
|
|
1830
|
+
declare function uploadFileForImport$1(httpClient: HttpClient$4): UploadFileForImportSignature;
|
|
1831
|
+
interface UploadFileForImportSignature {
|
|
1832
|
+
/** */
|
|
1833
|
+
(options?: UploadFileForImportOptions | undefined): Promise<UploadFileForImportResponse>;
|
|
1834
|
+
}
|
|
1835
|
+
declare function submitUrlForImport$1(httpClient: HttpClient$4): SubmitUrlForImportSignature;
|
|
1836
|
+
interface SubmitUrlForImportSignature {
|
|
1837
|
+
/**
|
|
1838
|
+
* Submits wordpress import process from URL.
|
|
1839
|
+
* It will prepare wordpress data for import from the given URL.
|
|
1840
|
+
* Use "GetImportStatus" to get the status of the import process.
|
|
1841
|
+
* Once the import status becomes READY_TO_IMPORT, the import process can be started by invoking "StartImport".
|
|
1842
|
+
* @param - Url to wordpress xml file.
|
|
1843
|
+
*/
|
|
1844
|
+
(url: string): Promise<void>;
|
|
1845
|
+
}
|
|
1846
|
+
declare function validateUrlForImport$1(httpClient: HttpClient$4): ValidateUrlForImportSignature;
|
|
1847
|
+
interface ValidateUrlForImportSignature {
|
|
1848
|
+
/** @param - Url for wordpress site. */
|
|
1849
|
+
(url: string | null): Promise<ValidateUrlForImportResponse>;
|
|
1850
|
+
}
|
|
1851
|
+
declare function getImportStatus$1(httpClient: HttpClient$4): GetImportStatusSignature;
|
|
1852
|
+
interface GetImportStatusSignature {
|
|
1853
|
+
/**
|
|
1854
|
+
* Gets the status of the import process.
|
|
1855
|
+
*/
|
|
1856
|
+
(): Promise<GetImportStatusResponse & GetImportStatusResponseNonNullableFields>;
|
|
1857
|
+
}
|
|
1858
|
+
declare function getNotImportedPosts$1(httpClient: HttpClient$4): GetNotImportedPostsSignature;
|
|
1859
|
+
interface GetNotImportedPostsSignature {
|
|
1860
|
+
/**
|
|
1315
1861
|
* Gets the posts that were not yet imported either because of an error or because import is still in progress.
|
|
1316
1862
|
*/
|
|
1317
1863
|
(): Promise<GetNotImportedPostsResponse & GetNotImportedPostsResponseNonNullableFields>;
|
|
1318
1864
|
}
|
|
1319
1865
|
|
|
1320
|
-
declare const startImport: MaybeContext<BuildRESTFunction<typeof startImport$1> & typeof startImport$1>;
|
|
1321
|
-
declare const uploadFileForImport: MaybeContext<BuildRESTFunction<typeof uploadFileForImport$1> & typeof uploadFileForImport$1>;
|
|
1322
|
-
declare const submitUrlForImport: MaybeContext<BuildRESTFunction<typeof submitUrlForImport$1> & typeof submitUrlForImport$1>;
|
|
1323
|
-
declare const validateUrlForImport: MaybeContext<BuildRESTFunction<typeof validateUrlForImport$1> & typeof validateUrlForImport$1>;
|
|
1324
|
-
declare const getImportStatus: MaybeContext<BuildRESTFunction<typeof getImportStatus$1> & typeof getImportStatus$1>;
|
|
1325
|
-
declare const getNotImportedPosts: MaybeContext<BuildRESTFunction<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1>;
|
|
1866
|
+
declare const startImport: MaybeContext$4<BuildRESTFunction$4<typeof startImport$1> & typeof startImport$1>;
|
|
1867
|
+
declare const uploadFileForImport: MaybeContext$4<BuildRESTFunction$4<typeof uploadFileForImport$1> & typeof uploadFileForImport$1>;
|
|
1868
|
+
declare const submitUrlForImport: MaybeContext$4<BuildRESTFunction$4<typeof submitUrlForImport$1> & typeof submitUrlForImport$1>;
|
|
1869
|
+
declare const validateUrlForImport: MaybeContext$4<BuildRESTFunction$4<typeof validateUrlForImport$1> & typeof validateUrlForImport$1>;
|
|
1870
|
+
declare const getImportStatus: MaybeContext$4<BuildRESTFunction$4<typeof getImportStatus$1> & typeof getImportStatus$1>;
|
|
1871
|
+
declare const getNotImportedPosts: MaybeContext$4<BuildRESTFunction$4<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1>;
|
|
1872
|
+
|
|
1873
|
+
type context$4_GetImportStatusRequest = GetImportStatusRequest;
|
|
1874
|
+
type context$4_GetImportStatusResponse = GetImportStatusResponse;
|
|
1875
|
+
type context$4_GetImportStatusResponseNonNullableFields = GetImportStatusResponseNonNullableFields;
|
|
1876
|
+
type context$4_GetNotImportedPostsRequest = GetNotImportedPostsRequest;
|
|
1877
|
+
type context$4_GetNotImportedPostsResponse = GetNotImportedPostsResponse;
|
|
1878
|
+
type context$4_GetNotImportedPostsResponseNonNullableFields = GetNotImportedPostsResponseNonNullableFields;
|
|
1879
|
+
type context$4_ImportStatus = ImportStatus;
|
|
1880
|
+
type context$4_StartImportOptions = StartImportOptions;
|
|
1881
|
+
type context$4_StartImportRequest = StartImportRequest;
|
|
1882
|
+
type context$4_StartImportResponse = StartImportResponse;
|
|
1883
|
+
type context$4_SubmitUrlForImportRequest = SubmitUrlForImportRequest;
|
|
1884
|
+
type context$4_SubmitUrlForImportResponse = SubmitUrlForImportResponse;
|
|
1885
|
+
type context$4_UploadFileForImportOptions = UploadFileForImportOptions;
|
|
1886
|
+
type context$4_UploadFileForImportRequest = UploadFileForImportRequest;
|
|
1887
|
+
type context$4_UploadFileForImportResponse = UploadFileForImportResponse;
|
|
1888
|
+
type context$4_ValidateUrlForImportRequest = ValidateUrlForImportRequest;
|
|
1889
|
+
type context$4_ValidateUrlForImportResponse = ValidateUrlForImportResponse;
|
|
1890
|
+
declare const context$4_getImportStatus: typeof getImportStatus;
|
|
1891
|
+
declare const context$4_getNotImportedPosts: typeof getNotImportedPosts;
|
|
1892
|
+
declare const context$4_startImport: typeof startImport;
|
|
1893
|
+
declare const context$4_submitUrlForImport: typeof submitUrlForImport;
|
|
1894
|
+
declare const context$4_uploadFileForImport: typeof uploadFileForImport;
|
|
1895
|
+
declare const context$4_validateUrlForImport: typeof validateUrlForImport;
|
|
1896
|
+
declare namespace context$4 {
|
|
1897
|
+
export { type context$4_GetImportStatusRequest as GetImportStatusRequest, type context$4_GetImportStatusResponse as GetImportStatusResponse, type context$4_GetImportStatusResponseNonNullableFields as GetImportStatusResponseNonNullableFields, type context$4_GetNotImportedPostsRequest as GetNotImportedPostsRequest, type context$4_GetNotImportedPostsResponse as GetNotImportedPostsResponse, type context$4_GetNotImportedPostsResponseNonNullableFields as GetNotImportedPostsResponseNonNullableFields, type context$4_ImportStatus as ImportStatus, type Post$1 as Post, type context$4_StartImportOptions as StartImportOptions, type context$4_StartImportRequest as StartImportRequest, type context$4_StartImportResponse as StartImportResponse, Status$2 as Status, type context$4_SubmitUrlForImportRequest as SubmitUrlForImportRequest, type context$4_SubmitUrlForImportResponse as SubmitUrlForImportResponse, type context$4_UploadFileForImportOptions as UploadFileForImportOptions, type context$4_UploadFileForImportRequest as UploadFileForImportRequest, type context$4_UploadFileForImportResponse as UploadFileForImportResponse, type context$4_ValidateUrlForImportRequest as ValidateUrlForImportRequest, type context$4_ValidateUrlForImportResponse as ValidateUrlForImportResponse, context$4_getImportStatus as getImportStatus, context$4_getNotImportedPosts as getNotImportedPosts, context$4_startImport as startImport, context$4_submitUrlForImport as submitUrlForImport, context$4_uploadFileForImport as uploadFileForImport, context$4_validateUrlForImport as validateUrlForImport };
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
1901
|
+
__type: 'host';
|
|
1902
|
+
create(host: H): T;
|
|
1903
|
+
};
|
|
1904
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
1905
|
+
type Host$3<Environment = unknown> = {
|
|
1906
|
+
channel: {
|
|
1907
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1908
|
+
disconnect: () => void;
|
|
1909
|
+
} | Promise<{
|
|
1910
|
+
disconnect: () => void;
|
|
1911
|
+
}>;
|
|
1912
|
+
};
|
|
1913
|
+
environment?: Environment;
|
|
1914
|
+
/**
|
|
1915
|
+
* Optional name of the environment, use for logging
|
|
1916
|
+
*/
|
|
1917
|
+
name?: string;
|
|
1918
|
+
/**
|
|
1919
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1920
|
+
*/
|
|
1921
|
+
apiBaseUrl?: string;
|
|
1922
|
+
/**
|
|
1923
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1924
|
+
* like internationalization, billing, etc.
|
|
1925
|
+
*/
|
|
1926
|
+
essentials?: {
|
|
1927
|
+
/**
|
|
1928
|
+
* The language of the currently viewed session
|
|
1929
|
+
*/
|
|
1930
|
+
language?: string;
|
|
1931
|
+
/**
|
|
1932
|
+
* The locale of the currently viewed session
|
|
1933
|
+
*/
|
|
1934
|
+
locale?: string;
|
|
1935
|
+
/**
|
|
1936
|
+
* Any headers that should be passed through to the API requests
|
|
1937
|
+
*/
|
|
1938
|
+
passThroughHeaders?: Record<string, string>;
|
|
1939
|
+
};
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
1943
|
+
interface HttpClient$3 {
|
|
1944
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
1945
|
+
fetchWithAuth: typeof fetch;
|
|
1946
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1947
|
+
getActiveToken?: () => string | undefined;
|
|
1948
|
+
}
|
|
1949
|
+
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
1950
|
+
type HttpResponse$3<T = any> = {
|
|
1951
|
+
data: T;
|
|
1952
|
+
status: number;
|
|
1953
|
+
statusText: string;
|
|
1954
|
+
headers: any;
|
|
1955
|
+
request?: any;
|
|
1956
|
+
};
|
|
1957
|
+
type RequestOptions$3<_TResponse = any, Data = any> = {
|
|
1958
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1959
|
+
url: string;
|
|
1960
|
+
data?: Data;
|
|
1961
|
+
params?: URLSearchParams;
|
|
1962
|
+
} & APIMetadata$3;
|
|
1963
|
+
type APIMetadata$3 = {
|
|
1964
|
+
methodFqn?: string;
|
|
1965
|
+
entityFqdn?: string;
|
|
1966
|
+
packageName?: string;
|
|
1967
|
+
};
|
|
1968
|
+
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
1969
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
1970
|
+
__type: 'event-definition';
|
|
1971
|
+
type: Type;
|
|
1972
|
+
isDomainEvent?: boolean;
|
|
1973
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1974
|
+
__payload: Payload;
|
|
1975
|
+
};
|
|
1976
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
1977
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
1978
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
1979
|
+
|
|
1980
|
+
type ServicePluginMethodInput$3 = {
|
|
1981
|
+
request: any;
|
|
1982
|
+
metadata: any;
|
|
1983
|
+
};
|
|
1984
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
1985
|
+
type ServicePluginMethodMetadata$3 = {
|
|
1986
|
+
name: string;
|
|
1987
|
+
primaryHttpMappingPath: string;
|
|
1988
|
+
transformations: {
|
|
1989
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
1990
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1991
|
+
};
|
|
1992
|
+
};
|
|
1993
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
1994
|
+
__type: 'service-plugin-definition';
|
|
1995
|
+
componentType: string;
|
|
1996
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
1997
|
+
__contract: Contract;
|
|
1998
|
+
};
|
|
1999
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
2000
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
2001
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
2002
|
+
|
|
2003
|
+
type RequestContext$3 = {
|
|
2004
|
+
isSSR: boolean;
|
|
2005
|
+
host: string;
|
|
2006
|
+
protocol?: string;
|
|
2007
|
+
};
|
|
2008
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
2009
|
+
/**
|
|
2010
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
2011
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
2012
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
2013
|
+
*/
|
|
2014
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
2015
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
2016
|
+
_?: T;
|
|
2017
|
+
url?: string;
|
|
2018
|
+
method?: Method$3;
|
|
2019
|
+
params?: any;
|
|
2020
|
+
data?: any;
|
|
2021
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
2022
|
+
};
|
|
2023
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
2024
|
+
__isAmbassador: boolean;
|
|
2025
|
+
};
|
|
2026
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
2027
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
2028
|
+
|
|
2029
|
+
declare global {
|
|
2030
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2031
|
+
interface SymbolConstructor {
|
|
2032
|
+
readonly observable: symbol;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
2040
|
+
|
|
2041
|
+
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)).
|
|
2042
|
+
|
|
2043
|
+
@example
|
|
2044
|
+
```
|
|
2045
|
+
import type {EmptyObject} from 'type-fest';
|
|
2046
|
+
|
|
2047
|
+
// The following illustrates the problem with `{}`.
|
|
2048
|
+
const foo1: {} = {}; // Pass
|
|
2049
|
+
const foo2: {} = []; // Pass
|
|
2050
|
+
const foo3: {} = 42; // Pass
|
|
2051
|
+
const foo4: {} = {a: 1}; // Pass
|
|
2052
|
+
|
|
2053
|
+
// With `EmptyObject` only the first case is valid.
|
|
2054
|
+
const bar1: EmptyObject = {}; // Pass
|
|
2055
|
+
const bar2: EmptyObject = 42; // Fail
|
|
2056
|
+
const bar3: EmptyObject = []; // Fail
|
|
2057
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
2058
|
+
```
|
|
2059
|
+
|
|
2060
|
+
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}.
|
|
2061
|
+
|
|
2062
|
+
@category Object
|
|
2063
|
+
*/
|
|
2064
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
Returns a boolean for whether the two given types are equal.
|
|
2068
|
+
|
|
2069
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
2070
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
2071
|
+
|
|
2072
|
+
Use-cases:
|
|
2073
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
2074
|
+
|
|
2075
|
+
@example
|
|
2076
|
+
```
|
|
2077
|
+
import type {IsEqual} from 'type-fest';
|
|
2078
|
+
|
|
2079
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
2080
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
2081
|
+
type Includes<Value extends readonly any[], Item> =
|
|
2082
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
2083
|
+
? IsEqual<Value[0], Item> extends true
|
|
2084
|
+
? true
|
|
2085
|
+
: Includes<rest, Item>
|
|
2086
|
+
: false;
|
|
2087
|
+
```
|
|
2088
|
+
|
|
2089
|
+
@category Type Guard
|
|
2090
|
+
@category Utilities
|
|
2091
|
+
*/
|
|
2092
|
+
type IsEqual$3<A, B> =
|
|
2093
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
2094
|
+
(<G>() => G extends B ? 1 : 2)
|
|
2095
|
+
? true
|
|
2096
|
+
: false;
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
Filter out keys from an object.
|
|
2100
|
+
|
|
2101
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
2102
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
2103
|
+
Returns `Key` otherwise.
|
|
2104
|
+
|
|
2105
|
+
@example
|
|
2106
|
+
```
|
|
2107
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
2108
|
+
//=> never
|
|
2109
|
+
```
|
|
2110
|
+
|
|
2111
|
+
@example
|
|
2112
|
+
```
|
|
2113
|
+
type Filtered = Filter<'bar', string>;
|
|
2114
|
+
//=> never
|
|
2115
|
+
```
|
|
2116
|
+
|
|
2117
|
+
@example
|
|
2118
|
+
```
|
|
2119
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
2120
|
+
//=> 'bar'
|
|
2121
|
+
```
|
|
2122
|
+
|
|
2123
|
+
@see {Except}
|
|
2124
|
+
*/
|
|
2125
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
2126
|
+
|
|
2127
|
+
type ExceptOptions$3 = {
|
|
2128
|
+
/**
|
|
2129
|
+
Disallow assigning non-specified properties.
|
|
2130
|
+
|
|
2131
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
2132
|
+
|
|
2133
|
+
@default false
|
|
2134
|
+
*/
|
|
2135
|
+
requireExactProps?: boolean;
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
Create a type from an object type without certain keys.
|
|
2140
|
+
|
|
2141
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
2142
|
+
|
|
2143
|
+
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.
|
|
2144
|
+
|
|
2145
|
+
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)).
|
|
2146
|
+
|
|
2147
|
+
@example
|
|
2148
|
+
```
|
|
2149
|
+
import type {Except} from 'type-fest';
|
|
2150
|
+
|
|
2151
|
+
type Foo = {
|
|
2152
|
+
a: number;
|
|
2153
|
+
b: string;
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
2157
|
+
//=> {b: string}
|
|
2158
|
+
|
|
2159
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
2160
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
2161
|
+
|
|
2162
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
2163
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
2164
|
+
|
|
2165
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
2166
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
2167
|
+
```
|
|
2168
|
+
|
|
2169
|
+
@category Object
|
|
2170
|
+
*/
|
|
2171
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
2172
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
2173
|
+
} & (Options['requireExactProps'] extends true
|
|
2174
|
+
? Partial<Record<KeysType, never>>
|
|
2175
|
+
: {});
|
|
2176
|
+
|
|
2177
|
+
/**
|
|
2178
|
+
Returns a boolean for whether the given type is `never`.
|
|
2179
|
+
|
|
2180
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
2181
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
2182
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
2183
|
+
|
|
2184
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
2185
|
+
|
|
2186
|
+
@example
|
|
2187
|
+
```
|
|
2188
|
+
import type {IsNever, And} from 'type-fest';
|
|
2189
|
+
|
|
2190
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
2191
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
2192
|
+
And<
|
|
2193
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
2194
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
2195
|
+
>;
|
|
2196
|
+
|
|
2197
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
2198
|
+
AreStringsEqual<I, O> extends true
|
|
2199
|
+
? never
|
|
2200
|
+
: void;
|
|
2201
|
+
|
|
2202
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
2203
|
+
if (input === output) {
|
|
2204
|
+
process.exit(0);
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
endIfEqual('abc', 'abc');
|
|
2209
|
+
//=> never
|
|
2210
|
+
|
|
2211
|
+
endIfEqual('abc', '123');
|
|
2212
|
+
//=> void
|
|
2213
|
+
```
|
|
2214
|
+
|
|
2215
|
+
@category Type Guard
|
|
2216
|
+
@category Utilities
|
|
2217
|
+
*/
|
|
2218
|
+
type IsNever$3<T> = [T] extends [never] ? true : false;
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
2222
|
+
|
|
2223
|
+
@see {@link IsNever}
|
|
2224
|
+
|
|
2225
|
+
@example
|
|
2226
|
+
```
|
|
2227
|
+
import type {IfNever} from 'type-fest';
|
|
2228
|
+
|
|
2229
|
+
type ShouldBeTrue = IfNever<never>;
|
|
2230
|
+
//=> true
|
|
2231
|
+
|
|
2232
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
2233
|
+
//=> 'bar'
|
|
2234
|
+
```
|
|
2235
|
+
|
|
2236
|
+
@category Type Guard
|
|
2237
|
+
@category Utilities
|
|
2238
|
+
*/
|
|
2239
|
+
type IfNever$3<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
2240
|
+
IsNever$3<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
2241
|
+
);
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
2245
|
+
|
|
2246
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
2247
|
+
|
|
2248
|
+
@example
|
|
2249
|
+
```
|
|
2250
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2251
|
+
|
|
2252
|
+
interface Example {
|
|
2253
|
+
a: string;
|
|
2254
|
+
b: string | number;
|
|
2255
|
+
c?: string;
|
|
2256
|
+
d: {};
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
2260
|
+
//=> 'a'
|
|
2261
|
+
```
|
|
2262
|
+
|
|
2263
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
2264
|
+
|
|
2265
|
+
@example
|
|
2266
|
+
```
|
|
2267
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2268
|
+
|
|
2269
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
2270
|
+
//=> 'a' | 'c'
|
|
2271
|
+
```
|
|
2272
|
+
|
|
2273
|
+
@category Object
|
|
2274
|
+
*/
|
|
2275
|
+
type ConditionalKeys$3<Base, Condition> =
|
|
2276
|
+
{
|
|
2277
|
+
// Map through all the keys of the given base type.
|
|
2278
|
+
[Key in keyof Base]-?:
|
|
2279
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
2280
|
+
Base[Key] extends Condition
|
|
2281
|
+
// Retain this key
|
|
2282
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
2283
|
+
? IfNever$3<Base[Key], IfNever$3<Condition, Key, never>, Key>
|
|
2284
|
+
// Discard this key since the condition fails.
|
|
2285
|
+
: never;
|
|
2286
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
2287
|
+
}[keyof Base];
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
2291
|
+
|
|
2292
|
+
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.
|
|
2293
|
+
|
|
2294
|
+
@example
|
|
2295
|
+
```
|
|
2296
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
2297
|
+
|
|
2298
|
+
class Awesome {
|
|
2299
|
+
name: string;
|
|
2300
|
+
successes: number;
|
|
2301
|
+
failures: bigint;
|
|
2302
|
+
|
|
2303
|
+
run() {}
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
2307
|
+
//=> {run: () => void}
|
|
2308
|
+
```
|
|
2309
|
+
|
|
2310
|
+
@example
|
|
2311
|
+
```
|
|
2312
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
2313
|
+
|
|
2314
|
+
interface Example {
|
|
2315
|
+
a: string;
|
|
2316
|
+
b: string | number;
|
|
2317
|
+
c: () => void;
|
|
2318
|
+
d: {};
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
2322
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
2323
|
+
```
|
|
2324
|
+
|
|
2325
|
+
@category Object
|
|
2326
|
+
*/
|
|
2327
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
2328
|
+
Base,
|
|
2329
|
+
ConditionalKeys$3<Base, Condition>
|
|
2330
|
+
>;
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
2334
|
+
* can either be a REST module or a host module.
|
|
2335
|
+
* This type is recursive, so it can describe nested modules.
|
|
2336
|
+
*/
|
|
2337
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$3<any> | ServicePluginDefinition$3<any> | {
|
|
2338
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
2339
|
+
};
|
|
2340
|
+
/**
|
|
2341
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
2342
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
2343
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
2344
|
+
* do not match the given host (as they will not work with the given host).
|
|
2345
|
+
*/
|
|
2346
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
2347
|
+
done: T;
|
|
2348
|
+
recurse: T extends {
|
|
2349
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
2350
|
+
} ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
|
|
2351
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
2352
|
+
-1,
|
|
2353
|
+
0,
|
|
2354
|
+
1,
|
|
2355
|
+
2,
|
|
2356
|
+
3,
|
|
2357
|
+
4,
|
|
2358
|
+
5
|
|
2359
|
+
][Depth]> : never;
|
|
2360
|
+
}, EmptyObject$3>;
|
|
2361
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
2362
|
+
type PublicMetadata$3 = {
|
|
2363
|
+
PACKAGE_NAME?: string;
|
|
2364
|
+
};
|
|
1326
2365
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
type context$4_GetNotImportedPostsRequest = GetNotImportedPostsRequest;
|
|
1331
|
-
type context$4_GetNotImportedPostsResponse = GetNotImportedPostsResponse;
|
|
1332
|
-
type context$4_GetNotImportedPostsResponseNonNullableFields = GetNotImportedPostsResponseNonNullableFields;
|
|
1333
|
-
type context$4_ImportStatus = ImportStatus;
|
|
1334
|
-
type context$4_StartImportOptions = StartImportOptions;
|
|
1335
|
-
type context$4_StartImportRequest = StartImportRequest;
|
|
1336
|
-
type context$4_StartImportResponse = StartImportResponse;
|
|
1337
|
-
type context$4_SubmitUrlForImportRequest = SubmitUrlForImportRequest;
|
|
1338
|
-
type context$4_SubmitUrlForImportResponse = SubmitUrlForImportResponse;
|
|
1339
|
-
type context$4_UploadFileForImportOptions = UploadFileForImportOptions;
|
|
1340
|
-
type context$4_UploadFileForImportRequest = UploadFileForImportRequest;
|
|
1341
|
-
type context$4_UploadFileForImportResponse = UploadFileForImportResponse;
|
|
1342
|
-
type context$4_ValidateUrlForImportRequest = ValidateUrlForImportRequest;
|
|
1343
|
-
type context$4_ValidateUrlForImportResponse = ValidateUrlForImportResponse;
|
|
1344
|
-
declare const context$4_getImportStatus: typeof getImportStatus;
|
|
1345
|
-
declare const context$4_getNotImportedPosts: typeof getNotImportedPosts;
|
|
1346
|
-
declare const context$4_startImport: typeof startImport;
|
|
1347
|
-
declare const context$4_submitUrlForImport: typeof submitUrlForImport;
|
|
1348
|
-
declare const context$4_uploadFileForImport: typeof uploadFileForImport;
|
|
1349
|
-
declare const context$4_validateUrlForImport: typeof validateUrlForImport;
|
|
1350
|
-
declare namespace context$4 {
|
|
1351
|
-
export { type context$4_GetImportStatusRequest as GetImportStatusRequest, type context$4_GetImportStatusResponse as GetImportStatusResponse, type context$4_GetImportStatusResponseNonNullableFields as GetImportStatusResponseNonNullableFields, type context$4_GetNotImportedPostsRequest as GetNotImportedPostsRequest, type context$4_GetNotImportedPostsResponse as GetNotImportedPostsResponse, type context$4_GetNotImportedPostsResponseNonNullableFields as GetNotImportedPostsResponseNonNullableFields, type context$4_ImportStatus as ImportStatus, type Post$1 as Post, type context$4_StartImportOptions as StartImportOptions, type context$4_StartImportRequest as StartImportRequest, type context$4_StartImportResponse as StartImportResponse, Status$2 as Status, type context$4_SubmitUrlForImportRequest as SubmitUrlForImportRequest, type context$4_SubmitUrlForImportResponse as SubmitUrlForImportResponse, type context$4_UploadFileForImportOptions as UploadFileForImportOptions, type context$4_UploadFileForImportRequest as UploadFileForImportRequest, type context$4_UploadFileForImportResponse as UploadFileForImportResponse, type context$4_ValidateUrlForImportRequest as ValidateUrlForImportRequest, type context$4_ValidateUrlForImportResponse as ValidateUrlForImportResponse, context$4_getImportStatus as getImportStatus, context$4_getNotImportedPosts as getNotImportedPosts, context$4_startImport as startImport, context$4_submitUrlForImport as submitUrlForImport, context$4_uploadFileForImport as uploadFileForImport, context$4_validateUrlForImport as validateUrlForImport };
|
|
2366
|
+
declare global {
|
|
2367
|
+
interface ContextualClient {
|
|
2368
|
+
}
|
|
1352
2369
|
}
|
|
2370
|
+
/**
|
|
2371
|
+
* A type used to create concerete types from SDK descriptors in
|
|
2372
|
+
* case a contextual client is available.
|
|
2373
|
+
*/
|
|
2374
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
2375
|
+
host: Host$3;
|
|
2376
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
1353
2377
|
|
|
1354
2378
|
interface Category$2 {
|
|
1355
2379
|
/** Category ID. */
|
|
@@ -1492,9 +2516,7 @@ declare enum Field$3 {
|
|
|
1492
2516
|
*/
|
|
1493
2517
|
INTERNAL_ID = "INTERNAL_ID",
|
|
1494
2518
|
/** Includes SEO data. */
|
|
1495
|
-
SEO = "SEO"
|
|
1496
|
-
/** Includes translations. */
|
|
1497
|
-
TRANSLATIONS = "TRANSLATIONS"
|
|
2519
|
+
SEO = "SEO"
|
|
1498
2520
|
}
|
|
1499
2521
|
interface CreateCategoryResponse {
|
|
1500
2522
|
/** Category info. */
|
|
@@ -2013,246 +3035,706 @@ interface GetCategoryBySlugOptions {
|
|
|
2013
3035
|
*/
|
|
2014
3036
|
language?: string | null;
|
|
2015
3037
|
}
|
|
2016
|
-
interface ListCategoriesOptions {
|
|
2017
|
-
/** Pagination options. */
|
|
2018
|
-
paging?: BlogPaging$2;
|
|
2019
|
-
/** List of category fields to be included in the response. By default, any fields not passed are not returned. */
|
|
2020
|
-
fieldsets?: Field$3[];
|
|
3038
|
+
interface ListCategoriesOptions {
|
|
3039
|
+
/** Pagination options. */
|
|
3040
|
+
paging?: BlogPaging$2;
|
|
3041
|
+
/** List of category fields to be included in the response. By default, any fields not passed are not returned. */
|
|
3042
|
+
fieldsets?: Field$3[];
|
|
3043
|
+
/**
|
|
3044
|
+
* Language filter.
|
|
3045
|
+
*
|
|
3046
|
+
* 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
|
|
3047
|
+
* Pass a language to only receive categories that are in that language.
|
|
3048
|
+
* If omitted, categories in all languages are returned.
|
|
3049
|
+
*/
|
|
3050
|
+
language?: string | null;
|
|
3051
|
+
}
|
|
3052
|
+
interface QueryCategoriesOptions {
|
|
3053
|
+
/** List of category fields to be included in the response. By default, any fields not passed are not returned. */
|
|
3054
|
+
fieldsets?: Field$3[] | undefined;
|
|
3055
|
+
}
|
|
3056
|
+
interface QueryOffsetResult$1 {
|
|
3057
|
+
currentPage: number | undefined;
|
|
3058
|
+
totalPages: number | undefined;
|
|
3059
|
+
totalCount: number | undefined;
|
|
3060
|
+
hasNext: () => boolean;
|
|
3061
|
+
hasPrev: () => boolean;
|
|
3062
|
+
length: number;
|
|
3063
|
+
pageSize: number;
|
|
3064
|
+
}
|
|
3065
|
+
interface CategoriesQueryResult extends QueryOffsetResult$1 {
|
|
3066
|
+
items: Category$2[];
|
|
3067
|
+
query: CategoriesQueryBuilder;
|
|
3068
|
+
next: () => Promise<CategoriesQueryResult>;
|
|
3069
|
+
prev: () => Promise<CategoriesQueryResult>;
|
|
3070
|
+
}
|
|
3071
|
+
interface CategoriesQueryBuilder {
|
|
3072
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3073
|
+
* @param value - Value to compare against.
|
|
3074
|
+
*/
|
|
3075
|
+
eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
3076
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3077
|
+
* @param value - Value to compare against.
|
|
3078
|
+
*/
|
|
3079
|
+
ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
3080
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3081
|
+
* @param value - Value to compare against.
|
|
3082
|
+
*/
|
|
3083
|
+
ge: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
3084
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3085
|
+
* @param value - Value to compare against.
|
|
3086
|
+
*/
|
|
3087
|
+
gt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
3088
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3089
|
+
* @param value - Value to compare against.
|
|
3090
|
+
*/
|
|
3091
|
+
le: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
3092
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
|
3093
|
+
* @param value - Value to compare against.
|
|
3094
|
+
*/
|
|
3095
|
+
lt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
3096
|
+
/** @param propertyName - Property whose value is compared with `string`.
|
|
3097
|
+
* @param string - String to compare against. Case-insensitive.
|
|
3098
|
+
*/
|
|
3099
|
+
startsWith: (propertyName: 'label' | 'title', value: string) => CategoriesQueryBuilder;
|
|
3100
|
+
/** @param propertyName - Property whose value is compared with `values`.
|
|
3101
|
+
* @param values - List of values to compare against.
|
|
3102
|
+
*/
|
|
3103
|
+
hasSome: (propertyName: '_id' | 'label' | 'title' | 'slug', value: any[]) => CategoriesQueryBuilder;
|
|
3104
|
+
in: (propertyName: 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
3105
|
+
exists: (propertyName: 'label' | 'title' | 'translationId' | 'language', value: boolean) => CategoriesQueryBuilder;
|
|
3106
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
|
|
3107
|
+
ascending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
|
|
3108
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
|
|
3109
|
+
descending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
|
|
3110
|
+
/** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
|
|
3111
|
+
limit: (limit: number) => CategoriesQueryBuilder;
|
|
3112
|
+
/** @param skip - Number of items to skip in the query results before returning the results. */
|
|
3113
|
+
skip: (skip: number) => CategoriesQueryBuilder;
|
|
3114
|
+
find: () => Promise<CategoriesQueryResult>;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
declare function getCategory$1(httpClient: HttpClient$3): GetCategorySignature;
|
|
3118
|
+
interface GetCategorySignature {
|
|
3119
|
+
/**
|
|
3120
|
+
* Gets a category by the specified ID.
|
|
3121
|
+
*
|
|
3122
|
+
*
|
|
3123
|
+
* The `getCategory()` function returns a Promise that resolves to a category whose ID matches the specified ID.
|
|
3124
|
+
*
|
|
3125
|
+
* @param - Category ID.
|
|
3126
|
+
* @param - Options specifying which fields to return.
|
|
3127
|
+
*/
|
|
3128
|
+
(categoryId: string, options?: GetCategoryOptions | undefined): Promise<GetCategoryResponse & GetCategoryResponseNonNullableFields>;
|
|
3129
|
+
}
|
|
3130
|
+
declare function getCategoryBySlug$1(httpClient: HttpClient$3): GetCategoryBySlugSignature;
|
|
3131
|
+
interface GetCategoryBySlugSignature {
|
|
3132
|
+
/**
|
|
3133
|
+
* Gets a category by the specified slug.
|
|
3134
|
+
*
|
|
3135
|
+
*
|
|
3136
|
+
* The `getCategoryBySlug()` function returns a Promise that resolves to a category whose slug matches the specified slug.
|
|
3137
|
+
*
|
|
3138
|
+
* The `slug` is the end of a category's URL that refers to a specific category. For example, if a category's URL is `https://example.com/blog/category/{my-category-slug}`, the slug is `my-post-slug`. The slug is case-sensitive string that is generally derived from the category's `label`, unless specified otherwise.
|
|
3139
|
+
*
|
|
3140
|
+
* @param - Slug of the category to retrieve.
|
|
3141
|
+
*
|
|
3142
|
+
* The end of a category's URL. For example, `'https:/example.com/blog/category/{my-category-slug}'`. Case sensitive and generally based on the category `label` if not specified.
|
|
3143
|
+
* @param - Options specifying which fields to return.
|
|
3144
|
+
*/
|
|
3145
|
+
(slug: string, options?: GetCategoryBySlugOptions | undefined): Promise<GetCategoryBySlugResponse & GetCategoryBySlugResponseNonNullableFields>;
|
|
3146
|
+
}
|
|
3147
|
+
declare function listCategories$1(httpClient: HttpClient$3): ListCategoriesSignature;
|
|
3148
|
+
interface ListCategoriesSignature {
|
|
3149
|
+
/**
|
|
3150
|
+
* Retrieves a list of categories.
|
|
3151
|
+
*
|
|
3152
|
+
*
|
|
3153
|
+
* The `listCategories()` function returns a Promise that resolves to a list of up to 100 categories per language in order of their `displayPosition` starting with `0`. The `displayPosition` is the position in which the categories are displayed in the Category Menu page. By default, categories get added to the bottom of the Category Menu with a `displayPosition` of `-1`.
|
|
3154
|
+
* @param - Filter and paging options.
|
|
3155
|
+
*/
|
|
3156
|
+
(options?: ListCategoriesOptions | undefined): Promise<ListCategoriesResponse & ListCategoriesResponseNonNullableFields>;
|
|
3157
|
+
}
|
|
3158
|
+
declare function queryCategories$1(httpClient: HttpClient$3): QueryCategoriesSignature;
|
|
3159
|
+
interface QueryCategoriesSignature {
|
|
3160
|
+
/**
|
|
3161
|
+
* Creates a query to retrieve a list of categories.
|
|
3162
|
+
*
|
|
3163
|
+
*
|
|
3164
|
+
* The `queryCategories()` function builds a query to retrieve a list of up to 100 categories per language, and returns a [`CategoriesQueryBuilder`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesquerybuilder) object.
|
|
3165
|
+
*
|
|
3166
|
+
* The returned object contains the query definition, which is typically used to run the query using the [`find()`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesquerybuilder/find) function.
|
|
3167
|
+
*
|
|
3168
|
+
* You can refine the query by chaining `CategoriesQueryBuilder` functions to the query. `CategoriesQueryBuilder` functions enable you to sort, filter, and control the results that `queryCategories` returns. Any functions chained to the `queryCategories()` function are applied in the order that they are called.
|
|
3169
|
+
*
|
|
3170
|
+
* `queryCategories()` runs with these `CategoriesQueryBuilder` defaults, which you can override.
|
|
3171
|
+
* - [`limit(100)`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesquerybuilder/limit)
|
|
3172
|
+
* - [`ascending(displayPosition)`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesquerybuilder/ascending)
|
|
3173
|
+
*
|
|
3174
|
+
* The following `CategoriesQueryBuilder` functions are supported for `queryCategories()`. For a full description of the `Categories` object, see the object returned for the [`items`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesqueryresult/items) property in [`CategoriesQueryResult`](https://www.wix.com/velo/reference/wix-blog-backend/categories/categoriesqueryresult).
|
|
3175
|
+
* @param - Options specifying which fields to return.
|
|
3176
|
+
*/
|
|
3177
|
+
(options?: QueryCategoriesOptions | undefined): CategoriesQueryBuilder;
|
|
3178
|
+
}
|
|
3179
|
+
declare const onCategoryCreated$1: EventDefinition$3<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
|
|
3180
|
+
declare const onCategoryUpdated$1: EventDefinition$3<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
|
|
3181
|
+
declare const onCategoryDeleted$1: EventDefinition$3<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
|
|
3182
|
+
|
|
3183
|
+
declare function createEventModule$3<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
|
|
3184
|
+
|
|
3185
|
+
declare const getCategory: MaybeContext$3<BuildRESTFunction$3<typeof getCategory$1> & typeof getCategory$1>;
|
|
3186
|
+
declare const getCategoryBySlug: MaybeContext$3<BuildRESTFunction$3<typeof getCategoryBySlug$1> & typeof getCategoryBySlug$1>;
|
|
3187
|
+
declare const listCategories: MaybeContext$3<BuildRESTFunction$3<typeof listCategories$1> & typeof listCategories$1>;
|
|
3188
|
+
declare const queryCategories: MaybeContext$3<BuildRESTFunction$3<typeof queryCategories$1> & typeof queryCategories$1>;
|
|
3189
|
+
|
|
3190
|
+
type _publicOnCategoryCreatedType = typeof onCategoryCreated$1;
|
|
3191
|
+
/**
|
|
3192
|
+
* Triggered when a category is created.
|
|
3193
|
+
*/
|
|
3194
|
+
declare const onCategoryCreated: ReturnType<typeof createEventModule$3<_publicOnCategoryCreatedType>>;
|
|
3195
|
+
|
|
3196
|
+
type _publicOnCategoryUpdatedType = typeof onCategoryUpdated$1;
|
|
3197
|
+
/**
|
|
3198
|
+
* Triggered when a category is updated.
|
|
3199
|
+
*/
|
|
3200
|
+
declare const onCategoryUpdated: ReturnType<typeof createEventModule$3<_publicOnCategoryUpdatedType>>;
|
|
3201
|
+
|
|
3202
|
+
type _publicOnCategoryDeletedType = typeof onCategoryDeleted$1;
|
|
3203
|
+
/**
|
|
3204
|
+
* Triggered when a category is deleted.
|
|
3205
|
+
*/
|
|
3206
|
+
declare const onCategoryDeleted: ReturnType<typeof createEventModule$3<_publicOnCategoryDeletedType>>;
|
|
3207
|
+
|
|
3208
|
+
type context$3_BulkCategoryResult = BulkCategoryResult;
|
|
3209
|
+
type context$3_BulkCreateCategoriesRequest = BulkCreateCategoriesRequest;
|
|
3210
|
+
type context$3_BulkCreateCategoriesResponse = BulkCreateCategoriesResponse;
|
|
3211
|
+
type context$3_BulkDeleteCategoryRequest = BulkDeleteCategoryRequest;
|
|
3212
|
+
type context$3_BulkDeleteCategoryResponse = BulkDeleteCategoryResponse;
|
|
3213
|
+
type context$3_BulkUpdateCategoriesRequest = BulkUpdateCategoriesRequest;
|
|
3214
|
+
type context$3_BulkUpdateCategoriesResponse = BulkUpdateCategoriesResponse;
|
|
3215
|
+
type context$3_CategoriesQueryBuilder = CategoriesQueryBuilder;
|
|
3216
|
+
type context$3_CategoriesQueryResult = CategoriesQueryResult;
|
|
3217
|
+
type context$3_CategoryCreatedEnvelope = CategoryCreatedEnvelope;
|
|
3218
|
+
type context$3_CategoryDeletedEnvelope = CategoryDeletedEnvelope;
|
|
3219
|
+
type context$3_CategoryLanguageCount = CategoryLanguageCount;
|
|
3220
|
+
type context$3_CategoryUpdatedEnvelope = CategoryUpdatedEnvelope;
|
|
3221
|
+
type context$3_CreateCategoryRequest = CreateCategoryRequest;
|
|
3222
|
+
type context$3_CreateCategoryResponse = CreateCategoryResponse;
|
|
3223
|
+
type context$3_DeleteCategoryRequest = DeleteCategoryRequest;
|
|
3224
|
+
type context$3_DeleteCategoryResponse = DeleteCategoryResponse;
|
|
3225
|
+
type context$3_GetCategoriesCountByLanguageRequest = GetCategoriesCountByLanguageRequest;
|
|
3226
|
+
type context$3_GetCategoriesCountByLanguageResponse = GetCategoriesCountByLanguageResponse;
|
|
3227
|
+
type context$3_GetCategoryBySlugOptions = GetCategoryBySlugOptions;
|
|
3228
|
+
type context$3_GetCategoryBySlugRequest = GetCategoryBySlugRequest;
|
|
3229
|
+
type context$3_GetCategoryBySlugResponse = GetCategoryBySlugResponse;
|
|
3230
|
+
type context$3_GetCategoryBySlugResponseNonNullableFields = GetCategoryBySlugResponseNonNullableFields;
|
|
3231
|
+
type context$3_GetCategoryOptions = GetCategoryOptions;
|
|
3232
|
+
type context$3_GetCategoryRequest = GetCategoryRequest;
|
|
3233
|
+
type context$3_GetCategoryResponse = GetCategoryResponse;
|
|
3234
|
+
type context$3_GetCategoryResponseNonNullableFields = GetCategoryResponseNonNullableFields;
|
|
3235
|
+
type context$3_InitialCategoriesCopied = InitialCategoriesCopied;
|
|
3236
|
+
type context$3_ListCategoriesOptions = ListCategoriesOptions;
|
|
3237
|
+
type context$3_ListCategoriesRequest = ListCategoriesRequest;
|
|
3238
|
+
type context$3_ListCategoriesResponse = ListCategoriesResponse;
|
|
3239
|
+
type context$3_ListCategoriesResponseNonNullableFields = ListCategoriesResponseNonNullableFields;
|
|
3240
|
+
type context$3_MaskedCategory = MaskedCategory;
|
|
3241
|
+
type context$3_QueryCategoriesOptions = QueryCategoriesOptions;
|
|
3242
|
+
type context$3_QueryCategoriesRequest = QueryCategoriesRequest;
|
|
3243
|
+
type context$3_QueryCategoriesResponse = QueryCategoriesResponse;
|
|
3244
|
+
type context$3_QueryCategoriesResponseNonNullableFields = QueryCategoriesResponseNonNullableFields;
|
|
3245
|
+
type context$3_UpdateCategoryRequest = UpdateCategoryRequest;
|
|
3246
|
+
type context$3_UpdateCategoryResponse = UpdateCategoryResponse;
|
|
3247
|
+
type context$3__publicOnCategoryCreatedType = _publicOnCategoryCreatedType;
|
|
3248
|
+
type context$3__publicOnCategoryDeletedType = _publicOnCategoryDeletedType;
|
|
3249
|
+
type context$3__publicOnCategoryUpdatedType = _publicOnCategoryUpdatedType;
|
|
3250
|
+
declare const context$3_getCategory: typeof getCategory;
|
|
3251
|
+
declare const context$3_getCategoryBySlug: typeof getCategoryBySlug;
|
|
3252
|
+
declare const context$3_listCategories: typeof listCategories;
|
|
3253
|
+
declare const context$3_onCategoryCreated: typeof onCategoryCreated;
|
|
3254
|
+
declare const context$3_onCategoryDeleted: typeof onCategoryDeleted;
|
|
3255
|
+
declare const context$3_onCategoryUpdated: typeof onCategoryUpdated;
|
|
3256
|
+
declare const context$3_queryCategories: typeof queryCategories;
|
|
3257
|
+
declare namespace context$3 {
|
|
3258
|
+
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 context$3_BulkCategoryResult as BulkCategoryResult, type context$3_BulkCreateCategoriesRequest as BulkCreateCategoriesRequest, type context$3_BulkCreateCategoriesResponse as BulkCreateCategoriesResponse, type context$3_BulkDeleteCategoryRequest as BulkDeleteCategoryRequest, type context$3_BulkDeleteCategoryResponse as BulkDeleteCategoryResponse, type context$3_BulkUpdateCategoriesRequest as BulkUpdateCategoriesRequest, type context$3_BulkUpdateCategoriesResponse as BulkUpdateCategoriesResponse, type context$3_CategoriesQueryBuilder as CategoriesQueryBuilder, type context$3_CategoriesQueryResult as CategoriesQueryResult, type Category$2 as Category, type context$3_CategoryCreatedEnvelope as CategoryCreatedEnvelope, type context$3_CategoryDeletedEnvelope as CategoryDeletedEnvelope, type context$3_CategoryLanguageCount as CategoryLanguageCount, type CategoryTranslation$2 as CategoryTranslation, type context$3_CategoryUpdatedEnvelope as CategoryUpdatedEnvelope, type context$3_CreateCategoryRequest as CreateCategoryRequest, type context$3_CreateCategoryResponse as CreateCategoryResponse, type CursorPaging$3 as CursorPaging, type Cursors$3 as Cursors, type context$3_DeleteCategoryRequest as DeleteCategoryRequest, type context$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 context$3_GetCategoriesCountByLanguageRequest as GetCategoriesCountByLanguageRequest, type context$3_GetCategoriesCountByLanguageResponse as GetCategoriesCountByLanguageResponse, type context$3_GetCategoryBySlugOptions as GetCategoryBySlugOptions, type context$3_GetCategoryBySlugRequest as GetCategoryBySlugRequest, type context$3_GetCategoryBySlugResponse as GetCategoryBySlugResponse, type context$3_GetCategoryBySlugResponseNonNullableFields as GetCategoryBySlugResponseNonNullableFields, type context$3_GetCategoryOptions as GetCategoryOptions, type context$3_GetCategoryRequest as GetCategoryRequest, type context$3_GetCategoryResponse as GetCategoryResponse, type context$3_GetCategoryResponseNonNullableFields as GetCategoryResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$3_InitialCategoriesCopied as InitialCategoriesCopied, type ItemMetadata$2 as ItemMetadata, type Keyword$3 as Keyword, type context$3_ListCategoriesOptions as ListCategoriesOptions, type context$3_ListCategoriesRequest as ListCategoriesRequest, type context$3_ListCategoriesResponse as ListCategoriesResponse, type context$3_ListCategoriesResponseNonNullableFields as ListCategoriesResponseNonNullableFields, type context$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 context$3_QueryCategoriesOptions as QueryCategoriesOptions, type context$3_QueryCategoriesRequest as QueryCategoriesRequest, type context$3_QueryCategoriesResponse as QueryCategoriesResponse, type context$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 context$3_UpdateCategoryRequest as UpdateCategoryRequest, type context$3_UpdateCategoryResponse as UpdateCategoryResponse, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnCategoryCreatedType as _publicOnCategoryCreatedType, type context$3__publicOnCategoryDeletedType as _publicOnCategoryDeletedType, type context$3__publicOnCategoryUpdatedType as _publicOnCategoryUpdatedType, context$3_getCategory as getCategory, context$3_getCategoryBySlug as getCategoryBySlug, context$3_listCategories as listCategories, context$3_onCategoryCreated as onCategoryCreated, context$3_onCategoryDeleted as onCategoryDeleted, context$3_onCategoryUpdated as onCategoryUpdated, onCategoryCreated$1 as publicOnCategoryCreated, onCategoryDeleted$1 as publicOnCategoryDeleted, onCategoryUpdated$1 as publicOnCategoryUpdated, context$3_queryCategories as queryCategories };
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
3262
|
+
__type: 'host';
|
|
3263
|
+
create(host: H): T;
|
|
3264
|
+
};
|
|
3265
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
3266
|
+
type Host$2<Environment = unknown> = {
|
|
3267
|
+
channel: {
|
|
3268
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
3269
|
+
disconnect: () => void;
|
|
3270
|
+
} | Promise<{
|
|
3271
|
+
disconnect: () => void;
|
|
3272
|
+
}>;
|
|
3273
|
+
};
|
|
3274
|
+
environment?: Environment;
|
|
2021
3275
|
/**
|
|
2022
|
-
*
|
|
2023
|
-
*
|
|
2024
|
-
* 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
|
|
2025
|
-
* Pass a language to only receive categories that are in that language.
|
|
2026
|
-
* If omitted, categories in all languages are returned.
|
|
2027
|
-
*/
|
|
2028
|
-
language?: string | null;
|
|
2029
|
-
}
|
|
2030
|
-
interface QueryCategoriesOptions {
|
|
2031
|
-
/** List of category fields to be included in the response. By default, any fields not passed are not returned. */
|
|
2032
|
-
fieldsets?: Field$3[] | undefined;
|
|
2033
|
-
}
|
|
2034
|
-
interface QueryOffsetResult$1 {
|
|
2035
|
-
currentPage: number | undefined;
|
|
2036
|
-
totalPages: number | undefined;
|
|
2037
|
-
totalCount: number | undefined;
|
|
2038
|
-
hasNext: () => boolean;
|
|
2039
|
-
hasPrev: () => boolean;
|
|
2040
|
-
length: number;
|
|
2041
|
-
pageSize: number;
|
|
2042
|
-
}
|
|
2043
|
-
interface CategoriesQueryResult extends QueryOffsetResult$1 {
|
|
2044
|
-
items: Category$2[];
|
|
2045
|
-
query: CategoriesQueryBuilder;
|
|
2046
|
-
next: () => Promise<CategoriesQueryResult>;
|
|
2047
|
-
prev: () => Promise<CategoriesQueryResult>;
|
|
2048
|
-
}
|
|
2049
|
-
interface CategoriesQueryBuilder {
|
|
2050
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2051
|
-
* @param value - Value to compare against.
|
|
2052
|
-
*/
|
|
2053
|
-
eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
2054
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2055
|
-
* @param value - Value to compare against.
|
|
2056
|
-
*/
|
|
2057
|
-
ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
|
|
2058
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2059
|
-
* @param value - Value to compare against.
|
|
2060
|
-
*/
|
|
2061
|
-
ge: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
2062
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2063
|
-
* @param value - Value to compare against.
|
|
2064
|
-
*/
|
|
2065
|
-
gt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
2066
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2067
|
-
* @param value - Value to compare against.
|
|
2068
|
-
*/
|
|
2069
|
-
le: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
|
|
2070
|
-
/** @param propertyName - Property whose value is compared with `value`.
|
|
2071
|
-
* @param value - Value to compare against.
|
|
3276
|
+
* Optional name of the environment, use for logging
|
|
2072
3277
|
*/
|
|
2073
|
-
|
|
2074
|
-
/**
|
|
2075
|
-
*
|
|
3278
|
+
name?: string;
|
|
3279
|
+
/**
|
|
3280
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
2076
3281
|
*/
|
|
2077
|
-
|
|
2078
|
-
/**
|
|
2079
|
-
*
|
|
3282
|
+
apiBaseUrl?: string;
|
|
3283
|
+
/**
|
|
3284
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3285
|
+
* like internationalization, billing, etc.
|
|
2080
3286
|
*/
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
3287
|
+
essentials?: {
|
|
3288
|
+
/**
|
|
3289
|
+
* The language of the currently viewed session
|
|
3290
|
+
*/
|
|
3291
|
+
language?: string;
|
|
3292
|
+
/**
|
|
3293
|
+
* The locale of the currently viewed session
|
|
3294
|
+
*/
|
|
3295
|
+
locale?: string;
|
|
3296
|
+
/**
|
|
3297
|
+
* Any headers that should be passed through to the API requests
|
|
3298
|
+
*/
|
|
3299
|
+
passThroughHeaders?: Record<string, string>;
|
|
3300
|
+
};
|
|
3301
|
+
};
|
|
3302
|
+
|
|
3303
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
3304
|
+
interface HttpClient$2 {
|
|
3305
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
3306
|
+
fetchWithAuth: typeof fetch;
|
|
3307
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
3308
|
+
getActiveToken?: () => string | undefined;
|
|
3309
|
+
}
|
|
3310
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
3311
|
+
type HttpResponse$2<T = any> = {
|
|
3312
|
+
data: T;
|
|
3313
|
+
status: number;
|
|
3314
|
+
statusText: string;
|
|
3315
|
+
headers: any;
|
|
3316
|
+
request?: any;
|
|
3317
|
+
};
|
|
3318
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
3319
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
3320
|
+
url: string;
|
|
3321
|
+
data?: Data;
|
|
3322
|
+
params?: URLSearchParams;
|
|
3323
|
+
} & APIMetadata$2;
|
|
3324
|
+
type APIMetadata$2 = {
|
|
3325
|
+
methodFqn?: string;
|
|
3326
|
+
entityFqdn?: string;
|
|
3327
|
+
packageName?: string;
|
|
3328
|
+
};
|
|
3329
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
3330
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
3331
|
+
__type: 'event-definition';
|
|
3332
|
+
type: Type;
|
|
3333
|
+
isDomainEvent?: boolean;
|
|
3334
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3335
|
+
__payload: Payload;
|
|
3336
|
+
};
|
|
3337
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
3338
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
3339
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
3340
|
+
|
|
3341
|
+
type ServicePluginMethodInput$2 = {
|
|
3342
|
+
request: any;
|
|
3343
|
+
metadata: any;
|
|
3344
|
+
};
|
|
3345
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
3346
|
+
type ServicePluginMethodMetadata$2 = {
|
|
3347
|
+
name: string;
|
|
3348
|
+
primaryHttpMappingPath: string;
|
|
3349
|
+
transformations: {
|
|
3350
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
3351
|
+
toREST: (...args: unknown[]) => unknown;
|
|
3352
|
+
};
|
|
3353
|
+
};
|
|
3354
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
3355
|
+
__type: 'service-plugin-definition';
|
|
3356
|
+
componentType: string;
|
|
3357
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
3358
|
+
__contract: Contract;
|
|
3359
|
+
};
|
|
3360
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
3361
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
3362
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
3363
|
+
|
|
3364
|
+
type RequestContext$2 = {
|
|
3365
|
+
isSSR: boolean;
|
|
3366
|
+
host: string;
|
|
3367
|
+
protocol?: string;
|
|
3368
|
+
};
|
|
3369
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
3370
|
+
/**
|
|
3371
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
3372
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
3373
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
3374
|
+
*/
|
|
3375
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
3376
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
3377
|
+
_?: T;
|
|
3378
|
+
url?: string;
|
|
3379
|
+
method?: Method$2;
|
|
3380
|
+
params?: any;
|
|
3381
|
+
data?: any;
|
|
3382
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
3383
|
+
};
|
|
3384
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
3385
|
+
__isAmbassador: boolean;
|
|
3386
|
+
};
|
|
3387
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
3388
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3389
|
+
|
|
3390
|
+
declare global {
|
|
3391
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3392
|
+
interface SymbolConstructor {
|
|
3393
|
+
readonly observable: symbol;
|
|
3394
|
+
}
|
|
2093
3395
|
}
|
|
2094
3396
|
|
|
2095
|
-
declare
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
3397
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
3398
|
+
|
|
3399
|
+
/**
|
|
3400
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
3401
|
+
|
|
3402
|
+
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)).
|
|
3403
|
+
|
|
3404
|
+
@example
|
|
3405
|
+
```
|
|
3406
|
+
import type {EmptyObject} from 'type-fest';
|
|
3407
|
+
|
|
3408
|
+
// The following illustrates the problem with `{}`.
|
|
3409
|
+
const foo1: {} = {}; // Pass
|
|
3410
|
+
const foo2: {} = []; // Pass
|
|
3411
|
+
const foo3: {} = 42; // Pass
|
|
3412
|
+
const foo4: {} = {a: 1}; // Pass
|
|
3413
|
+
|
|
3414
|
+
// With `EmptyObject` only the first case is valid.
|
|
3415
|
+
const bar1: EmptyObject = {}; // Pass
|
|
3416
|
+
const bar2: EmptyObject = 42; // Fail
|
|
3417
|
+
const bar3: EmptyObject = []; // Fail
|
|
3418
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
3419
|
+
```
|
|
3420
|
+
|
|
3421
|
+
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}.
|
|
3422
|
+
|
|
3423
|
+
@category Object
|
|
3424
|
+
*/
|
|
3425
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
3426
|
+
|
|
3427
|
+
/**
|
|
3428
|
+
Returns a boolean for whether the two given types are equal.
|
|
3429
|
+
|
|
3430
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
3431
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
3432
|
+
|
|
3433
|
+
Use-cases:
|
|
3434
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
3435
|
+
|
|
3436
|
+
@example
|
|
3437
|
+
```
|
|
3438
|
+
import type {IsEqual} from 'type-fest';
|
|
3439
|
+
|
|
3440
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
3441
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
3442
|
+
type Includes<Value extends readonly any[], Item> =
|
|
3443
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
3444
|
+
? IsEqual<Value[0], Item> extends true
|
|
3445
|
+
? true
|
|
3446
|
+
: Includes<rest, Item>
|
|
3447
|
+
: false;
|
|
3448
|
+
```
|
|
3449
|
+
|
|
3450
|
+
@category Type Guard
|
|
3451
|
+
@category Utilities
|
|
3452
|
+
*/
|
|
3453
|
+
type IsEqual$2<A, B> =
|
|
3454
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
3455
|
+
(<G>() => G extends B ? 1 : 2)
|
|
3456
|
+
? true
|
|
3457
|
+
: false;
|
|
3458
|
+
|
|
3459
|
+
/**
|
|
3460
|
+
Filter out keys from an object.
|
|
3461
|
+
|
|
3462
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
3463
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
3464
|
+
Returns `Key` otherwise.
|
|
3465
|
+
|
|
3466
|
+
@example
|
|
3467
|
+
```
|
|
3468
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
3469
|
+
//=> never
|
|
3470
|
+
```
|
|
3471
|
+
|
|
3472
|
+
@example
|
|
3473
|
+
```
|
|
3474
|
+
type Filtered = Filter<'bar', string>;
|
|
3475
|
+
//=> never
|
|
3476
|
+
```
|
|
3477
|
+
|
|
3478
|
+
@example
|
|
3479
|
+
```
|
|
3480
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
3481
|
+
//=> 'bar'
|
|
3482
|
+
```
|
|
3483
|
+
|
|
3484
|
+
@see {Except}
|
|
3485
|
+
*/
|
|
3486
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3487
|
+
|
|
3488
|
+
type ExceptOptions$2 = {
|
|
3489
|
+
/**
|
|
3490
|
+
Disallow assigning non-specified properties.
|
|
3491
|
+
|
|
3492
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3493
|
+
|
|
3494
|
+
@default false
|
|
3495
|
+
*/
|
|
3496
|
+
requireExactProps?: boolean;
|
|
3497
|
+
};
|
|
3498
|
+
|
|
3499
|
+
/**
|
|
3500
|
+
Create a type from an object type without certain keys.
|
|
3501
|
+
|
|
3502
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
3503
|
+
|
|
3504
|
+
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.
|
|
3505
|
+
|
|
3506
|
+
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)).
|
|
3507
|
+
|
|
3508
|
+
@example
|
|
3509
|
+
```
|
|
3510
|
+
import type {Except} from 'type-fest';
|
|
3511
|
+
|
|
3512
|
+
type Foo = {
|
|
3513
|
+
a: number;
|
|
3514
|
+
b: string;
|
|
3515
|
+
};
|
|
3516
|
+
|
|
3517
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
3518
|
+
//=> {b: string}
|
|
3519
|
+
|
|
3520
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
3521
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
3522
|
+
|
|
3523
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
3524
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
3525
|
+
|
|
3526
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
3527
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
3528
|
+
```
|
|
3529
|
+
|
|
3530
|
+
@category Object
|
|
3531
|
+
*/
|
|
3532
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
3533
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
3534
|
+
} & (Options['requireExactProps'] extends true
|
|
3535
|
+
? Partial<Record<KeysType, never>>
|
|
3536
|
+
: {});
|
|
3537
|
+
|
|
3538
|
+
/**
|
|
3539
|
+
Returns a boolean for whether the given type is `never`.
|
|
3540
|
+
|
|
3541
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
3542
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
3543
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
3544
|
+
|
|
3545
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
3546
|
+
|
|
3547
|
+
@example
|
|
3548
|
+
```
|
|
3549
|
+
import type {IsNever, And} from 'type-fest';
|
|
3550
|
+
|
|
3551
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
3552
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
3553
|
+
And<
|
|
3554
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
3555
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
3556
|
+
>;
|
|
3557
|
+
|
|
3558
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
3559
|
+
AreStringsEqual<I, O> extends true
|
|
3560
|
+
? never
|
|
3561
|
+
: void;
|
|
3562
|
+
|
|
3563
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
3564
|
+
if (input === output) {
|
|
3565
|
+
process.exit(0);
|
|
3566
|
+
}
|
|
2124
3567
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
3568
|
+
|
|
3569
|
+
endIfEqual('abc', 'abc');
|
|
3570
|
+
//=> never
|
|
3571
|
+
|
|
3572
|
+
endIfEqual('abc', '123');
|
|
3573
|
+
//=> void
|
|
3574
|
+
```
|
|
3575
|
+
|
|
3576
|
+
@category Type Guard
|
|
3577
|
+
@category Utilities
|
|
3578
|
+
*/
|
|
3579
|
+
type IsNever$2<T> = [T] extends [never] ? true : false;
|
|
3580
|
+
|
|
3581
|
+
/**
|
|
3582
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
3583
|
+
|
|
3584
|
+
@see {@link IsNever}
|
|
3585
|
+
|
|
3586
|
+
@example
|
|
3587
|
+
```
|
|
3588
|
+
import type {IfNever} from 'type-fest';
|
|
3589
|
+
|
|
3590
|
+
type ShouldBeTrue = IfNever<never>;
|
|
3591
|
+
//=> true
|
|
3592
|
+
|
|
3593
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
3594
|
+
//=> 'bar'
|
|
3595
|
+
```
|
|
3596
|
+
|
|
3597
|
+
@category Type Guard
|
|
3598
|
+
@category Utilities
|
|
3599
|
+
*/
|
|
3600
|
+
type IfNever$2<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
3601
|
+
IsNever$2<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
3602
|
+
);
|
|
3603
|
+
|
|
3604
|
+
/**
|
|
3605
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
3606
|
+
|
|
3607
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
3608
|
+
|
|
3609
|
+
@example
|
|
3610
|
+
```
|
|
3611
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3612
|
+
|
|
3613
|
+
interface Example {
|
|
3614
|
+
a: string;
|
|
3615
|
+
b: string | number;
|
|
3616
|
+
c?: string;
|
|
3617
|
+
d: {};
|
|
2135
3618
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
3619
|
+
|
|
3620
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
3621
|
+
//=> 'a'
|
|
3622
|
+
```
|
|
3623
|
+
|
|
3624
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
3625
|
+
|
|
3626
|
+
@example
|
|
3627
|
+
```
|
|
3628
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3629
|
+
|
|
3630
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
3631
|
+
//=> 'a' | 'c'
|
|
3632
|
+
```
|
|
3633
|
+
|
|
3634
|
+
@category Object
|
|
3635
|
+
*/
|
|
3636
|
+
type ConditionalKeys$2<Base, Condition> =
|
|
3637
|
+
{
|
|
3638
|
+
// Map through all the keys of the given base type.
|
|
3639
|
+
[Key in keyof Base]-?:
|
|
3640
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
3641
|
+
Base[Key] extends Condition
|
|
3642
|
+
// Retain this key
|
|
3643
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
3644
|
+
? IfNever$2<Base[Key], IfNever$2<Condition, Key, never>, Key>
|
|
3645
|
+
// Discard this key since the condition fails.
|
|
3646
|
+
: never;
|
|
3647
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
3648
|
+
}[keyof Base];
|
|
3649
|
+
|
|
3650
|
+
/**
|
|
3651
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
3652
|
+
|
|
3653
|
+
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.
|
|
3654
|
+
|
|
3655
|
+
@example
|
|
3656
|
+
```
|
|
3657
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3658
|
+
|
|
3659
|
+
class Awesome {
|
|
3660
|
+
name: string;
|
|
3661
|
+
successes: number;
|
|
3662
|
+
failures: bigint;
|
|
3663
|
+
|
|
3664
|
+
run() {}
|
|
2156
3665
|
}
|
|
2157
|
-
declare const onCategoryCreated$1: EventDefinition$4<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
|
|
2158
|
-
declare const onCategoryUpdated$1: EventDefinition$4<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
|
|
2159
|
-
declare const onCategoryDeleted$1: EventDefinition$4<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
|
|
2160
3666
|
|
|
2161
|
-
type
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
isDomainEvent?: boolean;
|
|
2165
|
-
transformations?: (envelope: unknown) => Payload;
|
|
2166
|
-
__payload: Payload;
|
|
2167
|
-
};
|
|
2168
|
-
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
2169
|
-
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
2170
|
-
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
3667
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3668
|
+
//=> {run: () => void}
|
|
3669
|
+
```
|
|
2171
3670
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
3671
|
+
@example
|
|
3672
|
+
```
|
|
3673
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3674
|
+
|
|
3675
|
+
interface Example {
|
|
3676
|
+
a: string;
|
|
3677
|
+
b: string | number;
|
|
3678
|
+
c: () => void;
|
|
3679
|
+
d: {};
|
|
2177
3680
|
}
|
|
2178
3681
|
|
|
2179
|
-
|
|
3682
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3683
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3684
|
+
```
|
|
2180
3685
|
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
3686
|
+
@category Object
|
|
3687
|
+
*/
|
|
3688
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
3689
|
+
Base,
|
|
3690
|
+
ConditionalKeys$2<Base, Condition>
|
|
3691
|
+
>;
|
|
2185
3692
|
|
|
2186
|
-
type _publicOnCategoryCreatedType = typeof onCategoryCreated$1;
|
|
2187
3693
|
/**
|
|
2188
|
-
*
|
|
3694
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3695
|
+
* can either be a REST module or a host module.
|
|
3696
|
+
* This type is recursive, so it can describe nested modules.
|
|
2189
3697
|
*/
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
3698
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$2<any> | ServicePluginDefinition$2<any> | {
|
|
3699
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
3700
|
+
};
|
|
2193
3701
|
/**
|
|
2194
|
-
*
|
|
3702
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3703
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3704
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3705
|
+
* do not match the given host (as they will not work with the given host).
|
|
2195
3706
|
*/
|
|
2196
|
-
|
|
3707
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
3708
|
+
done: T;
|
|
3709
|
+
recurse: T extends {
|
|
3710
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
3711
|
+
} ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
|
|
3712
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
3713
|
+
-1,
|
|
3714
|
+
0,
|
|
3715
|
+
1,
|
|
3716
|
+
2,
|
|
3717
|
+
3,
|
|
3718
|
+
4,
|
|
3719
|
+
5
|
|
3720
|
+
][Depth]> : never;
|
|
3721
|
+
}, EmptyObject$2>;
|
|
3722
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3723
|
+
type PublicMetadata$2 = {
|
|
3724
|
+
PACKAGE_NAME?: string;
|
|
3725
|
+
};
|
|
2197
3726
|
|
|
2198
|
-
|
|
3727
|
+
declare global {
|
|
3728
|
+
interface ContextualClient {
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
2199
3731
|
/**
|
|
2200
|
-
*
|
|
3732
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3733
|
+
* case a contextual client is available.
|
|
2201
3734
|
*/
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
type context$3_BulkCreateCategoriesRequest = BulkCreateCategoriesRequest;
|
|
2206
|
-
type context$3_BulkCreateCategoriesResponse = BulkCreateCategoriesResponse;
|
|
2207
|
-
type context$3_BulkDeleteCategoryRequest = BulkDeleteCategoryRequest;
|
|
2208
|
-
type context$3_BulkDeleteCategoryResponse = BulkDeleteCategoryResponse;
|
|
2209
|
-
type context$3_BulkUpdateCategoriesRequest = BulkUpdateCategoriesRequest;
|
|
2210
|
-
type context$3_BulkUpdateCategoriesResponse = BulkUpdateCategoriesResponse;
|
|
2211
|
-
type context$3_CategoriesQueryBuilder = CategoriesQueryBuilder;
|
|
2212
|
-
type context$3_CategoriesQueryResult = CategoriesQueryResult;
|
|
2213
|
-
type context$3_CategoryCreatedEnvelope = CategoryCreatedEnvelope;
|
|
2214
|
-
type context$3_CategoryDeletedEnvelope = CategoryDeletedEnvelope;
|
|
2215
|
-
type context$3_CategoryLanguageCount = CategoryLanguageCount;
|
|
2216
|
-
type context$3_CategoryUpdatedEnvelope = CategoryUpdatedEnvelope;
|
|
2217
|
-
type context$3_CreateCategoryRequest = CreateCategoryRequest;
|
|
2218
|
-
type context$3_CreateCategoryResponse = CreateCategoryResponse;
|
|
2219
|
-
type context$3_DeleteCategoryRequest = DeleteCategoryRequest;
|
|
2220
|
-
type context$3_DeleteCategoryResponse = DeleteCategoryResponse;
|
|
2221
|
-
type context$3_GetCategoriesCountByLanguageRequest = GetCategoriesCountByLanguageRequest;
|
|
2222
|
-
type context$3_GetCategoriesCountByLanguageResponse = GetCategoriesCountByLanguageResponse;
|
|
2223
|
-
type context$3_GetCategoryBySlugOptions = GetCategoryBySlugOptions;
|
|
2224
|
-
type context$3_GetCategoryBySlugRequest = GetCategoryBySlugRequest;
|
|
2225
|
-
type context$3_GetCategoryBySlugResponse = GetCategoryBySlugResponse;
|
|
2226
|
-
type context$3_GetCategoryBySlugResponseNonNullableFields = GetCategoryBySlugResponseNonNullableFields;
|
|
2227
|
-
type context$3_GetCategoryOptions = GetCategoryOptions;
|
|
2228
|
-
type context$3_GetCategoryRequest = GetCategoryRequest;
|
|
2229
|
-
type context$3_GetCategoryResponse = GetCategoryResponse;
|
|
2230
|
-
type context$3_GetCategoryResponseNonNullableFields = GetCategoryResponseNonNullableFields;
|
|
2231
|
-
type context$3_InitialCategoriesCopied = InitialCategoriesCopied;
|
|
2232
|
-
type context$3_ListCategoriesOptions = ListCategoriesOptions;
|
|
2233
|
-
type context$3_ListCategoriesRequest = ListCategoriesRequest;
|
|
2234
|
-
type context$3_ListCategoriesResponse = ListCategoriesResponse;
|
|
2235
|
-
type context$3_ListCategoriesResponseNonNullableFields = ListCategoriesResponseNonNullableFields;
|
|
2236
|
-
type context$3_MaskedCategory = MaskedCategory;
|
|
2237
|
-
type context$3_QueryCategoriesOptions = QueryCategoriesOptions;
|
|
2238
|
-
type context$3_QueryCategoriesRequest = QueryCategoriesRequest;
|
|
2239
|
-
type context$3_QueryCategoriesResponse = QueryCategoriesResponse;
|
|
2240
|
-
type context$3_QueryCategoriesResponseNonNullableFields = QueryCategoriesResponseNonNullableFields;
|
|
2241
|
-
type context$3_UpdateCategoryRequest = UpdateCategoryRequest;
|
|
2242
|
-
type context$3_UpdateCategoryResponse = UpdateCategoryResponse;
|
|
2243
|
-
type context$3__publicOnCategoryCreatedType = _publicOnCategoryCreatedType;
|
|
2244
|
-
type context$3__publicOnCategoryDeletedType = _publicOnCategoryDeletedType;
|
|
2245
|
-
type context$3__publicOnCategoryUpdatedType = _publicOnCategoryUpdatedType;
|
|
2246
|
-
declare const context$3_getCategory: typeof getCategory;
|
|
2247
|
-
declare const context$3_getCategoryBySlug: typeof getCategoryBySlug;
|
|
2248
|
-
declare const context$3_listCategories: typeof listCategories;
|
|
2249
|
-
declare const context$3_onCategoryCreated: typeof onCategoryCreated;
|
|
2250
|
-
declare const context$3_onCategoryDeleted: typeof onCategoryDeleted;
|
|
2251
|
-
declare const context$3_onCategoryUpdated: typeof onCategoryUpdated;
|
|
2252
|
-
declare const context$3_queryCategories: typeof queryCategories;
|
|
2253
|
-
declare namespace context$3 {
|
|
2254
|
-
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 context$3_BulkCategoryResult as BulkCategoryResult, type context$3_BulkCreateCategoriesRequest as BulkCreateCategoriesRequest, type context$3_BulkCreateCategoriesResponse as BulkCreateCategoriesResponse, type context$3_BulkDeleteCategoryRequest as BulkDeleteCategoryRequest, type context$3_BulkDeleteCategoryResponse as BulkDeleteCategoryResponse, type context$3_BulkUpdateCategoriesRequest as BulkUpdateCategoriesRequest, type context$3_BulkUpdateCategoriesResponse as BulkUpdateCategoriesResponse, type context$3_CategoriesQueryBuilder as CategoriesQueryBuilder, type context$3_CategoriesQueryResult as CategoriesQueryResult, type Category$2 as Category, type context$3_CategoryCreatedEnvelope as CategoryCreatedEnvelope, type context$3_CategoryDeletedEnvelope as CategoryDeletedEnvelope, type context$3_CategoryLanguageCount as CategoryLanguageCount, type CategoryTranslation$2 as CategoryTranslation, type context$3_CategoryUpdatedEnvelope as CategoryUpdatedEnvelope, type context$3_CreateCategoryRequest as CreateCategoryRequest, type context$3_CreateCategoryResponse as CreateCategoryResponse, type CursorPaging$3 as CursorPaging, type Cursors$3 as Cursors, type context$3_DeleteCategoryRequest as DeleteCategoryRequest, type context$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 context$3_GetCategoriesCountByLanguageRequest as GetCategoriesCountByLanguageRequest, type context$3_GetCategoriesCountByLanguageResponse as GetCategoriesCountByLanguageResponse, type context$3_GetCategoryBySlugOptions as GetCategoryBySlugOptions, type context$3_GetCategoryBySlugRequest as GetCategoryBySlugRequest, type context$3_GetCategoryBySlugResponse as GetCategoryBySlugResponse, type context$3_GetCategoryBySlugResponseNonNullableFields as GetCategoryBySlugResponseNonNullableFields, type context$3_GetCategoryOptions as GetCategoryOptions, type context$3_GetCategoryRequest as GetCategoryRequest, type context$3_GetCategoryResponse as GetCategoryResponse, type context$3_GetCategoryResponseNonNullableFields as GetCategoryResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$3_InitialCategoriesCopied as InitialCategoriesCopied, type ItemMetadata$2 as ItemMetadata, type Keyword$3 as Keyword, type context$3_ListCategoriesOptions as ListCategoriesOptions, type context$3_ListCategoriesRequest as ListCategoriesRequest, type context$3_ListCategoriesResponse as ListCategoriesResponse, type context$3_ListCategoriesResponseNonNullableFields as ListCategoriesResponseNonNullableFields, type context$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 context$3_QueryCategoriesOptions as QueryCategoriesOptions, type context$3_QueryCategoriesRequest as QueryCategoriesRequest, type context$3_QueryCategoriesResponse as QueryCategoriesResponse, type context$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 context$3_UpdateCategoryRequest as UpdateCategoryRequest, type context$3_UpdateCategoryResponse as UpdateCategoryResponse, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnCategoryCreatedType as _publicOnCategoryCreatedType, type context$3__publicOnCategoryDeletedType as _publicOnCategoryDeletedType, type context$3__publicOnCategoryUpdatedType as _publicOnCategoryUpdatedType, context$3_getCategory as getCategory, context$3_getCategoryBySlug as getCategoryBySlug, context$3_listCategories as listCategories, context$3_onCategoryCreated as onCategoryCreated, context$3_onCategoryDeleted as onCategoryDeleted, context$3_onCategoryUpdated as onCategoryUpdated, onCategoryCreated$1 as publicOnCategoryCreated, onCategoryDeleted$1 as publicOnCategoryDeleted, onCategoryUpdated$1 as publicOnCategoryUpdated, context$3_queryCategories as queryCategories };
|
|
2255
|
-
}
|
|
3735
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
3736
|
+
host: Host$2;
|
|
3737
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
2256
3738
|
|
|
2257
3739
|
interface DraftPost$1 {
|
|
2258
3740
|
/**
|
|
@@ -3920,8 +5402,6 @@ declare enum Field$2 {
|
|
|
3920
5402
|
CONTENT = "CONTENT",
|
|
3921
5403
|
/** Includes rich content field. */
|
|
3922
5404
|
RICH_CONTENT = "RICH_CONTENT",
|
|
3923
|
-
/** Includes draft post translations when present. */
|
|
3924
|
-
TRANSLATIONS = "TRANSLATIONS",
|
|
3925
5405
|
/** If the user has not set excerpt, returns the one autogenerated from content. */
|
|
3926
5406
|
GENERATED_EXCERPT = "GENERATED_EXCERPT"
|
|
3927
5407
|
}
|
|
@@ -5564,7 +7044,7 @@ interface DraftPostsQueryBuilder {
|
|
|
5564
7044
|
find: () => Promise<DraftPostsQueryResult>;
|
|
5565
7045
|
}
|
|
5566
7046
|
|
|
5567
|
-
declare function createDraftPost$1(httpClient: HttpClient): CreateDraftPostSignature;
|
|
7047
|
+
declare function createDraftPost$1(httpClient: HttpClient$2): CreateDraftPostSignature;
|
|
5568
7048
|
interface CreateDraftPostSignature {
|
|
5569
7049
|
/**
|
|
5570
7050
|
* Creates a draft post.
|
|
@@ -5575,7 +7055,7 @@ interface CreateDraftPostSignature {
|
|
|
5575
7055
|
*/
|
|
5576
7056
|
(draftPost: DraftPost$1, options?: CreateDraftPostOptions | undefined): Promise<CreateDraftPostResponse & CreateDraftPostResponseNonNullableFields>;
|
|
5577
7057
|
}
|
|
5578
|
-
declare function bulkCreateDraftPosts$1(httpClient: HttpClient): BulkCreateDraftPostsSignature;
|
|
7058
|
+
declare function bulkCreateDraftPosts$1(httpClient: HttpClient$2): BulkCreateDraftPostsSignature;
|
|
5579
7059
|
interface BulkCreateDraftPostsSignature {
|
|
5580
7060
|
/**
|
|
5581
7061
|
* Creates multiple draft posts.
|
|
@@ -5584,7 +7064,7 @@ interface BulkCreateDraftPostsSignature {
|
|
|
5584
7064
|
*/
|
|
5585
7065
|
(draftPosts: DraftPost$1[], options?: BulkCreateDraftPostsOptions | undefined): Promise<BulkCreateDraftPostsResponse & BulkCreateDraftPostsResponseNonNullableFields>;
|
|
5586
7066
|
}
|
|
5587
|
-
declare function bulkUpdateDraftPosts$1(httpClient: HttpClient): BulkUpdateDraftPostsSignature;
|
|
7067
|
+
declare function bulkUpdateDraftPosts$1(httpClient: HttpClient$2): BulkUpdateDraftPostsSignature;
|
|
5588
7068
|
interface BulkUpdateDraftPostsSignature {
|
|
5589
7069
|
/**
|
|
5590
7070
|
* Updates multiple draft posts.
|
|
@@ -5592,7 +7072,7 @@ interface BulkUpdateDraftPostsSignature {
|
|
|
5592
7072
|
*/
|
|
5593
7073
|
(options?: BulkUpdateDraftPostsOptions | undefined): Promise<BulkUpdateDraftPostsResponse & BulkUpdateDraftPostsResponseNonNullableFields>;
|
|
5594
7074
|
}
|
|
5595
|
-
declare function listDeletedDraftPosts$1(httpClient: HttpClient): ListDeletedDraftPostsSignature;
|
|
7075
|
+
declare function listDeletedDraftPosts$1(httpClient: HttpClient$2): ListDeletedDraftPostsSignature;
|
|
5596
7076
|
interface ListDeletedDraftPostsSignature {
|
|
5597
7077
|
/**
|
|
5598
7078
|
* Retrieves a list of up to 100 deleted draft posts.
|
|
@@ -5605,7 +7085,7 @@ interface ListDeletedDraftPostsSignature {
|
|
|
5605
7085
|
*/
|
|
5606
7086
|
(options?: ListDeletedDraftPostsOptions | undefined): Promise<ListDeletedDraftPostsResponse & ListDeletedDraftPostsResponseNonNullableFields>;
|
|
5607
7087
|
}
|
|
5608
|
-
declare function getDraftPost$1(httpClient: HttpClient): GetDraftPostSignature;
|
|
7088
|
+
declare function getDraftPost$1(httpClient: HttpClient$2): GetDraftPostSignature;
|
|
5609
7089
|
interface GetDraftPostSignature {
|
|
5610
7090
|
/**
|
|
5611
7091
|
* Gets a draft post by the provided ID.
|
|
@@ -5616,7 +7096,7 @@ interface GetDraftPostSignature {
|
|
|
5616
7096
|
*/
|
|
5617
7097
|
(draftPostId: string, options?: GetDraftPostOptions | undefined): Promise<GetDraftPostResponse & GetDraftPostResponseNonNullableFields>;
|
|
5618
7098
|
}
|
|
5619
|
-
declare function updateDraftPost$1(httpClient: HttpClient): UpdateDraftPostSignature;
|
|
7099
|
+
declare function updateDraftPost$1(httpClient: HttpClient$2): UpdateDraftPostSignature;
|
|
5620
7100
|
interface UpdateDraftPostSignature {
|
|
5621
7101
|
/**
|
|
5622
7102
|
* Updates a draft post.
|
|
@@ -5626,7 +7106,7 @@ interface UpdateDraftPostSignature {
|
|
|
5626
7106
|
*/
|
|
5627
7107
|
(_id: string, draftPost: UpdateDraftPost, options?: UpdateDraftPostOptions | undefined): Promise<UpdateDraftPostResponse & UpdateDraftPostResponseNonNullableFields>;
|
|
5628
7108
|
}
|
|
5629
|
-
declare function deleteDraftPost$1(httpClient: HttpClient): DeleteDraftPostSignature;
|
|
7109
|
+
declare function deleteDraftPost$1(httpClient: HttpClient$2): DeleteDraftPostSignature;
|
|
5630
7110
|
interface DeleteDraftPostSignature {
|
|
5631
7111
|
/**
|
|
5632
7112
|
* Moves a draft post with the provided ID to the trash bin.
|
|
@@ -5638,7 +7118,7 @@ interface DeleteDraftPostSignature {
|
|
|
5638
7118
|
*/
|
|
5639
7119
|
(draftPostId: string, options?: DeleteDraftPostOptions | undefined): Promise<void>;
|
|
5640
7120
|
}
|
|
5641
|
-
declare function removeFromTrashBin$1(httpClient: HttpClient): RemoveFromTrashBinSignature;
|
|
7121
|
+
declare function removeFromTrashBin$1(httpClient: HttpClient$2): RemoveFromTrashBinSignature;
|
|
5642
7122
|
interface RemoveFromTrashBinSignature {
|
|
5643
7123
|
/**
|
|
5644
7124
|
* Permanently deletes a draft post by the provided ID from the trash bin.
|
|
@@ -5648,7 +7128,7 @@ interface RemoveFromTrashBinSignature {
|
|
|
5648
7128
|
*/
|
|
5649
7129
|
(draftPostId: string): Promise<void>;
|
|
5650
7130
|
}
|
|
5651
|
-
declare function bulkDeleteDraftPosts$1(httpClient: HttpClient): BulkDeleteDraftPostsSignature;
|
|
7131
|
+
declare function bulkDeleteDraftPosts$1(httpClient: HttpClient$2): BulkDeleteDraftPostsSignature;
|
|
5652
7132
|
interface BulkDeleteDraftPostsSignature {
|
|
5653
7133
|
/**
|
|
5654
7134
|
* Deletes multiple draft posts.
|
|
@@ -5657,7 +7137,7 @@ interface BulkDeleteDraftPostsSignature {
|
|
|
5657
7137
|
*/
|
|
5658
7138
|
(postIds: string[], options?: BulkDeleteDraftPostsOptions | undefined): Promise<BulkDeleteDraftPostsResponse & BulkDeleteDraftPostsResponseNonNullableFields>;
|
|
5659
7139
|
}
|
|
5660
|
-
declare function listDraftPosts$1(httpClient: HttpClient): ListDraftPostsSignature;
|
|
7140
|
+
declare function listDraftPosts$1(httpClient: HttpClient$2): ListDraftPostsSignature;
|
|
5661
7141
|
interface ListDraftPostsSignature {
|
|
5662
7142
|
/**
|
|
5663
7143
|
* Retrieves a list of up to 100 draft posts per request.
|
|
@@ -5670,230 +7150,690 @@ interface ListDraftPostsSignature {
|
|
|
5670
7150
|
*/
|
|
5671
7151
|
(options?: ListDraftPostsOptions | undefined): Promise<ListDraftPostsResponse & ListDraftPostsResponseNonNullableFields>;
|
|
5672
7152
|
}
|
|
5673
|
-
declare function getDeletedDraftPost$1(httpClient: HttpClient): GetDeletedDraftPostSignature;
|
|
7153
|
+
declare function getDeletedDraftPost$1(httpClient: HttpClient$2): GetDeletedDraftPostSignature;
|
|
5674
7154
|
interface GetDeletedDraftPostSignature {
|
|
5675
7155
|
/**
|
|
5676
|
-
* Gets a deleted draft post from the trash bin by the provided ID.
|
|
5677
|
-
*
|
|
5678
|
-
* Uses the provided `draftPostId` to retrieve a previously deleted draft post from the trash bin.
|
|
5679
|
-
* @param - Draft post ID.
|
|
7156
|
+
* Gets a deleted draft post from the trash bin by the provided ID.
|
|
7157
|
+
*
|
|
7158
|
+
* Uses the provided `draftPostId` to retrieve a previously deleted draft post from the trash bin.
|
|
7159
|
+
* @param - Draft post ID.
|
|
7160
|
+
*/
|
|
7161
|
+
(draftPostId: string): Promise<GetDeletedDraftPostResponse & GetDeletedDraftPostResponseNonNullableFields>;
|
|
7162
|
+
}
|
|
7163
|
+
declare function restoreFromTrashBin$1(httpClient: HttpClient$2): RestoreFromTrashBinSignature;
|
|
7164
|
+
interface RestoreFromTrashBinSignature {
|
|
7165
|
+
/**
|
|
7166
|
+
* Restores a deleted draft post from the trash bin by the provided ID.
|
|
7167
|
+
*
|
|
7168
|
+
* Uses the `draftPostId` to restore a deleted draft post from the trash bin.
|
|
7169
|
+
* @param - Draft post ID.
|
|
7170
|
+
*/
|
|
7171
|
+
(draftPostId: string): Promise<RestoreFromTrashBinResponse & RestoreFromTrashBinResponseNonNullableFields>;
|
|
7172
|
+
}
|
|
7173
|
+
declare function queryDraftPosts$1(httpClient: HttpClient$2): QueryDraftPostsSignature;
|
|
7174
|
+
interface QueryDraftPostsSignature {
|
|
7175
|
+
/**
|
|
7176
|
+
* Retrieves a list of up to 100 draft posts, given the provided paging, filtering, and sorting.
|
|
7177
|
+
*
|
|
7178
|
+
* Query Draft Posts runs with these defaults, which you can override:
|
|
7179
|
+
* - `editedDate` is sorted in `DESC` order.
|
|
7180
|
+
* - `paging.limit` is `50`.
|
|
7181
|
+
* - `paging.offset` is `0`.
|
|
7182
|
+
* @param - Options for querying draft posts.
|
|
7183
|
+
*/
|
|
7184
|
+
(options?: QueryDraftPostsOptions | undefined): DraftPostsQueryBuilder;
|
|
7185
|
+
}
|
|
7186
|
+
declare function publishDraftPost$1(httpClient: HttpClient$2): PublishDraftPostSignature;
|
|
7187
|
+
interface PublishDraftPostSignature {
|
|
7188
|
+
/**
|
|
7189
|
+
* Publishes a specified draft post by ID. This creates a new post entity with the data from the draft post.
|
|
7190
|
+
*
|
|
7191
|
+
* If the specified draft post was already published, the published post will be updated with the latest values from the draft post entity.
|
|
7192
|
+
* @param - Draft post ID.
|
|
7193
|
+
*/
|
|
7194
|
+
(draftPostId: string): Promise<PublishDraftPostResponse & PublishDraftPostResponseNonNullableFields>;
|
|
7195
|
+
}
|
|
7196
|
+
declare const onDraftCreated$1: EventDefinition$2<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
|
|
7197
|
+
declare const onDraftUpdated$1: EventDefinition$2<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
|
|
7198
|
+
declare const onDraftDeleted$1: EventDefinition$2<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
|
|
7199
|
+
|
|
7200
|
+
declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
7201
|
+
|
|
7202
|
+
declare const createDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof createDraftPost$1> & typeof createDraftPost$1>;
|
|
7203
|
+
declare const bulkCreateDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkCreateDraftPosts$1> & typeof bulkCreateDraftPosts$1>;
|
|
7204
|
+
declare const bulkUpdateDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkUpdateDraftPosts$1> & typeof bulkUpdateDraftPosts$1>;
|
|
7205
|
+
declare const listDeletedDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof listDeletedDraftPosts$1> & typeof listDeletedDraftPosts$1>;
|
|
7206
|
+
declare const getDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof getDraftPost$1> & typeof getDraftPost$1>;
|
|
7207
|
+
declare const updateDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof updateDraftPost$1> & typeof updateDraftPost$1>;
|
|
7208
|
+
declare const deleteDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof deleteDraftPost$1> & typeof deleteDraftPost$1>;
|
|
7209
|
+
declare const removeFromTrashBin: MaybeContext$2<BuildRESTFunction$2<typeof removeFromTrashBin$1> & typeof removeFromTrashBin$1>;
|
|
7210
|
+
declare const bulkDeleteDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof bulkDeleteDraftPosts$1> & typeof bulkDeleteDraftPosts$1>;
|
|
7211
|
+
declare const listDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof listDraftPosts$1> & typeof listDraftPosts$1>;
|
|
7212
|
+
declare const getDeletedDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof getDeletedDraftPost$1> & typeof getDeletedDraftPost$1>;
|
|
7213
|
+
declare const restoreFromTrashBin: MaybeContext$2<BuildRESTFunction$2<typeof restoreFromTrashBin$1> & typeof restoreFromTrashBin$1>;
|
|
7214
|
+
declare const queryDraftPosts: MaybeContext$2<BuildRESTFunction$2<typeof queryDraftPosts$1> & typeof queryDraftPosts$1>;
|
|
7215
|
+
declare const publishDraftPost: MaybeContext$2<BuildRESTFunction$2<typeof publishDraftPost$1> & typeof publishDraftPost$1>;
|
|
7216
|
+
|
|
7217
|
+
type _publicOnDraftCreatedType = typeof onDraftCreated$1;
|
|
7218
|
+
/**
|
|
7219
|
+
* Triggered when a draft post is created.
|
|
7220
|
+
*/
|
|
7221
|
+
declare const onDraftCreated: ReturnType<typeof createEventModule$2<_publicOnDraftCreatedType>>;
|
|
7222
|
+
|
|
7223
|
+
type _publicOnDraftUpdatedType = typeof onDraftUpdated$1;
|
|
7224
|
+
/**
|
|
7225
|
+
* Triggered when a draft post is updated.
|
|
7226
|
+
*/
|
|
7227
|
+
declare const onDraftUpdated: ReturnType<typeof createEventModule$2<_publicOnDraftUpdatedType>>;
|
|
7228
|
+
|
|
7229
|
+
type _publicOnDraftDeletedType = typeof onDraftDeleted$1;
|
|
7230
|
+
/**
|
|
7231
|
+
* Triggered when a draft post is deleted.
|
|
7232
|
+
*/
|
|
7233
|
+
declare const onDraftDeleted: ReturnType<typeof createEventModule$2<_publicOnDraftDeletedType>>;
|
|
7234
|
+
|
|
7235
|
+
type context$2_Action = Action;
|
|
7236
|
+
declare const context$2_Action: typeof Action;
|
|
7237
|
+
type context$2_ApproveDraftPostRequest = ApproveDraftPostRequest;
|
|
7238
|
+
type context$2_ApproveDraftPostResponse = ApproveDraftPostResponse;
|
|
7239
|
+
type context$2_BulkCreateDraftPostsOptions = BulkCreateDraftPostsOptions;
|
|
7240
|
+
type context$2_BulkCreateDraftPostsRequest = BulkCreateDraftPostsRequest;
|
|
7241
|
+
type context$2_BulkCreateDraftPostsResponse = BulkCreateDraftPostsResponse;
|
|
7242
|
+
type context$2_BulkCreateDraftPostsResponseNonNullableFields = BulkCreateDraftPostsResponseNonNullableFields;
|
|
7243
|
+
type context$2_BulkDeleteDraftPostsOptions = BulkDeleteDraftPostsOptions;
|
|
7244
|
+
type context$2_BulkDeleteDraftPostsRequest = BulkDeleteDraftPostsRequest;
|
|
7245
|
+
type context$2_BulkDeleteDraftPostsResponse = BulkDeleteDraftPostsResponse;
|
|
7246
|
+
type context$2_BulkDeleteDraftPostsResponseNonNullableFields = BulkDeleteDraftPostsResponseNonNullableFields;
|
|
7247
|
+
type context$2_BulkDraftPostResult = BulkDraftPostResult;
|
|
7248
|
+
type context$2_BulkRejectDraftPostRequest = BulkRejectDraftPostRequest;
|
|
7249
|
+
type context$2_BulkRejectDraftPostResponse = BulkRejectDraftPostResponse;
|
|
7250
|
+
type context$2_BulkRevertToUnpublishedRequest = BulkRevertToUnpublishedRequest;
|
|
7251
|
+
type context$2_BulkRevertToUnpublishedResponse = BulkRevertToUnpublishedResponse;
|
|
7252
|
+
type context$2_BulkUpdateDraftPostLanguageRequest = BulkUpdateDraftPostLanguageRequest;
|
|
7253
|
+
type context$2_BulkUpdateDraftPostLanguageResponse = BulkUpdateDraftPostLanguageResponse;
|
|
7254
|
+
type context$2_BulkUpdateDraftPostsOptions = BulkUpdateDraftPostsOptions;
|
|
7255
|
+
type context$2_BulkUpdateDraftPostsRequest = BulkUpdateDraftPostsRequest;
|
|
7256
|
+
type context$2_BulkUpdateDraftPostsResponse = BulkUpdateDraftPostsResponse;
|
|
7257
|
+
type context$2_BulkUpdateDraftPostsResponseNonNullableFields = BulkUpdateDraftPostsResponseNonNullableFields;
|
|
7258
|
+
type context$2_ButtonDataType = ButtonDataType;
|
|
7259
|
+
declare const context$2_ButtonDataType: typeof ButtonDataType;
|
|
7260
|
+
type context$2_CreateDraftPostOptions = CreateDraftPostOptions;
|
|
7261
|
+
type context$2_CreateDraftPostRequest = CreateDraftPostRequest;
|
|
7262
|
+
type context$2_CreateDraftPostResponse = CreateDraftPostResponse;
|
|
7263
|
+
type context$2_CreateDraftPostResponseNonNullableFields = CreateDraftPostResponseNonNullableFields;
|
|
7264
|
+
type context$2_DeleteDraftPostOptions = DeleteDraftPostOptions;
|
|
7265
|
+
type context$2_DeleteDraftPostRequest = DeleteDraftPostRequest;
|
|
7266
|
+
type context$2_DeleteDraftPostResponse = DeleteDraftPostResponse;
|
|
7267
|
+
type context$2_DraftCreatedEnvelope = DraftCreatedEnvelope;
|
|
7268
|
+
type context$2_DraftDeletedEnvelope = DraftDeletedEnvelope;
|
|
7269
|
+
type context$2_DraftPostOwnerChanged = DraftPostOwnerChanged;
|
|
7270
|
+
type context$2_DraftPostsQueryBuilder = DraftPostsQueryBuilder;
|
|
7271
|
+
type context$2_DraftPostsQueryResult = DraftPostsQueryResult;
|
|
7272
|
+
type context$2_DraftUpdatedEnvelope = DraftUpdatedEnvelope;
|
|
7273
|
+
type context$2_GetDeletedDraftPostRequest = GetDeletedDraftPostRequest;
|
|
7274
|
+
type context$2_GetDeletedDraftPostResponse = GetDeletedDraftPostResponse;
|
|
7275
|
+
type context$2_GetDeletedDraftPostResponseNonNullableFields = GetDeletedDraftPostResponseNonNullableFields;
|
|
7276
|
+
type context$2_GetDraftPostOptions = GetDraftPostOptions;
|
|
7277
|
+
type context$2_GetDraftPostRequest = GetDraftPostRequest;
|
|
7278
|
+
type context$2_GetDraftPostResponse = GetDraftPostResponse;
|
|
7279
|
+
type context$2_GetDraftPostResponseNonNullableFields = GetDraftPostResponseNonNullableFields;
|
|
7280
|
+
type context$2_GetDraftPostTotalsRequest = GetDraftPostTotalsRequest;
|
|
7281
|
+
type context$2_GetDraftPostTotalsResponse = GetDraftPostTotalsResponse;
|
|
7282
|
+
type context$2_GetDraftPostsSort = GetDraftPostsSort;
|
|
7283
|
+
declare const context$2_GetDraftPostsSort: typeof GetDraftPostsSort;
|
|
7284
|
+
type context$2_GetPostAmountsByLanguageRequest = GetPostAmountsByLanguageRequest;
|
|
7285
|
+
type context$2_GetPostAmountsByLanguageResponse = GetPostAmountsByLanguageResponse;
|
|
7286
|
+
type context$2_InitialDraftPostsCopied = InitialDraftPostsCopied;
|
|
7287
|
+
type context$2_IsDraftPostAutoTranslatableRequest = IsDraftPostAutoTranslatableRequest;
|
|
7288
|
+
type context$2_IsDraftPostAutoTranslatableResponse = IsDraftPostAutoTranslatableResponse;
|
|
7289
|
+
type context$2_ListDeletedDraftPostsOptions = ListDeletedDraftPostsOptions;
|
|
7290
|
+
type context$2_ListDeletedDraftPostsRequest = ListDeletedDraftPostsRequest;
|
|
7291
|
+
type context$2_ListDeletedDraftPostsResponse = ListDeletedDraftPostsResponse;
|
|
7292
|
+
type context$2_ListDeletedDraftPostsResponseNonNullableFields = ListDeletedDraftPostsResponseNonNullableFields;
|
|
7293
|
+
type context$2_ListDraftPostsOptions = ListDraftPostsOptions;
|
|
7294
|
+
type context$2_ListDraftPostsRequest = ListDraftPostsRequest;
|
|
7295
|
+
type context$2_ListDraftPostsResponse = ListDraftPostsResponse;
|
|
7296
|
+
type context$2_ListDraftPostsResponseNonNullableFields = ListDraftPostsResponseNonNullableFields;
|
|
7297
|
+
type context$2_MarkPostAsInModerationRequest = MarkPostAsInModerationRequest;
|
|
7298
|
+
type context$2_MarkPostAsInModerationResponse = MarkPostAsInModerationResponse;
|
|
7299
|
+
type context$2_MaskedDraftPosts = MaskedDraftPosts;
|
|
7300
|
+
type context$2_PostAmountByLanguage = PostAmountByLanguage;
|
|
7301
|
+
type context$2_PublishDraftPostRequest = PublishDraftPostRequest;
|
|
7302
|
+
type context$2_PublishDraftPostResponse = PublishDraftPostResponse;
|
|
7303
|
+
type context$2_PublishDraftPostResponseNonNullableFields = PublishDraftPostResponseNonNullableFields;
|
|
7304
|
+
type context$2_QueryDraftPostsOptions = QueryDraftPostsOptions;
|
|
7305
|
+
type context$2_QueryDraftPostsRequest = QueryDraftPostsRequest;
|
|
7306
|
+
type context$2_QueryDraftPostsResponse = QueryDraftPostsResponse;
|
|
7307
|
+
type context$2_QueryDraftPostsResponseNonNullableFields = QueryDraftPostsResponseNonNullableFields;
|
|
7308
|
+
type context$2_RejectDraftPostRequest = RejectDraftPostRequest;
|
|
7309
|
+
type context$2_RejectDraftPostResponse = RejectDraftPostResponse;
|
|
7310
|
+
type context$2_RemoveFromTrashBinRequest = RemoveFromTrashBinRequest;
|
|
7311
|
+
type context$2_RemoveFromTrashBinResponse = RemoveFromTrashBinResponse;
|
|
7312
|
+
type context$2_RestoreFromTrashBinRequest = RestoreFromTrashBinRequest;
|
|
7313
|
+
type context$2_RestoreFromTrashBinResponse = RestoreFromTrashBinResponse;
|
|
7314
|
+
type context$2_RestoreFromTrashBinResponseNonNullableFields = RestoreFromTrashBinResponseNonNullableFields;
|
|
7315
|
+
type context$2_RevertToUnpublishedRequest = RevertToUnpublishedRequest;
|
|
7316
|
+
type context$2_RevertToUnpublishedResponse = RevertToUnpublishedResponse;
|
|
7317
|
+
type context$2_TotalDraftPosts = TotalDraftPosts;
|
|
7318
|
+
type context$2_TotalDraftPostsGroupingField = TotalDraftPostsGroupingField;
|
|
7319
|
+
declare const context$2_TotalDraftPostsGroupingField: typeof TotalDraftPostsGroupingField;
|
|
7320
|
+
type context$2_TranslateCategoryRequest = TranslateCategoryRequest;
|
|
7321
|
+
type context$2_TranslateCategoryResponse = TranslateCategoryResponse;
|
|
7322
|
+
type context$2_TranslateDraftRequest = TranslateDraftRequest;
|
|
7323
|
+
type context$2_TranslateDraftResponse = TranslateDraftResponse;
|
|
7324
|
+
type context$2_UnpublishPostRequest = UnpublishPostRequest;
|
|
7325
|
+
type context$2_UnpublishPostResponse = UnpublishPostResponse;
|
|
7326
|
+
type context$2_UpdateDraftPost = UpdateDraftPost;
|
|
7327
|
+
type context$2_UpdateDraftPostContentRequest = UpdateDraftPostContentRequest;
|
|
7328
|
+
type context$2_UpdateDraftPostContentRequestDraftContentOneOf = UpdateDraftPostContentRequestDraftContentOneOf;
|
|
7329
|
+
type context$2_UpdateDraftPostContentResponse = UpdateDraftPostContentResponse;
|
|
7330
|
+
type context$2_UpdateDraftPostLanguageRequest = UpdateDraftPostLanguageRequest;
|
|
7331
|
+
type context$2_UpdateDraftPostLanguageResponse = UpdateDraftPostLanguageResponse;
|
|
7332
|
+
type context$2_UpdateDraftPostOptions = UpdateDraftPostOptions;
|
|
7333
|
+
type context$2_UpdateDraftPostRequest = UpdateDraftPostRequest;
|
|
7334
|
+
type context$2_UpdateDraftPostResponse = UpdateDraftPostResponse;
|
|
7335
|
+
type context$2_UpdateDraftPostResponseNonNullableFields = UpdateDraftPostResponseNonNullableFields;
|
|
7336
|
+
type context$2__publicOnDraftCreatedType = _publicOnDraftCreatedType;
|
|
7337
|
+
type context$2__publicOnDraftDeletedType = _publicOnDraftDeletedType;
|
|
7338
|
+
type context$2__publicOnDraftUpdatedType = _publicOnDraftUpdatedType;
|
|
7339
|
+
declare const context$2_bulkCreateDraftPosts: typeof bulkCreateDraftPosts;
|
|
7340
|
+
declare const context$2_bulkDeleteDraftPosts: typeof bulkDeleteDraftPosts;
|
|
7341
|
+
declare const context$2_bulkUpdateDraftPosts: typeof bulkUpdateDraftPosts;
|
|
7342
|
+
declare const context$2_createDraftPost: typeof createDraftPost;
|
|
7343
|
+
declare const context$2_deleteDraftPost: typeof deleteDraftPost;
|
|
7344
|
+
declare const context$2_getDeletedDraftPost: typeof getDeletedDraftPost;
|
|
7345
|
+
declare const context$2_getDraftPost: typeof getDraftPost;
|
|
7346
|
+
declare const context$2_listDeletedDraftPosts: typeof listDeletedDraftPosts;
|
|
7347
|
+
declare const context$2_listDraftPosts: typeof listDraftPosts;
|
|
7348
|
+
declare const context$2_onDraftCreated: typeof onDraftCreated;
|
|
7349
|
+
declare const context$2_onDraftDeleted: typeof onDraftDeleted;
|
|
7350
|
+
declare const context$2_onDraftUpdated: typeof onDraftUpdated;
|
|
7351
|
+
declare const context$2_publishDraftPost: typeof publishDraftPost;
|
|
7352
|
+
declare const context$2_queryDraftPosts: typeof queryDraftPosts;
|
|
7353
|
+
declare const context$2_removeFromTrashBin: typeof removeFromTrashBin;
|
|
7354
|
+
declare const context$2_restoreFromTrashBin: typeof restoreFromTrashBin;
|
|
7355
|
+
declare const context$2_updateDraftPost: typeof updateDraftPost;
|
|
7356
|
+
declare namespace context$2 {
|
|
7357
|
+
export { context$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 context$2_ApproveDraftPostRequest as ApproveDraftPostRequest, type context$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 context$2_BulkCreateDraftPostsOptions as BulkCreateDraftPostsOptions, type context$2_BulkCreateDraftPostsRequest as BulkCreateDraftPostsRequest, type context$2_BulkCreateDraftPostsResponse as BulkCreateDraftPostsResponse, type context$2_BulkCreateDraftPostsResponseNonNullableFields as BulkCreateDraftPostsResponseNonNullableFields, type context$2_BulkDeleteDraftPostsOptions as BulkDeleteDraftPostsOptions, type context$2_BulkDeleteDraftPostsRequest as BulkDeleteDraftPostsRequest, type context$2_BulkDeleteDraftPostsResponse as BulkDeleteDraftPostsResponse, type context$2_BulkDeleteDraftPostsResponseNonNullableFields as BulkDeleteDraftPostsResponseNonNullableFields, type context$2_BulkDraftPostResult as BulkDraftPostResult, type context$2_BulkRejectDraftPostRequest as BulkRejectDraftPostRequest, type context$2_BulkRejectDraftPostResponse as BulkRejectDraftPostResponse, type context$2_BulkRevertToUnpublishedRequest as BulkRevertToUnpublishedRequest, type context$2_BulkRevertToUnpublishedResponse as BulkRevertToUnpublishedResponse, type context$2_BulkUpdateDraftPostLanguageRequest as BulkUpdateDraftPostLanguageRequest, type context$2_BulkUpdateDraftPostLanguageResponse as BulkUpdateDraftPostLanguageResponse, type context$2_BulkUpdateDraftPostsOptions as BulkUpdateDraftPostsOptions, type context$2_BulkUpdateDraftPostsRequest as BulkUpdateDraftPostsRequest, type context$2_BulkUpdateDraftPostsResponse as BulkUpdateDraftPostsResponse, type context$2_BulkUpdateDraftPostsResponseNonNullableFields as BulkUpdateDraftPostsResponseNonNullableFields, type BulletedListData$1 as BulletedListData, type ButtonData$1 as ButtonData, context$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 context$2_CreateDraftPostOptions as CreateDraftPostOptions, type context$2_CreateDraftPostRequest as CreateDraftPostRequest, type context$2_CreateDraftPostResponse as CreateDraftPostResponse, type context$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 context$2_DeleteDraftPostOptions as DeleteDraftPostOptions, type context$2_DeleteDraftPostRequest as DeleteDraftPostRequest, type context$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 context$2_DraftCreatedEnvelope as DraftCreatedEnvelope, type context$2_DraftDeletedEnvelope as DraftDeletedEnvelope, type DraftPost$1 as DraftPost, type context$2_DraftPostOwnerChanged as DraftPostOwnerChanged, type DraftPostTranslation$1 as DraftPostTranslation, type context$2_DraftPostsQueryBuilder as DraftPostsQueryBuilder, type context$2_DraftPostsQueryResult as DraftPostsQueryResult, type context$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 context$2_GetDeletedDraftPostRequest as GetDeletedDraftPostRequest, type context$2_GetDeletedDraftPostResponse as GetDeletedDraftPostResponse, type context$2_GetDeletedDraftPostResponseNonNullableFields as GetDeletedDraftPostResponseNonNullableFields, type context$2_GetDraftPostOptions as GetDraftPostOptions, type context$2_GetDraftPostRequest as GetDraftPostRequest, type context$2_GetDraftPostResponse as GetDraftPostResponse, type context$2_GetDraftPostResponseNonNullableFields as GetDraftPostResponseNonNullableFields, type context$2_GetDraftPostTotalsRequest as GetDraftPostTotalsRequest, type context$2_GetDraftPostTotalsResponse as GetDraftPostTotalsResponse, context$2_GetDraftPostsSort as GetDraftPostsSort, type context$2_GetPostAmountsByLanguageRequest as GetPostAmountsByLanguageRequest, type context$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 context$2_InitialDraftPostsCopied as InitialDraftPostsCopied, InitialExpandedItems$1 as InitialExpandedItems, type context$2_IsDraftPostAutoTranslatableRequest as IsDraftPostAutoTranslatableRequest, type context$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 context$2_ListDeletedDraftPostsOptions as ListDeletedDraftPostsOptions, type context$2_ListDeletedDraftPostsRequest as ListDeletedDraftPostsRequest, type context$2_ListDeletedDraftPostsResponse as ListDeletedDraftPostsResponse, type context$2_ListDeletedDraftPostsResponseNonNullableFields as ListDeletedDraftPostsResponseNonNullableFields, type context$2_ListDraftPostsOptions as ListDraftPostsOptions, type context$2_ListDraftPostsRequest as ListDraftPostsRequest, type context$2_ListDraftPostsResponse as ListDraftPostsResponse, type context$2_ListDraftPostsResponseNonNullableFields as ListDraftPostsResponseNonNullableFields, type ListValue$1 as ListValue, type MapData$1 as MapData, type MapSettings$1 as MapSettings, MapType$1 as MapType, type context$2_MarkPostAsInModerationRequest as MarkPostAsInModerationRequest, type context$2_MarkPostAsInModerationResponse as MarkPostAsInModerationResponse, type context$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 context$2_PostAmountByLanguage as PostAmountByLanguage, type context$2_PublishDraftPostRequest as PublishDraftPostRequest, type context$2_PublishDraftPostResponse as PublishDraftPostResponse, type context$2_PublishDraftPostResponseNonNullableFields as PublishDraftPostResponseNonNullableFields, type context$2_QueryDraftPostsOptions as QueryDraftPostsOptions, type context$2_QueryDraftPostsRequest as QueryDraftPostsRequest, type context$2_QueryDraftPostsResponse as QueryDraftPostsResponse, type context$2_QueryDraftPostsResponseNonNullableFields as QueryDraftPostsResponseNonNullableFields, type context$2_RejectDraftPostRequest as RejectDraftPostRequest, type context$2_RejectDraftPostResponse as RejectDraftPostResponse, type Rel$1 as Rel, type context$2_RemoveFromTrashBinRequest as RemoveFromTrashBinRequest, type context$2_RemoveFromTrashBinResponse as RemoveFromTrashBinResponse, type context$2_RestoreFromTrashBinRequest as RestoreFromTrashBinRequest, type context$2_RestoreFromTrashBinResponse as RestoreFromTrashBinResponse, type context$2_RestoreFromTrashBinResponseNonNullableFields as RestoreFromTrashBinResponseNonNullableFields, type RestoreInfo$2 as RestoreInfo, type context$2_RevertToUnpublishedRequest as RevertToUnpublishedRequest, type context$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 context$2_TotalDraftPosts as TotalDraftPosts, context$2_TotalDraftPostsGroupingField as TotalDraftPostsGroupingField, type context$2_TranslateCategoryRequest as TranslateCategoryRequest, type context$2_TranslateCategoryResponse as TranslateCategoryResponse, type context$2_TranslateDraftRequest as TranslateDraftRequest, type context$2_TranslateDraftResponse as TranslateDraftResponse, Type$1 as Type, type context$2_UnpublishPostRequest as UnpublishPostRequest, type context$2_UnpublishPostResponse as UnpublishPostResponse, type context$2_UpdateDraftPost as UpdateDraftPost, type context$2_UpdateDraftPostContentRequest as UpdateDraftPostContentRequest, type context$2_UpdateDraftPostContentRequestDraftContentOneOf as UpdateDraftPostContentRequestDraftContentOneOf, type context$2_UpdateDraftPostContentResponse as UpdateDraftPostContentResponse, type context$2_UpdateDraftPostLanguageRequest as UpdateDraftPostLanguageRequest, type context$2_UpdateDraftPostLanguageResponse as UpdateDraftPostLanguageResponse, type context$2_UpdateDraftPostOptions as UpdateDraftPostOptions, type context$2_UpdateDraftPostRequest as UpdateDraftPostRequest, type context$2_UpdateDraftPostResponse as UpdateDraftPostResponse, type context$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 context$2__publicOnDraftCreatedType as _publicOnDraftCreatedType, type context$2__publicOnDraftDeletedType as _publicOnDraftDeletedType, type context$2__publicOnDraftUpdatedType as _publicOnDraftUpdatedType, context$2_bulkCreateDraftPosts as bulkCreateDraftPosts, context$2_bulkDeleteDraftPosts as bulkDeleteDraftPosts, context$2_bulkUpdateDraftPosts as bulkUpdateDraftPosts, context$2_createDraftPost as createDraftPost, context$2_deleteDraftPost as deleteDraftPost, context$2_getDeletedDraftPost as getDeletedDraftPost, context$2_getDraftPost as getDraftPost, context$2_listDeletedDraftPosts as listDeletedDraftPosts, context$2_listDraftPosts as listDraftPosts, context$2_onDraftCreated as onDraftCreated, context$2_onDraftDeleted as onDraftDeleted, context$2_onDraftUpdated as onDraftUpdated, onDraftCreated$1 as publicOnDraftCreated, onDraftDeleted$1 as publicOnDraftDeleted, onDraftUpdated$1 as publicOnDraftUpdated, context$2_publishDraftPost as publishDraftPost, context$2_queryDraftPosts as queryDraftPosts, context$2_removeFromTrashBin as removeFromTrashBin, context$2_restoreFromTrashBin as restoreFromTrashBin, context$2_updateDraftPost as updateDraftPost };
|
|
7358
|
+
}
|
|
7359
|
+
|
|
7360
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
7361
|
+
__type: 'host';
|
|
7362
|
+
create(host: H): T;
|
|
7363
|
+
};
|
|
7364
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
7365
|
+
type Host$1<Environment = unknown> = {
|
|
7366
|
+
channel: {
|
|
7367
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
7368
|
+
disconnect: () => void;
|
|
7369
|
+
} | Promise<{
|
|
7370
|
+
disconnect: () => void;
|
|
7371
|
+
}>;
|
|
7372
|
+
};
|
|
7373
|
+
environment?: Environment;
|
|
7374
|
+
/**
|
|
7375
|
+
* Optional name of the environment, use for logging
|
|
5680
7376
|
*/
|
|
5681
|
-
|
|
5682
|
-
}
|
|
5683
|
-
declare function restoreFromTrashBin$1(httpClient: HttpClient): RestoreFromTrashBinSignature;
|
|
5684
|
-
interface RestoreFromTrashBinSignature {
|
|
7377
|
+
name?: string;
|
|
5685
7378
|
/**
|
|
5686
|
-
*
|
|
5687
|
-
*
|
|
5688
|
-
* Uses the `draftPostId` to restore a deleted draft post from the trash bin.
|
|
5689
|
-
* @param - Draft post ID.
|
|
7379
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
5690
7380
|
*/
|
|
5691
|
-
|
|
5692
|
-
}
|
|
5693
|
-
declare function queryDraftPosts$1(httpClient: HttpClient): QueryDraftPostsSignature;
|
|
5694
|
-
interface QueryDraftPostsSignature {
|
|
7381
|
+
apiBaseUrl?: string;
|
|
5695
7382
|
/**
|
|
5696
|
-
*
|
|
5697
|
-
*
|
|
5698
|
-
* Query Draft Posts runs with these defaults, which you can override:
|
|
5699
|
-
* - `editedDate` is sorted in `DESC` order.
|
|
5700
|
-
* - `paging.limit` is `50`.
|
|
5701
|
-
* - `paging.offset` is `0`.
|
|
5702
|
-
* @param - Options for querying draft posts.
|
|
7383
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
7384
|
+
* like internationalization, billing, etc.
|
|
5703
7385
|
*/
|
|
5704
|
-
|
|
7386
|
+
essentials?: {
|
|
7387
|
+
/**
|
|
7388
|
+
* The language of the currently viewed session
|
|
7389
|
+
*/
|
|
7390
|
+
language?: string;
|
|
7391
|
+
/**
|
|
7392
|
+
* The locale of the currently viewed session
|
|
7393
|
+
*/
|
|
7394
|
+
locale?: string;
|
|
7395
|
+
/**
|
|
7396
|
+
* Any headers that should be passed through to the API requests
|
|
7397
|
+
*/
|
|
7398
|
+
passThroughHeaders?: Record<string, string>;
|
|
7399
|
+
};
|
|
7400
|
+
};
|
|
7401
|
+
|
|
7402
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
7403
|
+
interface HttpClient$1 {
|
|
7404
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
7405
|
+
fetchWithAuth: typeof fetch;
|
|
7406
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
7407
|
+
getActiveToken?: () => string | undefined;
|
|
5705
7408
|
}
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
7409
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
7410
|
+
type HttpResponse$1<T = any> = {
|
|
7411
|
+
data: T;
|
|
7412
|
+
status: number;
|
|
7413
|
+
statusText: string;
|
|
7414
|
+
headers: any;
|
|
7415
|
+
request?: any;
|
|
7416
|
+
};
|
|
7417
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
7418
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
7419
|
+
url: string;
|
|
7420
|
+
data?: Data;
|
|
7421
|
+
params?: URLSearchParams;
|
|
7422
|
+
} & APIMetadata$1;
|
|
7423
|
+
type APIMetadata$1 = {
|
|
7424
|
+
methodFqn?: string;
|
|
7425
|
+
entityFqdn?: string;
|
|
7426
|
+
packageName?: string;
|
|
7427
|
+
};
|
|
7428
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
7429
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
7430
|
+
__type: 'event-definition';
|
|
7431
|
+
type: Type;
|
|
7432
|
+
isDomainEvent?: boolean;
|
|
7433
|
+
transformations?: (envelope: unknown) => Payload;
|
|
7434
|
+
__payload: Payload;
|
|
7435
|
+
};
|
|
7436
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
7437
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
7438
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
7439
|
+
|
|
7440
|
+
type ServicePluginMethodInput$1 = {
|
|
7441
|
+
request: any;
|
|
7442
|
+
metadata: any;
|
|
7443
|
+
};
|
|
7444
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
7445
|
+
type ServicePluginMethodMetadata$1 = {
|
|
7446
|
+
name: string;
|
|
7447
|
+
primaryHttpMappingPath: string;
|
|
7448
|
+
transformations: {
|
|
7449
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
7450
|
+
toREST: (...args: unknown[]) => unknown;
|
|
7451
|
+
};
|
|
7452
|
+
};
|
|
7453
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
7454
|
+
__type: 'service-plugin-definition';
|
|
7455
|
+
componentType: string;
|
|
7456
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
7457
|
+
__contract: Contract;
|
|
7458
|
+
};
|
|
7459
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
7460
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
7461
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
7462
|
+
|
|
7463
|
+
type RequestContext$1 = {
|
|
7464
|
+
isSSR: boolean;
|
|
7465
|
+
host: string;
|
|
7466
|
+
protocol?: string;
|
|
7467
|
+
};
|
|
7468
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
7469
|
+
/**
|
|
7470
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
7471
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
7472
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
7473
|
+
*/
|
|
7474
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
7475
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
7476
|
+
_?: T;
|
|
7477
|
+
url?: string;
|
|
7478
|
+
method?: Method$1;
|
|
7479
|
+
params?: any;
|
|
7480
|
+
data?: any;
|
|
7481
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
7482
|
+
};
|
|
7483
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
7484
|
+
__isAmbassador: boolean;
|
|
7485
|
+
};
|
|
7486
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
7487
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
7488
|
+
|
|
7489
|
+
declare global {
|
|
7490
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
7491
|
+
interface SymbolConstructor {
|
|
7492
|
+
readonly observable: symbol;
|
|
7493
|
+
}
|
|
5715
7494
|
}
|
|
5716
|
-
declare const onDraftCreated$1: EventDefinition$4<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
|
|
5717
|
-
declare const onDraftUpdated$1: EventDefinition$4<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
|
|
5718
|
-
declare const onDraftDeleted$1: EventDefinition$4<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
|
|
5719
7495
|
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
type
|
|
7496
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
7497
|
+
|
|
7498
|
+
/**
|
|
7499
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
7500
|
+
|
|
7501
|
+
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)).
|
|
7502
|
+
|
|
7503
|
+
@example
|
|
7504
|
+
```
|
|
7505
|
+
import type {EmptyObject} from 'type-fest';
|
|
7506
|
+
|
|
7507
|
+
// The following illustrates the problem with `{}`.
|
|
7508
|
+
const foo1: {} = {}; // Pass
|
|
7509
|
+
const foo2: {} = []; // Pass
|
|
7510
|
+
const foo3: {} = 42; // Pass
|
|
7511
|
+
const foo4: {} = {a: 1}; // Pass
|
|
7512
|
+
|
|
7513
|
+
// With `EmptyObject` only the first case is valid.
|
|
7514
|
+
const bar1: EmptyObject = {}; // Pass
|
|
7515
|
+
const bar2: EmptyObject = 42; // Fail
|
|
7516
|
+
const bar3: EmptyObject = []; // Fail
|
|
7517
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
7518
|
+
```
|
|
7519
|
+
|
|
7520
|
+
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}.
|
|
7521
|
+
|
|
7522
|
+
@category Object
|
|
7523
|
+
*/
|
|
7524
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
7525
|
+
|
|
7526
|
+
/**
|
|
7527
|
+
Returns a boolean for whether the two given types are equal.
|
|
7528
|
+
|
|
7529
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
7530
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
7531
|
+
|
|
7532
|
+
Use-cases:
|
|
7533
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
7534
|
+
|
|
7535
|
+
@example
|
|
7536
|
+
```
|
|
7537
|
+
import type {IsEqual} from 'type-fest';
|
|
7538
|
+
|
|
7539
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
7540
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
7541
|
+
type Includes<Value extends readonly any[], Item> =
|
|
7542
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
7543
|
+
? IsEqual<Value[0], Item> extends true
|
|
7544
|
+
? true
|
|
7545
|
+
: Includes<rest, Item>
|
|
7546
|
+
: false;
|
|
7547
|
+
```
|
|
7548
|
+
|
|
7549
|
+
@category Type Guard
|
|
7550
|
+
@category Utilities
|
|
7551
|
+
*/
|
|
7552
|
+
type IsEqual$1<A, B> =
|
|
7553
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
7554
|
+
(<G>() => G extends B ? 1 : 2)
|
|
7555
|
+
? true
|
|
7556
|
+
: false;
|
|
7557
|
+
|
|
7558
|
+
/**
|
|
7559
|
+
Filter out keys from an object.
|
|
7560
|
+
|
|
7561
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
7562
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
7563
|
+
Returns `Key` otherwise.
|
|
7564
|
+
|
|
7565
|
+
@example
|
|
7566
|
+
```
|
|
7567
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
7568
|
+
//=> never
|
|
7569
|
+
```
|
|
7570
|
+
|
|
7571
|
+
@example
|
|
7572
|
+
```
|
|
7573
|
+
type Filtered = Filter<'bar', string>;
|
|
7574
|
+
//=> never
|
|
7575
|
+
```
|
|
7576
|
+
|
|
7577
|
+
@example
|
|
7578
|
+
```
|
|
7579
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
7580
|
+
//=> 'bar'
|
|
7581
|
+
```
|
|
7582
|
+
|
|
7583
|
+
@see {Except}
|
|
7584
|
+
*/
|
|
7585
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
7586
|
+
|
|
7587
|
+
type ExceptOptions$1 = {
|
|
7588
|
+
/**
|
|
7589
|
+
Disallow assigning non-specified properties.
|
|
7590
|
+
|
|
7591
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
7592
|
+
|
|
7593
|
+
@default false
|
|
7594
|
+
*/
|
|
7595
|
+
requireExactProps?: boolean;
|
|
7596
|
+
};
|
|
7597
|
+
|
|
7598
|
+
/**
|
|
7599
|
+
Create a type from an object type without certain keys.
|
|
7600
|
+
|
|
7601
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
7602
|
+
|
|
7603
|
+
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.
|
|
7604
|
+
|
|
7605
|
+
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)).
|
|
7606
|
+
|
|
7607
|
+
@example
|
|
7608
|
+
```
|
|
7609
|
+
import type {Except} from 'type-fest';
|
|
7610
|
+
|
|
7611
|
+
type Foo = {
|
|
7612
|
+
a: number;
|
|
7613
|
+
b: string;
|
|
7614
|
+
};
|
|
7615
|
+
|
|
7616
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
7617
|
+
//=> {b: string}
|
|
7618
|
+
|
|
7619
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
7620
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
7621
|
+
|
|
7622
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
7623
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
7624
|
+
|
|
7625
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
7626
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
7627
|
+
```
|
|
7628
|
+
|
|
7629
|
+
@category Object
|
|
7630
|
+
*/
|
|
7631
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
7632
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
7633
|
+
} & (Options['requireExactProps'] extends true
|
|
7634
|
+
? Partial<Record<KeysType, never>>
|
|
7635
|
+
: {});
|
|
7636
|
+
|
|
7637
|
+
/**
|
|
7638
|
+
Returns a boolean for whether the given type is `never`.
|
|
7639
|
+
|
|
7640
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
7641
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
7642
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
7643
|
+
|
|
7644
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
5730
7645
|
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
7646
|
+
@example
|
|
7647
|
+
```
|
|
7648
|
+
import type {IsNever, And} from 'type-fest';
|
|
7649
|
+
|
|
7650
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
7651
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
7652
|
+
And<
|
|
7653
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
7654
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
7655
|
+
>;
|
|
7656
|
+
|
|
7657
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
7658
|
+
AreStringsEqual<I, O> extends true
|
|
7659
|
+
? never
|
|
7660
|
+
: void;
|
|
7661
|
+
|
|
7662
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
7663
|
+
if (input === output) {
|
|
7664
|
+
process.exit(0);
|
|
5735
7665
|
}
|
|
5736
7666
|
}
|
|
5737
7667
|
|
|
5738
|
-
|
|
7668
|
+
endIfEqual('abc', 'abc');
|
|
7669
|
+
//=> never
|
|
5739
7670
|
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
declare const bulkDeleteDraftPosts: MaybeContext<BuildRESTFunction<typeof bulkDeleteDraftPosts$1> & typeof bulkDeleteDraftPosts$1>;
|
|
5749
|
-
declare const listDraftPosts: MaybeContext<BuildRESTFunction<typeof listDraftPosts$1> & typeof listDraftPosts$1>;
|
|
5750
|
-
declare const getDeletedDraftPost: MaybeContext<BuildRESTFunction<typeof getDeletedDraftPost$1> & typeof getDeletedDraftPost$1>;
|
|
5751
|
-
declare const restoreFromTrashBin: MaybeContext<BuildRESTFunction<typeof restoreFromTrashBin$1> & typeof restoreFromTrashBin$1>;
|
|
5752
|
-
declare const queryDraftPosts: MaybeContext<BuildRESTFunction<typeof queryDraftPosts$1> & typeof queryDraftPosts$1>;
|
|
5753
|
-
declare const publishDraftPost: MaybeContext<BuildRESTFunction<typeof publishDraftPost$1> & typeof publishDraftPost$1>;
|
|
7671
|
+
endIfEqual('abc', '123');
|
|
7672
|
+
//=> void
|
|
7673
|
+
```
|
|
7674
|
+
|
|
7675
|
+
@category Type Guard
|
|
7676
|
+
@category Utilities
|
|
7677
|
+
*/
|
|
7678
|
+
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
5754
7679
|
|
|
5755
|
-
type _publicOnDraftCreatedType = typeof onDraftCreated$1;
|
|
5756
7680
|
/**
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
7681
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
7682
|
+
|
|
7683
|
+
@see {@link IsNever}
|
|
7684
|
+
|
|
7685
|
+
@example
|
|
7686
|
+
```
|
|
7687
|
+
import type {IfNever} from 'type-fest';
|
|
7688
|
+
|
|
7689
|
+
type ShouldBeTrue = IfNever<never>;
|
|
7690
|
+
//=> true
|
|
7691
|
+
|
|
7692
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
7693
|
+
//=> 'bar'
|
|
7694
|
+
```
|
|
7695
|
+
|
|
7696
|
+
@category Type Guard
|
|
7697
|
+
@category Utilities
|
|
7698
|
+
*/
|
|
7699
|
+
type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
7700
|
+
IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
7701
|
+
);
|
|
5760
7702
|
|
|
5761
|
-
type _publicOnDraftUpdatedType = typeof onDraftUpdated$1;
|
|
5762
7703
|
/**
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
7704
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
7705
|
+
|
|
7706
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
7707
|
+
|
|
7708
|
+
@example
|
|
7709
|
+
```
|
|
7710
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7711
|
+
|
|
7712
|
+
interface Example {
|
|
7713
|
+
a: string;
|
|
7714
|
+
b: string | number;
|
|
7715
|
+
c?: string;
|
|
7716
|
+
d: {};
|
|
7717
|
+
}
|
|
7718
|
+
|
|
7719
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
7720
|
+
//=> 'a'
|
|
7721
|
+
```
|
|
7722
|
+
|
|
7723
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
7724
|
+
|
|
7725
|
+
@example
|
|
7726
|
+
```
|
|
7727
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7728
|
+
|
|
7729
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
7730
|
+
//=> 'a' | 'c'
|
|
7731
|
+
```
|
|
7732
|
+
|
|
7733
|
+
@category Object
|
|
7734
|
+
*/
|
|
7735
|
+
type ConditionalKeys$1<Base, Condition> =
|
|
7736
|
+
{
|
|
7737
|
+
// Map through all the keys of the given base type.
|
|
7738
|
+
[Key in keyof Base]-?:
|
|
7739
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
7740
|
+
Base[Key] extends Condition
|
|
7741
|
+
// Retain this key
|
|
7742
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
7743
|
+
? IfNever$1<Base[Key], IfNever$1<Condition, Key, never>, Key>
|
|
7744
|
+
// Discard this key since the condition fails.
|
|
7745
|
+
: never;
|
|
7746
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
7747
|
+
}[keyof Base];
|
|
5766
7748
|
|
|
5767
|
-
type _publicOnDraftDeletedType = typeof onDraftDeleted$1;
|
|
5768
7749
|
/**
|
|
5769
|
-
|
|
5770
|
-
*/
|
|
5771
|
-
declare const onDraftDeleted: ReturnType<typeof createEventModule$2<_publicOnDraftDeletedType>>;
|
|
7750
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
5772
7751
|
|
|
5773
|
-
type
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
type
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
type
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
type
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
type
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
type
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
type
|
|
5817
|
-
|
|
5818
|
-
type
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
type
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
type
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
type
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
type context$2_RestoreFromTrashBinRequest = RestoreFromTrashBinRequest;
|
|
5851
|
-
type context$2_RestoreFromTrashBinResponse = RestoreFromTrashBinResponse;
|
|
5852
|
-
type context$2_RestoreFromTrashBinResponseNonNullableFields = RestoreFromTrashBinResponseNonNullableFields;
|
|
5853
|
-
type context$2_RevertToUnpublishedRequest = RevertToUnpublishedRequest;
|
|
5854
|
-
type context$2_RevertToUnpublishedResponse = RevertToUnpublishedResponse;
|
|
5855
|
-
type context$2_TotalDraftPosts = TotalDraftPosts;
|
|
5856
|
-
type context$2_TotalDraftPostsGroupingField = TotalDraftPostsGroupingField;
|
|
5857
|
-
declare const context$2_TotalDraftPostsGroupingField: typeof TotalDraftPostsGroupingField;
|
|
5858
|
-
type context$2_TranslateCategoryRequest = TranslateCategoryRequest;
|
|
5859
|
-
type context$2_TranslateCategoryResponse = TranslateCategoryResponse;
|
|
5860
|
-
type context$2_TranslateDraftRequest = TranslateDraftRequest;
|
|
5861
|
-
type context$2_TranslateDraftResponse = TranslateDraftResponse;
|
|
5862
|
-
type context$2_UnpublishPostRequest = UnpublishPostRequest;
|
|
5863
|
-
type context$2_UnpublishPostResponse = UnpublishPostResponse;
|
|
5864
|
-
type context$2_UpdateDraftPost = UpdateDraftPost;
|
|
5865
|
-
type context$2_UpdateDraftPostContentRequest = UpdateDraftPostContentRequest;
|
|
5866
|
-
type context$2_UpdateDraftPostContentRequestDraftContentOneOf = UpdateDraftPostContentRequestDraftContentOneOf;
|
|
5867
|
-
type context$2_UpdateDraftPostContentResponse = UpdateDraftPostContentResponse;
|
|
5868
|
-
type context$2_UpdateDraftPostLanguageRequest = UpdateDraftPostLanguageRequest;
|
|
5869
|
-
type context$2_UpdateDraftPostLanguageResponse = UpdateDraftPostLanguageResponse;
|
|
5870
|
-
type context$2_UpdateDraftPostOptions = UpdateDraftPostOptions;
|
|
5871
|
-
type context$2_UpdateDraftPostRequest = UpdateDraftPostRequest;
|
|
5872
|
-
type context$2_UpdateDraftPostResponse = UpdateDraftPostResponse;
|
|
5873
|
-
type context$2_UpdateDraftPostResponseNonNullableFields = UpdateDraftPostResponseNonNullableFields;
|
|
5874
|
-
type context$2__publicOnDraftCreatedType = _publicOnDraftCreatedType;
|
|
5875
|
-
type context$2__publicOnDraftDeletedType = _publicOnDraftDeletedType;
|
|
5876
|
-
type context$2__publicOnDraftUpdatedType = _publicOnDraftUpdatedType;
|
|
5877
|
-
declare const context$2_bulkCreateDraftPosts: typeof bulkCreateDraftPosts;
|
|
5878
|
-
declare const context$2_bulkDeleteDraftPosts: typeof bulkDeleteDraftPosts;
|
|
5879
|
-
declare const context$2_bulkUpdateDraftPosts: typeof bulkUpdateDraftPosts;
|
|
5880
|
-
declare const context$2_createDraftPost: typeof createDraftPost;
|
|
5881
|
-
declare const context$2_deleteDraftPost: typeof deleteDraftPost;
|
|
5882
|
-
declare const context$2_getDeletedDraftPost: typeof getDeletedDraftPost;
|
|
5883
|
-
declare const context$2_getDraftPost: typeof getDraftPost;
|
|
5884
|
-
declare const context$2_listDeletedDraftPosts: typeof listDeletedDraftPosts;
|
|
5885
|
-
declare const context$2_listDraftPosts: typeof listDraftPosts;
|
|
5886
|
-
declare const context$2_onDraftCreated: typeof onDraftCreated;
|
|
5887
|
-
declare const context$2_onDraftDeleted: typeof onDraftDeleted;
|
|
5888
|
-
declare const context$2_onDraftUpdated: typeof onDraftUpdated;
|
|
5889
|
-
declare const context$2_publishDraftPost: typeof publishDraftPost;
|
|
5890
|
-
declare const context$2_queryDraftPosts: typeof queryDraftPosts;
|
|
5891
|
-
declare const context$2_removeFromTrashBin: typeof removeFromTrashBin;
|
|
5892
|
-
declare const context$2_restoreFromTrashBin: typeof restoreFromTrashBin;
|
|
5893
|
-
declare const context$2_updateDraftPost: typeof updateDraftPost;
|
|
5894
|
-
declare namespace context$2 {
|
|
5895
|
-
export { context$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 context$2_ApproveDraftPostRequest as ApproveDraftPostRequest, type context$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 context$2_BulkCreateDraftPostsOptions as BulkCreateDraftPostsOptions, type context$2_BulkCreateDraftPostsRequest as BulkCreateDraftPostsRequest, type context$2_BulkCreateDraftPostsResponse as BulkCreateDraftPostsResponse, type context$2_BulkCreateDraftPostsResponseNonNullableFields as BulkCreateDraftPostsResponseNonNullableFields, type context$2_BulkDeleteDraftPostsOptions as BulkDeleteDraftPostsOptions, type context$2_BulkDeleteDraftPostsRequest as BulkDeleteDraftPostsRequest, type context$2_BulkDeleteDraftPostsResponse as BulkDeleteDraftPostsResponse, type context$2_BulkDeleteDraftPostsResponseNonNullableFields as BulkDeleteDraftPostsResponseNonNullableFields, type context$2_BulkDraftPostResult as BulkDraftPostResult, type context$2_BulkRejectDraftPostRequest as BulkRejectDraftPostRequest, type context$2_BulkRejectDraftPostResponse as BulkRejectDraftPostResponse, type context$2_BulkRevertToUnpublishedRequest as BulkRevertToUnpublishedRequest, type context$2_BulkRevertToUnpublishedResponse as BulkRevertToUnpublishedResponse, type context$2_BulkUpdateDraftPostLanguageRequest as BulkUpdateDraftPostLanguageRequest, type context$2_BulkUpdateDraftPostLanguageResponse as BulkUpdateDraftPostLanguageResponse, type context$2_BulkUpdateDraftPostsOptions as BulkUpdateDraftPostsOptions, type context$2_BulkUpdateDraftPostsRequest as BulkUpdateDraftPostsRequest, type context$2_BulkUpdateDraftPostsResponse as BulkUpdateDraftPostsResponse, type context$2_BulkUpdateDraftPostsResponseNonNullableFields as BulkUpdateDraftPostsResponseNonNullableFields, type BulletedListData$1 as BulletedListData, type ButtonData$1 as ButtonData, context$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 context$2_CreateDraftPostOptions as CreateDraftPostOptions, type context$2_CreateDraftPostRequest as CreateDraftPostRequest, type context$2_CreateDraftPostResponse as CreateDraftPostResponse, type context$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 context$2_DeleteDraftPostOptions as DeleteDraftPostOptions, type context$2_DeleteDraftPostRequest as DeleteDraftPostRequest, type context$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 context$2_DraftCreatedEnvelope as DraftCreatedEnvelope, type context$2_DraftDeletedEnvelope as DraftDeletedEnvelope, type DraftPost$1 as DraftPost, type context$2_DraftPostOwnerChanged as DraftPostOwnerChanged, type DraftPostTranslation$1 as DraftPostTranslation, type context$2_DraftPostsQueryBuilder as DraftPostsQueryBuilder, type context$2_DraftPostsQueryResult as DraftPostsQueryResult, type context$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 context$2_GetDeletedDraftPostRequest as GetDeletedDraftPostRequest, type context$2_GetDeletedDraftPostResponse as GetDeletedDraftPostResponse, type context$2_GetDeletedDraftPostResponseNonNullableFields as GetDeletedDraftPostResponseNonNullableFields, type context$2_GetDraftPostOptions as GetDraftPostOptions, type context$2_GetDraftPostRequest as GetDraftPostRequest, type context$2_GetDraftPostResponse as GetDraftPostResponse, type context$2_GetDraftPostResponseNonNullableFields as GetDraftPostResponseNonNullableFields, type context$2_GetDraftPostTotalsRequest as GetDraftPostTotalsRequest, type context$2_GetDraftPostTotalsResponse as GetDraftPostTotalsResponse, context$2_GetDraftPostsSort as GetDraftPostsSort, type context$2_GetPostAmountsByLanguageRequest as GetPostAmountsByLanguageRequest, type context$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 context$2_InitialDraftPostsCopied as InitialDraftPostsCopied, InitialExpandedItems$1 as InitialExpandedItems, type context$2_IsDraftPostAutoTranslatableRequest as IsDraftPostAutoTranslatableRequest, type context$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 context$2_ListDeletedDraftPostsOptions as ListDeletedDraftPostsOptions, type context$2_ListDeletedDraftPostsRequest as ListDeletedDraftPostsRequest, type context$2_ListDeletedDraftPostsResponse as ListDeletedDraftPostsResponse, type context$2_ListDeletedDraftPostsResponseNonNullableFields as ListDeletedDraftPostsResponseNonNullableFields, type context$2_ListDraftPostsOptions as ListDraftPostsOptions, type context$2_ListDraftPostsRequest as ListDraftPostsRequest, type context$2_ListDraftPostsResponse as ListDraftPostsResponse, type context$2_ListDraftPostsResponseNonNullableFields as ListDraftPostsResponseNonNullableFields, type ListValue$1 as ListValue, type MapData$1 as MapData, type MapSettings$1 as MapSettings, MapType$1 as MapType, type context$2_MarkPostAsInModerationRequest as MarkPostAsInModerationRequest, type context$2_MarkPostAsInModerationResponse as MarkPostAsInModerationResponse, type context$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 context$2_PostAmountByLanguage as PostAmountByLanguage, type context$2_PublishDraftPostRequest as PublishDraftPostRequest, type context$2_PublishDraftPostResponse as PublishDraftPostResponse, type context$2_PublishDraftPostResponseNonNullableFields as PublishDraftPostResponseNonNullableFields, type context$2_QueryDraftPostsOptions as QueryDraftPostsOptions, type context$2_QueryDraftPostsRequest as QueryDraftPostsRequest, type context$2_QueryDraftPostsResponse as QueryDraftPostsResponse, type context$2_QueryDraftPostsResponseNonNullableFields as QueryDraftPostsResponseNonNullableFields, type context$2_RejectDraftPostRequest as RejectDraftPostRequest, type context$2_RejectDraftPostResponse as RejectDraftPostResponse, type Rel$1 as Rel, type context$2_RemoveFromTrashBinRequest as RemoveFromTrashBinRequest, type context$2_RemoveFromTrashBinResponse as RemoveFromTrashBinResponse, type context$2_RestoreFromTrashBinRequest as RestoreFromTrashBinRequest, type context$2_RestoreFromTrashBinResponse as RestoreFromTrashBinResponse, type context$2_RestoreFromTrashBinResponseNonNullableFields as RestoreFromTrashBinResponseNonNullableFields, type RestoreInfo$2 as RestoreInfo, type context$2_RevertToUnpublishedRequest as RevertToUnpublishedRequest, type context$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 context$2_TotalDraftPosts as TotalDraftPosts, context$2_TotalDraftPostsGroupingField as TotalDraftPostsGroupingField, type context$2_TranslateCategoryRequest as TranslateCategoryRequest, type context$2_TranslateCategoryResponse as TranslateCategoryResponse, type context$2_TranslateDraftRequest as TranslateDraftRequest, type context$2_TranslateDraftResponse as TranslateDraftResponse, Type$1 as Type, type context$2_UnpublishPostRequest as UnpublishPostRequest, type context$2_UnpublishPostResponse as UnpublishPostResponse, type context$2_UpdateDraftPost as UpdateDraftPost, type context$2_UpdateDraftPostContentRequest as UpdateDraftPostContentRequest, type context$2_UpdateDraftPostContentRequestDraftContentOneOf as UpdateDraftPostContentRequestDraftContentOneOf, type context$2_UpdateDraftPostContentResponse as UpdateDraftPostContentResponse, type context$2_UpdateDraftPostLanguageRequest as UpdateDraftPostLanguageRequest, type context$2_UpdateDraftPostLanguageResponse as UpdateDraftPostLanguageResponse, type context$2_UpdateDraftPostOptions as UpdateDraftPostOptions, type context$2_UpdateDraftPostRequest as UpdateDraftPostRequest, type context$2_UpdateDraftPostResponse as UpdateDraftPostResponse, type context$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 context$2__publicOnDraftCreatedType as _publicOnDraftCreatedType, type context$2__publicOnDraftDeletedType as _publicOnDraftDeletedType, type context$2__publicOnDraftUpdatedType as _publicOnDraftUpdatedType, context$2_bulkCreateDraftPosts as bulkCreateDraftPosts, context$2_bulkDeleteDraftPosts as bulkDeleteDraftPosts, context$2_bulkUpdateDraftPosts as bulkUpdateDraftPosts, context$2_createDraftPost as createDraftPost, context$2_deleteDraftPost as deleteDraftPost, context$2_getDeletedDraftPost as getDeletedDraftPost, context$2_getDraftPost as getDraftPost, context$2_listDeletedDraftPosts as listDeletedDraftPosts, context$2_listDraftPosts as listDraftPosts, context$2_onDraftCreated as onDraftCreated, context$2_onDraftDeleted as onDraftDeleted, context$2_onDraftUpdated as onDraftUpdated, onDraftCreated$1 as publicOnDraftCreated, onDraftDeleted$1 as publicOnDraftDeleted, onDraftUpdated$1 as publicOnDraftUpdated, context$2_publishDraftPost as publishDraftPost, context$2_queryDraftPosts as queryDraftPosts, context$2_removeFromTrashBin as removeFromTrashBin, context$2_restoreFromTrashBin as restoreFromTrashBin, context$2_updateDraftPost as updateDraftPost };
|
|
7752
|
+
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.
|
|
7753
|
+
|
|
7754
|
+
@example
|
|
7755
|
+
```
|
|
7756
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
7757
|
+
|
|
7758
|
+
class Awesome {
|
|
7759
|
+
name: string;
|
|
7760
|
+
successes: number;
|
|
7761
|
+
failures: bigint;
|
|
7762
|
+
|
|
7763
|
+
run() {}
|
|
7764
|
+
}
|
|
7765
|
+
|
|
7766
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
7767
|
+
//=> {run: () => void}
|
|
7768
|
+
```
|
|
7769
|
+
|
|
7770
|
+
@example
|
|
7771
|
+
```
|
|
7772
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
7773
|
+
|
|
7774
|
+
interface Example {
|
|
7775
|
+
a: string;
|
|
7776
|
+
b: string | number;
|
|
7777
|
+
c: () => void;
|
|
7778
|
+
d: {};
|
|
7779
|
+
}
|
|
7780
|
+
|
|
7781
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
7782
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
7783
|
+
```
|
|
7784
|
+
|
|
7785
|
+
@category Object
|
|
7786
|
+
*/
|
|
7787
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
7788
|
+
Base,
|
|
7789
|
+
ConditionalKeys$1<Base, Condition>
|
|
7790
|
+
>;
|
|
7791
|
+
|
|
7792
|
+
/**
|
|
7793
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
7794
|
+
* can either be a REST module or a host module.
|
|
7795
|
+
* This type is recursive, so it can describe nested modules.
|
|
7796
|
+
*/
|
|
7797
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$1<any> | ServicePluginDefinition$1<any> | {
|
|
7798
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
7799
|
+
};
|
|
7800
|
+
/**
|
|
7801
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
7802
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
7803
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
7804
|
+
* do not match the given host (as they will not work with the given host).
|
|
7805
|
+
*/
|
|
7806
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
7807
|
+
done: T;
|
|
7808
|
+
recurse: T extends {
|
|
7809
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
7810
|
+
} ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
|
|
7811
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
7812
|
+
-1,
|
|
7813
|
+
0,
|
|
7814
|
+
1,
|
|
7815
|
+
2,
|
|
7816
|
+
3,
|
|
7817
|
+
4,
|
|
7818
|
+
5
|
|
7819
|
+
][Depth]> : never;
|
|
7820
|
+
}, EmptyObject$1>;
|
|
7821
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
7822
|
+
type PublicMetadata$1 = {
|
|
7823
|
+
PACKAGE_NAME?: string;
|
|
7824
|
+
};
|
|
7825
|
+
|
|
7826
|
+
declare global {
|
|
7827
|
+
interface ContextualClient {
|
|
7828
|
+
}
|
|
5896
7829
|
}
|
|
7830
|
+
/**
|
|
7831
|
+
* A type used to create concerete types from SDK descriptors in
|
|
7832
|
+
* case a contextual client is available.
|
|
7833
|
+
*/
|
|
7834
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
7835
|
+
host: Host$1;
|
|
7836
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
5897
7837
|
|
|
5898
7838
|
interface Post {
|
|
5899
7839
|
/**
|
|
@@ -7685,9 +9625,7 @@ declare enum GetPostsSort {
|
|
|
7685
9625
|
/** Sorting by title ascending */
|
|
7686
9626
|
TITLE_ASC = "TITLE_ASC",
|
|
7687
9627
|
/** Sorting by title descending */
|
|
7688
|
-
TITLE_DESC = "TITLE_DESC"
|
|
7689
|
-
/** Sorting by post rating descending. */
|
|
7690
|
-
RATING = "RATING"
|
|
9628
|
+
TITLE_DESC = "TITLE_DESC"
|
|
7691
9629
|
}
|
|
7692
9630
|
interface BlogPaging {
|
|
7693
9631
|
/**
|
|
@@ -7709,8 +9647,6 @@ interface BlogPaging {
|
|
|
7709
9647
|
}
|
|
7710
9648
|
declare enum PostFieldField {
|
|
7711
9649
|
UNKNOWN = "UNKNOWN",
|
|
7712
|
-
/** Deprecated use `METRICS` instead */
|
|
7713
|
-
COUNTERS = "COUNTERS",
|
|
7714
9650
|
/** Includes Post url when present */
|
|
7715
9651
|
URL = "URL",
|
|
7716
9652
|
/** Includes Post content text string when present */
|
|
@@ -7719,26 +9655,10 @@ declare enum PostFieldField {
|
|
|
7719
9655
|
METRICS = "METRICS",
|
|
7720
9656
|
/** Includes SEO data */
|
|
7721
9657
|
SEO = "SEO",
|
|
7722
|
-
/**
|
|
7723
|
-
* Includes Post content as a stringified DraftJS document
|
|
7724
|
-
* Reserved for internal use
|
|
7725
|
-
*/
|
|
7726
|
-
CONTENT = "CONTENT",
|
|
7727
|
-
/**
|
|
7728
|
-
* Includes internal id field
|
|
7729
|
-
* Reserved for internal use
|
|
7730
|
-
*/
|
|
7731
|
-
INTERNAL_ID = "INTERNAL_ID",
|
|
7732
9658
|
/** Includes post owners Contact Id */
|
|
7733
9659
|
CONTACT_ID = "CONTACT_ID",
|
|
7734
9660
|
/** Includes post rich content */
|
|
7735
|
-
RICH_CONTENT = "RICH_CONTENT"
|
|
7736
|
-
/** Includes post rich content string */
|
|
7737
|
-
RICH_CONTENT_STRING = "RICH_CONTENT_STRING",
|
|
7738
|
-
/** Includes compressed post rich content string */
|
|
7739
|
-
RICH_CONTENT_COMPRESSED = "RICH_CONTENT_COMPRESSED",
|
|
7740
|
-
/** Includes post translations */
|
|
7741
|
-
TRANSLATIONS = "TRANSLATIONS"
|
|
9661
|
+
RICH_CONTENT = "RICH_CONTENT"
|
|
7742
9662
|
}
|
|
7743
9663
|
interface ListDemoPostsResponse {
|
|
7744
9664
|
/** List of posts. */
|
|
@@ -9369,7 +11289,7 @@ interface GetTotalPostsOptions {
|
|
|
9369
11289
|
language?: string | null;
|
|
9370
11290
|
}
|
|
9371
11291
|
|
|
9372
|
-
declare function getPost$1(httpClient: HttpClient): GetPostSignature;
|
|
11292
|
+
declare function getPost$1(httpClient: HttpClient$1): GetPostSignature;
|
|
9373
11293
|
interface GetPostSignature {
|
|
9374
11294
|
/**
|
|
9375
11295
|
* Gets a post by the specified ID.
|
|
@@ -9383,7 +11303,7 @@ interface GetPostSignature {
|
|
|
9383
11303
|
*/
|
|
9384
11304
|
(postId: string, options?: GetPostOptions | undefined): Promise<GetPostResponse & GetPostResponseNonNullableFields>;
|
|
9385
11305
|
}
|
|
9386
|
-
declare function getPostBySlug$1(httpClient: HttpClient): GetPostBySlugSignature;
|
|
11306
|
+
declare function getPostBySlug$1(httpClient: HttpClient$1): GetPostBySlugSignature;
|
|
9387
11307
|
interface GetPostBySlugSignature {
|
|
9388
11308
|
/**
|
|
9389
11309
|
* Gets a post by the provided slug.
|
|
@@ -9400,7 +11320,7 @@ interface GetPostBySlugSignature {
|
|
|
9400
11320
|
*/
|
|
9401
11321
|
(slug: string, options?: GetPostBySlugOptions | undefined): Promise<GetPostBySlugResponse & GetPostBySlugResponseNonNullableFields>;
|
|
9402
11322
|
}
|
|
9403
|
-
declare function listPosts$1(httpClient: HttpClient): ListPostsSignature;
|
|
11323
|
+
declare function listPosts$1(httpClient: HttpClient$1): ListPostsSignature;
|
|
9404
11324
|
interface ListPostsSignature {
|
|
9405
11325
|
/**
|
|
9406
11326
|
* Retrieves a list of published posts.
|
|
@@ -9416,7 +11336,7 @@ interface ListPostsSignature {
|
|
|
9416
11336
|
*/
|
|
9417
11337
|
(options?: ListPostsOptions | undefined): Promise<ListPostsResponse & ListPostsResponseNonNullableFields>;
|
|
9418
11338
|
}
|
|
9419
|
-
declare function queryPosts$1(httpClient: HttpClient): QueryPostsSignature;
|
|
11339
|
+
declare function queryPosts$1(httpClient: HttpClient$1): QueryPostsSignature;
|
|
9420
11340
|
interface QueryPostsSignature {
|
|
9421
11341
|
/**
|
|
9422
11342
|
* Creates a query to retrieve a list of posts.
|
|
@@ -9441,7 +11361,7 @@ interface QueryPostsSignature {
|
|
|
9441
11361
|
*/
|
|
9442
11362
|
(options?: QueryPostsOptions | undefined): PostsQueryBuilder;
|
|
9443
11363
|
}
|
|
9444
|
-
declare function getPostMetrics$1(httpClient: HttpClient): GetPostMetricsSignature;
|
|
11364
|
+
declare function getPostMetrics$1(httpClient: HttpClient$1): GetPostMetricsSignature;
|
|
9445
11365
|
interface GetPostMetricsSignature {
|
|
9446
11366
|
/**
|
|
9447
11367
|
* Gets a specified post's metrics.
|
|
@@ -9455,7 +11375,7 @@ interface GetPostMetricsSignature {
|
|
|
9455
11375
|
*/
|
|
9456
11376
|
(postId: string): Promise<GetPostMetricsResponse & GetPostMetricsResponseNonNullableFields>;
|
|
9457
11377
|
}
|
|
9458
|
-
declare function queryPostCountStats$1(httpClient: HttpClient): QueryPostCountStatsSignature;
|
|
11378
|
+
declare function queryPostCountStats$1(httpClient: HttpClient$1): QueryPostCountStatsSignature;
|
|
9459
11379
|
interface QueryPostCountStatsSignature {
|
|
9460
11380
|
/**
|
|
9461
11381
|
* Retrieves the number of published posts per month within a specified time range.
|
|
@@ -9471,7 +11391,7 @@ interface QueryPostCountStatsSignature {
|
|
|
9471
11391
|
*/
|
|
9472
11392
|
(options?: QueryPostCountStatsOptions | undefined): Promise<QueryPostCountStatsResponse & QueryPostCountStatsResponseNonNullableFields>;
|
|
9473
11393
|
}
|
|
9474
|
-
declare function getTotalPosts$1(httpClient: HttpClient): GetTotalPostsSignature;
|
|
11394
|
+
declare function getTotalPosts$1(httpClient: HttpClient$1): GetTotalPostsSignature;
|
|
9475
11395
|
interface GetTotalPostsSignature {
|
|
9476
11396
|
/**
|
|
9477
11397
|
* Gets the total amount of published posts on the blog.
|
|
@@ -9486,39 +11406,21 @@ interface GetTotalPostsSignature {
|
|
|
9486
11406
|
*/
|
|
9487
11407
|
(options?: GetTotalPostsOptions | undefined): Promise<GetTotalPostsResponse & GetTotalPostsResponseNonNullableFields>;
|
|
9488
11408
|
}
|
|
9489
|
-
declare const onPostCreated$1: EventDefinition$
|
|
9490
|
-
declare const onPostUpdated$1: EventDefinition$
|
|
9491
|
-
declare const onPostDeleted$1: EventDefinition$
|
|
9492
|
-
declare const onPostLiked$1: EventDefinition$
|
|
9493
|
-
declare const onPostUnliked$1: EventDefinition$
|
|
9494
|
-
|
|
9495
|
-
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
9496
|
-
__type: 'event-definition';
|
|
9497
|
-
type: Type;
|
|
9498
|
-
isDomainEvent?: boolean;
|
|
9499
|
-
transformations?: (envelope: unknown) => Payload;
|
|
9500
|
-
__payload: Payload;
|
|
9501
|
-
};
|
|
9502
|
-
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
9503
|
-
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
9504
|
-
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
9505
|
-
|
|
9506
|
-
declare global {
|
|
9507
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
9508
|
-
interface SymbolConstructor {
|
|
9509
|
-
readonly observable: symbol;
|
|
9510
|
-
}
|
|
9511
|
-
}
|
|
11409
|
+
declare const onPostCreated$1: EventDefinition$1<PostCreatedEnvelope, "wix.blog.v3.post_created">;
|
|
11410
|
+
declare const onPostUpdated$1: EventDefinition$1<PostUpdatedEnvelope, "wix.blog.v3.post_updated">;
|
|
11411
|
+
declare const onPostDeleted$1: EventDefinition$1<PostDeletedEnvelope, "wix.blog.v3.post_deleted">;
|
|
11412
|
+
declare const onPostLiked$1: EventDefinition$1<PostLikedEnvelope, "wix.blog.v3.post_liked">;
|
|
11413
|
+
declare const onPostUnliked$1: EventDefinition$1<PostUnlikedEnvelope, "wix.blog.v3.post_unliked">;
|
|
9512
11414
|
|
|
9513
11415
|
declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
|
|
9514
11416
|
|
|
9515
|
-
declare const getPost: MaybeContext<BuildRESTFunction<typeof getPost$1> & typeof getPost$1>;
|
|
9516
|
-
declare const getPostBySlug: MaybeContext<BuildRESTFunction<typeof getPostBySlug$1> & typeof getPostBySlug$1>;
|
|
9517
|
-
declare const listPosts: MaybeContext<BuildRESTFunction<typeof listPosts$1> & typeof listPosts$1>;
|
|
9518
|
-
declare const queryPosts: MaybeContext<BuildRESTFunction<typeof queryPosts$1> & typeof queryPosts$1>;
|
|
9519
|
-
declare const getPostMetrics: MaybeContext<BuildRESTFunction<typeof getPostMetrics$1> & typeof getPostMetrics$1>;
|
|
9520
|
-
declare const queryPostCountStats: MaybeContext<BuildRESTFunction<typeof queryPostCountStats$1> & typeof queryPostCountStats$1>;
|
|
9521
|
-
declare const getTotalPosts: MaybeContext<BuildRESTFunction<typeof getTotalPosts$1> & typeof getTotalPosts$1>;
|
|
11417
|
+
declare const getPost: MaybeContext$1<BuildRESTFunction$1<typeof getPost$1> & typeof getPost$1>;
|
|
11418
|
+
declare const getPostBySlug: MaybeContext$1<BuildRESTFunction$1<typeof getPostBySlug$1> & typeof getPostBySlug$1>;
|
|
11419
|
+
declare const listPosts: MaybeContext$1<BuildRESTFunction$1<typeof listPosts$1> & typeof listPosts$1>;
|
|
11420
|
+
declare const queryPosts: MaybeContext$1<BuildRESTFunction$1<typeof queryPosts$1> & typeof queryPosts$1>;
|
|
11421
|
+
declare const getPostMetrics: MaybeContext$1<BuildRESTFunction$1<typeof getPostMetrics$1> & typeof getPostMetrics$1>;
|
|
11422
|
+
declare const queryPostCountStats: MaybeContext$1<BuildRESTFunction$1<typeof queryPostCountStats$1> & typeof queryPostCountStats$1>;
|
|
11423
|
+
declare const getTotalPosts: MaybeContext$1<BuildRESTFunction$1<typeof getTotalPosts$1> & typeof getTotalPosts$1>;
|
|
9522
11424
|
|
|
9523
11425
|
type _publicOnPostCreatedType = typeof onPostCreated$1;
|
|
9524
11426
|
/**
|
|
@@ -9833,6 +11735,484 @@ declare namespace context$1 {
|
|
|
9833
11735
|
export { type ActionEvent$1 as ActionEvent, context$1_Alignment as Alignment, type context$1_AnchorData as AnchorData, type context$1_AppEmbedData as AppEmbedData, type context$1_AppEmbedDataAppDataOneOf as AppEmbedDataAppDataOneOf, context$1_AppType as AppType, type context$1_AudioData as AudioData, type context$1_Background as Background, type context$1_BackgroundBackgroundOneOf as BackgroundBackgroundOneOf, context$1_BackgroundType as BackgroundType, type BaseEventMetadata$1 as BaseEventMetadata, type context$1_BlockquoteData as BlockquoteData, type context$1_BlogPaging as BlogPaging, type context$1_BookingData as BookingData, type context$1_Border as Border, type context$1_BorderColors as BorderColors, type context$1_BulkGetPostMetricsRequest as BulkGetPostMetricsRequest, type context$1_BulkGetPostMetricsResponse as BulkGetPostMetricsResponse, type context$1_BulkGetPostReactionsRequest as BulkGetPostReactionsRequest, type context$1_BulkGetPostReactionsResponse as BulkGetPostReactionsResponse, type context$1_BulletedListData as BulletedListData, type context$1_ButtonData as ButtonData, type context$1_Category as Category, type context$1_CategoryTranslation as CategoryTranslation, type context$1_CellStyle as CellStyle, type context$1_CodeBlockData as CodeBlockData, type context$1_CollapsibleListData as CollapsibleListData, type context$1_ColorData as ColorData, type context$1_Colors as Colors, type context$1_ConvertDraftJsToRichContentRequest as ConvertDraftJsToRichContentRequest, type context$1_ConvertDraftJsToRichContentResponse as ConvertDraftJsToRichContentResponse, type context$1_ConvertRichContentToDraftJsRequest as ConvertRichContentToDraftJsRequest, type context$1_ConvertRichContentToDraftJsResponse as ConvertRichContentToDraftJsResponse, type context$1_CoverMedia as CoverMedia, type context$1_CoverMediaMediaOneOf as CoverMediaMediaOneOf, type context$1_CreateDraftPostFromTemplateRequest as CreateDraftPostFromTemplateRequest, type context$1_CreateDraftPostFromTemplateResponse as CreateDraftPostFromTemplateResponse, context$1_Crop as Crop, type CursorPaging$1 as CursorPaging, type Cursors$1 as Cursors, type context$1_Decoration as Decoration, type context$1_DecorationDataOneOf as DecorationDataOneOf, context$1_DecorationType as DecorationType, type context$1_Design as Design, type context$1_Dimensions as Dimensions, context$1_Direction as Direction, type context$1_DividerData as DividerData, type context$1_DocumentStyle as DocumentStyle, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_DraftPost as DraftPost, type context$1_DraftPostTranslation as DraftPostTranslation, type context$1_EmbedData as EmbedData, type context$1_EmbedMedia as EmbedMedia, type context$1_EmbedThumbnail as EmbedThumbnail, type context$1_EmbedVideo as EmbedVideo, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventData as EventData, type EventMetadata$1 as EventMetadata, Field$1 as Field, type context$1_FileData as FileData, type context$1_FileSource as FileSource, type context$1_FileSourceDataOneOf as FileSourceDataOneOf, type context$1_FontSizeData as FontSizeData, context$1_FontType as FontType, type context$1_GIF as GIF, type context$1_GIFData as GIFData, type context$1_GalleryData as GalleryData, type context$1_GalleryOptions as GalleryOptions, type context$1_GetPostBySlugOptions as GetPostBySlugOptions, type context$1_GetPostBySlugRequest as GetPostBySlugRequest, type context$1_GetPostBySlugResponse as GetPostBySlugResponse, type context$1_GetPostBySlugResponseNonNullableFields as GetPostBySlugResponseNonNullableFields, type context$1_GetPostMetricsRequest as GetPostMetricsRequest, type context$1_GetPostMetricsResponse as GetPostMetricsResponse, type context$1_GetPostMetricsResponseNonNullableFields as GetPostMetricsResponseNonNullableFields, type context$1_GetPostOptions as GetPostOptions, type context$1_GetPostRequest as GetPostRequest, type context$1_GetPostResponse as GetPostResponse, type context$1_GetPostResponseNonNullableFields as GetPostResponseNonNullableFields, context$1_GetPostTemplatesSort as GetPostTemplatesSort, context$1_GetPostsSort as GetPostsSort, type context$1_GetTemplateRequest as GetTemplateRequest, type context$1_GetTemplateResponse as GetTemplateResponse, type context$1_GetTotalLikesPerMemberRequest as GetTotalLikesPerMemberRequest, type context$1_GetTotalLikesPerMemberResponse as GetTotalLikesPerMemberResponse, type context$1_GetTotalPostsOptions as GetTotalPostsOptions, type context$1_GetTotalPostsRequest as GetTotalPostsRequest, type context$1_GetTotalPostsResponse as GetTotalPostsResponse, type context$1_GetTotalPostsResponseNonNullableFields as GetTotalPostsResponseNonNullableFields, type context$1_GetTotalPublicationsRequest as GetTotalPublicationsRequest, type context$1_GetTotalPublicationsResponse as GetTotalPublicationsResponse, type context$1_Gradient as Gradient, type context$1_HTMLData as HTMLData, type context$1_HTMLDataDataOneOf as HTMLDataDataOneOf, type context$1_HeadingData as HeadingData, type context$1_Height as Height, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$1_Image as Image, type context$1_ImageData as ImageData, context$1_InitialExpandedItems as InitialExpandedItems, type context$1_InitialPostsCopied as InitialPostsCopied, type context$1_Item as Item, type context$1_ItemDataOneOf as ItemDataOneOf, type context$1_ItemStyle as ItemStyle, type Keyword$1 as Keyword, type context$1_Layout as Layout, context$1_LayoutType as LayoutType, type context$1_LikePostRequest as LikePostRequest, type context$1_LikePostResponse as LikePostResponse, context$1_LineStyle as LineStyle, type context$1_Link as Link, type context$1_LinkData as LinkData, type context$1_LinkDataOneOf as LinkDataOneOf, type context$1_LinkPreviewData as LinkPreviewData, type context$1_ListDemoPostsRequest as ListDemoPostsRequest, type context$1_ListDemoPostsResponse as ListDemoPostsResponse, type context$1_ListPostsArchiveRequest as ListPostsArchiveRequest, type context$1_ListPostsArchiveResponse as ListPostsArchiveResponse, type context$1_ListPostsOptions as ListPostsOptions, type context$1_ListPostsRequest as ListPostsRequest, type context$1_ListPostsResponse as ListPostsResponse, type context$1_ListPostsResponseNonNullableFields as ListPostsResponseNonNullableFields, type context$1_ListTemplatesRequest as ListTemplatesRequest, type context$1_ListTemplatesResponse as ListTemplatesResponse, type context$1_ListValue as ListValue, type context$1_MapData as MapData, type context$1_MapSettings as MapSettings, context$1_MapType as MapType, type context$1_Media as Media, type context$1_MediaMediaOneOf as MediaMediaOneOf, type context$1_MentionData as MentionData, type MessageEnvelope$1 as MessageEnvelope, type MetaData$1 as MetaData, type context$1_Metadata as Metadata, type context$1_Metrics as Metrics, type context$1_ModerationDetails as ModerationDetails, context$1_ModerationStatusStatus as ModerationStatusStatus, type context$1_Node as Node, type context$1_NodeDataOneOf as NodeDataOneOf, type context$1_NodeStyle as NodeStyle, context$1_NodeType as NodeType, context$1_NullValue as NullValue, type context$1_Oembed as Oembed, type context$1_OldBlogMigratedEvent as OldBlogMigratedEvent, type context$1_Option as Option, type context$1_OptionDesign as OptionDesign, type context$1_OptionLayout as OptionLayout, context$1_Order as Order, type context$1_OrderedListData as OrderedListData, context$1_Orientation as Orientation, context$1_Origin as Origin, type context$1_PDFSettings as PDFSettings, type Paging$1 as Paging, type PagingMetadataV2$1 as PagingMetadataV2, type context$1_ParagraphData as ParagraphData, type context$1_PeriodPostCount as PeriodPostCount, type context$1_PeriodPublicationsCount as PeriodPublicationsCount, type context$1_Permissions as Permissions, type context$1_PinPostRequest as PinPostRequest, type context$1_PinPostResponse as PinPostResponse, type PlatformQuery$1 as PlatformQuery, type PlatformQueryPagingMethodOneOf$1 as PlatformQueryPagingMethodOneOf, type context$1_PlaybackOptions as PlaybackOptions, type context$1_PluginContainerData as PluginContainerData, context$1_PluginContainerDataAlignment as PluginContainerDataAlignment, type context$1_PluginContainerDataWidth as PluginContainerDataWidth, type context$1_PluginContainerDataWidthDataOneOf as PluginContainerDataWidthDataOneOf, type context$1_Poll as Poll, type context$1_PollData as PollData, type context$1_PollDataLayout as PollDataLayout, type context$1_PollDesign as PollDesign, type context$1_PollLayout as PollLayout, context$1_PollLayoutDirection as PollLayoutDirection, context$1_PollLayoutType as PollLayoutType, type context$1_PollSettings as PollSettings, type context$1_Post as Post, type context$1_PostCountInfo as PostCountInfo, type context$1_PostCountersUpdated as PostCountersUpdated, type context$1_PostCountersUpdatedInitiatorOneOf as PostCountersUpdatedInitiatorOneOf, type context$1_PostCreatedEnvelope as PostCreatedEnvelope, type context$1_PostDeletedEnvelope as PostDeletedEnvelope, context$1_PostFieldField as PostFieldField, type context$1_PostLiked as PostLiked, type context$1_PostLikedEnvelope as PostLikedEnvelope, type context$1_PostLikedInitiatorOneOf as PostLikedInitiatorOneOf, type context$1_PostOwnerChanged as PostOwnerChanged, type context$1_PostTranslation as PostTranslation, type context$1_PostUnliked as PostUnliked, type context$1_PostUnlikedEnvelope as PostUnlikedEnvelope, type context$1_PostUnlikedInitiatorOneOf as PostUnlikedInitiatorOneOf, type context$1_PostUpdatedEnvelope as PostUpdatedEnvelope, type context$1_PostsQueryBuilder as PostsQueryBuilder, type context$1_PostsQueryResult as PostsQueryResult, type context$1_QueryPostCountStatsOptions as QueryPostCountStatsOptions, type context$1_QueryPostCountStatsRequest as QueryPostCountStatsRequest, type context$1_QueryPostCountStatsResponse as QueryPostCountStatsResponse, type context$1_QueryPostCountStatsResponseNonNullableFields as QueryPostCountStatsResponseNonNullableFields, type context$1_QueryPostsOptions as QueryPostsOptions, type context$1_QueryPostsRequest as QueryPostsRequest, type context$1_QueryPostsResponse as QueryPostsResponse, type context$1_QueryPostsResponseNonNullableFields as QueryPostsResponseNonNullableFields, type context$1_QueryPublicationsCountStatsRequest as QueryPublicationsCountStatsRequest, context$1_QueryPublicationsCountStatsRequestOrder as QueryPublicationsCountStatsRequestOrder, type context$1_QueryPublicationsCountStatsResponse as QueryPublicationsCountStatsResponse, type context$1_Reactions as Reactions, type context$1_Rel as Rel, type RestoreInfo$1 as RestoreInfo, type context$1_RichContent as RichContent, type context$1_SendActionEventRequest as SendActionEventRequest, type context$1_SendActionEventRequestActionOneOf as SendActionEventRequestActionOneOf, type context$1_SendActionEventResponse as SendActionEventResponse, type SeoSchema$1 as SeoSchema, type Settings$1 as Settings, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, context$1_Source as Source, type context$1_Spoiler as Spoiler, type context$1_SpoilerData as SpoilerData, context$1_Status as Status, type context$1_Styles as Styles, type context$1_TableCellData as TableCellData, type context$1_TableData as TableData, type Tag$1 as Tag, context$1_Target as Target, context$1_TextAlignment as TextAlignment, type context$1_TextData as TextData, type context$1_TextNodeStyle as TextNodeStyle, type context$1_TextStyle as TextStyle, type context$1_Thumbnails as Thumbnails, context$1_ThumbnailsAlignment as ThumbnailsAlignment, context$1_Type as Type, type context$1_UnlikePostRequest as UnlikePostRequest, type context$1_UnlikePostResponse as UnlikePostResponse, type context$1_UnpinPostRequest as UnpinPostRequest, type context$1_UnpinPostResponse as UnpinPostResponse, type context$1_V1Media as V1Media, context$1_VerticalAlignment as VerticalAlignment, type context$1_Video as Video, type context$1_VideoData as VideoData, type context$1_VideoResolution as VideoResolution, context$1_ViewMode as ViewMode, type context$1_ViewPostRequest as ViewPostRequest, type context$1_ViewPostResponse as ViewPostResponse, context$1_ViewRole as ViewRole, context$1_VoteRole as VoteRole, WebhookIdentityType$1 as WebhookIdentityType, context$1_Width as Width, context$1_WidthType as WidthType, type context$1_WixMedia as WixMedia, type context$1__publicOnPostCreatedType as _publicOnPostCreatedType, type context$1__publicOnPostDeletedType as _publicOnPostDeletedType, type context$1__publicOnPostLikedType as _publicOnPostLikedType, type context$1__publicOnPostUnlikedType as _publicOnPostUnlikedType, type context$1__publicOnPostUpdatedType as _publicOnPostUpdatedType, context$1_getPost as getPost, context$1_getPostBySlug as getPostBySlug, context$1_getPostMetrics as getPostMetrics, context$1_getTotalPosts as getTotalPosts, context$1_listPosts as listPosts, context$1_onPostCreated as onPostCreated, context$1_onPostDeleted as onPostDeleted, context$1_onPostLiked as onPostLiked, context$1_onPostUnliked as onPostUnliked, context$1_onPostUpdated as onPostUpdated, onPostCreated$1 as publicOnPostCreated, onPostDeleted$1 as publicOnPostDeleted, onPostLiked$1 as publicOnPostLiked, onPostUnliked$1 as publicOnPostUnliked, onPostUpdated$1 as publicOnPostUpdated, context$1_queryPostCountStats as queryPostCountStats, context$1_queryPosts as queryPosts };
|
|
9834
11736
|
}
|
|
9835
11737
|
|
|
11738
|
+
type HostModule<T, H extends Host> = {
|
|
11739
|
+
__type: 'host';
|
|
11740
|
+
create(host: H): T;
|
|
11741
|
+
};
|
|
11742
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
11743
|
+
type Host<Environment = unknown> = {
|
|
11744
|
+
channel: {
|
|
11745
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
11746
|
+
disconnect: () => void;
|
|
11747
|
+
} | Promise<{
|
|
11748
|
+
disconnect: () => void;
|
|
11749
|
+
}>;
|
|
11750
|
+
};
|
|
11751
|
+
environment?: Environment;
|
|
11752
|
+
/**
|
|
11753
|
+
* Optional name of the environment, use for logging
|
|
11754
|
+
*/
|
|
11755
|
+
name?: string;
|
|
11756
|
+
/**
|
|
11757
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
11758
|
+
*/
|
|
11759
|
+
apiBaseUrl?: string;
|
|
11760
|
+
/**
|
|
11761
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
11762
|
+
* like internationalization, billing, etc.
|
|
11763
|
+
*/
|
|
11764
|
+
essentials?: {
|
|
11765
|
+
/**
|
|
11766
|
+
* The language of the currently viewed session
|
|
11767
|
+
*/
|
|
11768
|
+
language?: string;
|
|
11769
|
+
/**
|
|
11770
|
+
* The locale of the currently viewed session
|
|
11771
|
+
*/
|
|
11772
|
+
locale?: string;
|
|
11773
|
+
/**
|
|
11774
|
+
* Any headers that should be passed through to the API requests
|
|
11775
|
+
*/
|
|
11776
|
+
passThroughHeaders?: Record<string, string>;
|
|
11777
|
+
};
|
|
11778
|
+
};
|
|
11779
|
+
|
|
11780
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
11781
|
+
interface HttpClient {
|
|
11782
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
11783
|
+
fetchWithAuth: typeof fetch;
|
|
11784
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
11785
|
+
getActiveToken?: () => string | undefined;
|
|
11786
|
+
}
|
|
11787
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
11788
|
+
type HttpResponse<T = any> = {
|
|
11789
|
+
data: T;
|
|
11790
|
+
status: number;
|
|
11791
|
+
statusText: string;
|
|
11792
|
+
headers: any;
|
|
11793
|
+
request?: any;
|
|
11794
|
+
};
|
|
11795
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
11796
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
11797
|
+
url: string;
|
|
11798
|
+
data?: Data;
|
|
11799
|
+
params?: URLSearchParams;
|
|
11800
|
+
} & APIMetadata;
|
|
11801
|
+
type APIMetadata = {
|
|
11802
|
+
methodFqn?: string;
|
|
11803
|
+
entityFqdn?: string;
|
|
11804
|
+
packageName?: string;
|
|
11805
|
+
};
|
|
11806
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
11807
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
11808
|
+
__type: 'event-definition';
|
|
11809
|
+
type: Type;
|
|
11810
|
+
isDomainEvent?: boolean;
|
|
11811
|
+
transformations?: (envelope: unknown) => Payload;
|
|
11812
|
+
__payload: Payload;
|
|
11813
|
+
};
|
|
11814
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
11815
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
11816
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
11817
|
+
|
|
11818
|
+
type ServicePluginMethodInput = {
|
|
11819
|
+
request: any;
|
|
11820
|
+
metadata: any;
|
|
11821
|
+
};
|
|
11822
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
11823
|
+
type ServicePluginMethodMetadata = {
|
|
11824
|
+
name: string;
|
|
11825
|
+
primaryHttpMappingPath: string;
|
|
11826
|
+
transformations: {
|
|
11827
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
11828
|
+
toREST: (...args: unknown[]) => unknown;
|
|
11829
|
+
};
|
|
11830
|
+
};
|
|
11831
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
11832
|
+
__type: 'service-plugin-definition';
|
|
11833
|
+
componentType: string;
|
|
11834
|
+
methods: ServicePluginMethodMetadata[];
|
|
11835
|
+
__contract: Contract;
|
|
11836
|
+
};
|
|
11837
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
11838
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
11839
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
11840
|
+
|
|
11841
|
+
type RequestContext = {
|
|
11842
|
+
isSSR: boolean;
|
|
11843
|
+
host: string;
|
|
11844
|
+
protocol?: string;
|
|
11845
|
+
};
|
|
11846
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
11847
|
+
/**
|
|
11848
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
11849
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
11850
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
11851
|
+
*/
|
|
11852
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
11853
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
11854
|
+
_?: T;
|
|
11855
|
+
url?: string;
|
|
11856
|
+
method?: Method;
|
|
11857
|
+
params?: any;
|
|
11858
|
+
data?: any;
|
|
11859
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
11860
|
+
};
|
|
11861
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
11862
|
+
__isAmbassador: boolean;
|
|
11863
|
+
};
|
|
11864
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
11865
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
11866
|
+
|
|
11867
|
+
declare global {
|
|
11868
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
11869
|
+
interface SymbolConstructor {
|
|
11870
|
+
readonly observable: symbol;
|
|
11871
|
+
}
|
|
11872
|
+
}
|
|
11873
|
+
|
|
11874
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
11875
|
+
|
|
11876
|
+
/**
|
|
11877
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
11878
|
+
|
|
11879
|
+
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)).
|
|
11880
|
+
|
|
11881
|
+
@example
|
|
11882
|
+
```
|
|
11883
|
+
import type {EmptyObject} from 'type-fest';
|
|
11884
|
+
|
|
11885
|
+
// The following illustrates the problem with `{}`.
|
|
11886
|
+
const foo1: {} = {}; // Pass
|
|
11887
|
+
const foo2: {} = []; // Pass
|
|
11888
|
+
const foo3: {} = 42; // Pass
|
|
11889
|
+
const foo4: {} = {a: 1}; // Pass
|
|
11890
|
+
|
|
11891
|
+
// With `EmptyObject` only the first case is valid.
|
|
11892
|
+
const bar1: EmptyObject = {}; // Pass
|
|
11893
|
+
const bar2: EmptyObject = 42; // Fail
|
|
11894
|
+
const bar3: EmptyObject = []; // Fail
|
|
11895
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
11896
|
+
```
|
|
11897
|
+
|
|
11898
|
+
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}.
|
|
11899
|
+
|
|
11900
|
+
@category Object
|
|
11901
|
+
*/
|
|
11902
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
11903
|
+
|
|
11904
|
+
/**
|
|
11905
|
+
Returns a boolean for whether the two given types are equal.
|
|
11906
|
+
|
|
11907
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
11908
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
11909
|
+
|
|
11910
|
+
Use-cases:
|
|
11911
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
11912
|
+
|
|
11913
|
+
@example
|
|
11914
|
+
```
|
|
11915
|
+
import type {IsEqual} from 'type-fest';
|
|
11916
|
+
|
|
11917
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
11918
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
11919
|
+
type Includes<Value extends readonly any[], Item> =
|
|
11920
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
11921
|
+
? IsEqual<Value[0], Item> extends true
|
|
11922
|
+
? true
|
|
11923
|
+
: Includes<rest, Item>
|
|
11924
|
+
: false;
|
|
11925
|
+
```
|
|
11926
|
+
|
|
11927
|
+
@category Type Guard
|
|
11928
|
+
@category Utilities
|
|
11929
|
+
*/
|
|
11930
|
+
type IsEqual<A, B> =
|
|
11931
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
11932
|
+
(<G>() => G extends B ? 1 : 2)
|
|
11933
|
+
? true
|
|
11934
|
+
: false;
|
|
11935
|
+
|
|
11936
|
+
/**
|
|
11937
|
+
Filter out keys from an object.
|
|
11938
|
+
|
|
11939
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
11940
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
11941
|
+
Returns `Key` otherwise.
|
|
11942
|
+
|
|
11943
|
+
@example
|
|
11944
|
+
```
|
|
11945
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
11946
|
+
//=> never
|
|
11947
|
+
```
|
|
11948
|
+
|
|
11949
|
+
@example
|
|
11950
|
+
```
|
|
11951
|
+
type Filtered = Filter<'bar', string>;
|
|
11952
|
+
//=> never
|
|
11953
|
+
```
|
|
11954
|
+
|
|
11955
|
+
@example
|
|
11956
|
+
```
|
|
11957
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
11958
|
+
//=> 'bar'
|
|
11959
|
+
```
|
|
11960
|
+
|
|
11961
|
+
@see {Except}
|
|
11962
|
+
*/
|
|
11963
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
11964
|
+
|
|
11965
|
+
type ExceptOptions = {
|
|
11966
|
+
/**
|
|
11967
|
+
Disallow assigning non-specified properties.
|
|
11968
|
+
|
|
11969
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
11970
|
+
|
|
11971
|
+
@default false
|
|
11972
|
+
*/
|
|
11973
|
+
requireExactProps?: boolean;
|
|
11974
|
+
};
|
|
11975
|
+
|
|
11976
|
+
/**
|
|
11977
|
+
Create a type from an object type without certain keys.
|
|
11978
|
+
|
|
11979
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
11980
|
+
|
|
11981
|
+
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.
|
|
11982
|
+
|
|
11983
|
+
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)).
|
|
11984
|
+
|
|
11985
|
+
@example
|
|
11986
|
+
```
|
|
11987
|
+
import type {Except} from 'type-fest';
|
|
11988
|
+
|
|
11989
|
+
type Foo = {
|
|
11990
|
+
a: number;
|
|
11991
|
+
b: string;
|
|
11992
|
+
};
|
|
11993
|
+
|
|
11994
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
11995
|
+
//=> {b: string}
|
|
11996
|
+
|
|
11997
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
11998
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
11999
|
+
|
|
12000
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
12001
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
12002
|
+
|
|
12003
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
12004
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
12005
|
+
```
|
|
12006
|
+
|
|
12007
|
+
@category Object
|
|
12008
|
+
*/
|
|
12009
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
12010
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
12011
|
+
} & (Options['requireExactProps'] extends true
|
|
12012
|
+
? Partial<Record<KeysType, never>>
|
|
12013
|
+
: {});
|
|
12014
|
+
|
|
12015
|
+
/**
|
|
12016
|
+
Returns a boolean for whether the given type is `never`.
|
|
12017
|
+
|
|
12018
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
12019
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
12020
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
12021
|
+
|
|
12022
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
12023
|
+
|
|
12024
|
+
@example
|
|
12025
|
+
```
|
|
12026
|
+
import type {IsNever, And} from 'type-fest';
|
|
12027
|
+
|
|
12028
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
12029
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
12030
|
+
And<
|
|
12031
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
12032
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
12033
|
+
>;
|
|
12034
|
+
|
|
12035
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
12036
|
+
AreStringsEqual<I, O> extends true
|
|
12037
|
+
? never
|
|
12038
|
+
: void;
|
|
12039
|
+
|
|
12040
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
12041
|
+
if (input === output) {
|
|
12042
|
+
process.exit(0);
|
|
12043
|
+
}
|
|
12044
|
+
}
|
|
12045
|
+
|
|
12046
|
+
endIfEqual('abc', 'abc');
|
|
12047
|
+
//=> never
|
|
12048
|
+
|
|
12049
|
+
endIfEqual('abc', '123');
|
|
12050
|
+
//=> void
|
|
12051
|
+
```
|
|
12052
|
+
|
|
12053
|
+
@category Type Guard
|
|
12054
|
+
@category Utilities
|
|
12055
|
+
*/
|
|
12056
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
12057
|
+
|
|
12058
|
+
/**
|
|
12059
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
12060
|
+
|
|
12061
|
+
@see {@link IsNever}
|
|
12062
|
+
|
|
12063
|
+
@example
|
|
12064
|
+
```
|
|
12065
|
+
import type {IfNever} from 'type-fest';
|
|
12066
|
+
|
|
12067
|
+
type ShouldBeTrue = IfNever<never>;
|
|
12068
|
+
//=> true
|
|
12069
|
+
|
|
12070
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
12071
|
+
//=> 'bar'
|
|
12072
|
+
```
|
|
12073
|
+
|
|
12074
|
+
@category Type Guard
|
|
12075
|
+
@category Utilities
|
|
12076
|
+
*/
|
|
12077
|
+
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
12078
|
+
IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
12079
|
+
);
|
|
12080
|
+
|
|
12081
|
+
/**
|
|
12082
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
12083
|
+
|
|
12084
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
12085
|
+
|
|
12086
|
+
@example
|
|
12087
|
+
```
|
|
12088
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
12089
|
+
|
|
12090
|
+
interface Example {
|
|
12091
|
+
a: string;
|
|
12092
|
+
b: string | number;
|
|
12093
|
+
c?: string;
|
|
12094
|
+
d: {};
|
|
12095
|
+
}
|
|
12096
|
+
|
|
12097
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
12098
|
+
//=> 'a'
|
|
12099
|
+
```
|
|
12100
|
+
|
|
12101
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
12102
|
+
|
|
12103
|
+
@example
|
|
12104
|
+
```
|
|
12105
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
12106
|
+
|
|
12107
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
12108
|
+
//=> 'a' | 'c'
|
|
12109
|
+
```
|
|
12110
|
+
|
|
12111
|
+
@category Object
|
|
12112
|
+
*/
|
|
12113
|
+
type ConditionalKeys<Base, Condition> =
|
|
12114
|
+
{
|
|
12115
|
+
// Map through all the keys of the given base type.
|
|
12116
|
+
[Key in keyof Base]-?:
|
|
12117
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
12118
|
+
Base[Key] extends Condition
|
|
12119
|
+
// Retain this key
|
|
12120
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
12121
|
+
? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
|
|
12122
|
+
// Discard this key since the condition fails.
|
|
12123
|
+
: never;
|
|
12124
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
12125
|
+
}[keyof Base];
|
|
12126
|
+
|
|
12127
|
+
/**
|
|
12128
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
12129
|
+
|
|
12130
|
+
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.
|
|
12131
|
+
|
|
12132
|
+
@example
|
|
12133
|
+
```
|
|
12134
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
12135
|
+
|
|
12136
|
+
class Awesome {
|
|
12137
|
+
name: string;
|
|
12138
|
+
successes: number;
|
|
12139
|
+
failures: bigint;
|
|
12140
|
+
|
|
12141
|
+
run() {}
|
|
12142
|
+
}
|
|
12143
|
+
|
|
12144
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
12145
|
+
//=> {run: () => void}
|
|
12146
|
+
```
|
|
12147
|
+
|
|
12148
|
+
@example
|
|
12149
|
+
```
|
|
12150
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
12151
|
+
|
|
12152
|
+
interface Example {
|
|
12153
|
+
a: string;
|
|
12154
|
+
b: string | number;
|
|
12155
|
+
c: () => void;
|
|
12156
|
+
d: {};
|
|
12157
|
+
}
|
|
12158
|
+
|
|
12159
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
12160
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
12161
|
+
```
|
|
12162
|
+
|
|
12163
|
+
@category Object
|
|
12164
|
+
*/
|
|
12165
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
12166
|
+
Base,
|
|
12167
|
+
ConditionalKeys<Base, Condition>
|
|
12168
|
+
>;
|
|
12169
|
+
|
|
12170
|
+
/**
|
|
12171
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
12172
|
+
* can either be a REST module or a host module.
|
|
12173
|
+
* This type is recursive, so it can describe nested modules.
|
|
12174
|
+
*/
|
|
12175
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
12176
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
12177
|
+
};
|
|
12178
|
+
/**
|
|
12179
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
12180
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
12181
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
12182
|
+
* do not match the given host (as they will not work with the given host).
|
|
12183
|
+
*/
|
|
12184
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
12185
|
+
done: T;
|
|
12186
|
+
recurse: T extends {
|
|
12187
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
12188
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
12189
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
12190
|
+
-1,
|
|
12191
|
+
0,
|
|
12192
|
+
1,
|
|
12193
|
+
2,
|
|
12194
|
+
3,
|
|
12195
|
+
4,
|
|
12196
|
+
5
|
|
12197
|
+
][Depth]> : never;
|
|
12198
|
+
}, EmptyObject>;
|
|
12199
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
12200
|
+
type PublicMetadata = {
|
|
12201
|
+
PACKAGE_NAME?: string;
|
|
12202
|
+
};
|
|
12203
|
+
|
|
12204
|
+
declare global {
|
|
12205
|
+
interface ContextualClient {
|
|
12206
|
+
}
|
|
12207
|
+
}
|
|
12208
|
+
/**
|
|
12209
|
+
* A type used to create concerete types from SDK descriptors in
|
|
12210
|
+
* case a contextual client is available.
|
|
12211
|
+
*/
|
|
12212
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
12213
|
+
host: Host;
|
|
12214
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
12215
|
+
|
|
9836
12216
|
interface BlogTag {
|
|
9837
12217
|
/**
|
|
9838
12218
|
* Tag ID.
|
|
@@ -9965,9 +12345,7 @@ interface GetOrCreateTagRequest {
|
|
|
9965
12345
|
declare enum Field {
|
|
9966
12346
|
UNKNOWN = "UNKNOWN",
|
|
9967
12347
|
/** Includes Tag URL when present. */
|
|
9968
|
-
URL = "URL"
|
|
9969
|
-
/** Includes SEO data. */
|
|
9970
|
-
SEO = "SEO"
|
|
12348
|
+
URL = "URL"
|
|
9971
12349
|
}
|
|
9972
12350
|
interface GetOrCreateTagResponse {
|
|
9973
12351
|
/** Tag info. */
|
|
@@ -10842,27 +13220,9 @@ interface DeleteTagSignature {
|
|
|
10842
13220
|
*/
|
|
10843
13221
|
(tagId: string): Promise<void>;
|
|
10844
13222
|
}
|
|
10845
|
-
declare const onTagCreated$1: EventDefinition
|
|
10846
|
-
declare const onTagUpdated$1: EventDefinition
|
|
10847
|
-
declare const onTagDeleted$1: EventDefinition
|
|
10848
|
-
|
|
10849
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
10850
|
-
__type: 'event-definition';
|
|
10851
|
-
type: Type;
|
|
10852
|
-
isDomainEvent?: boolean;
|
|
10853
|
-
transformations?: (envelope: unknown) => Payload;
|
|
10854
|
-
__payload: Payload;
|
|
10855
|
-
};
|
|
10856
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
10857
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
10858
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
10859
|
-
|
|
10860
|
-
declare global {
|
|
10861
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
10862
|
-
interface SymbolConstructor {
|
|
10863
|
-
readonly observable: symbol;
|
|
10864
|
-
}
|
|
10865
|
-
}
|
|
13223
|
+
declare const onTagCreated$1: EventDefinition<TagCreatedEnvelope, "wix.blog.v3.tag_created">;
|
|
13224
|
+
declare const onTagUpdated$1: EventDefinition<TagUpdatedEnvelope, "wix.blog.v3.tag_updated">;
|
|
13225
|
+
declare const onTagDeleted$1: EventDefinition<TagDeletedEnvelope, "wix.blog.v3.tag_deleted">;
|
|
10866
13226
|
|
|
10867
13227
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
10868
13228
|
|