@wix/portfolio 1.0.88 → 1.0.90
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 +2655 -182
- package/type-bundles/index.bundle.d.ts +2655 -182
- package/type-bundles/meta.bundle.d.ts +0 -20
|
@@ -1,39 +1,127 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type HostModule$5<T, H extends Host$5> = {
|
|
2
|
+
__type: 'host';
|
|
3
|
+
create(host: H): T;
|
|
4
|
+
};
|
|
5
|
+
type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
|
|
6
|
+
type Host$5<Environment = unknown> = {
|
|
7
|
+
channel: {
|
|
8
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
|
+
disconnect: () => void;
|
|
10
|
+
} | Promise<{
|
|
11
|
+
disconnect: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
|
+
*/
|
|
18
|
+
apiBaseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
21
|
+
* like internationalization, billing, etc.
|
|
22
|
+
*/
|
|
23
|
+
essentials?: {
|
|
24
|
+
/**
|
|
25
|
+
* The language of the currently viewed session
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The locale of the currently viewed session
|
|
30
|
+
*/
|
|
31
|
+
locale?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Any headers that should be passed through to the API requests
|
|
34
|
+
*/
|
|
35
|
+
passThroughHeaders?: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
|
|
40
|
+
interface HttpClient$5 {
|
|
41
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
|
|
4
42
|
fetchWithAuth: typeof fetch;
|
|
5
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
|
+
getActiveToken?: () => string | undefined;
|
|
6
45
|
}
|
|
7
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
8
|
-
type HttpResponse<T = any> = {
|
|
46
|
+
type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
|
|
47
|
+
type HttpResponse$5<T = any> = {
|
|
9
48
|
data: T;
|
|
10
49
|
status: number;
|
|
11
50
|
statusText: string;
|
|
12
51
|
headers: any;
|
|
13
52
|
request?: any;
|
|
14
53
|
};
|
|
15
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
54
|
+
type RequestOptions$5<_TResponse = any, Data = any> = {
|
|
16
55
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
17
56
|
url: string;
|
|
18
57
|
data?: Data;
|
|
19
58
|
params?: URLSearchParams;
|
|
20
|
-
} & APIMetadata;
|
|
21
|
-
type APIMetadata = {
|
|
59
|
+
} & APIMetadata$5;
|
|
60
|
+
type APIMetadata$5 = {
|
|
22
61
|
methodFqn?: string;
|
|
23
62
|
entityFqdn?: string;
|
|
24
63
|
packageName?: string;
|
|
25
64
|
};
|
|
26
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
27
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
65
|
+
type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
|
|
66
|
+
type EventDefinition$9<Payload = unknown, Type extends string = string> = {
|
|
28
67
|
__type: 'event-definition';
|
|
29
68
|
type: Type;
|
|
30
69
|
isDomainEvent?: boolean;
|
|
31
70
|
transformations?: (envelope: unknown) => Payload;
|
|
32
71
|
__payload: Payload;
|
|
33
72
|
};
|
|
34
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
35
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
36
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
73
|
+
declare function EventDefinition$9<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$9<Payload, Type>;
|
|
74
|
+
type EventHandler$9<T extends EventDefinition$9> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$9<T extends EventDefinition$9<any, string>> = (handler: EventHandler$9<T>) => void;
|
|
76
|
+
|
|
77
|
+
type ServicePluginMethodInput$5 = {
|
|
78
|
+
request: any;
|
|
79
|
+
metadata: any;
|
|
80
|
+
};
|
|
81
|
+
type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata$5 = {
|
|
83
|
+
name: string;
|
|
84
|
+
primaryHttpMappingPath: string;
|
|
85
|
+
transformations: {
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
|
|
87
|
+
toREST: (...args: unknown[]) => unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
|
|
91
|
+
__type: 'service-plugin-definition';
|
|
92
|
+
componentType: string;
|
|
93
|
+
methods: ServicePluginMethodMetadata$5[];
|
|
94
|
+
__contract: Contract;
|
|
95
|
+
};
|
|
96
|
+
declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
|
|
99
|
+
|
|
100
|
+
type RequestContext$5 = {
|
|
101
|
+
isSSR: boolean;
|
|
102
|
+
host: string;
|
|
103
|
+
protocol?: string;
|
|
104
|
+
};
|
|
105
|
+
type ResponseTransformer$5 = (data: any, headers?: any) => any;
|
|
106
|
+
/**
|
|
107
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
|
+
*/
|
|
111
|
+
type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions$5<T = any> = {
|
|
113
|
+
_?: T;
|
|
114
|
+
url?: string;
|
|
115
|
+
method?: Method$5;
|
|
116
|
+
params?: any;
|
|
117
|
+
data?: any;
|
|
118
|
+
transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
|
|
119
|
+
};
|
|
120
|
+
type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
|
|
121
|
+
__isAmbassador: boolean;
|
|
122
|
+
};
|
|
123
|
+
type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
37
125
|
|
|
38
126
|
declare global {
|
|
39
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -42,6 +130,284 @@ declare global {
|
|
|
42
130
|
}
|
|
43
131
|
}
|
|
44
132
|
|
|
133
|
+
declare const emptyObjectSymbol$5: unique symbol;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
137
|
+
|
|
138
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
139
|
+
|
|
140
|
+
@example
|
|
141
|
+
```
|
|
142
|
+
import type {EmptyObject} from 'type-fest';
|
|
143
|
+
|
|
144
|
+
// The following illustrates the problem with `{}`.
|
|
145
|
+
const foo1: {} = {}; // Pass
|
|
146
|
+
const foo2: {} = []; // Pass
|
|
147
|
+
const foo3: {} = 42; // Pass
|
|
148
|
+
const foo4: {} = {a: 1}; // Pass
|
|
149
|
+
|
|
150
|
+
// With `EmptyObject` only the first case is valid.
|
|
151
|
+
const bar1: EmptyObject = {}; // Pass
|
|
152
|
+
const bar2: EmptyObject = 42; // Fail
|
|
153
|
+
const bar3: EmptyObject = []; // Fail
|
|
154
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
158
|
+
|
|
159
|
+
@category Object
|
|
160
|
+
*/
|
|
161
|
+
type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Returns a boolean for whether the two given types are equal.
|
|
165
|
+
|
|
166
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
167
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
168
|
+
|
|
169
|
+
Use-cases:
|
|
170
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
171
|
+
|
|
172
|
+
@example
|
|
173
|
+
```
|
|
174
|
+
import type {IsEqual} from 'type-fest';
|
|
175
|
+
|
|
176
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
177
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
178
|
+
type Includes<Value extends readonly any[], Item> =
|
|
179
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
180
|
+
? IsEqual<Value[0], Item> extends true
|
|
181
|
+
? true
|
|
182
|
+
: Includes<rest, Item>
|
|
183
|
+
: false;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
@category Type Guard
|
|
187
|
+
@category Utilities
|
|
188
|
+
*/
|
|
189
|
+
type IsEqual$5<A, B> =
|
|
190
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
191
|
+
(<G>() => G extends B ? 1 : 2)
|
|
192
|
+
? true
|
|
193
|
+
: false;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
Filter out keys from an object.
|
|
197
|
+
|
|
198
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
199
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
200
|
+
Returns `Key` otherwise.
|
|
201
|
+
|
|
202
|
+
@example
|
|
203
|
+
```
|
|
204
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
205
|
+
//=> never
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
@example
|
|
209
|
+
```
|
|
210
|
+
type Filtered = Filter<'bar', string>;
|
|
211
|
+
//=> never
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
@example
|
|
215
|
+
```
|
|
216
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
217
|
+
//=> 'bar'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
@see {Except}
|
|
221
|
+
*/
|
|
222
|
+
type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
|
+
|
|
224
|
+
type ExceptOptions$5 = {
|
|
225
|
+
/**
|
|
226
|
+
Disallow assigning non-specified properties.
|
|
227
|
+
|
|
228
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
229
|
+
|
|
230
|
+
@default false
|
|
231
|
+
*/
|
|
232
|
+
requireExactProps?: boolean;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
Create a type from an object type without certain keys.
|
|
237
|
+
|
|
238
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
239
|
+
|
|
240
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
241
|
+
|
|
242
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
243
|
+
|
|
244
|
+
@example
|
|
245
|
+
```
|
|
246
|
+
import type {Except} from 'type-fest';
|
|
247
|
+
|
|
248
|
+
type Foo = {
|
|
249
|
+
a: number;
|
|
250
|
+
b: string;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
254
|
+
//=> {b: string}
|
|
255
|
+
|
|
256
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
257
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
258
|
+
|
|
259
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
260
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
261
|
+
|
|
262
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
263
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
@category Object
|
|
267
|
+
*/
|
|
268
|
+
type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
|
+
} & (Options['requireExactProps'] extends true
|
|
271
|
+
? Partial<Record<KeysType, never>>
|
|
272
|
+
: {});
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
|
+
|
|
277
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
278
|
+
|
|
279
|
+
@example
|
|
280
|
+
```
|
|
281
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
282
|
+
|
|
283
|
+
interface Example {
|
|
284
|
+
a: string;
|
|
285
|
+
b: string | number;
|
|
286
|
+
c?: string;
|
|
287
|
+
d: {};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
291
|
+
//=> 'a'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
295
|
+
|
|
296
|
+
@example
|
|
297
|
+
```
|
|
298
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
299
|
+
|
|
300
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
301
|
+
//=> 'a' | 'c'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
@category Object
|
|
305
|
+
*/
|
|
306
|
+
type ConditionalKeys$5<Base, Condition> = NonNullable<
|
|
307
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
|
+
{
|
|
309
|
+
// Map through all the keys of the given base type.
|
|
310
|
+
[Key in keyof Base]:
|
|
311
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
312
|
+
Base[Key] extends Condition
|
|
313
|
+
// Retain this key since the condition passes.
|
|
314
|
+
? Key
|
|
315
|
+
// Discard this key since the condition fails.
|
|
316
|
+
: never;
|
|
317
|
+
|
|
318
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
+
}[keyof Base]
|
|
320
|
+
>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
324
|
+
|
|
325
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
326
|
+
|
|
327
|
+
@example
|
|
328
|
+
```
|
|
329
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
330
|
+
|
|
331
|
+
class Awesome {
|
|
332
|
+
name: string;
|
|
333
|
+
successes: number;
|
|
334
|
+
failures: bigint;
|
|
335
|
+
|
|
336
|
+
run() {}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
340
|
+
//=> {run: () => void}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
@example
|
|
344
|
+
```
|
|
345
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
346
|
+
|
|
347
|
+
interface Example {
|
|
348
|
+
a: string;
|
|
349
|
+
b: string | number;
|
|
350
|
+
c: () => void;
|
|
351
|
+
d: {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
355
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
@category Object
|
|
359
|
+
*/
|
|
360
|
+
type ConditionalExcept$5<Base, Condition> = Except$5<
|
|
361
|
+
Base,
|
|
362
|
+
ConditionalKeys$5<Base, Condition>
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
367
|
+
* can either be a REST module or a host module.
|
|
368
|
+
* This type is recursive, so it can describe nested modules.
|
|
369
|
+
*/
|
|
370
|
+
type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$9<any> | ServicePluginDefinition$5<any> | {
|
|
371
|
+
[key: string]: Descriptors$5 | PublicMetadata$5 | any;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
375
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
376
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
|
+
* do not match the given host (as they will not work with the given host).
|
|
378
|
+
*/
|
|
379
|
+
type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
|
|
380
|
+
done: T;
|
|
381
|
+
recurse: T extends {
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$9<any> ? BuildEventDefinition$9<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
|
|
385
|
+
-1,
|
|
386
|
+
0,
|
|
387
|
+
1,
|
|
388
|
+
2,
|
|
389
|
+
3,
|
|
390
|
+
4,
|
|
391
|
+
5
|
|
392
|
+
][Depth]> : never;
|
|
393
|
+
}, EmptyObject$5>;
|
|
394
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
+
type PublicMetadata$5 = {
|
|
396
|
+
PACKAGE_NAME?: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare global {
|
|
400
|
+
interface ContextualClient {
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A type used to create concerete types from SDK descriptors in
|
|
405
|
+
* case a contextual client is available.
|
|
406
|
+
*/
|
|
407
|
+
type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host$5;
|
|
409
|
+
} ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
|
|
410
|
+
|
|
45
411
|
/** Collection is the main entity of CollectionsService */
|
|
46
412
|
interface Collection {
|
|
47
413
|
/**
|
|
@@ -718,7 +1084,7 @@ interface CollectionsQueryBuilder {
|
|
|
718
1084
|
find: () => Promise<CollectionsQueryResult>;
|
|
719
1085
|
}
|
|
720
1086
|
|
|
721
|
-
declare function createCollection$1(httpClient: HttpClient): CreateCollectionSignature;
|
|
1087
|
+
declare function createCollection$1(httpClient: HttpClient$5): CreateCollectionSignature;
|
|
722
1088
|
interface CreateCollectionSignature {
|
|
723
1089
|
/**
|
|
724
1090
|
* Creates a new Collection
|
|
@@ -727,7 +1093,7 @@ interface CreateCollectionSignature {
|
|
|
727
1093
|
*/
|
|
728
1094
|
(collection: Collection): Promise<Collection & CollectionNonNullableFields>;
|
|
729
1095
|
}
|
|
730
|
-
declare function getCollection$1(httpClient: HttpClient): GetCollectionSignature;
|
|
1096
|
+
declare function getCollection$1(httpClient: HttpClient$5): GetCollectionSignature;
|
|
731
1097
|
interface GetCollectionSignature {
|
|
732
1098
|
/**
|
|
733
1099
|
* Get a Collection by id
|
|
@@ -736,14 +1102,14 @@ interface GetCollectionSignature {
|
|
|
736
1102
|
*/
|
|
737
1103
|
(collectionId: string, options?: GetCollectionOptions | undefined): Promise<Collection & CollectionNonNullableFields>;
|
|
738
1104
|
}
|
|
739
|
-
declare function listCollections$1(httpClient: HttpClient): ListCollectionsSignature;
|
|
1105
|
+
declare function listCollections$1(httpClient: HttpClient$5): ListCollectionsSignature;
|
|
740
1106
|
interface ListCollectionsSignature {
|
|
741
1107
|
/**
|
|
742
1108
|
* List all Collections in portfolio
|
|
743
1109
|
*/
|
|
744
1110
|
(options?: ListCollectionsOptions | undefined): Promise<ListCollectionsResponse & ListCollectionsResponseNonNullableFields>;
|
|
745
1111
|
}
|
|
746
|
-
declare function updateCollection$1(httpClient: HttpClient): UpdateCollectionSignature;
|
|
1112
|
+
declare function updateCollection$1(httpClient: HttpClient$5): UpdateCollectionSignature;
|
|
747
1113
|
interface UpdateCollectionSignature {
|
|
748
1114
|
/**
|
|
749
1115
|
* Update a Collection, supports partial update
|
|
@@ -753,7 +1119,7 @@ interface UpdateCollectionSignature {
|
|
|
753
1119
|
*/
|
|
754
1120
|
(_id: string | null, collection: UpdateCollection): Promise<Collection & CollectionNonNullableFields>;
|
|
755
1121
|
}
|
|
756
|
-
declare function deleteCollection$1(httpClient: HttpClient): DeleteCollectionSignature;
|
|
1122
|
+
declare function deleteCollection$1(httpClient: HttpClient$5): DeleteCollectionSignature;
|
|
757
1123
|
interface DeleteCollectionSignature {
|
|
758
1124
|
/**
|
|
759
1125
|
* Delete a Collection
|
|
@@ -761,25 +1127,43 @@ interface DeleteCollectionSignature {
|
|
|
761
1127
|
*/
|
|
762
1128
|
(collectionId: string): Promise<DeleteCollectionResponse & DeleteCollectionResponseNonNullableFields>;
|
|
763
1129
|
}
|
|
764
|
-
declare function queryCollections$1(httpClient: HttpClient): QueryCollectionsSignature;
|
|
1130
|
+
declare function queryCollections$1(httpClient: HttpClient$5): QueryCollectionsSignature;
|
|
765
1131
|
interface QueryCollectionsSignature {
|
|
766
1132
|
/**
|
|
767
1133
|
* Query Collections using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language)
|
|
768
1134
|
*/
|
|
769
1135
|
(options?: QueryCollectionsOptions | undefined): CollectionsQueryBuilder;
|
|
770
1136
|
}
|
|
771
|
-
declare const onCollectionCreated$1: EventDefinition<CollectionCreatedEnvelope, "wix.portfolio.collections.v1.collection_created">;
|
|
772
|
-
declare const onCollectionUpdated$1: EventDefinition<CollectionUpdatedEnvelope, "wix.portfolio.collections.v1.collection_updated">;
|
|
773
|
-
declare const onCollectionDeleted$1: EventDefinition<CollectionDeletedEnvelope, "wix.portfolio.collections.v1.collection_deleted">;
|
|
1137
|
+
declare const onCollectionCreated$1: EventDefinition$9<CollectionCreatedEnvelope, "wix.portfolio.collections.v1.collection_created">;
|
|
1138
|
+
declare const onCollectionUpdated$1: EventDefinition$9<CollectionUpdatedEnvelope, "wix.portfolio.collections.v1.collection_updated">;
|
|
1139
|
+
declare const onCollectionDeleted$1: EventDefinition$9<CollectionDeletedEnvelope, "wix.portfolio.collections.v1.collection_deleted">;
|
|
1140
|
+
|
|
1141
|
+
type EventDefinition$8<Payload = unknown, Type extends string = string> = {
|
|
1142
|
+
__type: 'event-definition';
|
|
1143
|
+
type: Type;
|
|
1144
|
+
isDomainEvent?: boolean;
|
|
1145
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1146
|
+
__payload: Payload;
|
|
1147
|
+
};
|
|
1148
|
+
declare function EventDefinition$8<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$8<Payload, Type>;
|
|
1149
|
+
type EventHandler$8<T extends EventDefinition$8> = (payload: T['__payload']) => void | Promise<void>;
|
|
1150
|
+
type BuildEventDefinition$8<T extends EventDefinition$8<any, string>> = (handler: EventHandler$8<T>) => void;
|
|
1151
|
+
|
|
1152
|
+
declare global {
|
|
1153
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1154
|
+
interface SymbolConstructor {
|
|
1155
|
+
readonly observable: symbol;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
774
1158
|
|
|
775
|
-
declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
1159
|
+
declare function createEventModule$3<T extends EventDefinition$8<any, string>>(eventDefinition: T): BuildEventDefinition$8<T> & T;
|
|
776
1160
|
|
|
777
|
-
declare const createCollection: BuildRESTFunction<typeof createCollection$1> & typeof createCollection$1
|
|
778
|
-
declare const getCollection: BuildRESTFunction<typeof getCollection$1> & typeof getCollection$1
|
|
779
|
-
declare const listCollections: BuildRESTFunction<typeof listCollections$1> & typeof listCollections$1
|
|
780
|
-
declare const updateCollection: BuildRESTFunction<typeof updateCollection$1> & typeof updateCollection$1
|
|
781
|
-
declare const deleteCollection: BuildRESTFunction<typeof deleteCollection$1> & typeof deleteCollection$1
|
|
782
|
-
declare const queryCollections: BuildRESTFunction<typeof queryCollections$1> & typeof queryCollections$1
|
|
1161
|
+
declare const createCollection: MaybeContext$5<BuildRESTFunction$5<typeof createCollection$1> & typeof createCollection$1>;
|
|
1162
|
+
declare const getCollection: MaybeContext$5<BuildRESTFunction$5<typeof getCollection$1> & typeof getCollection$1>;
|
|
1163
|
+
declare const listCollections: MaybeContext$5<BuildRESTFunction$5<typeof listCollections$1> & typeof listCollections$1>;
|
|
1164
|
+
declare const updateCollection: MaybeContext$5<BuildRESTFunction$5<typeof updateCollection$1> & typeof updateCollection$1>;
|
|
1165
|
+
declare const deleteCollection: MaybeContext$5<BuildRESTFunction$5<typeof deleteCollection$1> & typeof deleteCollection$1>;
|
|
1166
|
+
declare const queryCollections: MaybeContext$5<BuildRESTFunction$5<typeof queryCollections$1> & typeof queryCollections$1>;
|
|
783
1167
|
|
|
784
1168
|
type _publicOnCollectionCreatedType = typeof onCollectionCreated$1;
|
|
785
1169
|
/** */
|
|
@@ -839,6 +1223,416 @@ declare namespace context$5 {
|
|
|
839
1223
|
export { type ActionEvent$5 as ActionEvent, type context$5_AdminRemoveMenuItemsResponse as AdminRemoveMenuItemsResponse, type App$2 as App, type BaseEventMetadata$3 as BaseEventMetadata, type context$5_Collection as Collection, type context$5_CollectionCreatedEnvelope as CollectionCreatedEnvelope, type context$5_CollectionDeletedEnvelope as CollectionDeletedEnvelope, type context$5_CollectionNonNullableFields as CollectionNonNullableFields, type context$5_CollectionUpdatedEnvelope as CollectionUpdatedEnvelope, type context$5_CollectionsQueryBuilder as CollectionsQueryBuilder, type context$5_CollectionsQueryResult as CollectionsQueryResult, type context$5_CreateCollectionRequest as CreateCollectionRequest, type context$5_CreateCollectionResponse as CreateCollectionResponse, type context$5_CreateCollectionResponseNonNullableFields as CreateCollectionResponseNonNullableFields, type CursorPaging$4 as CursorPaging, type Cursors$4 as Cursors, type context$5_DeleteCollectionRequest as DeleteCollectionRequest, type context$5_DeleteCollectionResponse as DeleteCollectionResponse, type context$5_DeleteCollectionResponseNonNullableFields as DeleteCollectionResponseNonNullableFields, type DomainEvent$5 as DomainEvent, type DomainEventBodyOneOf$5 as DomainEventBodyOneOf, type Empty$3 as Empty, type EntityCreatedEvent$5 as EntityCreatedEvent, type EntityDeletedEvent$5 as EntityDeletedEvent, type EntityUpdatedEvent$5 as EntityUpdatedEvent, type EventMetadata$3 as EventMetadata, type File$2 as File, type context$5_GetCollectionOptions as GetCollectionOptions, type context$5_GetCollectionRequest as GetCollectionRequest, type context$5_GetCollectionResponse as GetCollectionResponse, type context$5_GetCollectionResponseNonNullableFields as GetCollectionResponseNonNullableFields, type IdentificationData$5 as IdentificationData, type IdentificationDataIdOneOf$5 as IdentificationDataIdOneOf, type Image$3 as Image, ImageType$3 as ImageType, type InvalidateCache$2 as InvalidateCache, type InvalidateCacheGetByOneOf$2 as InvalidateCacheGetByOneOf, type Keyword$2 as Keyword, type context$5_ListCollectionsOptions as ListCollectionsOptions, type context$5_ListCollectionsRequest as ListCollectionsRequest, type context$5_ListCollectionsResponse as ListCollectionsResponse, type context$5_ListCollectionsResponseNonNullableFields as ListCollectionsResponseNonNullableFields, type MessageEnvelope$5 as MessageEnvelope, type Page$2 as Page, type Paging$3 as Paging, type PagingMetadataV2$4 as PagingMetadataV2, type Point$3 as Point, type context$5_QueryCollectionsOptions as QueryCollectionsOptions, type context$5_QueryCollectionsRequest as QueryCollectionsRequest, type context$5_QueryCollectionsResponse as QueryCollectionsResponse, type context$5_QueryCollectionsResponseNonNullableFields as QueryCollectionsResponseNonNullableFields, type QueryV2$3 as QueryV2, type QueryV2PagingMethodOneOf$3 as QueryV2PagingMethodOneOf, type RestoreInfo$5 as RestoreInfo, type SeoSchema$2 as SeoSchema, type Settings$2 as Settings, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, type Tag$2 as Tag, type URI$2 as URI, type UnsharpMasking$3 as UnsharpMasking, type context$5_UpdateCollection as UpdateCollection, type context$5_UpdateCollectionRequest as UpdateCollectionRequest, type context$5_UpdateCollectionResponse as UpdateCollectionResponse, type context$5_UpdateCollectionResponseNonNullableFields as UpdateCollectionResponseNonNullableFields, WebhookIdentityType$5 as WebhookIdentityType, type context$5__publicOnCollectionCreatedType as _publicOnCollectionCreatedType, type context$5__publicOnCollectionDeletedType as _publicOnCollectionDeletedType, type context$5__publicOnCollectionUpdatedType as _publicOnCollectionUpdatedType, context$5_createCollection as createCollection, context$5_deleteCollection as deleteCollection, context$5_getCollection as getCollection, context$5_listCollections as listCollections, context$5_onCollectionCreated as onCollectionCreated, context$5_onCollectionDeleted as onCollectionDeleted, context$5_onCollectionUpdated as onCollectionUpdated, onCollectionCreated$1 as publicOnCollectionCreated, onCollectionDeleted$1 as publicOnCollectionDeleted, onCollectionUpdated$1 as publicOnCollectionUpdated, context$5_queryCollections as queryCollections, context$5_updateCollection as updateCollection };
|
|
840
1224
|
}
|
|
841
1225
|
|
|
1226
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
1227
|
+
__type: 'host';
|
|
1228
|
+
create(host: H): T;
|
|
1229
|
+
};
|
|
1230
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
1231
|
+
type Host$4<Environment = unknown> = {
|
|
1232
|
+
channel: {
|
|
1233
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1234
|
+
disconnect: () => void;
|
|
1235
|
+
} | Promise<{
|
|
1236
|
+
disconnect: () => void;
|
|
1237
|
+
}>;
|
|
1238
|
+
};
|
|
1239
|
+
environment?: Environment;
|
|
1240
|
+
/**
|
|
1241
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1242
|
+
*/
|
|
1243
|
+
apiBaseUrl?: string;
|
|
1244
|
+
/**
|
|
1245
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1246
|
+
* like internationalization, billing, etc.
|
|
1247
|
+
*/
|
|
1248
|
+
essentials?: {
|
|
1249
|
+
/**
|
|
1250
|
+
* The language of the currently viewed session
|
|
1251
|
+
*/
|
|
1252
|
+
language?: string;
|
|
1253
|
+
/**
|
|
1254
|
+
* The locale of the currently viewed session
|
|
1255
|
+
*/
|
|
1256
|
+
locale?: string;
|
|
1257
|
+
/**
|
|
1258
|
+
* Any headers that should be passed through to the API requests
|
|
1259
|
+
*/
|
|
1260
|
+
passThroughHeaders?: Record<string, string>;
|
|
1261
|
+
};
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
1265
|
+
interface HttpClient$4 {
|
|
1266
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
1267
|
+
fetchWithAuth: typeof fetch;
|
|
1268
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1269
|
+
getActiveToken?: () => string | undefined;
|
|
1270
|
+
}
|
|
1271
|
+
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
1272
|
+
type HttpResponse$4<T = any> = {
|
|
1273
|
+
data: T;
|
|
1274
|
+
status: number;
|
|
1275
|
+
statusText: string;
|
|
1276
|
+
headers: any;
|
|
1277
|
+
request?: any;
|
|
1278
|
+
};
|
|
1279
|
+
type RequestOptions$4<_TResponse = any, Data = any> = {
|
|
1280
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1281
|
+
url: string;
|
|
1282
|
+
data?: Data;
|
|
1283
|
+
params?: URLSearchParams;
|
|
1284
|
+
} & APIMetadata$4;
|
|
1285
|
+
type APIMetadata$4 = {
|
|
1286
|
+
methodFqn?: string;
|
|
1287
|
+
entityFqdn?: string;
|
|
1288
|
+
packageName?: string;
|
|
1289
|
+
};
|
|
1290
|
+
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
1291
|
+
type EventDefinition$7<Payload = unknown, Type extends string = string> = {
|
|
1292
|
+
__type: 'event-definition';
|
|
1293
|
+
type: Type;
|
|
1294
|
+
isDomainEvent?: boolean;
|
|
1295
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1296
|
+
__payload: Payload;
|
|
1297
|
+
};
|
|
1298
|
+
declare function EventDefinition$7<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$7<Payload, Type>;
|
|
1299
|
+
type EventHandler$7<T extends EventDefinition$7> = (payload: T['__payload']) => void | Promise<void>;
|
|
1300
|
+
type BuildEventDefinition$7<T extends EventDefinition$7<any, string>> = (handler: EventHandler$7<T>) => void;
|
|
1301
|
+
|
|
1302
|
+
type ServicePluginMethodInput$4 = {
|
|
1303
|
+
request: any;
|
|
1304
|
+
metadata: any;
|
|
1305
|
+
};
|
|
1306
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
1307
|
+
type ServicePluginMethodMetadata$4 = {
|
|
1308
|
+
name: string;
|
|
1309
|
+
primaryHttpMappingPath: string;
|
|
1310
|
+
transformations: {
|
|
1311
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
1312
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
1316
|
+
__type: 'service-plugin-definition';
|
|
1317
|
+
componentType: string;
|
|
1318
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
1319
|
+
__contract: Contract;
|
|
1320
|
+
};
|
|
1321
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
1322
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
1323
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
1324
|
+
|
|
1325
|
+
type RequestContext$4 = {
|
|
1326
|
+
isSSR: boolean;
|
|
1327
|
+
host: string;
|
|
1328
|
+
protocol?: string;
|
|
1329
|
+
};
|
|
1330
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
1331
|
+
/**
|
|
1332
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1333
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1334
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1335
|
+
*/
|
|
1336
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1337
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
1338
|
+
_?: T;
|
|
1339
|
+
url?: string;
|
|
1340
|
+
method?: Method$4;
|
|
1341
|
+
params?: any;
|
|
1342
|
+
data?: any;
|
|
1343
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
1344
|
+
};
|
|
1345
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
1346
|
+
__isAmbassador: boolean;
|
|
1347
|
+
};
|
|
1348
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
1349
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1350
|
+
|
|
1351
|
+
declare global {
|
|
1352
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1353
|
+
interface SymbolConstructor {
|
|
1354
|
+
readonly observable: symbol;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1362
|
+
|
|
1363
|
+
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)).
|
|
1364
|
+
|
|
1365
|
+
@example
|
|
1366
|
+
```
|
|
1367
|
+
import type {EmptyObject} from 'type-fest';
|
|
1368
|
+
|
|
1369
|
+
// The following illustrates the problem with `{}`.
|
|
1370
|
+
const foo1: {} = {}; // Pass
|
|
1371
|
+
const foo2: {} = []; // Pass
|
|
1372
|
+
const foo3: {} = 42; // Pass
|
|
1373
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1374
|
+
|
|
1375
|
+
// With `EmptyObject` only the first case is valid.
|
|
1376
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1377
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1378
|
+
const bar3: EmptyObject = []; // Fail
|
|
1379
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1380
|
+
```
|
|
1381
|
+
|
|
1382
|
+
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}.
|
|
1383
|
+
|
|
1384
|
+
@category Object
|
|
1385
|
+
*/
|
|
1386
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
Returns a boolean for whether the two given types are equal.
|
|
1390
|
+
|
|
1391
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1392
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1393
|
+
|
|
1394
|
+
Use-cases:
|
|
1395
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1396
|
+
|
|
1397
|
+
@example
|
|
1398
|
+
```
|
|
1399
|
+
import type {IsEqual} from 'type-fest';
|
|
1400
|
+
|
|
1401
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1402
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1403
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1404
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1405
|
+
? IsEqual<Value[0], Item> extends true
|
|
1406
|
+
? true
|
|
1407
|
+
: Includes<rest, Item>
|
|
1408
|
+
: false;
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
@category Type Guard
|
|
1412
|
+
@category Utilities
|
|
1413
|
+
*/
|
|
1414
|
+
type IsEqual$4<A, B> =
|
|
1415
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1416
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1417
|
+
? true
|
|
1418
|
+
: false;
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
Filter out keys from an object.
|
|
1422
|
+
|
|
1423
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1424
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1425
|
+
Returns `Key` otherwise.
|
|
1426
|
+
|
|
1427
|
+
@example
|
|
1428
|
+
```
|
|
1429
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1430
|
+
//=> never
|
|
1431
|
+
```
|
|
1432
|
+
|
|
1433
|
+
@example
|
|
1434
|
+
```
|
|
1435
|
+
type Filtered = Filter<'bar', string>;
|
|
1436
|
+
//=> never
|
|
1437
|
+
```
|
|
1438
|
+
|
|
1439
|
+
@example
|
|
1440
|
+
```
|
|
1441
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1442
|
+
//=> 'bar'
|
|
1443
|
+
```
|
|
1444
|
+
|
|
1445
|
+
@see {Except}
|
|
1446
|
+
*/
|
|
1447
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1448
|
+
|
|
1449
|
+
type ExceptOptions$4 = {
|
|
1450
|
+
/**
|
|
1451
|
+
Disallow assigning non-specified properties.
|
|
1452
|
+
|
|
1453
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1454
|
+
|
|
1455
|
+
@default false
|
|
1456
|
+
*/
|
|
1457
|
+
requireExactProps?: boolean;
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
Create a type from an object type without certain keys.
|
|
1462
|
+
|
|
1463
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1464
|
+
|
|
1465
|
+
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.
|
|
1466
|
+
|
|
1467
|
+
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)).
|
|
1468
|
+
|
|
1469
|
+
@example
|
|
1470
|
+
```
|
|
1471
|
+
import type {Except} from 'type-fest';
|
|
1472
|
+
|
|
1473
|
+
type Foo = {
|
|
1474
|
+
a: number;
|
|
1475
|
+
b: string;
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1479
|
+
//=> {b: string}
|
|
1480
|
+
|
|
1481
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1482
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1483
|
+
|
|
1484
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1485
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1486
|
+
|
|
1487
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1488
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1489
|
+
```
|
|
1490
|
+
|
|
1491
|
+
@category Object
|
|
1492
|
+
*/
|
|
1493
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
1494
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1495
|
+
} & (Options['requireExactProps'] extends true
|
|
1496
|
+
? Partial<Record<KeysType, never>>
|
|
1497
|
+
: {});
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1501
|
+
|
|
1502
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1503
|
+
|
|
1504
|
+
@example
|
|
1505
|
+
```
|
|
1506
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1507
|
+
|
|
1508
|
+
interface Example {
|
|
1509
|
+
a: string;
|
|
1510
|
+
b: string | number;
|
|
1511
|
+
c?: string;
|
|
1512
|
+
d: {};
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1516
|
+
//=> 'a'
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1520
|
+
|
|
1521
|
+
@example
|
|
1522
|
+
```
|
|
1523
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1524
|
+
|
|
1525
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1526
|
+
//=> 'a' | 'c'
|
|
1527
|
+
```
|
|
1528
|
+
|
|
1529
|
+
@category Object
|
|
1530
|
+
*/
|
|
1531
|
+
type ConditionalKeys$4<Base, Condition> = NonNullable<
|
|
1532
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1533
|
+
{
|
|
1534
|
+
// Map through all the keys of the given base type.
|
|
1535
|
+
[Key in keyof Base]:
|
|
1536
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1537
|
+
Base[Key] extends Condition
|
|
1538
|
+
// Retain this key since the condition passes.
|
|
1539
|
+
? Key
|
|
1540
|
+
// Discard this key since the condition fails.
|
|
1541
|
+
: never;
|
|
1542
|
+
|
|
1543
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1544
|
+
}[keyof Base]
|
|
1545
|
+
>;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1549
|
+
|
|
1550
|
+
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.
|
|
1551
|
+
|
|
1552
|
+
@example
|
|
1553
|
+
```
|
|
1554
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1555
|
+
|
|
1556
|
+
class Awesome {
|
|
1557
|
+
name: string;
|
|
1558
|
+
successes: number;
|
|
1559
|
+
failures: bigint;
|
|
1560
|
+
|
|
1561
|
+
run() {}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1565
|
+
//=> {run: () => void}
|
|
1566
|
+
```
|
|
1567
|
+
|
|
1568
|
+
@example
|
|
1569
|
+
```
|
|
1570
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1571
|
+
|
|
1572
|
+
interface Example {
|
|
1573
|
+
a: string;
|
|
1574
|
+
b: string | number;
|
|
1575
|
+
c: () => void;
|
|
1576
|
+
d: {};
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1580
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
@category Object
|
|
1584
|
+
*/
|
|
1585
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
1586
|
+
Base,
|
|
1587
|
+
ConditionalKeys$4<Base, Condition>
|
|
1588
|
+
>;
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1592
|
+
* can either be a REST module or a host module.
|
|
1593
|
+
* This type is recursive, so it can describe nested modules.
|
|
1594
|
+
*/
|
|
1595
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$7<any> | ServicePluginDefinition$4<any> | {
|
|
1596
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
1597
|
+
};
|
|
1598
|
+
/**
|
|
1599
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1600
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1601
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1602
|
+
* do not match the given host (as they will not work with the given host).
|
|
1603
|
+
*/
|
|
1604
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
1605
|
+
done: T;
|
|
1606
|
+
recurse: T extends {
|
|
1607
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
1608
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$7<any> ? BuildEventDefinition$7<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
1609
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
1610
|
+
-1,
|
|
1611
|
+
0,
|
|
1612
|
+
1,
|
|
1613
|
+
2,
|
|
1614
|
+
3,
|
|
1615
|
+
4,
|
|
1616
|
+
5
|
|
1617
|
+
][Depth]> : never;
|
|
1618
|
+
}, EmptyObject$4>;
|
|
1619
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1620
|
+
type PublicMetadata$4 = {
|
|
1621
|
+
PACKAGE_NAME?: string;
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
declare global {
|
|
1625
|
+
interface ContextualClient {
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1630
|
+
* case a contextual client is available.
|
|
1631
|
+
*/
|
|
1632
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
1633
|
+
host: Host$4;
|
|
1634
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
1635
|
+
|
|
842
1636
|
interface PortfolioSettings {
|
|
843
1637
|
/**
|
|
844
1638
|
* The revision of the portfolio settings
|
|
@@ -1035,7 +1829,7 @@ interface UpdatePortfolioSettingsResponseNonNullableFields {
|
|
|
1035
1829
|
updatedPortfolioSettings?: PortfolioSettingsNonNullableFields;
|
|
1036
1830
|
}
|
|
1037
1831
|
|
|
1038
|
-
declare function createPortfolioSettings$1(httpClient: HttpClient): CreatePortfolioSettingsSignature;
|
|
1832
|
+
declare function createPortfolioSettings$1(httpClient: HttpClient$4): CreatePortfolioSettingsSignature;
|
|
1039
1833
|
interface CreatePortfolioSettingsSignature {
|
|
1040
1834
|
/**
|
|
1041
1835
|
* Create a new portfolio settings
|
|
@@ -1044,14 +1838,14 @@ interface CreatePortfolioSettingsSignature {
|
|
|
1044
1838
|
*/
|
|
1045
1839
|
(portfolioSettings: PortfolioSettings): Promise<PortfolioSettings & PortfolioSettingsNonNullableFields>;
|
|
1046
1840
|
}
|
|
1047
|
-
declare function getPortfolioSettings$1(httpClient: HttpClient): GetPortfolioSettingsSignature;
|
|
1841
|
+
declare function getPortfolioSettings$1(httpClient: HttpClient$4): GetPortfolioSettingsSignature;
|
|
1048
1842
|
interface GetPortfolioSettingsSignature {
|
|
1049
1843
|
/**
|
|
1050
1844
|
* Get the portfolio settings
|
|
1051
1845
|
*/
|
|
1052
1846
|
(): Promise<GetPortfolioSettingsResponse & GetPortfolioSettingsResponseNonNullableFields>;
|
|
1053
1847
|
}
|
|
1054
|
-
declare function updatePortfolioSettings$1(httpClient: HttpClient): UpdatePortfolioSettingsSignature;
|
|
1848
|
+
declare function updatePortfolioSettings$1(httpClient: HttpClient$4): UpdatePortfolioSettingsSignature;
|
|
1055
1849
|
interface UpdatePortfolioSettingsSignature {
|
|
1056
1850
|
/**
|
|
1057
1851
|
* Update the portfolio settings
|
|
@@ -1060,9 +1854,9 @@ interface UpdatePortfolioSettingsSignature {
|
|
|
1060
1854
|
(portfolioSettings: PortfolioSettings): Promise<UpdatePortfolioSettingsResponse & UpdatePortfolioSettingsResponseNonNullableFields>;
|
|
1061
1855
|
}
|
|
1062
1856
|
|
|
1063
|
-
declare const createPortfolioSettings: BuildRESTFunction<typeof createPortfolioSettings$1> & typeof createPortfolioSettings$1
|
|
1064
|
-
declare const getPortfolioSettings: BuildRESTFunction<typeof getPortfolioSettings$1> & typeof getPortfolioSettings$1
|
|
1065
|
-
declare const updatePortfolioSettings: BuildRESTFunction<typeof updatePortfolioSettings$1> & typeof updatePortfolioSettings$1
|
|
1857
|
+
declare const createPortfolioSettings: MaybeContext$4<BuildRESTFunction$4<typeof createPortfolioSettings$1> & typeof createPortfolioSettings$1>;
|
|
1858
|
+
declare const getPortfolioSettings: MaybeContext$4<BuildRESTFunction$4<typeof getPortfolioSettings$1> & typeof getPortfolioSettings$1>;
|
|
1859
|
+
declare const updatePortfolioSettings: MaybeContext$4<BuildRESTFunction$4<typeof updatePortfolioSettings$1> & typeof updatePortfolioSettings$1>;
|
|
1066
1860
|
|
|
1067
1861
|
type context$4_AddItemDirection = AddItemDirection;
|
|
1068
1862
|
declare const context$4_AddItemDirection: typeof AddItemDirection;
|
|
@@ -1089,22 +1883,432 @@ declare namespace context$4 {
|
|
|
1089
1883
|
export { type ActionEvent$4 as ActionEvent, context$4_AddItemDirection as AddItemDirection, type context$4_CreatePortfolioSettingsRequest as CreatePortfolioSettingsRequest, type context$4_CreatePortfolioSettingsResponse as CreatePortfolioSettingsResponse, type context$4_CreatePortfolioSettingsResponseNonNullableFields as CreatePortfolioSettingsResponseNonNullableFields, context$4_DefaultItemName as DefaultItemName, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, type context$4_GetPortfolioSettingsRequest as GetPortfolioSettingsRequest, type context$4_GetPortfolioSettingsResponse as GetPortfolioSettingsResponse, type context$4_GetPortfolioSettingsResponseNonNullableFields as GetPortfolioSettingsResponseNonNullableFields, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, type context$4_MediaSettings as MediaSettings, type MessageEnvelope$4 as MessageEnvelope, type context$4_PortfolioSettings as PortfolioSettings, type context$4_PortfolioSettingsNonNullableFields as PortfolioSettingsNonNullableFields, type context$4_ProjectItemSettings as ProjectItemSettings, type RestoreInfo$4 as RestoreInfo, type context$4_SiteMenuSettings as SiteMenuSettings, type context$4_UpdatePortfolioSettingsRequest as UpdatePortfolioSettingsRequest, type context$4_UpdatePortfolioSettingsResponse as UpdatePortfolioSettingsResponse, type context$4_UpdatePortfolioSettingsResponseNonNullableFields as UpdatePortfolioSettingsResponseNonNullableFields, WebhookIdentityType$4 as WebhookIdentityType, context$4_createPortfolioSettings as createPortfolioSettings, context$4_getPortfolioSettings as getPortfolioSettings, context$4_updatePortfolioSettings as updatePortfolioSettings };
|
|
1090
1884
|
}
|
|
1091
1885
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1886
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
1887
|
+
__type: 'host';
|
|
1888
|
+
create(host: H): T;
|
|
1889
|
+
};
|
|
1890
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
1891
|
+
type Host$3<Environment = unknown> = {
|
|
1892
|
+
channel: {
|
|
1893
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1894
|
+
disconnect: () => void;
|
|
1895
|
+
} | Promise<{
|
|
1896
|
+
disconnect: () => void;
|
|
1897
|
+
}>;
|
|
1898
|
+
};
|
|
1899
|
+
environment?: Environment;
|
|
1900
|
+
/**
|
|
1901
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1902
|
+
*/
|
|
1903
|
+
apiBaseUrl?: string;
|
|
1904
|
+
/**
|
|
1905
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1906
|
+
* like internationalization, billing, etc.
|
|
1907
|
+
*/
|
|
1908
|
+
essentials?: {
|
|
1909
|
+
/**
|
|
1910
|
+
* The language of the currently viewed session
|
|
1911
|
+
*/
|
|
1912
|
+
language?: string;
|
|
1913
|
+
/**
|
|
1914
|
+
* The locale of the currently viewed session
|
|
1915
|
+
*/
|
|
1916
|
+
locale?: string;
|
|
1917
|
+
/**
|
|
1918
|
+
* Any headers that should be passed through to the API requests
|
|
1919
|
+
*/
|
|
1920
|
+
passThroughHeaders?: Record<string, string>;
|
|
1921
|
+
};
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1924
|
+
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
1925
|
+
interface HttpClient$3 {
|
|
1926
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
1927
|
+
fetchWithAuth: typeof fetch;
|
|
1928
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1929
|
+
getActiveToken?: () => string | undefined;
|
|
1930
|
+
}
|
|
1931
|
+
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
1932
|
+
type HttpResponse$3<T = any> = {
|
|
1933
|
+
data: T;
|
|
1934
|
+
status: number;
|
|
1935
|
+
statusText: string;
|
|
1936
|
+
headers: any;
|
|
1937
|
+
request?: any;
|
|
1938
|
+
};
|
|
1939
|
+
type RequestOptions$3<_TResponse = any, Data = any> = {
|
|
1940
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1941
|
+
url: string;
|
|
1942
|
+
data?: Data;
|
|
1943
|
+
params?: URLSearchParams;
|
|
1944
|
+
} & APIMetadata$3;
|
|
1945
|
+
type APIMetadata$3 = {
|
|
1946
|
+
methodFqn?: string;
|
|
1947
|
+
entityFqdn?: string;
|
|
1948
|
+
packageName?: string;
|
|
1949
|
+
};
|
|
1950
|
+
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
1951
|
+
type EventDefinition$6<Payload = unknown, Type extends string = string> = {
|
|
1952
|
+
__type: 'event-definition';
|
|
1953
|
+
type: Type;
|
|
1954
|
+
isDomainEvent?: boolean;
|
|
1955
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1956
|
+
__payload: Payload;
|
|
1957
|
+
};
|
|
1958
|
+
declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
|
|
1959
|
+
type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
|
|
1960
|
+
type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
|
|
1961
|
+
|
|
1962
|
+
type ServicePluginMethodInput$3 = {
|
|
1963
|
+
request: any;
|
|
1964
|
+
metadata: any;
|
|
1965
|
+
};
|
|
1966
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
1967
|
+
type ServicePluginMethodMetadata$3 = {
|
|
1968
|
+
name: string;
|
|
1969
|
+
primaryHttpMappingPath: string;
|
|
1970
|
+
transformations: {
|
|
1971
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
1972
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1973
|
+
};
|
|
1974
|
+
};
|
|
1975
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
1976
|
+
__type: 'service-plugin-definition';
|
|
1977
|
+
componentType: string;
|
|
1978
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
1979
|
+
__contract: Contract;
|
|
1980
|
+
};
|
|
1981
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
1982
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
1983
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
1984
|
+
|
|
1985
|
+
type RequestContext$3 = {
|
|
1986
|
+
isSSR: boolean;
|
|
1987
|
+
host: string;
|
|
1988
|
+
protocol?: string;
|
|
1989
|
+
};
|
|
1990
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
1991
|
+
/**
|
|
1992
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1993
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1994
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1995
|
+
*/
|
|
1996
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1997
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
1998
|
+
_?: T;
|
|
1999
|
+
url?: string;
|
|
2000
|
+
method?: Method$3;
|
|
2001
|
+
params?: any;
|
|
2002
|
+
data?: any;
|
|
2003
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
2004
|
+
};
|
|
2005
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
2006
|
+
__isAmbassador: boolean;
|
|
2007
|
+
};
|
|
2008
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
2009
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
2010
|
+
|
|
2011
|
+
declare global {
|
|
2012
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2013
|
+
interface SymbolConstructor {
|
|
2014
|
+
readonly observable: symbol;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
2019
|
+
|
|
2020
|
+
/**
|
|
2021
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
2022
|
+
|
|
2023
|
+
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)).
|
|
2024
|
+
|
|
2025
|
+
@example
|
|
2026
|
+
```
|
|
2027
|
+
import type {EmptyObject} from 'type-fest';
|
|
2028
|
+
|
|
2029
|
+
// The following illustrates the problem with `{}`.
|
|
2030
|
+
const foo1: {} = {}; // Pass
|
|
2031
|
+
const foo2: {} = []; // Pass
|
|
2032
|
+
const foo3: {} = 42; // Pass
|
|
2033
|
+
const foo4: {} = {a: 1}; // Pass
|
|
2034
|
+
|
|
2035
|
+
// With `EmptyObject` only the first case is valid.
|
|
2036
|
+
const bar1: EmptyObject = {}; // Pass
|
|
2037
|
+
const bar2: EmptyObject = 42; // Fail
|
|
2038
|
+
const bar3: EmptyObject = []; // Fail
|
|
2039
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
2040
|
+
```
|
|
2041
|
+
|
|
2042
|
+
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}.
|
|
2043
|
+
|
|
2044
|
+
@category Object
|
|
2045
|
+
*/
|
|
2046
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
Returns a boolean for whether the two given types are equal.
|
|
2050
|
+
|
|
2051
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
2052
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
2053
|
+
|
|
2054
|
+
Use-cases:
|
|
2055
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
2056
|
+
|
|
2057
|
+
@example
|
|
2058
|
+
```
|
|
2059
|
+
import type {IsEqual} from 'type-fest';
|
|
2060
|
+
|
|
2061
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
2062
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
2063
|
+
type Includes<Value extends readonly any[], Item> =
|
|
2064
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
2065
|
+
? IsEqual<Value[0], Item> extends true
|
|
2066
|
+
? true
|
|
2067
|
+
: Includes<rest, Item>
|
|
2068
|
+
: false;
|
|
2069
|
+
```
|
|
2070
|
+
|
|
2071
|
+
@category Type Guard
|
|
2072
|
+
@category Utilities
|
|
2073
|
+
*/
|
|
2074
|
+
type IsEqual$3<A, B> =
|
|
2075
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
2076
|
+
(<G>() => G extends B ? 1 : 2)
|
|
2077
|
+
? true
|
|
2078
|
+
: false;
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
Filter out keys from an object.
|
|
2082
|
+
|
|
2083
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
2084
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
2085
|
+
Returns `Key` otherwise.
|
|
2086
|
+
|
|
2087
|
+
@example
|
|
2088
|
+
```
|
|
2089
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
2090
|
+
//=> never
|
|
2091
|
+
```
|
|
2092
|
+
|
|
2093
|
+
@example
|
|
2094
|
+
```
|
|
2095
|
+
type Filtered = Filter<'bar', string>;
|
|
2096
|
+
//=> never
|
|
2097
|
+
```
|
|
2098
|
+
|
|
2099
|
+
@example
|
|
2100
|
+
```
|
|
2101
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
2102
|
+
//=> 'bar'
|
|
2103
|
+
```
|
|
2104
|
+
|
|
2105
|
+
@see {Except}
|
|
2106
|
+
*/
|
|
2107
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
2108
|
+
|
|
2109
|
+
type ExceptOptions$3 = {
|
|
2110
|
+
/**
|
|
2111
|
+
Disallow assigning non-specified properties.
|
|
2112
|
+
|
|
2113
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
2114
|
+
|
|
2115
|
+
@default false
|
|
2116
|
+
*/
|
|
2117
|
+
requireExactProps?: boolean;
|
|
2118
|
+
};
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
Create a type from an object type without certain keys.
|
|
2122
|
+
|
|
2123
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
2124
|
+
|
|
2125
|
+
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.
|
|
2126
|
+
|
|
2127
|
+
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)).
|
|
2128
|
+
|
|
2129
|
+
@example
|
|
2130
|
+
```
|
|
2131
|
+
import type {Except} from 'type-fest';
|
|
2132
|
+
|
|
2133
|
+
type Foo = {
|
|
2134
|
+
a: number;
|
|
2135
|
+
b: string;
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
2139
|
+
//=> {b: string}
|
|
2140
|
+
|
|
2141
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
2142
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
2143
|
+
|
|
2144
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
2145
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
2146
|
+
|
|
2147
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
2148
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
2149
|
+
```
|
|
2150
|
+
|
|
2151
|
+
@category Object
|
|
2152
|
+
*/
|
|
2153
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
2154
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
2155
|
+
} & (Options['requireExactProps'] extends true
|
|
2156
|
+
? Partial<Record<KeysType, never>>
|
|
2157
|
+
: {});
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
2161
|
+
|
|
2162
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
2163
|
+
|
|
2164
|
+
@example
|
|
2165
|
+
```
|
|
2166
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2167
|
+
|
|
2168
|
+
interface Example {
|
|
2169
|
+
a: string;
|
|
2170
|
+
b: string | number;
|
|
2171
|
+
c?: string;
|
|
2172
|
+
d: {};
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
2176
|
+
//=> 'a'
|
|
2177
|
+
```
|
|
2178
|
+
|
|
2179
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
2180
|
+
|
|
2181
|
+
@example
|
|
2182
|
+
```
|
|
2183
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2184
|
+
|
|
2185
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
2186
|
+
//=> 'a' | 'c'
|
|
2187
|
+
```
|
|
2188
|
+
|
|
2189
|
+
@category Object
|
|
2190
|
+
*/
|
|
2191
|
+
type ConditionalKeys$3<Base, Condition> = NonNullable<
|
|
2192
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
2193
|
+
{
|
|
2194
|
+
// Map through all the keys of the given base type.
|
|
2195
|
+
[Key in keyof Base]:
|
|
2196
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
2197
|
+
Base[Key] extends Condition
|
|
2198
|
+
// Retain this key since the condition passes.
|
|
2199
|
+
? Key
|
|
2200
|
+
// Discard this key since the condition fails.
|
|
2201
|
+
: never;
|
|
2202
|
+
|
|
2203
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
2204
|
+
}[keyof Base]
|
|
2205
|
+
>;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
2209
|
+
|
|
2210
|
+
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.
|
|
2211
|
+
|
|
2212
|
+
@example
|
|
2213
|
+
```
|
|
2214
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
2215
|
+
|
|
2216
|
+
class Awesome {
|
|
2217
|
+
name: string;
|
|
2218
|
+
successes: number;
|
|
2219
|
+
failures: bigint;
|
|
2220
|
+
|
|
2221
|
+
run() {}
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
2225
|
+
//=> {run: () => void}
|
|
2226
|
+
```
|
|
2227
|
+
|
|
2228
|
+
@example
|
|
2229
|
+
```
|
|
2230
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
2231
|
+
|
|
2232
|
+
interface Example {
|
|
2233
|
+
a: string;
|
|
2234
|
+
b: string | number;
|
|
2235
|
+
c: () => void;
|
|
2236
|
+
d: {};
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
2240
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
2241
|
+
```
|
|
2242
|
+
|
|
2243
|
+
@category Object
|
|
2244
|
+
*/
|
|
2245
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
2246
|
+
Base,
|
|
2247
|
+
ConditionalKeys$3<Base, Condition>
|
|
2248
|
+
>;
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
2252
|
+
* can either be a REST module or a host module.
|
|
2253
|
+
* This type is recursive, so it can describe nested modules.
|
|
2254
|
+
*/
|
|
2255
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$6<any> | ServicePluginDefinition$3<any> | {
|
|
2256
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
2257
|
+
};
|
|
2258
|
+
/**
|
|
2259
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
2260
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
2261
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
2262
|
+
* do not match the given host (as they will not work with the given host).
|
|
2263
|
+
*/
|
|
2264
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
2265
|
+
done: T;
|
|
2266
|
+
recurse: T extends {
|
|
2267
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
2268
|
+
} ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$6<any> ? BuildEventDefinition$6<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
|
|
2269
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
2270
|
+
-1,
|
|
2271
|
+
0,
|
|
2272
|
+
1,
|
|
2273
|
+
2,
|
|
2274
|
+
3,
|
|
2275
|
+
4,
|
|
2276
|
+
5
|
|
2277
|
+
][Depth]> : never;
|
|
2278
|
+
}, EmptyObject$3>;
|
|
2279
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
2280
|
+
type PublicMetadata$3 = {
|
|
2281
|
+
PACKAGE_NAME?: string;
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
declare global {
|
|
2285
|
+
interface ContextualClient {
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* A type used to create concerete types from SDK descriptors in
|
|
2290
|
+
* case a contextual client is available.
|
|
2291
|
+
*/
|
|
2292
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
2293
|
+
host: Host$3;
|
|
2294
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
2295
|
+
|
|
2296
|
+
/** ProjectItem is the main entity of ProjectItemsService */
|
|
2297
|
+
interface Item extends ItemMetadataOneOf {
|
|
2298
|
+
/** Information about the image. */
|
|
2299
|
+
image?: Image$2;
|
|
2300
|
+
/** Information about the video. */
|
|
2301
|
+
video?: Video$2;
|
|
2302
|
+
/**
|
|
2303
|
+
* Id of the Project the items are part of
|
|
2304
|
+
* Project must exist before adding items to it. You can create a project using the [ProjectService](https://dev.wix.com/docs/rest/business-solutions/portfolio/project)
|
|
2305
|
+
*/
|
|
2306
|
+
projectId?: string | null;
|
|
2307
|
+
/**
|
|
2308
|
+
* Item ID.
|
|
2309
|
+
* @readonly
|
|
2310
|
+
*/
|
|
2311
|
+
_id?: string | null;
|
|
1108
2312
|
/**
|
|
1109
2313
|
* Index that determines which position a media item is displayed in the gallery. <br />
|
|
1110
2314
|
*
|
|
@@ -1866,7 +3070,7 @@ interface DuplicateProjectItemsOptions {
|
|
|
1866
3070
|
targetProjectId: string;
|
|
1867
3071
|
}
|
|
1868
3072
|
|
|
1869
|
-
declare function createProjectItem$1(httpClient: HttpClient): CreateProjectItemSignature;
|
|
3073
|
+
declare function createProjectItem$1(httpClient: HttpClient$3): CreateProjectItemSignature;
|
|
1870
3074
|
interface CreateProjectItemSignature {
|
|
1871
3075
|
/**
|
|
1872
3076
|
* Creates a new ProjectItem
|
|
@@ -1875,14 +3079,14 @@ interface CreateProjectItemSignature {
|
|
|
1875
3079
|
*/
|
|
1876
3080
|
(item: Item): Promise<Item & ItemNonNullableFields>;
|
|
1877
3081
|
}
|
|
1878
|
-
declare function bulkCreateProjectItems$1(httpClient: HttpClient): BulkCreateProjectItemsSignature;
|
|
3082
|
+
declare function bulkCreateProjectItems$1(httpClient: HttpClient$3): BulkCreateProjectItemsSignature;
|
|
1879
3083
|
interface BulkCreateProjectItemsSignature {
|
|
1880
3084
|
/**
|
|
1881
3085
|
* Create items in bulk
|
|
1882
3086
|
*/
|
|
1883
3087
|
(options?: BulkCreateProjectItemsOptions | undefined): Promise<BulkCreateProjectItemsResponse & BulkCreateProjectItemsResponseNonNullableFields>;
|
|
1884
3088
|
}
|
|
1885
|
-
declare function getProjectItem$1(httpClient: HttpClient): GetProjectItemSignature;
|
|
3089
|
+
declare function getProjectItem$1(httpClient: HttpClient$3): GetProjectItemSignature;
|
|
1886
3090
|
interface GetProjectItemSignature {
|
|
1887
3091
|
/**
|
|
1888
3092
|
* Get a ProjectItem by id
|
|
@@ -1891,7 +3095,7 @@ interface GetProjectItemSignature {
|
|
|
1891
3095
|
*/
|
|
1892
3096
|
(itemId: string): Promise<Item & ItemNonNullableFields>;
|
|
1893
3097
|
}
|
|
1894
|
-
declare function listProjectItems$1(httpClient: HttpClient): ListProjectItemsSignature;
|
|
3098
|
+
declare function listProjectItems$1(httpClient: HttpClient$3): ListProjectItemsSignature;
|
|
1895
3099
|
interface ListProjectItemsSignature {
|
|
1896
3100
|
/**
|
|
1897
3101
|
* List all items in project
|
|
@@ -1899,7 +3103,7 @@ interface ListProjectItemsSignature {
|
|
|
1899
3103
|
*/
|
|
1900
3104
|
(projectId: string, options?: ListProjectItemsOptions | undefined): Promise<ListProjectItemsResponse & ListProjectItemsResponseNonNullableFields>;
|
|
1901
3105
|
}
|
|
1902
|
-
declare function updateProjectItem$1(httpClient: HttpClient): UpdateProjectItemSignature;
|
|
3106
|
+
declare function updateProjectItem$1(httpClient: HttpClient$3): UpdateProjectItemSignature;
|
|
1903
3107
|
interface UpdateProjectItemSignature {
|
|
1904
3108
|
/**
|
|
1905
3109
|
* Update a ProjectItem, supports partial update
|
|
@@ -1908,14 +3112,14 @@ interface UpdateProjectItemSignature {
|
|
|
1908
3112
|
*/
|
|
1909
3113
|
(_id: string | null, item: UpdateProjectItem): Promise<Item & ItemNonNullableFields>;
|
|
1910
3114
|
}
|
|
1911
|
-
declare function bulkUpdateProjectItems$1(httpClient: HttpClient): BulkUpdateProjectItemsSignature;
|
|
3115
|
+
declare function bulkUpdateProjectItems$1(httpClient: HttpClient$3): BulkUpdateProjectItemsSignature;
|
|
1912
3116
|
interface BulkUpdateProjectItemsSignature {
|
|
1913
3117
|
/**
|
|
1914
3118
|
* Update ProjectItems in bulk
|
|
1915
3119
|
*/
|
|
1916
3120
|
(options?: BulkUpdateProjectItemsOptions | undefined): Promise<BulkUpdateProjectItemsResponse & BulkUpdateProjectItemsResponseNonNullableFields>;
|
|
1917
3121
|
}
|
|
1918
|
-
declare function deleteProjectItem$1(httpClient: HttpClient): DeleteProjectItemSignature;
|
|
3122
|
+
declare function deleteProjectItem$1(httpClient: HttpClient$3): DeleteProjectItemSignature;
|
|
1919
3123
|
interface DeleteProjectItemSignature {
|
|
1920
3124
|
/**
|
|
1921
3125
|
* Delete a ProjectItem
|
|
@@ -1923,14 +3127,14 @@ interface DeleteProjectItemSignature {
|
|
|
1923
3127
|
*/
|
|
1924
3128
|
(itemId: string): Promise<DeleteProjectItemResponse & DeleteProjectItemResponseNonNullableFields>;
|
|
1925
3129
|
}
|
|
1926
|
-
declare function bulkDeleteProjectItems$1(httpClient: HttpClient): BulkDeleteProjectItemsSignature;
|
|
3130
|
+
declare function bulkDeleteProjectItems$1(httpClient: HttpClient$3): BulkDeleteProjectItemsSignature;
|
|
1927
3131
|
interface BulkDeleteProjectItemsSignature {
|
|
1928
3132
|
/**
|
|
1929
3133
|
* Delete items in bulk
|
|
1930
3134
|
*/
|
|
1931
3135
|
(options: BulkDeleteProjectItemsOptions): Promise<BulkDeleteProjectItemsResponse & BulkDeleteProjectItemsResponseNonNullableFields>;
|
|
1932
3136
|
}
|
|
1933
|
-
declare function duplicateProjectItems$1(httpClient: HttpClient): DuplicateProjectItemsSignature;
|
|
3137
|
+
declare function duplicateProjectItems$1(httpClient: HttpClient$3): DuplicateProjectItemsSignature;
|
|
1934
3138
|
interface DuplicateProjectItemsSignature {
|
|
1935
3139
|
/**
|
|
1936
3140
|
* Given an 'origin' Project and 'target' Project, copy all ProjectItems in 'origin' Project to 'target' Project.
|
|
@@ -1938,21 +3142,39 @@ interface DuplicateProjectItemsSignature {
|
|
|
1938
3142
|
*/
|
|
1939
3143
|
(originProjectId: string, options: DuplicateProjectItemsOptions): Promise<DuplicateProjectItemsResponse & DuplicateProjectItemsResponseNonNullableFields>;
|
|
1940
3144
|
}
|
|
1941
|
-
declare const onProjectItemCreated$1: EventDefinition<ProjectItemCreatedEnvelope, "wix.portfolio.project_items.v1.project_item_created">;
|
|
1942
|
-
declare const onProjectItemUpdated$1: EventDefinition<ProjectItemUpdatedEnvelope, "wix.portfolio.project_items.v1.project_item_updated">;
|
|
1943
|
-
declare const onProjectItemDeleted$1: EventDefinition<ProjectItemDeletedEnvelope, "wix.portfolio.project_items.v1.project_item_deleted">;
|
|
3145
|
+
declare const onProjectItemCreated$1: EventDefinition$6<ProjectItemCreatedEnvelope, "wix.portfolio.project_items.v1.project_item_created">;
|
|
3146
|
+
declare const onProjectItemUpdated$1: EventDefinition$6<ProjectItemUpdatedEnvelope, "wix.portfolio.project_items.v1.project_item_updated">;
|
|
3147
|
+
declare const onProjectItemDeleted$1: EventDefinition$6<ProjectItemDeletedEnvelope, "wix.portfolio.project_items.v1.project_item_deleted">;
|
|
3148
|
+
|
|
3149
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
3150
|
+
__type: 'event-definition';
|
|
3151
|
+
type: Type;
|
|
3152
|
+
isDomainEvent?: boolean;
|
|
3153
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3154
|
+
__payload: Payload;
|
|
3155
|
+
};
|
|
3156
|
+
declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
|
|
3157
|
+
type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
|
|
3158
|
+
type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
|
|
3159
|
+
|
|
3160
|
+
declare global {
|
|
3161
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3162
|
+
interface SymbolConstructor {
|
|
3163
|
+
readonly observable: symbol;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
1944
3166
|
|
|
1945
|
-
declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
3167
|
+
declare function createEventModule$2<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
|
|
1946
3168
|
|
|
1947
|
-
declare const createProjectItem: BuildRESTFunction<typeof createProjectItem$1> & typeof createProjectItem$1
|
|
1948
|
-
declare const bulkCreateProjectItems: BuildRESTFunction<typeof bulkCreateProjectItems$1> & typeof bulkCreateProjectItems$1
|
|
1949
|
-
declare const getProjectItem: BuildRESTFunction<typeof getProjectItem$1> & typeof getProjectItem$1
|
|
1950
|
-
declare const listProjectItems: BuildRESTFunction<typeof listProjectItems$1> & typeof listProjectItems$1
|
|
1951
|
-
declare const updateProjectItem: BuildRESTFunction<typeof updateProjectItem$1> & typeof updateProjectItem$1
|
|
1952
|
-
declare const bulkUpdateProjectItems: BuildRESTFunction<typeof bulkUpdateProjectItems$1> & typeof bulkUpdateProjectItems$1
|
|
1953
|
-
declare const deleteProjectItem: BuildRESTFunction<typeof deleteProjectItem$1> & typeof deleteProjectItem$1
|
|
1954
|
-
declare const bulkDeleteProjectItems: BuildRESTFunction<typeof bulkDeleteProjectItems$1> & typeof bulkDeleteProjectItems$1
|
|
1955
|
-
declare const duplicateProjectItems: BuildRESTFunction<typeof duplicateProjectItems$1> & typeof duplicateProjectItems$1
|
|
3169
|
+
declare const createProjectItem: MaybeContext$3<BuildRESTFunction$3<typeof createProjectItem$1> & typeof createProjectItem$1>;
|
|
3170
|
+
declare const bulkCreateProjectItems: MaybeContext$3<BuildRESTFunction$3<typeof bulkCreateProjectItems$1> & typeof bulkCreateProjectItems$1>;
|
|
3171
|
+
declare const getProjectItem: MaybeContext$3<BuildRESTFunction$3<typeof getProjectItem$1> & typeof getProjectItem$1>;
|
|
3172
|
+
declare const listProjectItems: MaybeContext$3<BuildRESTFunction$3<typeof listProjectItems$1> & typeof listProjectItems$1>;
|
|
3173
|
+
declare const updateProjectItem: MaybeContext$3<BuildRESTFunction$3<typeof updateProjectItem$1> & typeof updateProjectItem$1>;
|
|
3174
|
+
declare const bulkUpdateProjectItems: MaybeContext$3<BuildRESTFunction$3<typeof bulkUpdateProjectItems$1> & typeof bulkUpdateProjectItems$1>;
|
|
3175
|
+
declare const deleteProjectItem: MaybeContext$3<BuildRESTFunction$3<typeof deleteProjectItem$1> & typeof deleteProjectItem$1>;
|
|
3176
|
+
declare const bulkDeleteProjectItems: MaybeContext$3<BuildRESTFunction$3<typeof bulkDeleteProjectItems$1> & typeof bulkDeleteProjectItems$1>;
|
|
3177
|
+
declare const duplicateProjectItems: MaybeContext$3<BuildRESTFunction$3<typeof duplicateProjectItems$1> & typeof duplicateProjectItems$1>;
|
|
1956
3178
|
|
|
1957
3179
|
type _publicOnProjectItemCreatedType = typeof onProjectItemCreated$1;
|
|
1958
3180
|
/** */
|
|
@@ -2039,72 +3261,477 @@ declare namespace context$3 {
|
|
|
2039
3261
|
export { type ActionEvent$3 as ActionEvent, type App$1 as App, type ApplicationError$1 as ApplicationError, type BaseEventMetadata$2 as BaseEventMetadata, type BulkActionMetadata$1 as BulkActionMetadata, type context$3_BulkCreateProjectItemResult as BulkCreateProjectItemResult, type context$3_BulkCreateProjectItemsOptions as BulkCreateProjectItemsOptions, type context$3_BulkCreateProjectItemsRequest as BulkCreateProjectItemsRequest, type context$3_BulkCreateProjectItemsResponse as BulkCreateProjectItemsResponse, type context$3_BulkCreateProjectItemsResponseNonNullableFields as BulkCreateProjectItemsResponseNonNullableFields, type context$3_BulkDeleteProjectItemResult as BulkDeleteProjectItemResult, type context$3_BulkDeleteProjectItemsOptions as BulkDeleteProjectItemsOptions, type context$3_BulkDeleteProjectItemsRequest as BulkDeleteProjectItemsRequest, type context$3_BulkDeleteProjectItemsResponse as BulkDeleteProjectItemsResponse, type context$3_BulkDeleteProjectItemsResponseNonNullableFields as BulkDeleteProjectItemsResponseNonNullableFields, type context$3_BulkUpdateProjectItemResult as BulkUpdateProjectItemResult, type context$3_BulkUpdateProjectItemsOptions as BulkUpdateProjectItemsOptions, type context$3_BulkUpdateProjectItemsRequest as BulkUpdateProjectItemsRequest, type context$3_BulkUpdateProjectItemsResponse as BulkUpdateProjectItemsResponse, type context$3_BulkUpdateProjectItemsResponseNonNullableFields as BulkUpdateProjectItemsResponseNonNullableFields, type context$3_CreateProjectGalleryRequest as CreateProjectGalleryRequest, type context$3_CreateProjectGalleryResponse as CreateProjectGalleryResponse, type context$3_CreateProjectItemRequest as CreateProjectItemRequest, type context$3_CreateProjectItemResponse as CreateProjectItemResponse, type context$3_CreateProjectItemResponseNonNullableFields as CreateProjectItemResponseNonNullableFields, type CursorPaging$3 as CursorPaging, type Cursors$3 as Cursors, type context$3_DeleteProjectItemRequest as DeleteProjectItemRequest, type context$3_DeleteProjectItemResponse as DeleteProjectItemResponse, type context$3_DeleteProjectItemResponseNonNullableFields as DeleteProjectItemResponseNonNullableFields, type DeletedProjectRestored$1 as DeletedProjectRestored, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type context$3_DuplicateProjectItemsOptions as DuplicateProjectItemsOptions, type context$3_DuplicateProjectItemsRequest as DuplicateProjectItemsRequest, type context$3_DuplicateProjectItemsResponse as DuplicateProjectItemsResponse, type context$3_DuplicateProjectItemsResponseNonNullableFields as DuplicateProjectItemsResponseNonNullableFields, type Empty$2 as Empty, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type EventMetadata$2 as EventMetadata, type File$1 as File, type context$3_GenerateTokenForProjectItemsRequest as GenerateTokenForProjectItemsRequest, type context$3_GenerateTokenForProjectItemsResponse as GenerateTokenForProjectItemsResponse, type context$3_GetProjectItemRequest as GetProjectItemRequest, type context$3_GetProjectItemResponse as GetProjectItemResponse, type context$3_GetProjectItemResponseNonNullableFields as GetProjectItemResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type Image$2 as Image, ImageType$2 as ImageType, type InvalidateCache$1 as InvalidateCache, type InvalidateCacheGetByOneOf$1 as InvalidateCacheGetByOneOf, type context$3_Item as Item, type ItemMetadata$1 as ItemMetadata, type context$3_ItemMetadataOneOf as ItemMetadataOneOf, type context$3_ItemNonNullableFields as ItemNonNullableFields, type context$3_Link as Link, type context$3_ListProjectItemsOptions as ListProjectItemsOptions, type context$3_ListProjectItemsRequest as ListProjectItemsRequest, type context$3_ListProjectItemsResponse as ListProjectItemsResponse, type context$3_ListProjectItemsResponseNonNullableFields as ListProjectItemsResponseNonNullableFields, type context$3_MaskedItem as MaskedItem, type MessageEnvelope$3 as MessageEnvelope, type Page$1 as Page, type Paging$2 as Paging, type PagingMetadataV2$3 as PagingMetadataV2, type Point$2 as Point, type context$3_ProjectItemCreatedEnvelope as ProjectItemCreatedEnvelope, type context$3_ProjectItemDeletedEnvelope as ProjectItemDeletedEnvelope, type context$3_ProjectItemMediaToken as ProjectItemMediaToken, type context$3_ProjectItemUpdatedEnvelope as ProjectItemUpdatedEnvelope, type context$3_QueryProjectItemsRequest as QueryProjectItemsRequest, type context$3_QueryProjectItemsResponse as QueryProjectItemsResponse, type QueryV2$2 as QueryV2, type QueryV2PagingMethodOneOf$2 as QueryV2PagingMethodOneOf, type RestoreInfo$3 as RestoreInfo, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type context$3_Tags as Tags, context$3_Type as Type, type URI$1 as URI, type UnsharpMasking$2 as UnsharpMasking, type context$3_UpdateProjectItem as UpdateProjectItem, type context$3_UpdateProjectItemRequest as UpdateProjectItemRequest, type context$3_UpdateProjectItemResponse as UpdateProjectItemResponse, type context$3_UpdateProjectItemResponseNonNullableFields as UpdateProjectItemResponseNonNullableFields, type Video$2 as Video, type VideoResolution$2 as VideoResolution, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnProjectItemCreatedType as _publicOnProjectItemCreatedType, type context$3__publicOnProjectItemDeletedType as _publicOnProjectItemDeletedType, type context$3__publicOnProjectItemUpdatedType as _publicOnProjectItemUpdatedType, context$3_bulkCreateProjectItems as bulkCreateProjectItems, context$3_bulkDeleteProjectItems as bulkDeleteProjectItems, context$3_bulkUpdateProjectItems as bulkUpdateProjectItems, context$3_createProjectItem as createProjectItem, context$3_deleteProjectItem as deleteProjectItem, context$3_duplicateProjectItems as duplicateProjectItems, context$3_getProjectItem as getProjectItem, context$3_listProjectItems as listProjectItems, context$3_onProjectItemCreated as onProjectItemCreated, context$3_onProjectItemDeleted as onProjectItemDeleted, context$3_onProjectItemUpdated as onProjectItemUpdated, onProjectItemCreated$1 as publicOnProjectItemCreated, onProjectItemDeleted$1 as publicOnProjectItemDeleted, onProjectItemUpdated$1 as publicOnProjectItemUpdated, context$3_updateProjectItem as updateProjectItem };
|
|
2040
3262
|
}
|
|
2041
3263
|
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
/**
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
* indicates if the project is synced from external platform (via integration page) and therefore will be updated from the external platform on daily basis
|
|
2087
|
-
* @readonly
|
|
2088
|
-
*/
|
|
2089
|
-
syncedProject?: boolean | null;
|
|
2090
|
-
}
|
|
2091
|
-
/** @oneof */
|
|
2092
|
-
interface ProjectCoverOneOf$1 {
|
|
2093
|
-
/** project's cover photo */
|
|
2094
|
-
coverImage?: Image$1;
|
|
2095
|
-
/** project's cover video */
|
|
2096
|
-
coverVideo?: Video$1;
|
|
3264
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
3265
|
+
__type: 'host';
|
|
3266
|
+
create(host: H): T;
|
|
3267
|
+
};
|
|
3268
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
3269
|
+
type Host$2<Environment = unknown> = {
|
|
3270
|
+
channel: {
|
|
3271
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
3272
|
+
disconnect: () => void;
|
|
3273
|
+
} | Promise<{
|
|
3274
|
+
disconnect: () => void;
|
|
3275
|
+
}>;
|
|
3276
|
+
};
|
|
3277
|
+
environment?: Environment;
|
|
3278
|
+
/**
|
|
3279
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3280
|
+
*/
|
|
3281
|
+
apiBaseUrl?: string;
|
|
3282
|
+
/**
|
|
3283
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3284
|
+
* like internationalization, billing, etc.
|
|
3285
|
+
*/
|
|
3286
|
+
essentials?: {
|
|
3287
|
+
/**
|
|
3288
|
+
* The language of the currently viewed session
|
|
3289
|
+
*/
|
|
3290
|
+
language?: string;
|
|
3291
|
+
/**
|
|
3292
|
+
* The locale of the currently viewed session
|
|
3293
|
+
*/
|
|
3294
|
+
locale?: string;
|
|
3295
|
+
/**
|
|
3296
|
+
* Any headers that should be passed through to the API requests
|
|
3297
|
+
*/
|
|
3298
|
+
passThroughHeaders?: Record<string, string>;
|
|
3299
|
+
};
|
|
3300
|
+
};
|
|
3301
|
+
|
|
3302
|
+
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
3303
|
+
interface HttpClient$2 {
|
|
3304
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
3305
|
+
fetchWithAuth: typeof fetch;
|
|
3306
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
3307
|
+
getActiveToken?: () => string | undefined;
|
|
2097
3308
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
3309
|
+
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
3310
|
+
type HttpResponse$2<T = any> = {
|
|
3311
|
+
data: T;
|
|
3312
|
+
status: number;
|
|
3313
|
+
statusText: string;
|
|
3314
|
+
headers: any;
|
|
3315
|
+
request?: any;
|
|
3316
|
+
};
|
|
3317
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
3318
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
3319
|
+
url: string;
|
|
3320
|
+
data?: Data;
|
|
3321
|
+
params?: URLSearchParams;
|
|
3322
|
+
} & APIMetadata$2;
|
|
3323
|
+
type APIMetadata$2 = {
|
|
3324
|
+
methodFqn?: string;
|
|
3325
|
+
entityFqdn?: string;
|
|
3326
|
+
packageName?: string;
|
|
3327
|
+
};
|
|
3328
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
3329
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
3330
|
+
__type: 'event-definition';
|
|
3331
|
+
type: Type;
|
|
3332
|
+
isDomainEvent?: boolean;
|
|
3333
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3334
|
+
__payload: Payload;
|
|
3335
|
+
};
|
|
3336
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
3337
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
3338
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
3339
|
+
|
|
3340
|
+
type ServicePluginMethodInput$2 = {
|
|
3341
|
+
request: any;
|
|
3342
|
+
metadata: any;
|
|
3343
|
+
};
|
|
3344
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
3345
|
+
type ServicePluginMethodMetadata$2 = {
|
|
3346
|
+
name: string;
|
|
3347
|
+
primaryHttpMappingPath: string;
|
|
3348
|
+
transformations: {
|
|
3349
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
3350
|
+
toREST: (...args: unknown[]) => unknown;
|
|
3351
|
+
};
|
|
3352
|
+
};
|
|
3353
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
3354
|
+
__type: 'service-plugin-definition';
|
|
3355
|
+
componentType: string;
|
|
3356
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
3357
|
+
__contract: Contract;
|
|
3358
|
+
};
|
|
3359
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
3360
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
3361
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
3362
|
+
|
|
3363
|
+
type RequestContext$2 = {
|
|
3364
|
+
isSSR: boolean;
|
|
3365
|
+
host: string;
|
|
3366
|
+
protocol?: string;
|
|
3367
|
+
};
|
|
3368
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
3369
|
+
/**
|
|
3370
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
3371
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
3372
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
3373
|
+
*/
|
|
3374
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
3375
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
3376
|
+
_?: T;
|
|
3377
|
+
url?: string;
|
|
3378
|
+
method?: Method$2;
|
|
3379
|
+
params?: any;
|
|
3380
|
+
data?: any;
|
|
3381
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
3382
|
+
};
|
|
3383
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
3384
|
+
__isAmbassador: boolean;
|
|
3385
|
+
};
|
|
3386
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
3387
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3388
|
+
|
|
3389
|
+
declare global {
|
|
3390
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3391
|
+
interface SymbolConstructor {
|
|
3392
|
+
readonly observable: symbol;
|
|
3393
|
+
}
|
|
2103
3394
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
3395
|
+
|
|
3396
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
3400
|
+
|
|
3401
|
+
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)).
|
|
3402
|
+
|
|
3403
|
+
@example
|
|
3404
|
+
```
|
|
3405
|
+
import type {EmptyObject} from 'type-fest';
|
|
3406
|
+
|
|
3407
|
+
// The following illustrates the problem with `{}`.
|
|
3408
|
+
const foo1: {} = {}; // Pass
|
|
3409
|
+
const foo2: {} = []; // Pass
|
|
3410
|
+
const foo3: {} = 42; // Pass
|
|
3411
|
+
const foo4: {} = {a: 1}; // Pass
|
|
3412
|
+
|
|
3413
|
+
// With `EmptyObject` only the first case is valid.
|
|
3414
|
+
const bar1: EmptyObject = {}; // Pass
|
|
3415
|
+
const bar2: EmptyObject = 42; // Fail
|
|
3416
|
+
const bar3: EmptyObject = []; // Fail
|
|
3417
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
3418
|
+
```
|
|
3419
|
+
|
|
3420
|
+
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}.
|
|
3421
|
+
|
|
3422
|
+
@category Object
|
|
3423
|
+
*/
|
|
3424
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
3425
|
+
|
|
3426
|
+
/**
|
|
3427
|
+
Returns a boolean for whether the two given types are equal.
|
|
3428
|
+
|
|
3429
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
3430
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
3431
|
+
|
|
3432
|
+
Use-cases:
|
|
3433
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
3434
|
+
|
|
3435
|
+
@example
|
|
3436
|
+
```
|
|
3437
|
+
import type {IsEqual} from 'type-fest';
|
|
3438
|
+
|
|
3439
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
3440
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
3441
|
+
type Includes<Value extends readonly any[], Item> =
|
|
3442
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
3443
|
+
? IsEqual<Value[0], Item> extends true
|
|
3444
|
+
? true
|
|
3445
|
+
: Includes<rest, Item>
|
|
3446
|
+
: false;
|
|
3447
|
+
```
|
|
3448
|
+
|
|
3449
|
+
@category Type Guard
|
|
3450
|
+
@category Utilities
|
|
3451
|
+
*/
|
|
3452
|
+
type IsEqual$2<A, B> =
|
|
3453
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
3454
|
+
(<G>() => G extends B ? 1 : 2)
|
|
3455
|
+
? true
|
|
3456
|
+
: false;
|
|
3457
|
+
|
|
3458
|
+
/**
|
|
3459
|
+
Filter out keys from an object.
|
|
3460
|
+
|
|
3461
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
3462
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
3463
|
+
Returns `Key` otherwise.
|
|
3464
|
+
|
|
3465
|
+
@example
|
|
3466
|
+
```
|
|
3467
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
3468
|
+
//=> never
|
|
3469
|
+
```
|
|
3470
|
+
|
|
3471
|
+
@example
|
|
3472
|
+
```
|
|
3473
|
+
type Filtered = Filter<'bar', string>;
|
|
3474
|
+
//=> never
|
|
3475
|
+
```
|
|
3476
|
+
|
|
3477
|
+
@example
|
|
3478
|
+
```
|
|
3479
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
3480
|
+
//=> 'bar'
|
|
3481
|
+
```
|
|
3482
|
+
|
|
3483
|
+
@see {Except}
|
|
3484
|
+
*/
|
|
3485
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3486
|
+
|
|
3487
|
+
type ExceptOptions$2 = {
|
|
3488
|
+
/**
|
|
3489
|
+
Disallow assigning non-specified properties.
|
|
3490
|
+
|
|
3491
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3492
|
+
|
|
3493
|
+
@default false
|
|
3494
|
+
*/
|
|
3495
|
+
requireExactProps?: boolean;
|
|
3496
|
+
};
|
|
3497
|
+
|
|
3498
|
+
/**
|
|
3499
|
+
Create a type from an object type without certain keys.
|
|
3500
|
+
|
|
3501
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
3502
|
+
|
|
3503
|
+
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.
|
|
3504
|
+
|
|
3505
|
+
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)).
|
|
3506
|
+
|
|
3507
|
+
@example
|
|
3508
|
+
```
|
|
3509
|
+
import type {Except} from 'type-fest';
|
|
3510
|
+
|
|
3511
|
+
type Foo = {
|
|
3512
|
+
a: number;
|
|
3513
|
+
b: string;
|
|
3514
|
+
};
|
|
3515
|
+
|
|
3516
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
3517
|
+
//=> {b: string}
|
|
3518
|
+
|
|
3519
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
3520
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
3521
|
+
|
|
3522
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
3523
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
3524
|
+
|
|
3525
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
3526
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
3527
|
+
```
|
|
3528
|
+
|
|
3529
|
+
@category Object
|
|
3530
|
+
*/
|
|
3531
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
3532
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
3533
|
+
} & (Options['requireExactProps'] extends true
|
|
3534
|
+
? Partial<Record<KeysType, never>>
|
|
3535
|
+
: {});
|
|
3536
|
+
|
|
3537
|
+
/**
|
|
3538
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
3539
|
+
|
|
3540
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
3541
|
+
|
|
3542
|
+
@example
|
|
3543
|
+
```
|
|
3544
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3545
|
+
|
|
3546
|
+
interface Example {
|
|
3547
|
+
a: string;
|
|
3548
|
+
b: string | number;
|
|
3549
|
+
c?: string;
|
|
3550
|
+
d: {};
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
3554
|
+
//=> 'a'
|
|
3555
|
+
```
|
|
3556
|
+
|
|
3557
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
3558
|
+
|
|
3559
|
+
@example
|
|
3560
|
+
```
|
|
3561
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
3562
|
+
|
|
3563
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
3564
|
+
//=> 'a' | 'c'
|
|
3565
|
+
```
|
|
3566
|
+
|
|
3567
|
+
@category Object
|
|
3568
|
+
*/
|
|
3569
|
+
type ConditionalKeys$2<Base, Condition> = NonNullable<
|
|
3570
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
3571
|
+
{
|
|
3572
|
+
// Map through all the keys of the given base type.
|
|
3573
|
+
[Key in keyof Base]:
|
|
3574
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
3575
|
+
Base[Key] extends Condition
|
|
3576
|
+
// Retain this key since the condition passes.
|
|
3577
|
+
? Key
|
|
3578
|
+
// Discard this key since the condition fails.
|
|
3579
|
+
: never;
|
|
3580
|
+
|
|
3581
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
3582
|
+
}[keyof Base]
|
|
3583
|
+
>;
|
|
3584
|
+
|
|
3585
|
+
/**
|
|
3586
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
3587
|
+
|
|
3588
|
+
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.
|
|
3589
|
+
|
|
3590
|
+
@example
|
|
3591
|
+
```
|
|
3592
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3593
|
+
|
|
3594
|
+
class Awesome {
|
|
3595
|
+
name: string;
|
|
3596
|
+
successes: number;
|
|
3597
|
+
failures: bigint;
|
|
3598
|
+
|
|
3599
|
+
run() {}
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3603
|
+
//=> {run: () => void}
|
|
3604
|
+
```
|
|
3605
|
+
|
|
3606
|
+
@example
|
|
3607
|
+
```
|
|
3608
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3609
|
+
|
|
3610
|
+
interface Example {
|
|
3611
|
+
a: string;
|
|
3612
|
+
b: string | number;
|
|
3613
|
+
c: () => void;
|
|
3614
|
+
d: {};
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3618
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3619
|
+
```
|
|
3620
|
+
|
|
3621
|
+
@category Object
|
|
3622
|
+
*/
|
|
3623
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
3624
|
+
Base,
|
|
3625
|
+
ConditionalKeys$2<Base, Condition>
|
|
3626
|
+
>;
|
|
3627
|
+
|
|
3628
|
+
/**
|
|
3629
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3630
|
+
* can either be a REST module or a host module.
|
|
3631
|
+
* This type is recursive, so it can describe nested modules.
|
|
3632
|
+
*/
|
|
3633
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
|
|
3634
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
3635
|
+
};
|
|
3636
|
+
/**
|
|
3637
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3638
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3639
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3640
|
+
* do not match the given host (as they will not work with the given host).
|
|
3641
|
+
*/
|
|
3642
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
3643
|
+
done: T;
|
|
3644
|
+
recurse: T extends {
|
|
3645
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
3646
|
+
} ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
|
|
3647
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
3648
|
+
-1,
|
|
3649
|
+
0,
|
|
3650
|
+
1,
|
|
3651
|
+
2,
|
|
3652
|
+
3,
|
|
3653
|
+
4,
|
|
3654
|
+
5
|
|
3655
|
+
][Depth]> : never;
|
|
3656
|
+
}, EmptyObject$2>;
|
|
3657
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3658
|
+
type PublicMetadata$2 = {
|
|
3659
|
+
PACKAGE_NAME?: string;
|
|
3660
|
+
};
|
|
3661
|
+
|
|
3662
|
+
declare global {
|
|
3663
|
+
interface ContextualClient {
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
/**
|
|
3667
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3668
|
+
* case a contextual client is available.
|
|
3669
|
+
*/
|
|
3670
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
3671
|
+
host: Host$2;
|
|
3672
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
3673
|
+
|
|
3674
|
+
/** Project is the main entity of ProjectsService */
|
|
3675
|
+
interface Project$1 extends ProjectCoverOneOf$1 {
|
|
3676
|
+
/** project's cover photo */
|
|
3677
|
+
coverImage?: Image$1;
|
|
3678
|
+
/** project's cover video */
|
|
3679
|
+
coverVideo?: Video$1;
|
|
3680
|
+
/**
|
|
3681
|
+
* Project ID
|
|
3682
|
+
* @readonly
|
|
3683
|
+
*/
|
|
3684
|
+
_id?: string | null;
|
|
3685
|
+
/**
|
|
3686
|
+
* Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision
|
|
3687
|
+
* @readonly
|
|
3688
|
+
*/
|
|
3689
|
+
revision?: string | null;
|
|
3690
|
+
title?: string | null;
|
|
3691
|
+
description?: string | null;
|
|
3692
|
+
/** indicates if the project should be hidden from Portfolio */
|
|
3693
|
+
hidden?: boolean | null;
|
|
3694
|
+
/** Collections must exist to be added to a project. Can be created/updated/deleted using [Collection Service](https://dev.wix.com/docs/rest/business-solutions/portfolio/collection) */
|
|
3695
|
+
collectionIds?: string[];
|
|
3696
|
+
/** Custom project details */
|
|
3697
|
+
details?: ProjectDetail$1[];
|
|
3698
|
+
/** Project's slug */
|
|
3699
|
+
slug?: string | null;
|
|
3700
|
+
/**
|
|
3701
|
+
* Represents the time this Project was created
|
|
3702
|
+
* @readonly
|
|
3703
|
+
*/
|
|
3704
|
+
_createdDate?: Date;
|
|
3705
|
+
/**
|
|
3706
|
+
* Represents the time this Project was last updated
|
|
3707
|
+
* @readonly
|
|
3708
|
+
*/
|
|
3709
|
+
_updatedDate?: Date;
|
|
3710
|
+
/**
|
|
3711
|
+
* Url and relative url of Project - in order to receive this field in READ requests you will need to pass the `include_page_url` field as part of request
|
|
3712
|
+
* @readonly
|
|
3713
|
+
*/
|
|
3714
|
+
url?: string;
|
|
3715
|
+
/** SEO data for the project */
|
|
3716
|
+
seoData?: SeoSchema$1;
|
|
3717
|
+
}
|
|
3718
|
+
/** @oneof */
|
|
3719
|
+
interface ProjectCoverOneOf$1 {
|
|
3720
|
+
/** project's cover photo */
|
|
3721
|
+
coverImage?: Image$1;
|
|
3722
|
+
/** project's cover video */
|
|
3723
|
+
coverVideo?: Video$1;
|
|
3724
|
+
}
|
|
3725
|
+
interface Image$1 {
|
|
3726
|
+
/** Image info - Wix Media Image. */
|
|
3727
|
+
imageInfo?: string;
|
|
3728
|
+
/** Focal point of the image. */
|
|
3729
|
+
focalPoint?: Point$1;
|
|
3730
|
+
}
|
|
3731
|
+
declare enum ImageType$1 {
|
|
3732
|
+
UNDEFINED = "UNDEFINED",
|
|
3733
|
+
WIX_MEDIA = "WIX_MEDIA",
|
|
3734
|
+
EXTERNAL = "EXTERNAL"
|
|
2108
3735
|
}
|
|
2109
3736
|
interface Point$1 {
|
|
2110
3737
|
/** X-coordinate of the focal point. */
|
|
@@ -3180,11 +4807,6 @@ interface UpdateProject {
|
|
|
3180
4807
|
url?: string;
|
|
3181
4808
|
/** SEO data for the project */
|
|
3182
4809
|
seoData?: SeoSchema$1;
|
|
3183
|
-
/**
|
|
3184
|
-
* indicates if the project is synced from external platform (via integration page) and therefore will be updated from the external platform on daily basis
|
|
3185
|
-
* @readonly
|
|
3186
|
-
*/
|
|
3187
|
-
syncedProject?: boolean | null;
|
|
3188
4810
|
}
|
|
3189
4811
|
interface BulkUpdateProjectsOptions {
|
|
3190
4812
|
/** projects to be updated. */
|
|
@@ -3289,14 +4911,14 @@ interface QueryProjectsWithCollectionInfoOptions {
|
|
|
3289
4911
|
includePageUrl?: boolean | null;
|
|
3290
4912
|
}
|
|
3291
4913
|
|
|
3292
|
-
declare function getProjectPageData$1(httpClient: HttpClient): GetProjectPageDataSignature;
|
|
4914
|
+
declare function getProjectPageData$1(httpClient: HttpClient$2): GetProjectPageDataSignature;
|
|
3293
4915
|
interface GetProjectPageDataSignature {
|
|
3294
4916
|
/**
|
|
3295
4917
|
* Get project data for a specific project
|
|
3296
4918
|
*/
|
|
3297
4919
|
(identifiers: GetProjectPageDataIdentifiers): Promise<GetProjectPageDataResponse & GetProjectPageDataResponseNonNullableFields>;
|
|
3298
4920
|
}
|
|
3299
|
-
declare function createProject$1(httpClient: HttpClient): CreateProjectSignature;
|
|
4921
|
+
declare function createProject$1(httpClient: HttpClient$2): CreateProjectSignature;
|
|
3300
4922
|
interface CreateProjectSignature {
|
|
3301
4923
|
/**
|
|
3302
4924
|
* Creates a new Project
|
|
@@ -3305,7 +4927,7 @@ interface CreateProjectSignature {
|
|
|
3305
4927
|
*/
|
|
3306
4928
|
(project: Project$1): Promise<Project$1 & ProjectNonNullableFields$1>;
|
|
3307
4929
|
}
|
|
3308
|
-
declare function getProject$1(httpClient: HttpClient): GetProjectSignature;
|
|
4930
|
+
declare function getProject$1(httpClient: HttpClient$2): GetProjectSignature;
|
|
3309
4931
|
interface GetProjectSignature {
|
|
3310
4932
|
/**
|
|
3311
4933
|
* Get a Project by id
|
|
@@ -3314,14 +4936,14 @@ interface GetProjectSignature {
|
|
|
3314
4936
|
*/
|
|
3315
4937
|
(projectId: string, options?: GetProjectOptions | undefined): Promise<Project$1 & ProjectNonNullableFields$1>;
|
|
3316
4938
|
}
|
|
3317
|
-
declare function listProjects$1(httpClient: HttpClient): ListProjectsSignature;
|
|
4939
|
+
declare function listProjects$1(httpClient: HttpClient$2): ListProjectsSignature;
|
|
3318
4940
|
interface ListProjectsSignature {
|
|
3319
4941
|
/**
|
|
3320
4942
|
* List all projects in portfolio by creation date
|
|
3321
4943
|
*/
|
|
3322
4944
|
(options?: ListProjectsOptions | undefined): Promise<ListProjectsResponse & ListProjectsResponseNonNullableFields>;
|
|
3323
4945
|
}
|
|
3324
|
-
declare function updateProject$1(httpClient: HttpClient): UpdateProjectSignature;
|
|
4946
|
+
declare function updateProject$1(httpClient: HttpClient$2): UpdateProjectSignature;
|
|
3325
4947
|
interface UpdateProjectSignature {
|
|
3326
4948
|
/**
|
|
3327
4949
|
* Update a Project, supports partial update
|
|
@@ -3331,14 +4953,14 @@ interface UpdateProjectSignature {
|
|
|
3331
4953
|
*/
|
|
3332
4954
|
(_id: string | null, project: UpdateProject): Promise<Project$1 & ProjectNonNullableFields$1>;
|
|
3333
4955
|
}
|
|
3334
|
-
declare function bulkUpdateProjects$1(httpClient: HttpClient): BulkUpdateProjectsSignature;
|
|
4956
|
+
declare function bulkUpdateProjects$1(httpClient: HttpClient$2): BulkUpdateProjectsSignature;
|
|
3335
4957
|
interface BulkUpdateProjectsSignature {
|
|
3336
4958
|
/**
|
|
3337
4959
|
* Update Projects in bulk
|
|
3338
4960
|
*/
|
|
3339
4961
|
(options?: BulkUpdateProjectsOptions | undefined): Promise<BulkUpdateProjectsResponse & BulkUpdateProjectsResponseNonNullableFields>;
|
|
3340
4962
|
}
|
|
3341
|
-
declare function deleteProject$1(httpClient: HttpClient): DeleteProjectSignature;
|
|
4963
|
+
declare function deleteProject$1(httpClient: HttpClient$2): DeleteProjectSignature;
|
|
3342
4964
|
interface DeleteProjectSignature {
|
|
3343
4965
|
/**
|
|
3344
4966
|
* Delete a Project
|
|
@@ -3346,14 +4968,14 @@ interface DeleteProjectSignature {
|
|
|
3346
4968
|
*/
|
|
3347
4969
|
(projectId: string): Promise<DeleteProjectResponse & DeleteProjectResponseNonNullableFields>;
|
|
3348
4970
|
}
|
|
3349
|
-
declare function queryProjects$1(httpClient: HttpClient): QueryProjectsSignature;
|
|
4971
|
+
declare function queryProjects$1(httpClient: HttpClient$2): QueryProjectsSignature;
|
|
3350
4972
|
interface QueryProjectsSignature {
|
|
3351
4973
|
/**
|
|
3352
4974
|
* Query Projects using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language)
|
|
3353
4975
|
*/
|
|
3354
4976
|
(options?: QueryProjectsOptions | undefined): ProjectsQueryBuilder;
|
|
3355
4977
|
}
|
|
3356
|
-
declare function updateProjectOrderInCollection$3(httpClient: HttpClient): UpdateProjectOrderInCollectionSignature$1;
|
|
4978
|
+
declare function updateProjectOrderInCollection$3(httpClient: HttpClient$2): UpdateProjectOrderInCollectionSignature$1;
|
|
3357
4979
|
interface UpdateProjectOrderInCollectionSignature$1 {
|
|
3358
4980
|
/**
|
|
3359
4981
|
* Deprecated - please use ProjectsInCollectionsService.UpdateProjectOrderInCollection instead
|
|
@@ -3363,7 +4985,7 @@ interface UpdateProjectOrderInCollectionSignature$1 {
|
|
|
3363
4985
|
*/
|
|
3364
4986
|
(identifiers: UpdateProjectOrderInCollectionIdentifiers$1, sortOrder: number | null): Promise<UpdateProjectOrderInCollectionResponse$1 & UpdateProjectOrderInCollectionResponseNonNullableFields$1>;
|
|
3365
4987
|
}
|
|
3366
|
-
declare function queryProjectsWithCollectionInfo$1(httpClient: HttpClient): QueryProjectsWithCollectionInfoSignature;
|
|
4988
|
+
declare function queryProjectsWithCollectionInfo$1(httpClient: HttpClient$2): QueryProjectsWithCollectionInfoSignature;
|
|
3367
4989
|
interface QueryProjectsWithCollectionInfoSignature {
|
|
3368
4990
|
/**
|
|
3369
4991
|
* Deprecated - please use ProjectsInCollectionsService.QueryProjectsInCollections instead
|
|
@@ -3373,22 +4995,40 @@ interface QueryProjectsWithCollectionInfoSignature {
|
|
|
3373
4995
|
*/
|
|
3374
4996
|
(query: QueryV2$1, options?: QueryProjectsWithCollectionInfoOptions | undefined): Promise<QueryProjectWithCollectionInfoResponse & QueryProjectWithCollectionInfoResponseNonNullableFields>;
|
|
3375
4997
|
}
|
|
3376
|
-
declare const onProjectCreated$1: EventDefinition<ProjectCreatedEnvelope, "wix.portfolio.projects.v1.project_created">;
|
|
3377
|
-
declare const onProjectUpdated$1: EventDefinition<ProjectUpdatedEnvelope, "wix.portfolio.projects.v1.project_updated">;
|
|
3378
|
-
declare const onProjectDeleted$1: EventDefinition<ProjectDeletedEnvelope, "wix.portfolio.projects.v1.project_deleted">;
|
|
4998
|
+
declare const onProjectCreated$1: EventDefinition$4<ProjectCreatedEnvelope, "wix.portfolio.projects.v1.project_created">;
|
|
4999
|
+
declare const onProjectUpdated$1: EventDefinition$4<ProjectUpdatedEnvelope, "wix.portfolio.projects.v1.project_updated">;
|
|
5000
|
+
declare const onProjectDeleted$1: EventDefinition$4<ProjectDeletedEnvelope, "wix.portfolio.projects.v1.project_deleted">;
|
|
3379
5001
|
|
|
3380
|
-
|
|
5002
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
5003
|
+
__type: 'event-definition';
|
|
5004
|
+
type: Type;
|
|
5005
|
+
isDomainEvent?: boolean;
|
|
5006
|
+
transformations?: (envelope: unknown) => Payload;
|
|
5007
|
+
__payload: Payload;
|
|
5008
|
+
};
|
|
5009
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
5010
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
5011
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
3381
5012
|
|
|
3382
|
-
declare
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
declare
|
|
3390
|
-
|
|
3391
|
-
declare const
|
|
5013
|
+
declare global {
|
|
5014
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
5015
|
+
interface SymbolConstructor {
|
|
5016
|
+
readonly observable: symbol;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
|
|
5020
|
+
declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
|
|
5021
|
+
|
|
5022
|
+
declare const getProjectPageData: MaybeContext$2<BuildRESTFunction$2<typeof getProjectPageData$1> & typeof getProjectPageData$1>;
|
|
5023
|
+
declare const createProject: MaybeContext$2<BuildRESTFunction$2<typeof createProject$1> & typeof createProject$1>;
|
|
5024
|
+
declare const getProject: MaybeContext$2<BuildRESTFunction$2<typeof getProject$1> & typeof getProject$1>;
|
|
5025
|
+
declare const listProjects: MaybeContext$2<BuildRESTFunction$2<typeof listProjects$1> & typeof listProjects$1>;
|
|
5026
|
+
declare const updateProject: MaybeContext$2<BuildRESTFunction$2<typeof updateProject$1> & typeof updateProject$1>;
|
|
5027
|
+
declare const bulkUpdateProjects: MaybeContext$2<BuildRESTFunction$2<typeof bulkUpdateProjects$1> & typeof bulkUpdateProjects$1>;
|
|
5028
|
+
declare const deleteProject: MaybeContext$2<BuildRESTFunction$2<typeof deleteProject$1> & typeof deleteProject$1>;
|
|
5029
|
+
declare const queryProjects: MaybeContext$2<BuildRESTFunction$2<typeof queryProjects$1> & typeof queryProjects$1>;
|
|
5030
|
+
declare const updateProjectOrderInCollection$2: MaybeContext$2<BuildRESTFunction$2<typeof updateProjectOrderInCollection$3> & typeof updateProjectOrderInCollection$3>;
|
|
5031
|
+
declare const queryProjectsWithCollectionInfo: MaybeContext$2<BuildRESTFunction$2<typeof queryProjectsWithCollectionInfo$1> & typeof queryProjectsWithCollectionInfo$1>;
|
|
3392
5032
|
|
|
3393
5033
|
type _publicOnProjectCreatedType = typeof onProjectCreated$1;
|
|
3394
5034
|
/** */
|
|
@@ -3479,6 +5119,416 @@ declare namespace context$2 {
|
|
|
3479
5119
|
export { type ActionEvent$2 as ActionEvent, type context$2_App as App, type context$2_ApplicationError as ApplicationError, type Asset$1 as Asset, type BaseEventMetadata$1 as BaseEventMetadata, type context$2_BulkActionMetadata as BulkActionMetadata, type context$2_BulkUpdateProjectsOptions as BulkUpdateProjectsOptions, type context$2_BulkUpdateProjectsRequest as BulkUpdateProjectsRequest, type context$2_BulkUpdateProjectsResponse as BulkUpdateProjectsResponse, type context$2_BulkUpdateProjectsResponseNonNullableFields as BulkUpdateProjectsResponseNonNullableFields, type context$2_BulkUpdateProjectsResult as BulkUpdateProjectsResult, type context$2_CreateNewPortfolioAppRequest as CreateNewPortfolioAppRequest, type context$2_CreateNewPortfolioAppResponse as CreateNewPortfolioAppResponse, type context$2_CreateProjectRequest as CreateProjectRequest, type context$2_CreateProjectResponse as CreateProjectResponse, type context$2_CreateProjectResponseNonNullableFields as CreateProjectResponseNonNullableFields, type CursorPaging$2 as CursorPaging, type Cursors$2 as Cursors, type DeleteContext$1 as DeleteContext, type context$2_DeleteProjectRequest as DeleteProjectRequest, type context$2_DeleteProjectResponse as DeleteProjectResponse, type context$2_DeleteProjectResponseNonNullableFields as DeleteProjectResponseNonNullableFields, DeleteStatus$1 as DeleteStatus, type context$2_DeletedProjectRestored as DeletedProjectRestored, type DetailsLink$1 as DetailsLink, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type Empty$1 as Empty, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type context$2_File as File, type context$2_GetProjectOptions as GetProjectOptions, type context$2_GetProjectPageDataIdentifiers as GetProjectPageDataIdentifiers, type context$2_GetProjectPageDataRequest as GetProjectPageDataRequest, type context$2_GetProjectPageDataResponse as GetProjectPageDataResponse, type context$2_GetProjectPageDataResponseNonNullableFields as GetProjectPageDataResponseNonNullableFields, type context$2_GetProjectRequest as GetProjectRequest, type context$2_GetProjectResponse as GetProjectResponse, type context$2_GetProjectResponseNonNullableFields as GetProjectResponseNonNullableFields, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type Image$1 as Image, ImageType$1 as ImageType, type context$2_InvalidateCache as InvalidateCache, type context$2_InvalidateCacheGetByOneOf as InvalidateCacheGetByOneOf, type context$2_ItemMetadata as ItemMetadata, type Keyword$1 as Keyword, type context$2_ListProjectsOptions as ListProjectsOptions, type context$2_ListProjectsRequest as ListProjectsRequest, type context$2_ListProjectsResponse as ListProjectsResponse, type context$2_ListProjectsResponseNonNullableFields as ListProjectsResponseNonNullableFields, type context$2_MaskedProject as MaskedProject, type context$2_MenuSettingUpdatedEvent as MenuSettingUpdatedEvent, type MessageEnvelope$2 as MessageEnvelope, type MetaSiteSpecialEvent$1 as MetaSiteSpecialEvent, type MetaSiteSpecialEventPayloadOneOf$1 as MetaSiteSpecialEventPayloadOneOf, Namespace$1 as Namespace, type NamespaceChanged$1 as NamespaceChanged, type context$2_Page as Page, type Paging$1 as Paging, type PagingMetadataV2$2 as PagingMetadataV2, type Point$1 as Point, type Project$1 as Project, type ProjectCoverOneOf$1 as ProjectCoverOneOf, type context$2_ProjectCreatedEnvelope as ProjectCreatedEnvelope, type context$2_ProjectDeletedEnvelope as ProjectDeletedEnvelope, type ProjectDetail$1 as ProjectDetail, type ProjectDetailValueOneOf$1 as ProjectDetailValueOneOf, type ProjectInCollection$1 as ProjectInCollection, type ProjectNonNullableFields$1 as ProjectNonNullableFields, type context$2_ProjectSlug as ProjectSlug, type ProjectSource$1 as ProjectSource, type context$2_ProjectUpdatedEnvelope as ProjectUpdatedEnvelope, type context$2_ProjectsQueryBuilder as ProjectsQueryBuilder, type context$2_ProjectsQueryResult as ProjectsQueryResult, type context$2_QueryProjectWithCollectionInfoRequest as QueryProjectWithCollectionInfoRequest, type context$2_QueryProjectWithCollectionInfoResponse as QueryProjectWithCollectionInfoResponse, type context$2_QueryProjectWithCollectionInfoResponseNonNullableFields as QueryProjectWithCollectionInfoResponseNonNullableFields, type context$2_QueryProjectsOptions as QueryProjectsOptions, type context$2_QueryProjectsRequest as QueryProjectsRequest, type context$2_QueryProjectsResponse as QueryProjectsResponse, type context$2_QueryProjectsResponseNonNullableFields as QueryProjectsResponseNonNullableFields, type context$2_QueryProjectsWithCollectionInfoOptions as QueryProjectsWithCollectionInfoOptions, type QueryV2$1 as QueryV2, type QueryV2PagingMethodOneOf$1 as QueryV2PagingMethodOneOf, type RestoreInfo$2 as RestoreInfo, type context$2_RestoreProjectFromTrashBinRequest as RestoreProjectFromTrashBinRequest, type context$2_RestoreProjectFromTrashBinResponse as RestoreProjectFromTrashBinResponse, type SeoSchema$1 as SeoSchema, type ServiceProvisioned$1 as ServiceProvisioned, type ServiceRemoved$1 as ServiceRemoved, type Settings$1 as Settings, type SiteCreated$1 as SiteCreated, SiteCreatedContext$1 as SiteCreatedContext, type SiteDeleted$1 as SiteDeleted, type SiteHardDeleted$1 as SiteHardDeleted, type SiteMarkedAsTemplate$1 as SiteMarkedAsTemplate, type SiteMarkedAsWixSite$1 as SiteMarkedAsWixSite, type SitePublished$1 as SitePublished, type SiteRenamed$1 as SiteRenamed, type SiteTransferred$1 as SiteTransferred, type SiteUndeleted$1 as SiteUndeleted, type SiteUnpublished$1 as SiteUnpublished, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, State$1 as State, type StudioAssigned$1 as StudioAssigned, type StudioUnassigned$1 as StudioUnassigned, type context$2_SyncProjectWithCollectionMappings as SyncProjectWithCollectionMappings, SyncStatus$2 as SyncStatus, type Tag$1 as Tag, type context$2_URI as URI, type UnsharpMasking$1 as UnsharpMasking, type context$2_UpdateProject as UpdateProject, type UpdateProjectOrderInCollectionIdentifiers$1 as UpdateProjectOrderInCollectionIdentifiers, type UpdateProjectOrderInCollectionRequest$1 as UpdateProjectOrderInCollectionRequest, type UpdateProjectOrderInCollectionResponse$1 as UpdateProjectOrderInCollectionResponse, type UpdateProjectOrderInCollectionResponseNonNullableFields$1 as UpdateProjectOrderInCollectionResponseNonNullableFields, type context$2_UpdateProjectRequest as UpdateProjectRequest, type context$2_UpdateProjectResponse as UpdateProjectResponse, type context$2_UpdateProjectResponseNonNullableFields as UpdateProjectResponseNonNullableFields, type Video$1 as Video, type VideoResolution$1 as VideoResolution, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnProjectCreatedType as _publicOnProjectCreatedType, type context$2__publicOnProjectDeletedType as _publicOnProjectDeletedType, type context$2__publicOnProjectUpdatedType as _publicOnProjectUpdatedType, context$2_bulkUpdateProjects as bulkUpdateProjects, context$2_createProject as createProject, context$2_deleteProject as deleteProject, context$2_getProject as getProject, context$2_getProjectPageData as getProjectPageData, context$2_listProjects as listProjects, context$2_onProjectCreated as onProjectCreated, context$2_onProjectDeleted as onProjectDeleted, context$2_onProjectUpdated as onProjectUpdated, onProjectCreated$1 as publicOnProjectCreated, onProjectDeleted$1 as publicOnProjectDeleted, onProjectUpdated$1 as publicOnProjectUpdated, context$2_queryProjects as queryProjects, context$2_queryProjectsWithCollectionInfo as queryProjectsWithCollectionInfo, context$2_updateProject as updateProject, updateProjectOrderInCollection$2 as updateProjectOrderInCollection };
|
|
3480
5120
|
}
|
|
3481
5121
|
|
|
5122
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
5123
|
+
__type: 'host';
|
|
5124
|
+
create(host: H): T;
|
|
5125
|
+
};
|
|
5126
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
5127
|
+
type Host$1<Environment = unknown> = {
|
|
5128
|
+
channel: {
|
|
5129
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
5130
|
+
disconnect: () => void;
|
|
5131
|
+
} | Promise<{
|
|
5132
|
+
disconnect: () => void;
|
|
5133
|
+
}>;
|
|
5134
|
+
};
|
|
5135
|
+
environment?: Environment;
|
|
5136
|
+
/**
|
|
5137
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
5138
|
+
*/
|
|
5139
|
+
apiBaseUrl?: string;
|
|
5140
|
+
/**
|
|
5141
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
5142
|
+
* like internationalization, billing, etc.
|
|
5143
|
+
*/
|
|
5144
|
+
essentials?: {
|
|
5145
|
+
/**
|
|
5146
|
+
* The language of the currently viewed session
|
|
5147
|
+
*/
|
|
5148
|
+
language?: string;
|
|
5149
|
+
/**
|
|
5150
|
+
* The locale of the currently viewed session
|
|
5151
|
+
*/
|
|
5152
|
+
locale?: string;
|
|
5153
|
+
/**
|
|
5154
|
+
* Any headers that should be passed through to the API requests
|
|
5155
|
+
*/
|
|
5156
|
+
passThroughHeaders?: Record<string, string>;
|
|
5157
|
+
};
|
|
5158
|
+
};
|
|
5159
|
+
|
|
5160
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
5161
|
+
interface HttpClient$1 {
|
|
5162
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
5163
|
+
fetchWithAuth: typeof fetch;
|
|
5164
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
5165
|
+
getActiveToken?: () => string | undefined;
|
|
5166
|
+
}
|
|
5167
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
5168
|
+
type HttpResponse$1<T = any> = {
|
|
5169
|
+
data: T;
|
|
5170
|
+
status: number;
|
|
5171
|
+
statusText: string;
|
|
5172
|
+
headers: any;
|
|
5173
|
+
request?: any;
|
|
5174
|
+
};
|
|
5175
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
5176
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
5177
|
+
url: string;
|
|
5178
|
+
data?: Data;
|
|
5179
|
+
params?: URLSearchParams;
|
|
5180
|
+
} & APIMetadata$1;
|
|
5181
|
+
type APIMetadata$1 = {
|
|
5182
|
+
methodFqn?: string;
|
|
5183
|
+
entityFqdn?: string;
|
|
5184
|
+
packageName?: string;
|
|
5185
|
+
};
|
|
5186
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
5187
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
5188
|
+
__type: 'event-definition';
|
|
5189
|
+
type: Type;
|
|
5190
|
+
isDomainEvent?: boolean;
|
|
5191
|
+
transformations?: (envelope: unknown) => Payload;
|
|
5192
|
+
__payload: Payload;
|
|
5193
|
+
};
|
|
5194
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
5195
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
5196
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
5197
|
+
|
|
5198
|
+
type ServicePluginMethodInput$1 = {
|
|
5199
|
+
request: any;
|
|
5200
|
+
metadata: any;
|
|
5201
|
+
};
|
|
5202
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
5203
|
+
type ServicePluginMethodMetadata$1 = {
|
|
5204
|
+
name: string;
|
|
5205
|
+
primaryHttpMappingPath: string;
|
|
5206
|
+
transformations: {
|
|
5207
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
5208
|
+
toREST: (...args: unknown[]) => unknown;
|
|
5209
|
+
};
|
|
5210
|
+
};
|
|
5211
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
5212
|
+
__type: 'service-plugin-definition';
|
|
5213
|
+
componentType: string;
|
|
5214
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
5215
|
+
__contract: Contract;
|
|
5216
|
+
};
|
|
5217
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
5218
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
5219
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
5220
|
+
|
|
5221
|
+
type RequestContext$1 = {
|
|
5222
|
+
isSSR: boolean;
|
|
5223
|
+
host: string;
|
|
5224
|
+
protocol?: string;
|
|
5225
|
+
};
|
|
5226
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
5227
|
+
/**
|
|
5228
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
5229
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
5230
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
5231
|
+
*/
|
|
5232
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
5233
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
5234
|
+
_?: T;
|
|
5235
|
+
url?: string;
|
|
5236
|
+
method?: Method$1;
|
|
5237
|
+
params?: any;
|
|
5238
|
+
data?: any;
|
|
5239
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
5240
|
+
};
|
|
5241
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
5242
|
+
__isAmbassador: boolean;
|
|
5243
|
+
};
|
|
5244
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
5245
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
5246
|
+
|
|
5247
|
+
declare global {
|
|
5248
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
5249
|
+
interface SymbolConstructor {
|
|
5250
|
+
readonly observable: symbol;
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5254
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
5255
|
+
|
|
5256
|
+
/**
|
|
5257
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
5258
|
+
|
|
5259
|
+
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)).
|
|
5260
|
+
|
|
5261
|
+
@example
|
|
5262
|
+
```
|
|
5263
|
+
import type {EmptyObject} from 'type-fest';
|
|
5264
|
+
|
|
5265
|
+
// The following illustrates the problem with `{}`.
|
|
5266
|
+
const foo1: {} = {}; // Pass
|
|
5267
|
+
const foo2: {} = []; // Pass
|
|
5268
|
+
const foo3: {} = 42; // Pass
|
|
5269
|
+
const foo4: {} = {a: 1}; // Pass
|
|
5270
|
+
|
|
5271
|
+
// With `EmptyObject` only the first case is valid.
|
|
5272
|
+
const bar1: EmptyObject = {}; // Pass
|
|
5273
|
+
const bar2: EmptyObject = 42; // Fail
|
|
5274
|
+
const bar3: EmptyObject = []; // Fail
|
|
5275
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
5276
|
+
```
|
|
5277
|
+
|
|
5278
|
+
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}.
|
|
5279
|
+
|
|
5280
|
+
@category Object
|
|
5281
|
+
*/
|
|
5282
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
5283
|
+
|
|
5284
|
+
/**
|
|
5285
|
+
Returns a boolean for whether the two given types are equal.
|
|
5286
|
+
|
|
5287
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
5288
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
5289
|
+
|
|
5290
|
+
Use-cases:
|
|
5291
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
5292
|
+
|
|
5293
|
+
@example
|
|
5294
|
+
```
|
|
5295
|
+
import type {IsEqual} from 'type-fest';
|
|
5296
|
+
|
|
5297
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
5298
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
5299
|
+
type Includes<Value extends readonly any[], Item> =
|
|
5300
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
5301
|
+
? IsEqual<Value[0], Item> extends true
|
|
5302
|
+
? true
|
|
5303
|
+
: Includes<rest, Item>
|
|
5304
|
+
: false;
|
|
5305
|
+
```
|
|
5306
|
+
|
|
5307
|
+
@category Type Guard
|
|
5308
|
+
@category Utilities
|
|
5309
|
+
*/
|
|
5310
|
+
type IsEqual$1<A, B> =
|
|
5311
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
5312
|
+
(<G>() => G extends B ? 1 : 2)
|
|
5313
|
+
? true
|
|
5314
|
+
: false;
|
|
5315
|
+
|
|
5316
|
+
/**
|
|
5317
|
+
Filter out keys from an object.
|
|
5318
|
+
|
|
5319
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
5320
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
5321
|
+
Returns `Key` otherwise.
|
|
5322
|
+
|
|
5323
|
+
@example
|
|
5324
|
+
```
|
|
5325
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
5326
|
+
//=> never
|
|
5327
|
+
```
|
|
5328
|
+
|
|
5329
|
+
@example
|
|
5330
|
+
```
|
|
5331
|
+
type Filtered = Filter<'bar', string>;
|
|
5332
|
+
//=> never
|
|
5333
|
+
```
|
|
5334
|
+
|
|
5335
|
+
@example
|
|
5336
|
+
```
|
|
5337
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
5338
|
+
//=> 'bar'
|
|
5339
|
+
```
|
|
5340
|
+
|
|
5341
|
+
@see {Except}
|
|
5342
|
+
*/
|
|
5343
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
5344
|
+
|
|
5345
|
+
type ExceptOptions$1 = {
|
|
5346
|
+
/**
|
|
5347
|
+
Disallow assigning non-specified properties.
|
|
5348
|
+
|
|
5349
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
5350
|
+
|
|
5351
|
+
@default false
|
|
5352
|
+
*/
|
|
5353
|
+
requireExactProps?: boolean;
|
|
5354
|
+
};
|
|
5355
|
+
|
|
5356
|
+
/**
|
|
5357
|
+
Create a type from an object type without certain keys.
|
|
5358
|
+
|
|
5359
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
5360
|
+
|
|
5361
|
+
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.
|
|
5362
|
+
|
|
5363
|
+
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)).
|
|
5364
|
+
|
|
5365
|
+
@example
|
|
5366
|
+
```
|
|
5367
|
+
import type {Except} from 'type-fest';
|
|
5368
|
+
|
|
5369
|
+
type Foo = {
|
|
5370
|
+
a: number;
|
|
5371
|
+
b: string;
|
|
5372
|
+
};
|
|
5373
|
+
|
|
5374
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
5375
|
+
//=> {b: string}
|
|
5376
|
+
|
|
5377
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
5378
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
5379
|
+
|
|
5380
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
5381
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
5382
|
+
|
|
5383
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
5384
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
5385
|
+
```
|
|
5386
|
+
|
|
5387
|
+
@category Object
|
|
5388
|
+
*/
|
|
5389
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
5390
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
5391
|
+
} & (Options['requireExactProps'] extends true
|
|
5392
|
+
? Partial<Record<KeysType, never>>
|
|
5393
|
+
: {});
|
|
5394
|
+
|
|
5395
|
+
/**
|
|
5396
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
5397
|
+
|
|
5398
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
5399
|
+
|
|
5400
|
+
@example
|
|
5401
|
+
```
|
|
5402
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5403
|
+
|
|
5404
|
+
interface Example {
|
|
5405
|
+
a: string;
|
|
5406
|
+
b: string | number;
|
|
5407
|
+
c?: string;
|
|
5408
|
+
d: {};
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
5412
|
+
//=> 'a'
|
|
5413
|
+
```
|
|
5414
|
+
|
|
5415
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
5416
|
+
|
|
5417
|
+
@example
|
|
5418
|
+
```
|
|
5419
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5420
|
+
|
|
5421
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
5422
|
+
//=> 'a' | 'c'
|
|
5423
|
+
```
|
|
5424
|
+
|
|
5425
|
+
@category Object
|
|
5426
|
+
*/
|
|
5427
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
5428
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
5429
|
+
{
|
|
5430
|
+
// Map through all the keys of the given base type.
|
|
5431
|
+
[Key in keyof Base]:
|
|
5432
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
5433
|
+
Base[Key] extends Condition
|
|
5434
|
+
// Retain this key since the condition passes.
|
|
5435
|
+
? Key
|
|
5436
|
+
// Discard this key since the condition fails.
|
|
5437
|
+
: never;
|
|
5438
|
+
|
|
5439
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
5440
|
+
}[keyof Base]
|
|
5441
|
+
>;
|
|
5442
|
+
|
|
5443
|
+
/**
|
|
5444
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
5445
|
+
|
|
5446
|
+
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.
|
|
5447
|
+
|
|
5448
|
+
@example
|
|
5449
|
+
```
|
|
5450
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
5451
|
+
|
|
5452
|
+
class Awesome {
|
|
5453
|
+
name: string;
|
|
5454
|
+
successes: number;
|
|
5455
|
+
failures: bigint;
|
|
5456
|
+
|
|
5457
|
+
run() {}
|
|
5458
|
+
}
|
|
5459
|
+
|
|
5460
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
5461
|
+
//=> {run: () => void}
|
|
5462
|
+
```
|
|
5463
|
+
|
|
5464
|
+
@example
|
|
5465
|
+
```
|
|
5466
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
5467
|
+
|
|
5468
|
+
interface Example {
|
|
5469
|
+
a: string;
|
|
5470
|
+
b: string | number;
|
|
5471
|
+
c: () => void;
|
|
5472
|
+
d: {};
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
5476
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
5477
|
+
```
|
|
5478
|
+
|
|
5479
|
+
@category Object
|
|
5480
|
+
*/
|
|
5481
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
5482
|
+
Base,
|
|
5483
|
+
ConditionalKeys$1<Base, Condition>
|
|
5484
|
+
>;
|
|
5485
|
+
|
|
5486
|
+
/**
|
|
5487
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
5488
|
+
* can either be a REST module or a host module.
|
|
5489
|
+
* This type is recursive, so it can describe nested modules.
|
|
5490
|
+
*/
|
|
5491
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$2<any> | ServicePluginDefinition$1<any> | {
|
|
5492
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
5493
|
+
};
|
|
5494
|
+
/**
|
|
5495
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
5496
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
5497
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
5498
|
+
* do not match the given host (as they will not work with the given host).
|
|
5499
|
+
*/
|
|
5500
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
5501
|
+
done: T;
|
|
5502
|
+
recurse: T extends {
|
|
5503
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
5504
|
+
} ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
|
|
5505
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
5506
|
+
-1,
|
|
5507
|
+
0,
|
|
5508
|
+
1,
|
|
5509
|
+
2,
|
|
5510
|
+
3,
|
|
5511
|
+
4,
|
|
5512
|
+
5
|
|
5513
|
+
][Depth]> : never;
|
|
5514
|
+
}, EmptyObject$1>;
|
|
5515
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
5516
|
+
type PublicMetadata$1 = {
|
|
5517
|
+
PACKAGE_NAME?: string;
|
|
5518
|
+
};
|
|
5519
|
+
|
|
5520
|
+
declare global {
|
|
5521
|
+
interface ContextualClient {
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
/**
|
|
5525
|
+
* A type used to create concerete types from SDK descriptors in
|
|
5526
|
+
* case a contextual client is available.
|
|
5527
|
+
*/
|
|
5528
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
5529
|
+
host: Host$1;
|
|
5530
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
5531
|
+
|
|
3482
5532
|
interface ProjectInCollection {
|
|
3483
5533
|
/** Collection ID */
|
|
3484
5534
|
collectionId?: string;
|
|
@@ -3530,11 +5580,6 @@ interface Project extends ProjectCoverOneOf {
|
|
|
3530
5580
|
url?: string;
|
|
3531
5581
|
/** SEO data for the project */
|
|
3532
5582
|
seoData?: SeoSchema;
|
|
3533
|
-
/**
|
|
3534
|
-
* indicates if the project is synced from external platform (via integration page) and therefore will be updated from the external platform on daily basis
|
|
3535
|
-
* @readonly
|
|
3536
|
-
*/
|
|
3537
|
-
syncedProject?: boolean | null;
|
|
3538
5583
|
}
|
|
3539
5584
|
/** @oneof */
|
|
3540
5585
|
interface ProjectCoverOneOf {
|
|
@@ -4111,7 +6156,7 @@ interface UpdateProjectOrderInCollectionIdentifiers {
|
|
|
4111
6156
|
collectionId: string;
|
|
4112
6157
|
}
|
|
4113
6158
|
|
|
4114
|
-
declare function queryProjectInCollections$1(httpClient: HttpClient): QueryProjectInCollectionsSignature;
|
|
6159
|
+
declare function queryProjectInCollections$1(httpClient: HttpClient$1): QueryProjectInCollectionsSignature;
|
|
4115
6160
|
interface QueryProjectInCollectionsSignature {
|
|
4116
6161
|
/**
|
|
4117
6162
|
* Query project in collection context using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language)
|
|
@@ -4124,7 +6169,7 @@ interface QueryProjectInCollectionsSignature {
|
|
|
4124
6169
|
*/
|
|
4125
6170
|
(options?: QueryProjectInCollectionsOptions | undefined): ProjectInCollectionsQueryBuilder;
|
|
4126
6171
|
}
|
|
4127
|
-
declare function updateProjectOrderInCollection$1(httpClient: HttpClient): UpdateProjectOrderInCollectionSignature;
|
|
6172
|
+
declare function updateProjectOrderInCollection$1(httpClient: HttpClient$1): UpdateProjectOrderInCollectionSignature;
|
|
4128
6173
|
interface UpdateProjectOrderInCollectionSignature {
|
|
4129
6174
|
/**
|
|
4130
6175
|
* Updates Project's order in a given Collection
|
|
@@ -4132,12 +6177,30 @@ interface UpdateProjectOrderInCollectionSignature {
|
|
|
4132
6177
|
*/
|
|
4133
6178
|
(identifiers: UpdateProjectOrderInCollectionIdentifiers, sortOrder: number | null): Promise<UpdateProjectOrderInCollectionResponse & UpdateProjectOrderInCollectionResponseNonNullableFields>;
|
|
4134
6179
|
}
|
|
4135
|
-
declare const onProjectInCollectionProjectOrderInCollectionUpdatedEvent$1: EventDefinition<ProjectInCollectionProjectOrderInCollectionUpdatedEnvelope, "wix.portfolio.projects.v1.project_in_collection_project_order_in_collection_updated_event">;
|
|
6180
|
+
declare const onProjectInCollectionProjectOrderInCollectionUpdatedEvent$1: EventDefinition$2<ProjectInCollectionProjectOrderInCollectionUpdatedEnvelope, "wix.portfolio.projects.v1.project_in_collection_project_order_in_collection_updated_event">;
|
|
4136
6181
|
|
|
4137
|
-
|
|
6182
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
6183
|
+
__type: 'event-definition';
|
|
6184
|
+
type: Type;
|
|
6185
|
+
isDomainEvent?: boolean;
|
|
6186
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6187
|
+
__payload: Payload;
|
|
6188
|
+
};
|
|
6189
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
6190
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
6191
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
4138
6192
|
|
|
4139
|
-
declare
|
|
4140
|
-
|
|
6193
|
+
declare global {
|
|
6194
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6195
|
+
interface SymbolConstructor {
|
|
6196
|
+
readonly observable: symbol;
|
|
6197
|
+
}
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
declare function createEventModule<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
|
|
6201
|
+
|
|
6202
|
+
declare const queryProjectInCollections: MaybeContext$1<BuildRESTFunction$1<typeof queryProjectInCollections$1> & typeof queryProjectInCollections$1>;
|
|
6203
|
+
declare const updateProjectOrderInCollection: MaybeContext$1<BuildRESTFunction$1<typeof updateProjectOrderInCollection$1> & typeof updateProjectOrderInCollection$1>;
|
|
4141
6204
|
|
|
4142
6205
|
type _publicOnProjectInCollectionProjectOrderInCollectionUpdatedEventType = typeof onProjectInCollectionProjectOrderInCollectionUpdatedEvent$1;
|
|
4143
6206
|
/** */
|
|
@@ -4189,6 +6252,416 @@ declare namespace context$1 {
|
|
|
4189
6252
|
export { type ActionEvent$1 as ActionEvent, type context$1_BaseEventMetadata as BaseEventMetadata, type CursorPaging$1 as CursorPaging, type Cursors$1 as Cursors, type context$1_DetailsLink as DetailsLink, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventMetadata as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$1_Image as Image, context$1_ImageType as ImageType, type context$1_Keyword as Keyword, type MessageEnvelope$1 as MessageEnvelope, type context$1_Paging as Paging, type PagingMetadataV2$1 as PagingMetadataV2, type context$1_Point as Point, type context$1_Project as Project, type context$1_ProjectCoverOneOf as ProjectCoverOneOf, type context$1_ProjectDetail as ProjectDetail, type context$1_ProjectDetailValueOneOf as ProjectDetailValueOneOf, type context$1_ProjectInCollection as ProjectInCollection, type context$1_ProjectInCollectionProjectOrderInCollectionUpdatedEnvelope as ProjectInCollectionProjectOrderInCollectionUpdatedEnvelope, type context$1_ProjectInCollectionsQueryBuilder as ProjectInCollectionsQueryBuilder, type context$1_ProjectInCollectionsQueryResult as ProjectInCollectionsQueryResult, type context$1_ProjectOrderInCollectionUpdatedEvent as ProjectOrderInCollectionUpdatedEvent, type context$1_ProjectSource as ProjectSource, type context$1_QueryProjectInCollectionsOptions as QueryProjectInCollectionsOptions, type context$1_QueryProjectInCollectionsRequest as QueryProjectInCollectionsRequest, type context$1_QueryProjectInCollectionsResponse as QueryProjectInCollectionsResponse, type context$1_QueryProjectInCollectionsResponseNonNullableFields as QueryProjectInCollectionsResponseNonNullableFields, type context$1_QueryV2 as QueryV2, type context$1_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type RestoreInfo$1 as RestoreInfo, type context$1_SeoSchema as SeoSchema, type context$1_Settings as Settings, context$1_SortOrder as SortOrder, type context$1_Sorting as Sorting, SyncStatus$1 as SyncStatus, type context$1_Tag as Tag, type context$1_UnsharpMasking as UnsharpMasking, type context$1_UpdateProjectOrderInCollectionIdentifiers as UpdateProjectOrderInCollectionIdentifiers, type context$1_UpdateProjectOrderInCollectionRequest as UpdateProjectOrderInCollectionRequest, type context$1_UpdateProjectOrderInCollectionResponse as UpdateProjectOrderInCollectionResponse, type context$1_UpdateProjectOrderInCollectionResponseNonNullableFields as UpdateProjectOrderInCollectionResponseNonNullableFields, type context$1_Video as Video, type context$1_VideoResolution as VideoResolution, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnProjectInCollectionProjectOrderInCollectionUpdatedEventType as _publicOnProjectInCollectionProjectOrderInCollectionUpdatedEventType, context$1_onProjectInCollectionProjectOrderInCollectionUpdatedEvent as onProjectInCollectionProjectOrderInCollectionUpdatedEvent, onProjectInCollectionProjectOrderInCollectionUpdatedEvent$1 as publicOnProjectInCollectionProjectOrderInCollectionUpdatedEvent, context$1_queryProjectInCollections as queryProjectInCollections, context$1_updateProjectOrderInCollection as updateProjectOrderInCollection };
|
|
4190
6253
|
}
|
|
4191
6254
|
|
|
6255
|
+
type HostModule<T, H extends Host> = {
|
|
6256
|
+
__type: 'host';
|
|
6257
|
+
create(host: H): T;
|
|
6258
|
+
};
|
|
6259
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6260
|
+
type Host<Environment = unknown> = {
|
|
6261
|
+
channel: {
|
|
6262
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
6263
|
+
disconnect: () => void;
|
|
6264
|
+
} | Promise<{
|
|
6265
|
+
disconnect: () => void;
|
|
6266
|
+
}>;
|
|
6267
|
+
};
|
|
6268
|
+
environment?: Environment;
|
|
6269
|
+
/**
|
|
6270
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
6271
|
+
*/
|
|
6272
|
+
apiBaseUrl?: string;
|
|
6273
|
+
/**
|
|
6274
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
6275
|
+
* like internationalization, billing, etc.
|
|
6276
|
+
*/
|
|
6277
|
+
essentials?: {
|
|
6278
|
+
/**
|
|
6279
|
+
* The language of the currently viewed session
|
|
6280
|
+
*/
|
|
6281
|
+
language?: string;
|
|
6282
|
+
/**
|
|
6283
|
+
* The locale of the currently viewed session
|
|
6284
|
+
*/
|
|
6285
|
+
locale?: string;
|
|
6286
|
+
/**
|
|
6287
|
+
* Any headers that should be passed through to the API requests
|
|
6288
|
+
*/
|
|
6289
|
+
passThroughHeaders?: Record<string, string>;
|
|
6290
|
+
};
|
|
6291
|
+
};
|
|
6292
|
+
|
|
6293
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
6294
|
+
interface HttpClient {
|
|
6295
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
6296
|
+
fetchWithAuth: typeof fetch;
|
|
6297
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
6298
|
+
getActiveToken?: () => string | undefined;
|
|
6299
|
+
}
|
|
6300
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
6301
|
+
type HttpResponse<T = any> = {
|
|
6302
|
+
data: T;
|
|
6303
|
+
status: number;
|
|
6304
|
+
statusText: string;
|
|
6305
|
+
headers: any;
|
|
6306
|
+
request?: any;
|
|
6307
|
+
};
|
|
6308
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
6309
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
6310
|
+
url: string;
|
|
6311
|
+
data?: Data;
|
|
6312
|
+
params?: URLSearchParams;
|
|
6313
|
+
} & APIMetadata;
|
|
6314
|
+
type APIMetadata = {
|
|
6315
|
+
methodFqn?: string;
|
|
6316
|
+
entityFqdn?: string;
|
|
6317
|
+
packageName?: string;
|
|
6318
|
+
};
|
|
6319
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
6320
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
6321
|
+
__type: 'event-definition';
|
|
6322
|
+
type: Type;
|
|
6323
|
+
isDomainEvent?: boolean;
|
|
6324
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6325
|
+
__payload: Payload;
|
|
6326
|
+
};
|
|
6327
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
6328
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
6329
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
6330
|
+
|
|
6331
|
+
type ServicePluginMethodInput = {
|
|
6332
|
+
request: any;
|
|
6333
|
+
metadata: any;
|
|
6334
|
+
};
|
|
6335
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
6336
|
+
type ServicePluginMethodMetadata = {
|
|
6337
|
+
name: string;
|
|
6338
|
+
primaryHttpMappingPath: string;
|
|
6339
|
+
transformations: {
|
|
6340
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
6341
|
+
toREST: (...args: unknown[]) => unknown;
|
|
6342
|
+
};
|
|
6343
|
+
};
|
|
6344
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
6345
|
+
__type: 'service-plugin-definition';
|
|
6346
|
+
componentType: string;
|
|
6347
|
+
methods: ServicePluginMethodMetadata[];
|
|
6348
|
+
__contract: Contract;
|
|
6349
|
+
};
|
|
6350
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
6351
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
6352
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
6353
|
+
|
|
6354
|
+
type RequestContext = {
|
|
6355
|
+
isSSR: boolean;
|
|
6356
|
+
host: string;
|
|
6357
|
+
protocol?: string;
|
|
6358
|
+
};
|
|
6359
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
6360
|
+
/**
|
|
6361
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
6362
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
6363
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
6364
|
+
*/
|
|
6365
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6366
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
6367
|
+
_?: T;
|
|
6368
|
+
url?: string;
|
|
6369
|
+
method?: Method;
|
|
6370
|
+
params?: any;
|
|
6371
|
+
data?: any;
|
|
6372
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
6373
|
+
};
|
|
6374
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
6375
|
+
__isAmbassador: boolean;
|
|
6376
|
+
};
|
|
6377
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
6378
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
6379
|
+
|
|
6380
|
+
declare global {
|
|
6381
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6382
|
+
interface SymbolConstructor {
|
|
6383
|
+
readonly observable: symbol;
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6386
|
+
|
|
6387
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
6388
|
+
|
|
6389
|
+
/**
|
|
6390
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
6391
|
+
|
|
6392
|
+
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)).
|
|
6393
|
+
|
|
6394
|
+
@example
|
|
6395
|
+
```
|
|
6396
|
+
import type {EmptyObject} from 'type-fest';
|
|
6397
|
+
|
|
6398
|
+
// The following illustrates the problem with `{}`.
|
|
6399
|
+
const foo1: {} = {}; // Pass
|
|
6400
|
+
const foo2: {} = []; // Pass
|
|
6401
|
+
const foo3: {} = 42; // Pass
|
|
6402
|
+
const foo4: {} = {a: 1}; // Pass
|
|
6403
|
+
|
|
6404
|
+
// With `EmptyObject` only the first case is valid.
|
|
6405
|
+
const bar1: EmptyObject = {}; // Pass
|
|
6406
|
+
const bar2: EmptyObject = 42; // Fail
|
|
6407
|
+
const bar3: EmptyObject = []; // Fail
|
|
6408
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
6409
|
+
```
|
|
6410
|
+
|
|
6411
|
+
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}.
|
|
6412
|
+
|
|
6413
|
+
@category Object
|
|
6414
|
+
*/
|
|
6415
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
6416
|
+
|
|
6417
|
+
/**
|
|
6418
|
+
Returns a boolean for whether the two given types are equal.
|
|
6419
|
+
|
|
6420
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
6421
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
6422
|
+
|
|
6423
|
+
Use-cases:
|
|
6424
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
6425
|
+
|
|
6426
|
+
@example
|
|
6427
|
+
```
|
|
6428
|
+
import type {IsEqual} from 'type-fest';
|
|
6429
|
+
|
|
6430
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
6431
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
6432
|
+
type Includes<Value extends readonly any[], Item> =
|
|
6433
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
6434
|
+
? IsEqual<Value[0], Item> extends true
|
|
6435
|
+
? true
|
|
6436
|
+
: Includes<rest, Item>
|
|
6437
|
+
: false;
|
|
6438
|
+
```
|
|
6439
|
+
|
|
6440
|
+
@category Type Guard
|
|
6441
|
+
@category Utilities
|
|
6442
|
+
*/
|
|
6443
|
+
type IsEqual<A, B> =
|
|
6444
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
6445
|
+
(<G>() => G extends B ? 1 : 2)
|
|
6446
|
+
? true
|
|
6447
|
+
: false;
|
|
6448
|
+
|
|
6449
|
+
/**
|
|
6450
|
+
Filter out keys from an object.
|
|
6451
|
+
|
|
6452
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
6453
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
6454
|
+
Returns `Key` otherwise.
|
|
6455
|
+
|
|
6456
|
+
@example
|
|
6457
|
+
```
|
|
6458
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
6459
|
+
//=> never
|
|
6460
|
+
```
|
|
6461
|
+
|
|
6462
|
+
@example
|
|
6463
|
+
```
|
|
6464
|
+
type Filtered = Filter<'bar', string>;
|
|
6465
|
+
//=> never
|
|
6466
|
+
```
|
|
6467
|
+
|
|
6468
|
+
@example
|
|
6469
|
+
```
|
|
6470
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
6471
|
+
//=> 'bar'
|
|
6472
|
+
```
|
|
6473
|
+
|
|
6474
|
+
@see {Except}
|
|
6475
|
+
*/
|
|
6476
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
6477
|
+
|
|
6478
|
+
type ExceptOptions = {
|
|
6479
|
+
/**
|
|
6480
|
+
Disallow assigning non-specified properties.
|
|
6481
|
+
|
|
6482
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
6483
|
+
|
|
6484
|
+
@default false
|
|
6485
|
+
*/
|
|
6486
|
+
requireExactProps?: boolean;
|
|
6487
|
+
};
|
|
6488
|
+
|
|
6489
|
+
/**
|
|
6490
|
+
Create a type from an object type without certain keys.
|
|
6491
|
+
|
|
6492
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
6493
|
+
|
|
6494
|
+
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.
|
|
6495
|
+
|
|
6496
|
+
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)).
|
|
6497
|
+
|
|
6498
|
+
@example
|
|
6499
|
+
```
|
|
6500
|
+
import type {Except} from 'type-fest';
|
|
6501
|
+
|
|
6502
|
+
type Foo = {
|
|
6503
|
+
a: number;
|
|
6504
|
+
b: string;
|
|
6505
|
+
};
|
|
6506
|
+
|
|
6507
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
6508
|
+
//=> {b: string}
|
|
6509
|
+
|
|
6510
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
6511
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
6512
|
+
|
|
6513
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
6514
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
6515
|
+
|
|
6516
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
6517
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
6518
|
+
```
|
|
6519
|
+
|
|
6520
|
+
@category Object
|
|
6521
|
+
*/
|
|
6522
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
6523
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
6524
|
+
} & (Options['requireExactProps'] extends true
|
|
6525
|
+
? Partial<Record<KeysType, never>>
|
|
6526
|
+
: {});
|
|
6527
|
+
|
|
6528
|
+
/**
|
|
6529
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
6530
|
+
|
|
6531
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
6532
|
+
|
|
6533
|
+
@example
|
|
6534
|
+
```
|
|
6535
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6536
|
+
|
|
6537
|
+
interface Example {
|
|
6538
|
+
a: string;
|
|
6539
|
+
b: string | number;
|
|
6540
|
+
c?: string;
|
|
6541
|
+
d: {};
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
6545
|
+
//=> 'a'
|
|
6546
|
+
```
|
|
6547
|
+
|
|
6548
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
6549
|
+
|
|
6550
|
+
@example
|
|
6551
|
+
```
|
|
6552
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6553
|
+
|
|
6554
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
6555
|
+
//=> 'a' | 'c'
|
|
6556
|
+
```
|
|
6557
|
+
|
|
6558
|
+
@category Object
|
|
6559
|
+
*/
|
|
6560
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
6561
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
6562
|
+
{
|
|
6563
|
+
// Map through all the keys of the given base type.
|
|
6564
|
+
[Key in keyof Base]:
|
|
6565
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
6566
|
+
Base[Key] extends Condition
|
|
6567
|
+
// Retain this key since the condition passes.
|
|
6568
|
+
? Key
|
|
6569
|
+
// Discard this key since the condition fails.
|
|
6570
|
+
: never;
|
|
6571
|
+
|
|
6572
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
6573
|
+
}[keyof Base]
|
|
6574
|
+
>;
|
|
6575
|
+
|
|
6576
|
+
/**
|
|
6577
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
6578
|
+
|
|
6579
|
+
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.
|
|
6580
|
+
|
|
6581
|
+
@example
|
|
6582
|
+
```
|
|
6583
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
6584
|
+
|
|
6585
|
+
class Awesome {
|
|
6586
|
+
name: string;
|
|
6587
|
+
successes: number;
|
|
6588
|
+
failures: bigint;
|
|
6589
|
+
|
|
6590
|
+
run() {}
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6593
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
6594
|
+
//=> {run: () => void}
|
|
6595
|
+
```
|
|
6596
|
+
|
|
6597
|
+
@example
|
|
6598
|
+
```
|
|
6599
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
6600
|
+
|
|
6601
|
+
interface Example {
|
|
6602
|
+
a: string;
|
|
6603
|
+
b: string | number;
|
|
6604
|
+
c: () => void;
|
|
6605
|
+
d: {};
|
|
6606
|
+
}
|
|
6607
|
+
|
|
6608
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
6609
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
6610
|
+
```
|
|
6611
|
+
|
|
6612
|
+
@category Object
|
|
6613
|
+
*/
|
|
6614
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
6615
|
+
Base,
|
|
6616
|
+
ConditionalKeys<Base, Condition>
|
|
6617
|
+
>;
|
|
6618
|
+
|
|
6619
|
+
/**
|
|
6620
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
6621
|
+
* can either be a REST module or a host module.
|
|
6622
|
+
* This type is recursive, so it can describe nested modules.
|
|
6623
|
+
*/
|
|
6624
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
6625
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
6626
|
+
};
|
|
6627
|
+
/**
|
|
6628
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
6629
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
6630
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
6631
|
+
* do not match the given host (as they will not work with the given host).
|
|
6632
|
+
*/
|
|
6633
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
6634
|
+
done: T;
|
|
6635
|
+
recurse: T extends {
|
|
6636
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
6637
|
+
} ? 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<{
|
|
6638
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
6639
|
+
-1,
|
|
6640
|
+
0,
|
|
6641
|
+
1,
|
|
6642
|
+
2,
|
|
6643
|
+
3,
|
|
6644
|
+
4,
|
|
6645
|
+
5
|
|
6646
|
+
][Depth]> : never;
|
|
6647
|
+
}, EmptyObject>;
|
|
6648
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
6649
|
+
type PublicMetadata = {
|
|
6650
|
+
PACKAGE_NAME?: string;
|
|
6651
|
+
};
|
|
6652
|
+
|
|
6653
|
+
declare global {
|
|
6654
|
+
interface ContextualClient {
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
/**
|
|
6658
|
+
* A type used to create concerete types from SDK descriptors in
|
|
6659
|
+
* case a contextual client is available.
|
|
6660
|
+
*/
|
|
6661
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
6662
|
+
host: Host;
|
|
6663
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
6664
|
+
|
|
4192
6665
|
interface SyncedProject {
|
|
4193
6666
|
/** Project ID in Portfolio - if project was yet to be create, will be None */
|
|
4194
6667
|
portfolioProjectId?: string | null;
|
|
@@ -4872,11 +7345,11 @@ interface GetLoginRedirectableUrlSignature {
|
|
|
4872
7345
|
(appDefId: string): Promise<GetLoginRedirectableUrlResponse & GetLoginRedirectableUrlResponseNonNullableFields>;
|
|
4873
7346
|
}
|
|
4874
7347
|
|
|
4875
|
-
declare const getProjects: BuildRESTFunction<typeof getProjects$1> & typeof getProjects$1
|
|
4876
|
-
declare const syncProject: BuildRESTFunction<typeof syncProject$1> & typeof syncProject$1
|
|
4877
|
-
declare const getSyncStatus: BuildRESTFunction<typeof getSyncStatus$1> & typeof getSyncStatus$1
|
|
4878
|
-
declare const stopSync: BuildRESTFunction<typeof stopSync$1> & typeof stopSync$1
|
|
4879
|
-
declare const getLoginRedirectableUrl: BuildRESTFunction<typeof getLoginRedirectableUrl$1> & typeof getLoginRedirectableUrl$1
|
|
7348
|
+
declare const getProjects: MaybeContext<BuildRESTFunction<typeof getProjects$1> & typeof getProjects$1>;
|
|
7349
|
+
declare const syncProject: MaybeContext<BuildRESTFunction<typeof syncProject$1> & typeof syncProject$1>;
|
|
7350
|
+
declare const getSyncStatus: MaybeContext<BuildRESTFunction<typeof getSyncStatus$1> & typeof getSyncStatus$1>;
|
|
7351
|
+
declare const stopSync: MaybeContext<BuildRESTFunction<typeof stopSync$1> & typeof stopSync$1>;
|
|
7352
|
+
declare const getLoginRedirectableUrl: MaybeContext<BuildRESTFunction<typeof getLoginRedirectableUrl$1> & typeof getLoginRedirectableUrl$1>;
|
|
4880
7353
|
|
|
4881
7354
|
type context_ActionEvent = ActionEvent;
|
|
4882
7355
|
type context_Asset = Asset;
|