@wix/groups 1.0.101 → 1.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/context.js +1 -0
- package/build/cjs/context.js.map +1 -0
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/meta.js +1 -0
- package/build/cjs/meta.js.map +1 -0
- package/package.json +11 -11
- package/type-bundles/context.bundle.d.ts +3598 -150
- package/type-bundles/index.bundle.d.ts +3598 -150
|
@@ -1,8 +1,47 @@
|
|
|
1
|
+
type HostModule$8<T, H extends Host$8> = {
|
|
2
|
+
__type: 'host';
|
|
3
|
+
create(host: H): T;
|
|
4
|
+
};
|
|
5
|
+
type HostModuleAPI$8<T extends HostModule$8<any, any>> = T extends HostModule$8<infer U, any> ? U : never;
|
|
6
|
+
type Host$8<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
|
+
|
|
1
39
|
type RESTFunctionDescriptor$8<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$8) => T;
|
|
2
40
|
interface HttpClient$8 {
|
|
3
41
|
request<TResponse, TData = any>(req: RequestOptionsFactory$8<TResponse, TData>): Promise<HttpResponse$8<TResponse>>;
|
|
4
42
|
fetchWithAuth: typeof fetch;
|
|
5
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
|
+
getActiveToken?: () => string | undefined;
|
|
6
45
|
}
|
|
7
46
|
type RequestOptionsFactory$8<TResponse = any, TData = any> = (context: any) => RequestOptions$8<TResponse, TData>;
|
|
8
47
|
type HttpResponse$8<T = any> = {
|
|
@@ -24,16 +63,65 @@ type APIMetadata$8 = {
|
|
|
24
63
|
packageName?: string;
|
|
25
64
|
};
|
|
26
65
|
type BuildRESTFunction$8<T extends RESTFunctionDescriptor$8> = T extends RESTFunctionDescriptor$8<infer U> ? U : never;
|
|
27
|
-
type EventDefinition$
|
|
66
|
+
type EventDefinition$g<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$
|
|
35
|
-
type EventHandler$
|
|
36
|
-
type BuildEventDefinition$
|
|
73
|
+
declare function EventDefinition$g<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$g<Payload, Type>;
|
|
74
|
+
type EventHandler$g<T extends EventDefinition$g> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$g<T extends EventDefinition$g<any, string>> = (handler: EventHandler$g<T>) => void;
|
|
76
|
+
|
|
77
|
+
type ServicePluginMethodInput$8 = {
|
|
78
|
+
request: any;
|
|
79
|
+
metadata: any;
|
|
80
|
+
};
|
|
81
|
+
type ServicePluginContract$8 = Record<string, (payload: ServicePluginMethodInput$8) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata$8 = {
|
|
83
|
+
name: string;
|
|
84
|
+
primaryHttpMappingPath: string;
|
|
85
|
+
transformations: {
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$8;
|
|
87
|
+
toREST: (...args: unknown[]) => unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginDefinition$8<Contract extends ServicePluginContract$8> = {
|
|
91
|
+
__type: 'service-plugin-definition';
|
|
92
|
+
componentType: string;
|
|
93
|
+
methods: ServicePluginMethodMetadata$8[];
|
|
94
|
+
__contract: Contract;
|
|
95
|
+
};
|
|
96
|
+
declare function ServicePluginDefinition$8<Contract extends ServicePluginContract$8>(componentType: string, methods: ServicePluginMethodMetadata$8[]): ServicePluginDefinition$8<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition$8<T extends ServicePluginDefinition$8<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$8 = "wix_spi_error";
|
|
99
|
+
|
|
100
|
+
type RequestContext$8 = {
|
|
101
|
+
isSSR: boolean;
|
|
102
|
+
host: string;
|
|
103
|
+
protocol?: string;
|
|
104
|
+
};
|
|
105
|
+
type ResponseTransformer$8 = (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$8 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions$8<T = any> = {
|
|
113
|
+
_?: T;
|
|
114
|
+
url?: string;
|
|
115
|
+
method?: Method$8;
|
|
116
|
+
params?: any;
|
|
117
|
+
data?: any;
|
|
118
|
+
transformResponse?: ResponseTransformer$8 | ResponseTransformer$8[];
|
|
119
|
+
};
|
|
120
|
+
type AmbassadorFactory$8<Request, Response> = (payload: Request) => ((context: RequestContext$8) => AmbassadorRequestOptions$8<Response>) & {
|
|
121
|
+
__isAmbassador: boolean;
|
|
122
|
+
};
|
|
123
|
+
type AmbassadorFunctionDescriptor$8<Request = any, Response = any> = AmbassadorFactory$8<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction$8<T extends AmbassadorFunctionDescriptor$8> = T extends AmbassadorFunctionDescriptor$8<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$8: 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$8 = {[emptyObjectSymbol$8]?: 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$8<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$8<KeyType, ExcludeType> = IsEqual$8<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
|
+
|
|
224
|
+
type ExceptOptions$8 = {
|
|
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$8<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$8 = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter$8<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$8<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$8<Base, Condition> = Except$8<
|
|
361
|
+
Base,
|
|
362
|
+
ConditionalKeys$8<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$8 = RESTFunctionDescriptor$8 | AmbassadorFunctionDescriptor$8 | HostModule$8<any, any> | EventDefinition$g<any> | ServicePluginDefinition$8<any> | {
|
|
371
|
+
[key: string]: Descriptors$8 | PublicMetadata$8 | 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$8<T extends Descriptors$8, H extends Host$8<any> | undefined, Depth extends number = 5> = {
|
|
380
|
+
done: T;
|
|
381
|
+
recurse: T extends {
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$8;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor$8 ? BuildAmbassadorFunction$8<T> : T extends RESTFunctionDescriptor$8 ? BuildRESTFunction$8<T> : T extends EventDefinition$g<any> ? BuildEventDefinition$g<T> : T extends ServicePluginDefinition$8<any> ? BuildServicePluginDefinition$8<T> : T extends HostModule$8<any, any> ? HostModuleAPI$8<T> : ConditionalExcept$8<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors$8 ? BuildDescriptors$8<T[Key], H, [
|
|
385
|
+
-1,
|
|
386
|
+
0,
|
|
387
|
+
1,
|
|
388
|
+
2,
|
|
389
|
+
3,
|
|
390
|
+
4,
|
|
391
|
+
5
|
|
392
|
+
][Depth]> : never;
|
|
393
|
+
}, EmptyObject$8>;
|
|
394
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
+
type PublicMetadata$8 = {
|
|
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$8<T extends Descriptors$8> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host$8;
|
|
409
|
+
} ? BuildDescriptors$8<T, globalThis.ContextualClient['host']> : T;
|
|
410
|
+
|
|
45
411
|
interface Group$2 {
|
|
46
412
|
/**
|
|
47
413
|
* Group ID.
|
|
@@ -965,21 +1331,39 @@ interface QueryGroupsSignature {
|
|
|
965
1331
|
*/
|
|
966
1332
|
(options?: QueryGroupsOptions | undefined): GroupsQueryBuilder;
|
|
967
1333
|
}
|
|
968
|
-
declare const onGroupCreated$1: EventDefinition$
|
|
969
|
-
declare const onGroupUpdated$1: EventDefinition$
|
|
970
|
-
declare const onGroupCoverChanged$1: EventDefinition$
|
|
971
|
-
declare const onGroupDescriptionChanged$1: EventDefinition$
|
|
972
|
-
declare const onGroupDeleted$1: EventDefinition$
|
|
1334
|
+
declare const onGroupCreated$1: EventDefinition$g<GroupCreatedEnvelope, "wix.social_groups.v2.group_created">;
|
|
1335
|
+
declare const onGroupUpdated$1: EventDefinition$g<GroupUpdatedEnvelope, "wix.social_groups.v2.group_updated">;
|
|
1336
|
+
declare const onGroupCoverChanged$1: EventDefinition$g<GroupCoverChangedEnvelope, "wix.social_groups.v2.group_group_cover_changed">;
|
|
1337
|
+
declare const onGroupDescriptionChanged$1: EventDefinition$g<GroupDescriptionChangedEnvelope, "wix.social_groups.v2.group_group_description_changed">;
|
|
1338
|
+
declare const onGroupDeleted$1: EventDefinition$g<GroupDeletedEnvelope, "wix.social_groups.v2.group_deleted">;
|
|
1339
|
+
|
|
1340
|
+
type EventDefinition$f<Payload = unknown, Type extends string = string> = {
|
|
1341
|
+
__type: 'event-definition';
|
|
1342
|
+
type: Type;
|
|
1343
|
+
isDomainEvent?: boolean;
|
|
1344
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1345
|
+
__payload: Payload;
|
|
1346
|
+
};
|
|
1347
|
+
declare function EventDefinition$f<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$f<Payload, Type>;
|
|
1348
|
+
type EventHandler$f<T extends EventDefinition$f> = (payload: T['__payload']) => void | Promise<void>;
|
|
1349
|
+
type BuildEventDefinition$f<T extends EventDefinition$f<any, string>> = (handler: EventHandler$f<T>) => void;
|
|
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
|
+
}
|
|
973
1357
|
|
|
974
|
-
declare function createEventModule$7<T extends EventDefinition$
|
|
1358
|
+
declare function createEventModule$7<T extends EventDefinition$f<any, string>>(eventDefinition: T): BuildEventDefinition$f<T> & T;
|
|
975
1359
|
|
|
976
|
-
declare const createGroup: BuildRESTFunction$8<typeof createGroup$1> & typeof createGroup$1
|
|
977
|
-
declare const updateGroup: BuildRESTFunction$8<typeof updateGroup$1> & typeof updateGroup$1
|
|
978
|
-
declare const deleteGroup: BuildRESTFunction$8<typeof deleteGroup$1> & typeof deleteGroup$1
|
|
979
|
-
declare const getGroup: BuildRESTFunction$8<typeof getGroup$1> & typeof getGroup$1
|
|
980
|
-
declare const getGroupBySlug: BuildRESTFunction$8<typeof getGroupBySlug$1> & typeof getGroupBySlug$1
|
|
981
|
-
declare const listGroups: BuildRESTFunction$8<typeof listGroups$1> & typeof listGroups$1
|
|
982
|
-
declare const queryGroups: BuildRESTFunction$8<typeof queryGroups$1> & typeof queryGroups$1
|
|
1360
|
+
declare const createGroup: MaybeContext$8<BuildRESTFunction$8<typeof createGroup$1> & typeof createGroup$1>;
|
|
1361
|
+
declare const updateGroup: MaybeContext$8<BuildRESTFunction$8<typeof updateGroup$1> & typeof updateGroup$1>;
|
|
1362
|
+
declare const deleteGroup: MaybeContext$8<BuildRESTFunction$8<typeof deleteGroup$1> & typeof deleteGroup$1>;
|
|
1363
|
+
declare const getGroup: MaybeContext$8<BuildRESTFunction$8<typeof getGroup$1> & typeof getGroup$1>;
|
|
1364
|
+
declare const getGroupBySlug: MaybeContext$8<BuildRESTFunction$8<typeof getGroupBySlug$1> & typeof getGroupBySlug$1>;
|
|
1365
|
+
declare const listGroups: MaybeContext$8<BuildRESTFunction$8<typeof listGroups$1> & typeof listGroups$1>;
|
|
1366
|
+
declare const queryGroups: MaybeContext$8<BuildRESTFunction$8<typeof queryGroups$1> & typeof queryGroups$1>;
|
|
983
1367
|
|
|
984
1368
|
type _publicOnGroupCreatedType = typeof onGroupCreated$1;
|
|
985
1369
|
/**
|
|
@@ -1089,11 +1473,50 @@ declare namespace context$8 {
|
|
|
1089
1473
|
export { type AccessRestriction$2 as AccessRestriction, type AccessRestrictionDataOneOf$2 as AccessRestrictionDataOneOf, type ActionEvent$7 as ActionEvent, AllowPolicy$2 as AllowPolicy, type context$8_BMFeatures as BMFeatures, context$8_BMFeaturesBMFeatures as BMFeaturesBMFeatures, type BaseEventMetadata$7 as BaseEventMetadata, context$8_ContentType as ContentType, type CoverImage$2 as CoverImage, type context$8_CreateGroupOptions as CreateGroupOptions, type context$8_CreateGroupRequest as CreateGroupRequest, type context$8_CreateGroupResponse as CreateGroupResponse, type context$8_CreateGroupResponseNonNullableFields as CreateGroupResponseNonNullableFields, type context$8_DeleteGroupRequest as DeleteGroupRequest, type context$8_DeleteGroupResponse as DeleteGroupResponse, type context$8_DeleteGroupResponseNonNullableFields as DeleteGroupResponseNonNullableFields, type DomainEvent$7 as DomainEvent, type DomainEventBodyOneOf$7 as DomainEventBodyOneOf, type EntityCreatedEvent$7 as EntityCreatedEvent, type EntityDeletedEvent$7 as EntityDeletedEvent, type EntityUpdatedEvent$7 as EntityUpdatedEvent, type EventMetadata$7 as EventMetadata, type Events$2 as Events, type context$8_GetGroupBMFeaturesRequest as GetGroupBMFeaturesRequest, type context$8_GetGroupBMFeaturesResponse as GetGroupBMFeaturesResponse, type context$8_GetGroupBySlugOptions as GetGroupBySlugOptions, type context$8_GetGroupBySlugRequest as GetGroupBySlugRequest, type context$8_GetGroupBySlugResponse as GetGroupBySlugResponse, type context$8_GetGroupBySlugResponseNonNullableFields as GetGroupBySlugResponseNonNullableFields, type context$8_GetGroupMembersGroupIdsRequest as GetGroupMembersGroupIdsRequest, type context$8_GetGroupMembersGroupIdsResponse as GetGroupMembersGroupIdsResponse, type context$8_GetGroupOptions as GetGroupOptions, type context$8_GetGroupRequest as GetGroupRequest, type context$8_GetGroupResponse as GetGroupResponse, type context$8_GetGroupResponseNonNullableFields as GetGroupResponseNonNullableFields, type Group$2 as Group, type context$8_GroupCoverChanged as GroupCoverChanged, type context$8_GroupCoverChangedEnvelope as GroupCoverChangedEnvelope, type context$8_GroupCreatedEnvelope as GroupCreatedEnvelope, type context$8_GroupDeletedEnvelope as GroupDeletedEnvelope, type context$8_GroupDescriptionChanged as GroupDescriptionChanged, type context$8_GroupDescriptionChangedEnvelope as GroupDescriptionChangedEnvelope, type GroupDetails$2 as GroupDetails, type GroupDetailsPosition$2 as GroupDetailsPosition, type context$8_GroupIntegrationsData as GroupIntegrationsData, type GroupNonNullableFields$2 as GroupNonNullableFields, type context$8_GroupPermissions as GroupPermissions, type GroupSettings$2 as GroupSettings, type context$8_GroupUpdatedEnvelope as GroupUpdatedEnvelope, type context$8_GroupWithMsId as GroupWithMsId, type context$8_GroupsQueryBuilder as GroupsQueryBuilder, type context$8_GroupsQueryResult as GroupsQueryResult, type IdentificationData$7 as IdentificationData, type IdentificationDataIdOneOf$7 as IdentificationDataIdOneOf, type Identity$2 as Identity, IdentityType$2 as IdentityType, type Image$2 as Image, type context$8_ListGroupIntegrationsDataRequest as ListGroupIntegrationsDataRequest, type context$8_ListGroupIntegrationsDataResponse as ListGroupIntegrationsDataResponse, type context$8_ListGroupsByUserIdRequest as ListGroupsByUserIdRequest, type context$8_ListGroupsByUserIdResponse as ListGroupsByUserIdResponse, type context$8_ListGroupsOptions as ListGroupsOptions, type context$8_ListGroupsRequest as ListGroupsRequest, type context$8_ListGroupsResponse as ListGroupsResponse, type context$8_ListGroupsResponseNonNullableFields as ListGroupsResponseNonNullableFields, type Logo$2 as Logo, MembershipStatus$1 as MembershipStatus, type MessageEnvelope$7 as MessageEnvelope, type OnboardingStepSettings$2 as OnboardingStepSettings, type Paging$6 as Paging, type PagingMetadata$6 as PagingMetadata, type Position$2 as Position, PrivacyStatus$2 as PrivacyStatus, type Query$5 as Query, type context$8_QueryGroupsByMembershipRequest as QueryGroupsByMembershipRequest, type context$8_QueryGroupsByMembershipResponse as QueryGroupsByMembershipResponse, type context$8_QueryGroupsOptions as QueryGroupsOptions, type context$8_QueryGroupsRequest as QueryGroupsRequest, type context$8_QueryGroupsResponse as QueryGroupsResponse, type context$8_QueryGroupsResponseNonNullableFields as QueryGroupsResponseNonNullableFields, type context$8_QueryJoinedGroupsRequest as QueryJoinedGroupsRequest, type context$8_QueryJoinedGroupsResponse as QueryJoinedGroupsResponse, type RestoreInfo$7 as RestoreInfo, SortOrder$5 as SortOrder, type Sorting$5 as Sorting, StepKey$2 as StepKey, Type$2 as Type, type context$8_UpdateGroup as UpdateGroup, type context$8_UpdateGroupOptions as UpdateGroupOptions, type context$8_UpdateGroupRequest as UpdateGroupRequest, type context$8_UpdateGroupResponse as UpdateGroupResponse, type context$8_UpdateGroupResponseNonNullableFields as UpdateGroupResponseNonNullableFields, WebhookIdentityType$7 as WebhookIdentityType, type context$8__publicOnGroupCoverChangedType as _publicOnGroupCoverChangedType, type context$8__publicOnGroupCreatedType as _publicOnGroupCreatedType, type context$8__publicOnGroupDeletedType as _publicOnGroupDeletedType, type context$8__publicOnGroupDescriptionChangedType as _publicOnGroupDescriptionChangedType, type context$8__publicOnGroupUpdatedType as _publicOnGroupUpdatedType, context$8_createGroup as createGroup, context$8_deleteGroup as deleteGroup, context$8_getGroup as getGroup, context$8_getGroupBySlug as getGroupBySlug, context$8_listGroups as listGroups, context$8_onGroupCoverChanged as onGroupCoverChanged, context$8_onGroupCreated as onGroupCreated, context$8_onGroupDeleted as onGroupDeleted, context$8_onGroupDescriptionChanged as onGroupDescriptionChanged, context$8_onGroupUpdated as onGroupUpdated, onGroupCoverChanged$1 as publicOnGroupCoverChanged, onGroupCreated$1 as publicOnGroupCreated, onGroupDeleted$1 as publicOnGroupDeleted, onGroupDescriptionChanged$1 as publicOnGroupDescriptionChanged, onGroupUpdated$1 as publicOnGroupUpdated, context$8_queryGroups as queryGroups, context$8_updateGroup as updateGroup };
|
|
1090
1474
|
}
|
|
1091
1475
|
|
|
1476
|
+
type HostModule$7<T, H extends Host$7> = {
|
|
1477
|
+
__type: 'host';
|
|
1478
|
+
create(host: H): T;
|
|
1479
|
+
};
|
|
1480
|
+
type HostModuleAPI$7<T extends HostModule$7<any, any>> = T extends HostModule$7<infer U, any> ? U : never;
|
|
1481
|
+
type Host$7<Environment = unknown> = {
|
|
1482
|
+
channel: {
|
|
1483
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1484
|
+
disconnect: () => void;
|
|
1485
|
+
} | Promise<{
|
|
1486
|
+
disconnect: () => void;
|
|
1487
|
+
}>;
|
|
1488
|
+
};
|
|
1489
|
+
environment?: Environment;
|
|
1490
|
+
/**
|
|
1491
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1492
|
+
*/
|
|
1493
|
+
apiBaseUrl?: string;
|
|
1494
|
+
/**
|
|
1495
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1496
|
+
* like internationalization, billing, etc.
|
|
1497
|
+
*/
|
|
1498
|
+
essentials?: {
|
|
1499
|
+
/**
|
|
1500
|
+
* The language of the currently viewed session
|
|
1501
|
+
*/
|
|
1502
|
+
language?: string;
|
|
1503
|
+
/**
|
|
1504
|
+
* The locale of the currently viewed session
|
|
1505
|
+
*/
|
|
1506
|
+
locale?: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* Any headers that should be passed through to the API requests
|
|
1509
|
+
*/
|
|
1510
|
+
passThroughHeaders?: Record<string, string>;
|
|
1511
|
+
};
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1092
1514
|
type RESTFunctionDescriptor$7<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$7) => T;
|
|
1093
1515
|
interface HttpClient$7 {
|
|
1094
1516
|
request<TResponse, TData = any>(req: RequestOptionsFactory$7<TResponse, TData>): Promise<HttpResponse$7<TResponse>>;
|
|
1095
1517
|
fetchWithAuth: typeof fetch;
|
|
1096
1518
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1519
|
+
getActiveToken?: () => string | undefined;
|
|
1097
1520
|
}
|
|
1098
1521
|
type RequestOptionsFactory$7<TResponse = any, TData = any> = (context: any) => RequestOptions$7<TResponse, TData>;
|
|
1099
1522
|
type HttpResponse$7<T = any> = {
|
|
@@ -1115,16 +1538,65 @@ type APIMetadata$7 = {
|
|
|
1115
1538
|
packageName?: string;
|
|
1116
1539
|
};
|
|
1117
1540
|
type BuildRESTFunction$7<T extends RESTFunctionDescriptor$7> = T extends RESTFunctionDescriptor$7<infer U> ? U : never;
|
|
1118
|
-
type EventDefinition$
|
|
1541
|
+
type EventDefinition$e<Payload = unknown, Type extends string = string> = {
|
|
1119
1542
|
__type: 'event-definition';
|
|
1120
1543
|
type: Type;
|
|
1121
1544
|
isDomainEvent?: boolean;
|
|
1122
1545
|
transformations?: (envelope: unknown) => Payload;
|
|
1123
1546
|
__payload: Payload;
|
|
1124
1547
|
};
|
|
1125
|
-
declare function EventDefinition$
|
|
1126
|
-
type EventHandler$
|
|
1127
|
-
type BuildEventDefinition$
|
|
1548
|
+
declare function EventDefinition$e<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$e<Payload, Type>;
|
|
1549
|
+
type EventHandler$e<T extends EventDefinition$e> = (payload: T['__payload']) => void | Promise<void>;
|
|
1550
|
+
type BuildEventDefinition$e<T extends EventDefinition$e<any, string>> = (handler: EventHandler$e<T>) => void;
|
|
1551
|
+
|
|
1552
|
+
type ServicePluginMethodInput$7 = {
|
|
1553
|
+
request: any;
|
|
1554
|
+
metadata: any;
|
|
1555
|
+
};
|
|
1556
|
+
type ServicePluginContract$7 = Record<string, (payload: ServicePluginMethodInput$7) => unknown | Promise<unknown>>;
|
|
1557
|
+
type ServicePluginMethodMetadata$7 = {
|
|
1558
|
+
name: string;
|
|
1559
|
+
primaryHttpMappingPath: string;
|
|
1560
|
+
transformations: {
|
|
1561
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$7;
|
|
1562
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1563
|
+
};
|
|
1564
|
+
};
|
|
1565
|
+
type ServicePluginDefinition$7<Contract extends ServicePluginContract$7> = {
|
|
1566
|
+
__type: 'service-plugin-definition';
|
|
1567
|
+
componentType: string;
|
|
1568
|
+
methods: ServicePluginMethodMetadata$7[];
|
|
1569
|
+
__contract: Contract;
|
|
1570
|
+
};
|
|
1571
|
+
declare function ServicePluginDefinition$7<Contract extends ServicePluginContract$7>(componentType: string, methods: ServicePluginMethodMetadata$7[]): ServicePluginDefinition$7<Contract>;
|
|
1572
|
+
type BuildServicePluginDefinition$7<T extends ServicePluginDefinition$7<any>> = (implementation: T['__contract']) => void;
|
|
1573
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$7 = "wix_spi_error";
|
|
1574
|
+
|
|
1575
|
+
type RequestContext$7 = {
|
|
1576
|
+
isSSR: boolean;
|
|
1577
|
+
host: string;
|
|
1578
|
+
protocol?: string;
|
|
1579
|
+
};
|
|
1580
|
+
type ResponseTransformer$7 = (data: any, headers?: any) => any;
|
|
1581
|
+
/**
|
|
1582
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1583
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1584
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1585
|
+
*/
|
|
1586
|
+
type Method$7 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1587
|
+
type AmbassadorRequestOptions$7<T = any> = {
|
|
1588
|
+
_?: T;
|
|
1589
|
+
url?: string;
|
|
1590
|
+
method?: Method$7;
|
|
1591
|
+
params?: any;
|
|
1592
|
+
data?: any;
|
|
1593
|
+
transformResponse?: ResponseTransformer$7 | ResponseTransformer$7[];
|
|
1594
|
+
};
|
|
1595
|
+
type AmbassadorFactory$7<Request, Response> = (payload: Request) => ((context: RequestContext$7) => AmbassadorRequestOptions$7<Response>) & {
|
|
1596
|
+
__isAmbassador: boolean;
|
|
1597
|
+
};
|
|
1598
|
+
type AmbassadorFunctionDescriptor$7<Request = any, Response = any> = AmbassadorFactory$7<Request, Response>;
|
|
1599
|
+
type BuildAmbassadorFunction$7<T extends AmbassadorFunctionDescriptor$7> = T extends AmbassadorFunctionDescriptor$7<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1128
1600
|
|
|
1129
1601
|
declare global {
|
|
1130
1602
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -1133,6 +1605,284 @@ declare global {
|
|
|
1133
1605
|
}
|
|
1134
1606
|
}
|
|
1135
1607
|
|
|
1608
|
+
declare const emptyObjectSymbol$7: unique symbol;
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1612
|
+
|
|
1613
|
+
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)).
|
|
1614
|
+
|
|
1615
|
+
@example
|
|
1616
|
+
```
|
|
1617
|
+
import type {EmptyObject} from 'type-fest';
|
|
1618
|
+
|
|
1619
|
+
// The following illustrates the problem with `{}`.
|
|
1620
|
+
const foo1: {} = {}; // Pass
|
|
1621
|
+
const foo2: {} = []; // Pass
|
|
1622
|
+
const foo3: {} = 42; // Pass
|
|
1623
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1624
|
+
|
|
1625
|
+
// With `EmptyObject` only the first case is valid.
|
|
1626
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1627
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1628
|
+
const bar3: EmptyObject = []; // Fail
|
|
1629
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1630
|
+
```
|
|
1631
|
+
|
|
1632
|
+
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}.
|
|
1633
|
+
|
|
1634
|
+
@category Object
|
|
1635
|
+
*/
|
|
1636
|
+
type EmptyObject$7 = {[emptyObjectSymbol$7]?: never};
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
Returns a boolean for whether the two given types are equal.
|
|
1640
|
+
|
|
1641
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1642
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1643
|
+
|
|
1644
|
+
Use-cases:
|
|
1645
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1646
|
+
|
|
1647
|
+
@example
|
|
1648
|
+
```
|
|
1649
|
+
import type {IsEqual} from 'type-fest';
|
|
1650
|
+
|
|
1651
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1652
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1653
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1654
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1655
|
+
? IsEqual<Value[0], Item> extends true
|
|
1656
|
+
? true
|
|
1657
|
+
: Includes<rest, Item>
|
|
1658
|
+
: false;
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
@category Type Guard
|
|
1662
|
+
@category Utilities
|
|
1663
|
+
*/
|
|
1664
|
+
type IsEqual$7<A, B> =
|
|
1665
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1666
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1667
|
+
? true
|
|
1668
|
+
: false;
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
Filter out keys from an object.
|
|
1672
|
+
|
|
1673
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1674
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1675
|
+
Returns `Key` otherwise.
|
|
1676
|
+
|
|
1677
|
+
@example
|
|
1678
|
+
```
|
|
1679
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1680
|
+
//=> never
|
|
1681
|
+
```
|
|
1682
|
+
|
|
1683
|
+
@example
|
|
1684
|
+
```
|
|
1685
|
+
type Filtered = Filter<'bar', string>;
|
|
1686
|
+
//=> never
|
|
1687
|
+
```
|
|
1688
|
+
|
|
1689
|
+
@example
|
|
1690
|
+
```
|
|
1691
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1692
|
+
//=> 'bar'
|
|
1693
|
+
```
|
|
1694
|
+
|
|
1695
|
+
@see {Except}
|
|
1696
|
+
*/
|
|
1697
|
+
type Filter$7<KeyType, ExcludeType> = IsEqual$7<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1698
|
+
|
|
1699
|
+
type ExceptOptions$7 = {
|
|
1700
|
+
/**
|
|
1701
|
+
Disallow assigning non-specified properties.
|
|
1702
|
+
|
|
1703
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1704
|
+
|
|
1705
|
+
@default false
|
|
1706
|
+
*/
|
|
1707
|
+
requireExactProps?: boolean;
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
Create a type from an object type without certain keys.
|
|
1712
|
+
|
|
1713
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1714
|
+
|
|
1715
|
+
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.
|
|
1716
|
+
|
|
1717
|
+
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)).
|
|
1718
|
+
|
|
1719
|
+
@example
|
|
1720
|
+
```
|
|
1721
|
+
import type {Except} from 'type-fest';
|
|
1722
|
+
|
|
1723
|
+
type Foo = {
|
|
1724
|
+
a: number;
|
|
1725
|
+
b: string;
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1729
|
+
//=> {b: string}
|
|
1730
|
+
|
|
1731
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1732
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1733
|
+
|
|
1734
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1735
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1736
|
+
|
|
1737
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1738
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1739
|
+
```
|
|
1740
|
+
|
|
1741
|
+
@category Object
|
|
1742
|
+
*/
|
|
1743
|
+
type Except$7<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$7 = {requireExactProps: false}> = {
|
|
1744
|
+
[KeyType in keyof ObjectType as Filter$7<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1745
|
+
} & (Options['requireExactProps'] extends true
|
|
1746
|
+
? Partial<Record<KeysType, never>>
|
|
1747
|
+
: {});
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1751
|
+
|
|
1752
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1753
|
+
|
|
1754
|
+
@example
|
|
1755
|
+
```
|
|
1756
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1757
|
+
|
|
1758
|
+
interface Example {
|
|
1759
|
+
a: string;
|
|
1760
|
+
b: string | number;
|
|
1761
|
+
c?: string;
|
|
1762
|
+
d: {};
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1766
|
+
//=> 'a'
|
|
1767
|
+
```
|
|
1768
|
+
|
|
1769
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1770
|
+
|
|
1771
|
+
@example
|
|
1772
|
+
```
|
|
1773
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1774
|
+
|
|
1775
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1776
|
+
//=> 'a' | 'c'
|
|
1777
|
+
```
|
|
1778
|
+
|
|
1779
|
+
@category Object
|
|
1780
|
+
*/
|
|
1781
|
+
type ConditionalKeys$7<Base, Condition> = NonNullable<
|
|
1782
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1783
|
+
{
|
|
1784
|
+
// Map through all the keys of the given base type.
|
|
1785
|
+
[Key in keyof Base]:
|
|
1786
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1787
|
+
Base[Key] extends Condition
|
|
1788
|
+
// Retain this key since the condition passes.
|
|
1789
|
+
? Key
|
|
1790
|
+
// Discard this key since the condition fails.
|
|
1791
|
+
: never;
|
|
1792
|
+
|
|
1793
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1794
|
+
}[keyof Base]
|
|
1795
|
+
>;
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1799
|
+
|
|
1800
|
+
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.
|
|
1801
|
+
|
|
1802
|
+
@example
|
|
1803
|
+
```
|
|
1804
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1805
|
+
|
|
1806
|
+
class Awesome {
|
|
1807
|
+
name: string;
|
|
1808
|
+
successes: number;
|
|
1809
|
+
failures: bigint;
|
|
1810
|
+
|
|
1811
|
+
run() {}
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1815
|
+
//=> {run: () => void}
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
@example
|
|
1819
|
+
```
|
|
1820
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1821
|
+
|
|
1822
|
+
interface Example {
|
|
1823
|
+
a: string;
|
|
1824
|
+
b: string | number;
|
|
1825
|
+
c: () => void;
|
|
1826
|
+
d: {};
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1830
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1831
|
+
```
|
|
1832
|
+
|
|
1833
|
+
@category Object
|
|
1834
|
+
*/
|
|
1835
|
+
type ConditionalExcept$7<Base, Condition> = Except$7<
|
|
1836
|
+
Base,
|
|
1837
|
+
ConditionalKeys$7<Base, Condition>
|
|
1838
|
+
>;
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1842
|
+
* can either be a REST module or a host module.
|
|
1843
|
+
* This type is recursive, so it can describe nested modules.
|
|
1844
|
+
*/
|
|
1845
|
+
type Descriptors$7 = RESTFunctionDescriptor$7 | AmbassadorFunctionDescriptor$7 | HostModule$7<any, any> | EventDefinition$e<any> | ServicePluginDefinition$7<any> | {
|
|
1846
|
+
[key: string]: Descriptors$7 | PublicMetadata$7 | any;
|
|
1847
|
+
};
|
|
1848
|
+
/**
|
|
1849
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1850
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1851
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1852
|
+
* do not match the given host (as they will not work with the given host).
|
|
1853
|
+
*/
|
|
1854
|
+
type BuildDescriptors$7<T extends Descriptors$7, H extends Host$7<any> | undefined, Depth extends number = 5> = {
|
|
1855
|
+
done: T;
|
|
1856
|
+
recurse: T extends {
|
|
1857
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$7;
|
|
1858
|
+
} ? never : T extends AmbassadorFunctionDescriptor$7 ? BuildAmbassadorFunction$7<T> : T extends RESTFunctionDescriptor$7 ? BuildRESTFunction$7<T> : T extends EventDefinition$e<any> ? BuildEventDefinition$e<T> : T extends ServicePluginDefinition$7<any> ? BuildServicePluginDefinition$7<T> : T extends HostModule$7<any, any> ? HostModuleAPI$7<T> : ConditionalExcept$7<{
|
|
1859
|
+
[Key in keyof T]: T[Key] extends Descriptors$7 ? BuildDescriptors$7<T[Key], H, [
|
|
1860
|
+
-1,
|
|
1861
|
+
0,
|
|
1862
|
+
1,
|
|
1863
|
+
2,
|
|
1864
|
+
3,
|
|
1865
|
+
4,
|
|
1866
|
+
5
|
|
1867
|
+
][Depth]> : never;
|
|
1868
|
+
}, EmptyObject$7>;
|
|
1869
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1870
|
+
type PublicMetadata$7 = {
|
|
1871
|
+
PACKAGE_NAME?: string;
|
|
1872
|
+
};
|
|
1873
|
+
|
|
1874
|
+
declare global {
|
|
1875
|
+
interface ContextualClient {
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1880
|
+
* case a contextual client is available.
|
|
1881
|
+
*/
|
|
1882
|
+
type MaybeContext$7<T extends Descriptors$7> = globalThis.ContextualClient extends {
|
|
1883
|
+
host: Host$7;
|
|
1884
|
+
} ? BuildDescriptors$7<T, globalThis.ContextualClient['host']> : T;
|
|
1885
|
+
|
|
1136
1886
|
interface GroupMember$1 {
|
|
1137
1887
|
/**
|
|
1138
1888
|
* @internal
|
|
@@ -1825,17 +2575,35 @@ interface QueryMembershipsSignature {
|
|
|
1825
2575
|
*/
|
|
1826
2576
|
(memberId: string | null, options?: QueryMembershipsOptions | undefined): Promise<QueryMembershipsResponse & QueryMembershipsResponseNonNullableFields>;
|
|
1827
2577
|
}
|
|
1828
|
-
declare const onGroupMemberAdded$1: EventDefinition$
|
|
1829
|
-
declare const onGroupMemberRemoved$1: EventDefinition$
|
|
2578
|
+
declare const onGroupMemberAdded$1: EventDefinition$e<GroupMemberAddedEnvelope, "wix.social_groups.v2.group_member_added">;
|
|
2579
|
+
declare const onGroupMemberRemoved$1: EventDefinition$e<GroupMemberRemovedEnvelope, "wix.social_groups.v2.group_member_removed">;
|
|
2580
|
+
|
|
2581
|
+
type EventDefinition$d<Payload = unknown, Type extends string = string> = {
|
|
2582
|
+
__type: 'event-definition';
|
|
2583
|
+
type: Type;
|
|
2584
|
+
isDomainEvent?: boolean;
|
|
2585
|
+
transformations?: (envelope: unknown) => Payload;
|
|
2586
|
+
__payload: Payload;
|
|
2587
|
+
};
|
|
2588
|
+
declare function EventDefinition$d<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$d<Payload, Type>;
|
|
2589
|
+
type EventHandler$d<T extends EventDefinition$d> = (payload: T['__payload']) => void | Promise<void>;
|
|
2590
|
+
type BuildEventDefinition$d<T extends EventDefinition$d<any, string>> = (handler: EventHandler$d<T>) => void;
|
|
2591
|
+
|
|
2592
|
+
declare global {
|
|
2593
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2594
|
+
interface SymbolConstructor {
|
|
2595
|
+
readonly observable: symbol;
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
1830
2598
|
|
|
1831
|
-
declare function createEventModule$6<T extends EventDefinition$
|
|
2599
|
+
declare function createEventModule$6<T extends EventDefinition$d<any, string>>(eventDefinition: T): BuildEventDefinition$d<T> & T;
|
|
1832
2600
|
|
|
1833
|
-
declare const addGroupMembers: BuildRESTFunction$7<typeof addGroupMembers$1> & typeof addGroupMembers$1
|
|
1834
|
-
declare const removeGroupMembers: BuildRESTFunction$7<typeof removeGroupMembers$1> & typeof removeGroupMembers$1
|
|
1835
|
-
declare const listGroupMembers: BuildRESTFunction$7<typeof listGroupMembers$1> & typeof listGroupMembers$1
|
|
1836
|
-
declare const queryGroupMembers: BuildRESTFunction$7<typeof queryGroupMembers$1> & typeof queryGroupMembers$1
|
|
1837
|
-
declare const listMemberships: BuildRESTFunction$7<typeof listMemberships$1> & typeof listMemberships$1
|
|
1838
|
-
declare const queryMemberships: BuildRESTFunction$7<typeof queryMemberships$1> & typeof queryMemberships$1
|
|
2601
|
+
declare const addGroupMembers: MaybeContext$7<BuildRESTFunction$7<typeof addGroupMembers$1> & typeof addGroupMembers$1>;
|
|
2602
|
+
declare const removeGroupMembers: MaybeContext$7<BuildRESTFunction$7<typeof removeGroupMembers$1> & typeof removeGroupMembers$1>;
|
|
2603
|
+
declare const listGroupMembers: MaybeContext$7<BuildRESTFunction$7<typeof listGroupMembers$1> & typeof listGroupMembers$1>;
|
|
2604
|
+
declare const queryGroupMembers: MaybeContext$7<BuildRESTFunction$7<typeof queryGroupMembers$1> & typeof queryGroupMembers$1>;
|
|
2605
|
+
declare const listMemberships: MaybeContext$7<BuildRESTFunction$7<typeof listMemberships$1> & typeof listMemberships$1>;
|
|
2606
|
+
declare const queryMemberships: MaybeContext$7<BuildRESTFunction$7<typeof queryMemberships$1> & typeof queryMemberships$1>;
|
|
1839
2607
|
|
|
1840
2608
|
type _publicOnGroupMemberAddedType = typeof onGroupMemberAdded$1;
|
|
1841
2609
|
/**
|
|
@@ -1903,11 +2671,50 @@ declare namespace context$7 {
|
|
|
1903
2671
|
export { type ActionEvent$6 as ActionEvent, type context$7_AddGroupMembersOptions as AddGroupMembersOptions, type context$7_AddGroupMembersRequest as AddGroupMembersRequest, type context$7_AddGroupMembersResponse as AddGroupMembersResponse, type context$7_AddGroupMembersResponseNonNullableFields as AddGroupMembersResponseNonNullableFields, type BaseEventMetadata$6 as BaseEventMetadata, type DomainEvent$6 as DomainEvent, type DomainEventBodyOneOf$6 as DomainEventBodyOneOf, type EntityCreatedEvent$6 as EntityCreatedEvent, type EntityDeletedEvent$6 as EntityDeletedEvent, type EntityUpdatedEvent$6 as EntityUpdatedEvent, type EventMetadata$6 as EventMetadata, type GroupMember$1 as GroupMember, type context$7_GroupMemberAddedEnvelope as GroupMemberAddedEnvelope, type context$7_GroupMemberRemovedEnvelope as GroupMemberRemovedEnvelope, type GroupRole$1 as GroupRole, type IdentificationData$6 as IdentificationData, type IdentificationDataIdOneOf$6 as IdentificationDataIdOneOf, context$7_JoinBy as JoinBy, type JoinRequest$1 as JoinRequest, type JoinRequestsApproved$1 as JoinRequestsApproved, type context$7_JoinResponse as JoinResponse, type context$7_LeaveRequest as LeaveRequest, type context$7_LeaveResponse as LeaveResponse, type context$7_ListGroupMembersOptions as ListGroupMembersOptions, type context$7_ListGroupMembersRequest as ListGroupMembersRequest, type context$7_ListGroupMembersResponse as ListGroupMembersResponse, type context$7_ListGroupMembersResponseNonNullableFields as ListGroupMembersResponseNonNullableFields, type context$7_ListMembershipsOptions as ListMembershipsOptions, type context$7_ListMembershipsRequest as ListMembershipsRequest, type context$7_ListMembershipsResponse as ListMembershipsResponse, type context$7_ListMembershipsResponseNonNullableFields as ListMembershipsResponseNonNullableFields, type context$7_MemberAdded as MemberAdded, type context$7_MemberJoined as MemberJoined, type MemberJoinedGroup$1 as MemberJoinedGroup, type context$7_MemberLeft as MemberLeft, type context$7_MemberRemoved as MemberRemoved, type MembersAddedToGroup$1 as MembersAddedToGroup, type MembersInvitedToGroup$1 as MembersInvitedToGroup, type context$7_MembersQueryBuilder as MembersQueryBuilder, type context$7_MembersQueryResult as MembersQueryResult, type context$7_Membership as Membership, type MembershipQuestionAnswer$3 as MembershipQuestionAnswer, context$7_MembershipStatus as MembershipStatus, type MessageEnvelope$6 as MessageEnvelope, type Paging$5 as Paging, type PagingMetadata$5 as PagingMetadata, type Query$4 as Query, type context$7_QueryGroupMembersRequest as QueryGroupMembersRequest, type context$7_QueryGroupMembersResponse as QueryGroupMembersResponse, type context$7_QueryGroupMembersResponseNonNullableFields as QueryGroupMembersResponseNonNullableFields, type context$7_QueryMembershipsOptions as QueryMembershipsOptions, type context$7_QueryMembershipsRequest as QueryMembershipsRequest, type context$7_QueryMembershipsResponse as QueryMembershipsResponse, type context$7_QueryMembershipsResponseNonNullableFields as QueryMembershipsResponseNonNullableFields, type context$7_QueryMyMembershipRequest as QueryMyMembershipRequest, type context$7_QueryMyMembershipResponse as QueryMyMembershipResponse, type context$7_QueryNonGroupMembersRequest as QueryNonGroupMembersRequest, type context$7_QueryNonGroupMembersResponse as QueryNonGroupMembersResponse, type context$7_RemoveGroupMembersOptions as RemoveGroupMembersOptions, type context$7_RemoveGroupMembersRequest as RemoveGroupMembersRequest, type context$7_RemoveGroupMembersResponse as RemoveGroupMembersResponse, type RestoreInfo$6 as RestoreInfo, Role$1 as Role, type SocialGroupsEvent$1 as SocialGroupsEvent, type SocialGroupsEventPayloadOneOf$1 as SocialGroupsEventPayloadOneOf, SortOrder$4 as SortOrder, type Sorting$4 as Sorting, WebhookIdentityType$6 as WebhookIdentityType, type context$7__publicOnGroupMemberAddedType as _publicOnGroupMemberAddedType, type context$7__publicOnGroupMemberRemovedType as _publicOnGroupMemberRemovedType, context$7_addGroupMembers as addGroupMembers, context$7_listGroupMembers as listGroupMembers, context$7_listMemberships as listMemberships, context$7_onGroupMemberAdded as onGroupMemberAdded, context$7_onGroupMemberRemoved as onGroupMemberRemoved, onGroupMemberAdded$1 as publicOnGroupMemberAdded, onGroupMemberRemoved$1 as publicOnGroupMemberRemoved, context$7_queryGroupMembers as queryGroupMembers, context$7_queryMemberships as queryMemberships, context$7_removeGroupMembers as removeGroupMembers };
|
|
1904
2672
|
}
|
|
1905
2673
|
|
|
2674
|
+
type HostModule$6<T, H extends Host$6> = {
|
|
2675
|
+
__type: 'host';
|
|
2676
|
+
create(host: H): T;
|
|
2677
|
+
};
|
|
2678
|
+
type HostModuleAPI$6<T extends HostModule$6<any, any>> = T extends HostModule$6<infer U, any> ? U : never;
|
|
2679
|
+
type Host$6<Environment = unknown> = {
|
|
2680
|
+
channel: {
|
|
2681
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
2682
|
+
disconnect: () => void;
|
|
2683
|
+
} | Promise<{
|
|
2684
|
+
disconnect: () => void;
|
|
2685
|
+
}>;
|
|
2686
|
+
};
|
|
2687
|
+
environment?: Environment;
|
|
2688
|
+
/**
|
|
2689
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
2690
|
+
*/
|
|
2691
|
+
apiBaseUrl?: string;
|
|
2692
|
+
/**
|
|
2693
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
2694
|
+
* like internationalization, billing, etc.
|
|
2695
|
+
*/
|
|
2696
|
+
essentials?: {
|
|
2697
|
+
/**
|
|
2698
|
+
* The language of the currently viewed session
|
|
2699
|
+
*/
|
|
2700
|
+
language?: string;
|
|
2701
|
+
/**
|
|
2702
|
+
* The locale of the currently viewed session
|
|
2703
|
+
*/
|
|
2704
|
+
locale?: string;
|
|
2705
|
+
/**
|
|
2706
|
+
* Any headers that should be passed through to the API requests
|
|
2707
|
+
*/
|
|
2708
|
+
passThroughHeaders?: Record<string, string>;
|
|
2709
|
+
};
|
|
2710
|
+
};
|
|
2711
|
+
|
|
1906
2712
|
type RESTFunctionDescriptor$6<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$6) => T;
|
|
1907
2713
|
interface HttpClient$6 {
|
|
1908
2714
|
request<TResponse, TData = any>(req: RequestOptionsFactory$6<TResponse, TData>): Promise<HttpResponse$6<TResponse>>;
|
|
1909
2715
|
fetchWithAuth: typeof fetch;
|
|
1910
2716
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
2717
|
+
getActiveToken?: () => string | undefined;
|
|
1911
2718
|
}
|
|
1912
2719
|
type RequestOptionsFactory$6<TResponse = any, TData = any> = (context: any) => RequestOptions$6<TResponse, TData>;
|
|
1913
2720
|
type HttpResponse$6<T = any> = {
|
|
@@ -1929,16 +2736,65 @@ type APIMetadata$6 = {
|
|
|
1929
2736
|
packageName?: string;
|
|
1930
2737
|
};
|
|
1931
2738
|
type BuildRESTFunction$6<T extends RESTFunctionDescriptor$6> = T extends RESTFunctionDescriptor$6<infer U> ? U : never;
|
|
1932
|
-
type EventDefinition$
|
|
2739
|
+
type EventDefinition$c<Payload = unknown, Type extends string = string> = {
|
|
1933
2740
|
__type: 'event-definition';
|
|
1934
2741
|
type: Type;
|
|
1935
2742
|
isDomainEvent?: boolean;
|
|
1936
2743
|
transformations?: (envelope: unknown) => Payload;
|
|
1937
2744
|
__payload: Payload;
|
|
1938
2745
|
};
|
|
1939
|
-
declare function EventDefinition$
|
|
1940
|
-
type EventHandler$
|
|
1941
|
-
type BuildEventDefinition$
|
|
2746
|
+
declare function EventDefinition$c<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$c<Payload, Type>;
|
|
2747
|
+
type EventHandler$c<T extends EventDefinition$c> = (payload: T['__payload']) => void | Promise<void>;
|
|
2748
|
+
type BuildEventDefinition$c<T extends EventDefinition$c<any, string>> = (handler: EventHandler$c<T>) => void;
|
|
2749
|
+
|
|
2750
|
+
type ServicePluginMethodInput$6 = {
|
|
2751
|
+
request: any;
|
|
2752
|
+
metadata: any;
|
|
2753
|
+
};
|
|
2754
|
+
type ServicePluginContract$6 = Record<string, (payload: ServicePluginMethodInput$6) => unknown | Promise<unknown>>;
|
|
2755
|
+
type ServicePluginMethodMetadata$6 = {
|
|
2756
|
+
name: string;
|
|
2757
|
+
primaryHttpMappingPath: string;
|
|
2758
|
+
transformations: {
|
|
2759
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$6;
|
|
2760
|
+
toREST: (...args: unknown[]) => unknown;
|
|
2761
|
+
};
|
|
2762
|
+
};
|
|
2763
|
+
type ServicePluginDefinition$6<Contract extends ServicePluginContract$6> = {
|
|
2764
|
+
__type: 'service-plugin-definition';
|
|
2765
|
+
componentType: string;
|
|
2766
|
+
methods: ServicePluginMethodMetadata$6[];
|
|
2767
|
+
__contract: Contract;
|
|
2768
|
+
};
|
|
2769
|
+
declare function ServicePluginDefinition$6<Contract extends ServicePluginContract$6>(componentType: string, methods: ServicePluginMethodMetadata$6[]): ServicePluginDefinition$6<Contract>;
|
|
2770
|
+
type BuildServicePluginDefinition$6<T extends ServicePluginDefinition$6<any>> = (implementation: T['__contract']) => void;
|
|
2771
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$6 = "wix_spi_error";
|
|
2772
|
+
|
|
2773
|
+
type RequestContext$6 = {
|
|
2774
|
+
isSSR: boolean;
|
|
2775
|
+
host: string;
|
|
2776
|
+
protocol?: string;
|
|
2777
|
+
};
|
|
2778
|
+
type ResponseTransformer$6 = (data: any, headers?: any) => any;
|
|
2779
|
+
/**
|
|
2780
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
2781
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
2782
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
2783
|
+
*/
|
|
2784
|
+
type Method$6 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
2785
|
+
type AmbassadorRequestOptions$6<T = any> = {
|
|
2786
|
+
_?: T;
|
|
2787
|
+
url?: string;
|
|
2788
|
+
method?: Method$6;
|
|
2789
|
+
params?: any;
|
|
2790
|
+
data?: any;
|
|
2791
|
+
transformResponse?: ResponseTransformer$6 | ResponseTransformer$6[];
|
|
2792
|
+
};
|
|
2793
|
+
type AmbassadorFactory$6<Request, Response> = (payload: Request) => ((context: RequestContext$6) => AmbassadorRequestOptions$6<Response>) & {
|
|
2794
|
+
__isAmbassador: boolean;
|
|
2795
|
+
};
|
|
2796
|
+
type AmbassadorFunctionDescriptor$6<Request = any, Response = any> = AmbassadorFactory$6<Request, Response>;
|
|
2797
|
+
type BuildAmbassadorFunction$6<T extends AmbassadorFunctionDescriptor$6> = T extends AmbassadorFunctionDescriptor$6<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1942
2798
|
|
|
1943
2799
|
declare global {
|
|
1944
2800
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -1947,29 +2803,307 @@ declare global {
|
|
|
1947
2803
|
}
|
|
1948
2804
|
}
|
|
1949
2805
|
|
|
2806
|
+
declare const emptyObjectSymbol$6: unique symbol;
|
|
2807
|
+
|
|
1950
2808
|
/**
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
2809
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
2810
|
+
|
|
2811
|
+
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)).
|
|
2812
|
+
|
|
2813
|
+
@example
|
|
2814
|
+
```
|
|
2815
|
+
import type {EmptyObject} from 'type-fest';
|
|
2816
|
+
|
|
2817
|
+
// The following illustrates the problem with `{}`.
|
|
2818
|
+
const foo1: {} = {}; // Pass
|
|
2819
|
+
const foo2: {} = []; // Pass
|
|
2820
|
+
const foo3: {} = 42; // Pass
|
|
2821
|
+
const foo4: {} = {a: 1}; // Pass
|
|
2822
|
+
|
|
2823
|
+
// With `EmptyObject` only the first case is valid.
|
|
2824
|
+
const bar1: EmptyObject = {}; // Pass
|
|
2825
|
+
const bar2: EmptyObject = 42; // Fail
|
|
2826
|
+
const bar3: EmptyObject = []; // Fail
|
|
2827
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
2828
|
+
```
|
|
2829
|
+
|
|
2830
|
+
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}.
|
|
2831
|
+
|
|
2832
|
+
@category Object
|
|
2833
|
+
*/
|
|
2834
|
+
type EmptyObject$6 = {[emptyObjectSymbol$6]?: never};
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
Returns a boolean for whether the two given types are equal.
|
|
2838
|
+
|
|
2839
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
2840
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
2841
|
+
|
|
2842
|
+
Use-cases:
|
|
2843
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
2844
|
+
|
|
2845
|
+
@example
|
|
2846
|
+
```
|
|
2847
|
+
import type {IsEqual} from 'type-fest';
|
|
2848
|
+
|
|
2849
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
2850
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
2851
|
+
type Includes<Value extends readonly any[], Item> =
|
|
2852
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
2853
|
+
? IsEqual<Value[0], Item> extends true
|
|
2854
|
+
? true
|
|
2855
|
+
: Includes<rest, Item>
|
|
2856
|
+
: false;
|
|
2857
|
+
```
|
|
2858
|
+
|
|
2859
|
+
@category Type Guard
|
|
2860
|
+
@category Utilities
|
|
2861
|
+
*/
|
|
2862
|
+
type IsEqual$6<A, B> =
|
|
2863
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
2864
|
+
(<G>() => G extends B ? 1 : 2)
|
|
2865
|
+
? true
|
|
2866
|
+
: false;
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
Filter out keys from an object.
|
|
2870
|
+
|
|
2871
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
2872
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
2873
|
+
Returns `Key` otherwise.
|
|
2874
|
+
|
|
2875
|
+
@example
|
|
2876
|
+
```
|
|
2877
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
2878
|
+
//=> never
|
|
2879
|
+
```
|
|
2880
|
+
|
|
2881
|
+
@example
|
|
2882
|
+
```
|
|
2883
|
+
type Filtered = Filter<'bar', string>;
|
|
2884
|
+
//=> never
|
|
2885
|
+
```
|
|
2886
|
+
|
|
2887
|
+
@example
|
|
2888
|
+
```
|
|
2889
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
2890
|
+
//=> 'bar'
|
|
2891
|
+
```
|
|
2892
|
+
|
|
2893
|
+
@see {Except}
|
|
2894
|
+
*/
|
|
2895
|
+
type Filter$6<KeyType, ExcludeType> = IsEqual$6<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
2896
|
+
|
|
2897
|
+
type ExceptOptions$6 = {
|
|
2898
|
+
/**
|
|
2899
|
+
Disallow assigning non-specified properties.
|
|
2900
|
+
|
|
2901
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
2902
|
+
|
|
2903
|
+
@default false
|
|
2904
|
+
*/
|
|
2905
|
+
requireExactProps?: boolean;
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
Create a type from an object type without certain keys.
|
|
2910
|
+
|
|
2911
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
2912
|
+
|
|
2913
|
+
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.
|
|
2914
|
+
|
|
2915
|
+
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)).
|
|
2916
|
+
|
|
2917
|
+
@example
|
|
2918
|
+
```
|
|
2919
|
+
import type {Except} from 'type-fest';
|
|
2920
|
+
|
|
2921
|
+
type Foo = {
|
|
2922
|
+
a: number;
|
|
2923
|
+
b: string;
|
|
2924
|
+
};
|
|
2925
|
+
|
|
2926
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
2927
|
+
//=> {b: string}
|
|
2928
|
+
|
|
2929
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
2930
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
2931
|
+
|
|
2932
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
2933
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
2934
|
+
|
|
2935
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
2936
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
2937
|
+
```
|
|
2938
|
+
|
|
2939
|
+
@category Object
|
|
2940
|
+
*/
|
|
2941
|
+
type Except$6<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$6 = {requireExactProps: false}> = {
|
|
2942
|
+
[KeyType in keyof ObjectType as Filter$6<KeyType, KeysType>]: ObjectType[KeyType];
|
|
2943
|
+
} & (Options['requireExactProps'] extends true
|
|
2944
|
+
? Partial<Record<KeysType, never>>
|
|
2945
|
+
: {});
|
|
2946
|
+
|
|
2947
|
+
/**
|
|
2948
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
2949
|
+
|
|
2950
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
2951
|
+
|
|
2952
|
+
@example
|
|
2953
|
+
```
|
|
2954
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2955
|
+
|
|
2956
|
+
interface Example {
|
|
2957
|
+
a: string;
|
|
2958
|
+
b: string | number;
|
|
2959
|
+
c?: string;
|
|
2960
|
+
d: {};
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
2964
|
+
//=> 'a'
|
|
2965
|
+
```
|
|
2966
|
+
|
|
2967
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
2968
|
+
|
|
2969
|
+
@example
|
|
2970
|
+
```
|
|
2971
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
2972
|
+
|
|
2973
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
2974
|
+
//=> 'a' | 'c'
|
|
2975
|
+
```
|
|
2976
|
+
|
|
2977
|
+
@category Object
|
|
2978
|
+
*/
|
|
2979
|
+
type ConditionalKeys$6<Base, Condition> = NonNullable<
|
|
2980
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
2981
|
+
{
|
|
2982
|
+
// Map through all the keys of the given base type.
|
|
2983
|
+
[Key in keyof Base]:
|
|
2984
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
2985
|
+
Base[Key] extends Condition
|
|
2986
|
+
// Retain this key since the condition passes.
|
|
2987
|
+
? Key
|
|
2988
|
+
// Discard this key since the condition fails.
|
|
2989
|
+
: never;
|
|
2990
|
+
|
|
2991
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
2992
|
+
}[keyof Base]
|
|
2993
|
+
>;
|
|
2994
|
+
|
|
2995
|
+
/**
|
|
2996
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
2997
|
+
|
|
2998
|
+
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.
|
|
2999
|
+
|
|
3000
|
+
@example
|
|
3001
|
+
```
|
|
3002
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
3003
|
+
|
|
3004
|
+
class Awesome {
|
|
3005
|
+
name: string;
|
|
3006
|
+
successes: number;
|
|
3007
|
+
failures: bigint;
|
|
3008
|
+
|
|
3009
|
+
run() {}
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
3013
|
+
//=> {run: () => void}
|
|
3014
|
+
```
|
|
3015
|
+
|
|
3016
|
+
@example
|
|
3017
|
+
```
|
|
3018
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
3019
|
+
|
|
3020
|
+
interface Example {
|
|
3021
|
+
a: string;
|
|
3022
|
+
b: string | number;
|
|
3023
|
+
c: () => void;
|
|
3024
|
+
d: {};
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
3028
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
3029
|
+
```
|
|
3030
|
+
|
|
3031
|
+
@category Object
|
|
3032
|
+
*/
|
|
3033
|
+
type ConditionalExcept$6<Base, Condition> = Except$6<
|
|
3034
|
+
Base,
|
|
3035
|
+
ConditionalKeys$6<Base, Condition>
|
|
3036
|
+
>;
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
3040
|
+
* can either be a REST module or a host module.
|
|
3041
|
+
* This type is recursive, so it can describe nested modules.
|
|
3042
|
+
*/
|
|
3043
|
+
type Descriptors$6 = RESTFunctionDescriptor$6 | AmbassadorFunctionDescriptor$6 | HostModule$6<any, any> | EventDefinition$c<any> | ServicePluginDefinition$6<any> | {
|
|
3044
|
+
[key: string]: Descriptors$6 | PublicMetadata$6 | any;
|
|
3045
|
+
};
|
|
3046
|
+
/**
|
|
3047
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
3048
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
3049
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
3050
|
+
* do not match the given host (as they will not work with the given host).
|
|
3051
|
+
*/
|
|
3052
|
+
type BuildDescriptors$6<T extends Descriptors$6, H extends Host$6<any> | undefined, Depth extends number = 5> = {
|
|
3053
|
+
done: T;
|
|
3054
|
+
recurse: T extends {
|
|
3055
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$6;
|
|
3056
|
+
} ? never : T extends AmbassadorFunctionDescriptor$6 ? BuildAmbassadorFunction$6<T> : T extends RESTFunctionDescriptor$6 ? BuildRESTFunction$6<T> : T extends EventDefinition$c<any> ? BuildEventDefinition$c<T> : T extends ServicePluginDefinition$6<any> ? BuildServicePluginDefinition$6<T> : T extends HostModule$6<any, any> ? HostModuleAPI$6<T> : ConditionalExcept$6<{
|
|
3057
|
+
[Key in keyof T]: T[Key] extends Descriptors$6 ? BuildDescriptors$6<T[Key], H, [
|
|
3058
|
+
-1,
|
|
3059
|
+
0,
|
|
3060
|
+
1,
|
|
3061
|
+
2,
|
|
3062
|
+
3,
|
|
3063
|
+
4,
|
|
3064
|
+
5
|
|
3065
|
+
][Depth]> : never;
|
|
3066
|
+
}, EmptyObject$6>;
|
|
3067
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
3068
|
+
type PublicMetadata$6 = {
|
|
3069
|
+
PACKAGE_NAME?: string;
|
|
3070
|
+
};
|
|
3071
|
+
|
|
3072
|
+
declare global {
|
|
3073
|
+
interface ContextualClient {
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
/**
|
|
3077
|
+
* A type used to create concerete types from SDK descriptors in
|
|
3078
|
+
* case a contextual client is available.
|
|
3079
|
+
*/
|
|
3080
|
+
type MaybeContext$6<T extends Descriptors$6> = globalThis.ContextualClient extends {
|
|
3081
|
+
host: Host$6;
|
|
3082
|
+
} ? BuildDescriptors$6<T, globalThis.ContextualClient['host']> : T;
|
|
3083
|
+
|
|
3084
|
+
/**
|
|
3085
|
+
* >**Notes:**
|
|
3086
|
+
* > + Site owners may set that members are not permitted to create groups in the Wix Groups application settings.
|
|
3087
|
+
* > + In this situation, site members have to submit a Group Request to create a new group.
|
|
3088
|
+
* > + Group Requests can be approved or rejected by an admin.
|
|
3089
|
+
* > + After a Group Request has been approved, the new group is added to the Group List in the Wix Groups app home page.
|
|
3090
|
+
* > + See [About Wix Groups](https://dev.wix.com/docs/rest/crm/community/groups/introduction) for more details.
|
|
3091
|
+
*/
|
|
3092
|
+
interface GroupRequest {
|
|
3093
|
+
/**
|
|
3094
|
+
* ID of the request to create a group. Same as group ID.
|
|
3095
|
+
* @readonly
|
|
3096
|
+
*/
|
|
3097
|
+
_id?: string | null;
|
|
3098
|
+
/** Group requested to create. */
|
|
3099
|
+
group?: Group$1;
|
|
3100
|
+
/**
|
|
3101
|
+
* Status of the request to create a group. One of:
|
|
3102
|
+
* - `"PENDING"` - Pending group request.
|
|
3103
|
+
* - `"APPROVED"` - Approved group request.
|
|
3104
|
+
* - `"REJECTED"` - Rejected group request.
|
|
3105
|
+
* - `"CANCELED"` - Canceled group request.
|
|
3106
|
+
*/
|
|
1973
3107
|
status?: RequestStatus$3;
|
|
1974
3108
|
/** Details of request to create a group. */
|
|
1975
3109
|
requestDetails?: RequestDetails$3;
|
|
@@ -2717,16 +3851,34 @@ interface QueryGroupRequestsSignature {
|
|
|
2717
3851
|
*/
|
|
2718
3852
|
(options?: QueryGroupRequestsOptions | undefined): GroupRequestsQueryBuilder;
|
|
2719
3853
|
}
|
|
2720
|
-
declare const onGroupRequestCreated$1: EventDefinition$
|
|
2721
|
-
declare const onGroupRequestApproved$1: EventDefinition$
|
|
2722
|
-
declare const onGroupRequestRejected$1: EventDefinition$
|
|
3854
|
+
declare const onGroupRequestCreated$1: EventDefinition$c<GroupRequestCreatedEnvelope, "wix.social_groups.v2.group_request_created">;
|
|
3855
|
+
declare const onGroupRequestApproved$1: EventDefinition$c<GroupRequestApprovedEnvelope, "wix.social_groups.v2.group_request_approved">;
|
|
3856
|
+
declare const onGroupRequestRejected$1: EventDefinition$c<GroupRequestRejectedEnvelope, "wix.social_groups.v2.group_request_rejected">;
|
|
3857
|
+
|
|
3858
|
+
type EventDefinition$b<Payload = unknown, Type extends string = string> = {
|
|
3859
|
+
__type: 'event-definition';
|
|
3860
|
+
type: Type;
|
|
3861
|
+
isDomainEvent?: boolean;
|
|
3862
|
+
transformations?: (envelope: unknown) => Payload;
|
|
3863
|
+
__payload: Payload;
|
|
3864
|
+
};
|
|
3865
|
+
declare function EventDefinition$b<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$b<Payload, Type>;
|
|
3866
|
+
type EventHandler$b<T extends EventDefinition$b> = (payload: T['__payload']) => void | Promise<void>;
|
|
3867
|
+
type BuildEventDefinition$b<T extends EventDefinition$b<any, string>> = (handler: EventHandler$b<T>) => void;
|
|
3868
|
+
|
|
3869
|
+
declare global {
|
|
3870
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
3871
|
+
interface SymbolConstructor {
|
|
3872
|
+
readonly observable: symbol;
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
2723
3875
|
|
|
2724
|
-
declare function createEventModule$5<T extends EventDefinition$
|
|
3876
|
+
declare function createEventModule$5<T extends EventDefinition$b<any, string>>(eventDefinition: T): BuildEventDefinition$b<T> & T;
|
|
2725
3877
|
|
|
2726
|
-
declare const approveGroupRequests: BuildRESTFunction$6<typeof approveGroupRequests$1> & typeof approveGroupRequests$1
|
|
2727
|
-
declare const rejectGroupRequests: BuildRESTFunction$6<typeof rejectGroupRequests$1> & typeof rejectGroupRequests$1
|
|
2728
|
-
declare const listGroupRequests: BuildRESTFunction$6<typeof listGroupRequests$1> & typeof listGroupRequests$1
|
|
2729
|
-
declare const queryGroupRequests: BuildRESTFunction$6<typeof queryGroupRequests$1> & typeof queryGroupRequests$1
|
|
3878
|
+
declare const approveGroupRequests: MaybeContext$6<BuildRESTFunction$6<typeof approveGroupRequests$1> & typeof approveGroupRequests$1>;
|
|
3879
|
+
declare const rejectGroupRequests: MaybeContext$6<BuildRESTFunction$6<typeof rejectGroupRequests$1> & typeof rejectGroupRequests$1>;
|
|
3880
|
+
declare const listGroupRequests: MaybeContext$6<BuildRESTFunction$6<typeof listGroupRequests$1> & typeof listGroupRequests$1>;
|
|
3881
|
+
declare const queryGroupRequests: MaybeContext$6<BuildRESTFunction$6<typeof queryGroupRequests$1> & typeof queryGroupRequests$1>;
|
|
2730
3882
|
|
|
2731
3883
|
type _publicOnGroupRequestCreatedType = typeof onGroupRequestCreated$1;
|
|
2732
3884
|
/** */
|
|
@@ -2784,11 +3936,50 @@ declare namespace context$6 {
|
|
|
2784
3936
|
export { type AccessRestriction$1 as AccessRestriction, type AccessRestrictionDataOneOf$1 as AccessRestrictionDataOneOf, type ActionEvent$5 as ActionEvent, AllowPolicy$1 as AllowPolicy, type context$6_ApproveGroupRequestsRequest as ApproveGroupRequestsRequest, type context$6_ApproveGroupRequestsResponse as ApproveGroupRequestsResponse, type context$6_ApproveGroupRequestsResponseNonNullableFields as ApproveGroupRequestsResponseNonNullableFields, type BaseEventMetadata$5 as BaseEventMetadata, type context$6_CancelGroupRequestRequest as CancelGroupRequestRequest, type context$6_CancelGroupRequestResponse as CancelGroupRequestResponse, type CoverImage$1 as CoverImage, type DomainEvent$5 as DomainEvent, type DomainEventBodyOneOf$5 as DomainEventBodyOneOf, type EntityCreatedEvent$5 as EntityCreatedEvent, type EntityDeletedEvent$5 as EntityDeletedEvent, type EntityUpdatedEvent$5 as EntityUpdatedEvent, type EventMetadata$5 as EventMetadata, type Events$1 as Events, type Group$1 as Group, type GroupDetails$1 as GroupDetails, type GroupDetailsPosition$1 as GroupDetailsPosition, type context$6_GroupRequest as GroupRequest, type context$6_GroupRequestApproved as GroupRequestApproved, type context$6_GroupRequestApprovedEnvelope as GroupRequestApprovedEnvelope, type context$6_GroupRequestCreatedEnvelope as GroupRequestCreatedEnvelope, type context$6_GroupRequestRejected as GroupRequestRejected, type context$6_GroupRequestRejectedEnvelope as GroupRequestRejectedEnvelope, type context$6_GroupRequestsQueryBuilder as GroupRequestsQueryBuilder, type context$6_GroupRequestsQueryResult as GroupRequestsQueryResult, type GroupSettings$1 as GroupSettings, type IdentificationData$5 as IdentificationData, type IdentificationDataIdOneOf$5 as IdentificationDataIdOneOf, type Identity$1 as Identity, IdentityType$1 as IdentityType, type Image$1 as Image, ItemsToUpdate$3 as ItemsToUpdate, type context$6_ListGroupRequestsOptions as ListGroupRequestsOptions, type context$6_ListGroupRequestsRequest as ListGroupRequestsRequest, type context$6_ListGroupRequestsResponse as ListGroupRequestsResponse, type context$6_ListGroupRequestsResponseNonNullableFields as ListGroupRequestsResponseNonNullableFields, type Logo$1 as Logo, type MessageEnvelope$5 as MessageEnvelope, type OnboardingStepSettings$1 as OnboardingStepSettings, OwnershipFilter$3 as OwnershipFilter, type Paging$4 as Paging, type PagingMetadata$4 as PagingMetadata, type Position$1 as Position, PrivacyStatus$1 as PrivacyStatus, type Query$3 as Query, type context$6_QueryGroupRequestsOptions as QueryGroupRequestsOptions, type context$6_QueryGroupRequestsRequest as QueryGroupRequestsRequest, type context$6_QueryGroupRequestsResponse as QueryGroupRequestsResponse, type context$6_QueryGroupRequestsResponseNonNullableFields as QueryGroupRequestsResponseNonNullableFields, type context$6_RejectGroupRequestsRequest as RejectGroupRequestsRequest, type context$6_RejectGroupRequestsResponse as RejectGroupRequestsResponse, type context$6_RejectGroupRequestsResponseNonNullableFields as RejectGroupRequestsResponseNonNullableFields, type Rejection$3 as Rejection, type RequestDetails$3 as RequestDetails, RequestStatus$3 as RequestStatus, type RestoreInfo$5 as RestoreInfo, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, StepKey$1 as StepKey, type context$6_SubmitGroupRequestRequest as SubmitGroupRequestRequest, type context$6_SubmitGroupRequestResponse as SubmitGroupRequestResponse, Type$1 as Type, WebhookIdentityType$5 as WebhookIdentityType, type context$6__publicOnGroupRequestApprovedType as _publicOnGroupRequestApprovedType, type context$6__publicOnGroupRequestCreatedType as _publicOnGroupRequestCreatedType, type context$6__publicOnGroupRequestRejectedType as _publicOnGroupRequestRejectedType, context$6_approveGroupRequests as approveGroupRequests, context$6_listGroupRequests as listGroupRequests, context$6_onGroupRequestApproved as onGroupRequestApproved, context$6_onGroupRequestCreated as onGroupRequestCreated, context$6_onGroupRequestRejected as onGroupRequestRejected, onGroupRequestApproved$1 as publicOnGroupRequestApproved, onGroupRequestCreated$1 as publicOnGroupRequestCreated, onGroupRequestRejected$1 as publicOnGroupRequestRejected, context$6_queryGroupRequests as queryGroupRequests, context$6_rejectGroupRequests as rejectGroupRequests };
|
|
2785
3937
|
}
|
|
2786
3938
|
|
|
3939
|
+
type HostModule$5<T, H extends Host$5> = {
|
|
3940
|
+
__type: 'host';
|
|
3941
|
+
create(host: H): T;
|
|
3942
|
+
};
|
|
3943
|
+
type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
|
|
3944
|
+
type Host$5<Environment = unknown> = {
|
|
3945
|
+
channel: {
|
|
3946
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
3947
|
+
disconnect: () => void;
|
|
3948
|
+
} | Promise<{
|
|
3949
|
+
disconnect: () => void;
|
|
3950
|
+
}>;
|
|
3951
|
+
};
|
|
3952
|
+
environment?: Environment;
|
|
3953
|
+
/**
|
|
3954
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
3955
|
+
*/
|
|
3956
|
+
apiBaseUrl?: string;
|
|
3957
|
+
/**
|
|
3958
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
3959
|
+
* like internationalization, billing, etc.
|
|
3960
|
+
*/
|
|
3961
|
+
essentials?: {
|
|
3962
|
+
/**
|
|
3963
|
+
* The language of the currently viewed session
|
|
3964
|
+
*/
|
|
3965
|
+
language?: string;
|
|
3966
|
+
/**
|
|
3967
|
+
* The locale of the currently viewed session
|
|
3968
|
+
*/
|
|
3969
|
+
locale?: string;
|
|
3970
|
+
/**
|
|
3971
|
+
* Any headers that should be passed through to the API requests
|
|
3972
|
+
*/
|
|
3973
|
+
passThroughHeaders?: Record<string, string>;
|
|
3974
|
+
};
|
|
3975
|
+
};
|
|
3976
|
+
|
|
2787
3977
|
type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
|
|
2788
3978
|
interface HttpClient$5 {
|
|
2789
3979
|
request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
|
|
2790
3980
|
fetchWithAuth: typeof fetch;
|
|
2791
3981
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
3982
|
+
getActiveToken?: () => string | undefined;
|
|
2792
3983
|
}
|
|
2793
3984
|
type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
|
|
2794
3985
|
type HttpResponse$5<T = any> = {
|
|
@@ -2810,16 +4001,65 @@ type APIMetadata$5 = {
|
|
|
2810
4001
|
packageName?: string;
|
|
2811
4002
|
};
|
|
2812
4003
|
type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
|
|
2813
|
-
type EventDefinition$
|
|
4004
|
+
type EventDefinition$a<Payload = unknown, Type extends string = string> = {
|
|
2814
4005
|
__type: 'event-definition';
|
|
2815
4006
|
type: Type;
|
|
2816
4007
|
isDomainEvent?: boolean;
|
|
2817
4008
|
transformations?: (envelope: unknown) => Payload;
|
|
2818
4009
|
__payload: Payload;
|
|
2819
4010
|
};
|
|
2820
|
-
declare function EventDefinition$
|
|
2821
|
-
type EventHandler$
|
|
2822
|
-
type BuildEventDefinition$
|
|
4011
|
+
declare function EventDefinition$a<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$a<Payload, Type>;
|
|
4012
|
+
type EventHandler$a<T extends EventDefinition$a> = (payload: T['__payload']) => void | Promise<void>;
|
|
4013
|
+
type BuildEventDefinition$a<T extends EventDefinition$a<any, string>> = (handler: EventHandler$a<T>) => void;
|
|
4014
|
+
|
|
4015
|
+
type ServicePluginMethodInput$5 = {
|
|
4016
|
+
request: any;
|
|
4017
|
+
metadata: any;
|
|
4018
|
+
};
|
|
4019
|
+
type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
|
|
4020
|
+
type ServicePluginMethodMetadata$5 = {
|
|
4021
|
+
name: string;
|
|
4022
|
+
primaryHttpMappingPath: string;
|
|
4023
|
+
transformations: {
|
|
4024
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
|
|
4025
|
+
toREST: (...args: unknown[]) => unknown;
|
|
4026
|
+
};
|
|
4027
|
+
};
|
|
4028
|
+
type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
|
|
4029
|
+
__type: 'service-plugin-definition';
|
|
4030
|
+
componentType: string;
|
|
4031
|
+
methods: ServicePluginMethodMetadata$5[];
|
|
4032
|
+
__contract: Contract;
|
|
4033
|
+
};
|
|
4034
|
+
declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
|
|
4035
|
+
type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
|
|
4036
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
|
|
4037
|
+
|
|
4038
|
+
type RequestContext$5 = {
|
|
4039
|
+
isSSR: boolean;
|
|
4040
|
+
host: string;
|
|
4041
|
+
protocol?: string;
|
|
4042
|
+
};
|
|
4043
|
+
type ResponseTransformer$5 = (data: any, headers?: any) => any;
|
|
4044
|
+
/**
|
|
4045
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
4046
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
4047
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
4048
|
+
*/
|
|
4049
|
+
type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
4050
|
+
type AmbassadorRequestOptions$5<T = any> = {
|
|
4051
|
+
_?: T;
|
|
4052
|
+
url?: string;
|
|
4053
|
+
method?: Method$5;
|
|
4054
|
+
params?: any;
|
|
4055
|
+
data?: any;
|
|
4056
|
+
transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
|
|
4057
|
+
};
|
|
4058
|
+
type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
|
|
4059
|
+
__isAmbassador: boolean;
|
|
4060
|
+
};
|
|
4061
|
+
type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
|
|
4062
|
+
type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
2823
4063
|
|
|
2824
4064
|
declare global {
|
|
2825
4065
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -2828,6 +4068,284 @@ declare global {
|
|
|
2828
4068
|
}
|
|
2829
4069
|
}
|
|
2830
4070
|
|
|
4071
|
+
declare const emptyObjectSymbol$5: unique symbol;
|
|
4072
|
+
|
|
4073
|
+
/**
|
|
4074
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
4075
|
+
|
|
4076
|
+
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)).
|
|
4077
|
+
|
|
4078
|
+
@example
|
|
4079
|
+
```
|
|
4080
|
+
import type {EmptyObject} from 'type-fest';
|
|
4081
|
+
|
|
4082
|
+
// The following illustrates the problem with `{}`.
|
|
4083
|
+
const foo1: {} = {}; // Pass
|
|
4084
|
+
const foo2: {} = []; // Pass
|
|
4085
|
+
const foo3: {} = 42; // Pass
|
|
4086
|
+
const foo4: {} = {a: 1}; // Pass
|
|
4087
|
+
|
|
4088
|
+
// With `EmptyObject` only the first case is valid.
|
|
4089
|
+
const bar1: EmptyObject = {}; // Pass
|
|
4090
|
+
const bar2: EmptyObject = 42; // Fail
|
|
4091
|
+
const bar3: EmptyObject = []; // Fail
|
|
4092
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
4093
|
+
```
|
|
4094
|
+
|
|
4095
|
+
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}.
|
|
4096
|
+
|
|
4097
|
+
@category Object
|
|
4098
|
+
*/
|
|
4099
|
+
type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
|
|
4100
|
+
|
|
4101
|
+
/**
|
|
4102
|
+
Returns a boolean for whether the two given types are equal.
|
|
4103
|
+
|
|
4104
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
4105
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
4106
|
+
|
|
4107
|
+
Use-cases:
|
|
4108
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
4109
|
+
|
|
4110
|
+
@example
|
|
4111
|
+
```
|
|
4112
|
+
import type {IsEqual} from 'type-fest';
|
|
4113
|
+
|
|
4114
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
4115
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
4116
|
+
type Includes<Value extends readonly any[], Item> =
|
|
4117
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
4118
|
+
? IsEqual<Value[0], Item> extends true
|
|
4119
|
+
? true
|
|
4120
|
+
: Includes<rest, Item>
|
|
4121
|
+
: false;
|
|
4122
|
+
```
|
|
4123
|
+
|
|
4124
|
+
@category Type Guard
|
|
4125
|
+
@category Utilities
|
|
4126
|
+
*/
|
|
4127
|
+
type IsEqual$5<A, B> =
|
|
4128
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
4129
|
+
(<G>() => G extends B ? 1 : 2)
|
|
4130
|
+
? true
|
|
4131
|
+
: false;
|
|
4132
|
+
|
|
4133
|
+
/**
|
|
4134
|
+
Filter out keys from an object.
|
|
4135
|
+
|
|
4136
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
4137
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
4138
|
+
Returns `Key` otherwise.
|
|
4139
|
+
|
|
4140
|
+
@example
|
|
4141
|
+
```
|
|
4142
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
4143
|
+
//=> never
|
|
4144
|
+
```
|
|
4145
|
+
|
|
4146
|
+
@example
|
|
4147
|
+
```
|
|
4148
|
+
type Filtered = Filter<'bar', string>;
|
|
4149
|
+
//=> never
|
|
4150
|
+
```
|
|
4151
|
+
|
|
4152
|
+
@example
|
|
4153
|
+
```
|
|
4154
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
4155
|
+
//=> 'bar'
|
|
4156
|
+
```
|
|
4157
|
+
|
|
4158
|
+
@see {Except}
|
|
4159
|
+
*/
|
|
4160
|
+
type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
4161
|
+
|
|
4162
|
+
type ExceptOptions$5 = {
|
|
4163
|
+
/**
|
|
4164
|
+
Disallow assigning non-specified properties.
|
|
4165
|
+
|
|
4166
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
4167
|
+
|
|
4168
|
+
@default false
|
|
4169
|
+
*/
|
|
4170
|
+
requireExactProps?: boolean;
|
|
4171
|
+
};
|
|
4172
|
+
|
|
4173
|
+
/**
|
|
4174
|
+
Create a type from an object type without certain keys.
|
|
4175
|
+
|
|
4176
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
4177
|
+
|
|
4178
|
+
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.
|
|
4179
|
+
|
|
4180
|
+
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)).
|
|
4181
|
+
|
|
4182
|
+
@example
|
|
4183
|
+
```
|
|
4184
|
+
import type {Except} from 'type-fest';
|
|
4185
|
+
|
|
4186
|
+
type Foo = {
|
|
4187
|
+
a: number;
|
|
4188
|
+
b: string;
|
|
4189
|
+
};
|
|
4190
|
+
|
|
4191
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
4192
|
+
//=> {b: string}
|
|
4193
|
+
|
|
4194
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
4195
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
4196
|
+
|
|
4197
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
4198
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
4199
|
+
|
|
4200
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
4201
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
4202
|
+
```
|
|
4203
|
+
|
|
4204
|
+
@category Object
|
|
4205
|
+
*/
|
|
4206
|
+
type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
|
|
4207
|
+
[KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
|
|
4208
|
+
} & (Options['requireExactProps'] extends true
|
|
4209
|
+
? Partial<Record<KeysType, never>>
|
|
4210
|
+
: {});
|
|
4211
|
+
|
|
4212
|
+
/**
|
|
4213
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
4214
|
+
|
|
4215
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
4216
|
+
|
|
4217
|
+
@example
|
|
4218
|
+
```
|
|
4219
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
4220
|
+
|
|
4221
|
+
interface Example {
|
|
4222
|
+
a: string;
|
|
4223
|
+
b: string | number;
|
|
4224
|
+
c?: string;
|
|
4225
|
+
d: {};
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
4229
|
+
//=> 'a'
|
|
4230
|
+
```
|
|
4231
|
+
|
|
4232
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
4233
|
+
|
|
4234
|
+
@example
|
|
4235
|
+
```
|
|
4236
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
4237
|
+
|
|
4238
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
4239
|
+
//=> 'a' | 'c'
|
|
4240
|
+
```
|
|
4241
|
+
|
|
4242
|
+
@category Object
|
|
4243
|
+
*/
|
|
4244
|
+
type ConditionalKeys$5<Base, Condition> = NonNullable<
|
|
4245
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
4246
|
+
{
|
|
4247
|
+
// Map through all the keys of the given base type.
|
|
4248
|
+
[Key in keyof Base]:
|
|
4249
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
4250
|
+
Base[Key] extends Condition
|
|
4251
|
+
// Retain this key since the condition passes.
|
|
4252
|
+
? Key
|
|
4253
|
+
// Discard this key since the condition fails.
|
|
4254
|
+
: never;
|
|
4255
|
+
|
|
4256
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
4257
|
+
}[keyof Base]
|
|
4258
|
+
>;
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
4262
|
+
|
|
4263
|
+
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.
|
|
4264
|
+
|
|
4265
|
+
@example
|
|
4266
|
+
```
|
|
4267
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
4268
|
+
|
|
4269
|
+
class Awesome {
|
|
4270
|
+
name: string;
|
|
4271
|
+
successes: number;
|
|
4272
|
+
failures: bigint;
|
|
4273
|
+
|
|
4274
|
+
run() {}
|
|
4275
|
+
}
|
|
4276
|
+
|
|
4277
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
4278
|
+
//=> {run: () => void}
|
|
4279
|
+
```
|
|
4280
|
+
|
|
4281
|
+
@example
|
|
4282
|
+
```
|
|
4283
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
4284
|
+
|
|
4285
|
+
interface Example {
|
|
4286
|
+
a: string;
|
|
4287
|
+
b: string | number;
|
|
4288
|
+
c: () => void;
|
|
4289
|
+
d: {};
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
4293
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
4294
|
+
```
|
|
4295
|
+
|
|
4296
|
+
@category Object
|
|
4297
|
+
*/
|
|
4298
|
+
type ConditionalExcept$5<Base, Condition> = Except$5<
|
|
4299
|
+
Base,
|
|
4300
|
+
ConditionalKeys$5<Base, Condition>
|
|
4301
|
+
>;
|
|
4302
|
+
|
|
4303
|
+
/**
|
|
4304
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
4305
|
+
* can either be a REST module or a host module.
|
|
4306
|
+
* This type is recursive, so it can describe nested modules.
|
|
4307
|
+
*/
|
|
4308
|
+
type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$a<any> | ServicePluginDefinition$5<any> | {
|
|
4309
|
+
[key: string]: Descriptors$5 | PublicMetadata$5 | any;
|
|
4310
|
+
};
|
|
4311
|
+
/**
|
|
4312
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
4313
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
4314
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
4315
|
+
* do not match the given host (as they will not work with the given host).
|
|
4316
|
+
*/
|
|
4317
|
+
type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
|
|
4318
|
+
done: T;
|
|
4319
|
+
recurse: T extends {
|
|
4320
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
|
|
4321
|
+
} ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$a<any> ? BuildEventDefinition$a<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
|
|
4322
|
+
[Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
|
|
4323
|
+
-1,
|
|
4324
|
+
0,
|
|
4325
|
+
1,
|
|
4326
|
+
2,
|
|
4327
|
+
3,
|
|
4328
|
+
4,
|
|
4329
|
+
5
|
|
4330
|
+
][Depth]> : never;
|
|
4331
|
+
}, EmptyObject$5>;
|
|
4332
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
4333
|
+
type PublicMetadata$5 = {
|
|
4334
|
+
PACKAGE_NAME?: string;
|
|
4335
|
+
};
|
|
4336
|
+
|
|
4337
|
+
declare global {
|
|
4338
|
+
interface ContextualClient {
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
/**
|
|
4342
|
+
* A type used to create concerete types from SDK descriptors in
|
|
4343
|
+
* case a contextual client is available.
|
|
4344
|
+
*/
|
|
4345
|
+
type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
|
|
4346
|
+
host: Host$5;
|
|
4347
|
+
} ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
|
|
4348
|
+
|
|
2831
4349
|
/**
|
|
2832
4350
|
* A group member may have multiple roles in a single group.
|
|
2833
4351
|
* Currently, only `MEMBER` and `ADMIN` roles are supported, but more roles may be available in the future.
|
|
@@ -3179,13 +4697,31 @@ interface UnassignRoleSignature {
|
|
|
3179
4697
|
*/
|
|
3180
4698
|
(groupId: string, memberIds: string[], role: GroupRole, options?: UnassignRoleOptions | undefined): Promise<UnassignRoleResponse & UnassignRoleResponseNonNullableFields>;
|
|
3181
4699
|
}
|
|
3182
|
-
declare const onGroupRoleAssigned$1: EventDefinition$
|
|
3183
|
-
declare const onGroupRoleUnassigned$1: EventDefinition$
|
|
4700
|
+
declare const onGroupRoleAssigned$1: EventDefinition$a<GroupRoleAssignedEnvelope, "wix.social_groups.v2.group_role_assigned">;
|
|
4701
|
+
declare const onGroupRoleUnassigned$1: EventDefinition$a<GroupRoleUnassignedEnvelope, "wix.social_groups.v2.group_role_unassigned">;
|
|
4702
|
+
|
|
4703
|
+
type EventDefinition$9<Payload = unknown, Type extends string = string> = {
|
|
4704
|
+
__type: 'event-definition';
|
|
4705
|
+
type: Type;
|
|
4706
|
+
isDomainEvent?: boolean;
|
|
4707
|
+
transformations?: (envelope: unknown) => Payload;
|
|
4708
|
+
__payload: Payload;
|
|
4709
|
+
};
|
|
4710
|
+
declare function EventDefinition$9<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$9<Payload, Type>;
|
|
4711
|
+
type EventHandler$9<T extends EventDefinition$9> = (payload: T['__payload']) => void | Promise<void>;
|
|
4712
|
+
type BuildEventDefinition$9<T extends EventDefinition$9<any, string>> = (handler: EventHandler$9<T>) => void;
|
|
4713
|
+
|
|
4714
|
+
declare global {
|
|
4715
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
4716
|
+
interface SymbolConstructor {
|
|
4717
|
+
readonly observable: symbol;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
3184
4720
|
|
|
3185
|
-
declare function createEventModule$4<T extends EventDefinition$
|
|
4721
|
+
declare function createEventModule$4<T extends EventDefinition$9<any, string>>(eventDefinition: T): BuildEventDefinition$9<T> & T;
|
|
3186
4722
|
|
|
3187
|
-
declare const assignRole: BuildRESTFunction$5<typeof assignRole$1> & typeof assignRole$1
|
|
3188
|
-
declare const unassignRole: BuildRESTFunction$5<typeof unassignRole$1> & typeof unassignRole$1
|
|
4723
|
+
declare const assignRole: MaybeContext$5<BuildRESTFunction$5<typeof assignRole$1> & typeof assignRole$1>;
|
|
4724
|
+
declare const unassignRole: MaybeContext$5<BuildRESTFunction$5<typeof unassignRole$1> & typeof unassignRole$1>;
|
|
3189
4725
|
|
|
3190
4726
|
type _publicOnGroupRoleAssignedType = typeof onGroupRoleAssigned$1;
|
|
3191
4727
|
/**
|
|
@@ -3225,11 +4761,50 @@ declare namespace context$5 {
|
|
|
3225
4761
|
export { type ActionEvent$4 as ActionEvent, type context$5_AssignRoleOptions as AssignRoleOptions, type context$5_AssignRoleRequest as AssignRoleRequest, type context$5_AssignRoleResponse as AssignRoleResponse, type context$5_AssignRoleResponseNonNullableFields as AssignRoleResponseNonNullableFields, type BaseEventMetadata$4 as BaseEventMetadata, 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 EventMetadata$4 as EventMetadata, type context$5_GroupMember as GroupMember, type context$5_GroupRole as GroupRole, type context$5_GroupRoleAssignedEnvelope as GroupRoleAssignedEnvelope, type context$5_GroupRoleUnassignedEnvelope as GroupRoleUnassignedEnvelope, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, type MessageEnvelope$4 as MessageEnvelope, type RestoreInfo$4 as RestoreInfo, context$5_Role as Role, type context$5_RoleAssignedToGroupMember as RoleAssignedToGroupMember, type context$5_RoleUnassignedFromGroupMember as RoleUnassignedFromGroupMember, type context$5_UnassignRoleOptions as UnassignRoleOptions, type context$5_UnassignRoleRequest as UnassignRoleRequest, type context$5_UnassignRoleResponse as UnassignRoleResponse, type context$5_UnassignRoleResponseNonNullableFields as UnassignRoleResponseNonNullableFields, WebhookIdentityType$4 as WebhookIdentityType, type context$5__publicOnGroupRoleAssignedType as _publicOnGroupRoleAssignedType, type context$5__publicOnGroupRoleUnassignedType as _publicOnGroupRoleUnassignedType, context$5_assignRole as assignRole, context$5_onGroupRoleAssigned as onGroupRoleAssigned, context$5_onGroupRoleUnassigned as onGroupRoleUnassigned, onGroupRoleAssigned$1 as publicOnGroupRoleAssigned, onGroupRoleUnassigned$1 as publicOnGroupRoleUnassigned, context$5_unassignRole as unassignRole };
|
|
3226
4762
|
}
|
|
3227
4763
|
|
|
4764
|
+
type HostModule$4<T, H extends Host$4> = {
|
|
4765
|
+
__type: 'host';
|
|
4766
|
+
create(host: H): T;
|
|
4767
|
+
};
|
|
4768
|
+
type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
|
|
4769
|
+
type Host$4<Environment = unknown> = {
|
|
4770
|
+
channel: {
|
|
4771
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
4772
|
+
disconnect: () => void;
|
|
4773
|
+
} | Promise<{
|
|
4774
|
+
disconnect: () => void;
|
|
4775
|
+
}>;
|
|
4776
|
+
};
|
|
4777
|
+
environment?: Environment;
|
|
4778
|
+
/**
|
|
4779
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
4780
|
+
*/
|
|
4781
|
+
apiBaseUrl?: string;
|
|
4782
|
+
/**
|
|
4783
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
4784
|
+
* like internationalization, billing, etc.
|
|
4785
|
+
*/
|
|
4786
|
+
essentials?: {
|
|
4787
|
+
/**
|
|
4788
|
+
* The language of the currently viewed session
|
|
4789
|
+
*/
|
|
4790
|
+
language?: string;
|
|
4791
|
+
/**
|
|
4792
|
+
* The locale of the currently viewed session
|
|
4793
|
+
*/
|
|
4794
|
+
locale?: string;
|
|
4795
|
+
/**
|
|
4796
|
+
* Any headers that should be passed through to the API requests
|
|
4797
|
+
*/
|
|
4798
|
+
passThroughHeaders?: Record<string, string>;
|
|
4799
|
+
};
|
|
4800
|
+
};
|
|
4801
|
+
|
|
3228
4802
|
type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
|
|
3229
4803
|
interface HttpClient$4 {
|
|
3230
4804
|
request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
|
|
3231
4805
|
fetchWithAuth: typeof fetch;
|
|
3232
4806
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
4807
|
+
getActiveToken?: () => string | undefined;
|
|
3233
4808
|
}
|
|
3234
4809
|
type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
|
|
3235
4810
|
type HttpResponse$4<T = any> = {
|
|
@@ -3251,16 +4826,65 @@ type APIMetadata$4 = {
|
|
|
3251
4826
|
packageName?: string;
|
|
3252
4827
|
};
|
|
3253
4828
|
type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
|
|
3254
|
-
type EventDefinition$
|
|
4829
|
+
type EventDefinition$8<Payload = unknown, Type extends string = string> = {
|
|
3255
4830
|
__type: 'event-definition';
|
|
3256
4831
|
type: Type;
|
|
3257
4832
|
isDomainEvent?: boolean;
|
|
3258
4833
|
transformations?: (envelope: unknown) => Payload;
|
|
3259
4834
|
__payload: Payload;
|
|
3260
4835
|
};
|
|
3261
|
-
declare function EventDefinition$
|
|
3262
|
-
type EventHandler$
|
|
3263
|
-
type BuildEventDefinition$
|
|
4836
|
+
declare function EventDefinition$8<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$8<Payload, Type>;
|
|
4837
|
+
type EventHandler$8<T extends EventDefinition$8> = (payload: T['__payload']) => void | Promise<void>;
|
|
4838
|
+
type BuildEventDefinition$8<T extends EventDefinition$8<any, string>> = (handler: EventHandler$8<T>) => void;
|
|
4839
|
+
|
|
4840
|
+
type ServicePluginMethodInput$4 = {
|
|
4841
|
+
request: any;
|
|
4842
|
+
metadata: any;
|
|
4843
|
+
};
|
|
4844
|
+
type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
|
|
4845
|
+
type ServicePluginMethodMetadata$4 = {
|
|
4846
|
+
name: string;
|
|
4847
|
+
primaryHttpMappingPath: string;
|
|
4848
|
+
transformations: {
|
|
4849
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
|
|
4850
|
+
toREST: (...args: unknown[]) => unknown;
|
|
4851
|
+
};
|
|
4852
|
+
};
|
|
4853
|
+
type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
|
|
4854
|
+
__type: 'service-plugin-definition';
|
|
4855
|
+
componentType: string;
|
|
4856
|
+
methods: ServicePluginMethodMetadata$4[];
|
|
4857
|
+
__contract: Contract;
|
|
4858
|
+
};
|
|
4859
|
+
declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
|
|
4860
|
+
type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
|
|
4861
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
|
|
4862
|
+
|
|
4863
|
+
type RequestContext$4 = {
|
|
4864
|
+
isSSR: boolean;
|
|
4865
|
+
host: string;
|
|
4866
|
+
protocol?: string;
|
|
4867
|
+
};
|
|
4868
|
+
type ResponseTransformer$4 = (data: any, headers?: any) => any;
|
|
4869
|
+
/**
|
|
4870
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
4871
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
4872
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
4873
|
+
*/
|
|
4874
|
+
type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
4875
|
+
type AmbassadorRequestOptions$4<T = any> = {
|
|
4876
|
+
_?: T;
|
|
4877
|
+
url?: string;
|
|
4878
|
+
method?: Method$4;
|
|
4879
|
+
params?: any;
|
|
4880
|
+
data?: any;
|
|
4881
|
+
transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
|
|
4882
|
+
};
|
|
4883
|
+
type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
|
|
4884
|
+
__isAmbassador: boolean;
|
|
4885
|
+
};
|
|
4886
|
+
type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
|
|
4887
|
+
type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3264
4888
|
|
|
3265
4889
|
declare global {
|
|
3266
4890
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -3269,25 +4893,303 @@ declare global {
|
|
|
3269
4893
|
}
|
|
3270
4894
|
}
|
|
3271
4895
|
|
|
4896
|
+
declare const emptyObjectSymbol$4: unique symbol;
|
|
4897
|
+
|
|
3272
4898
|
/**
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
}
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
4899
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
4900
|
+
|
|
4901
|
+
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)).
|
|
4902
|
+
|
|
4903
|
+
@example
|
|
4904
|
+
```
|
|
4905
|
+
import type {EmptyObject} from 'type-fest';
|
|
4906
|
+
|
|
4907
|
+
// The following illustrates the problem with `{}`.
|
|
4908
|
+
const foo1: {} = {}; // Pass
|
|
4909
|
+
const foo2: {} = []; // Pass
|
|
4910
|
+
const foo3: {} = 42; // Pass
|
|
4911
|
+
const foo4: {} = {a: 1}; // Pass
|
|
4912
|
+
|
|
4913
|
+
// With `EmptyObject` only the first case is valid.
|
|
4914
|
+
const bar1: EmptyObject = {}; // Pass
|
|
4915
|
+
const bar2: EmptyObject = 42; // Fail
|
|
4916
|
+
const bar3: EmptyObject = []; // Fail
|
|
4917
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
4918
|
+
```
|
|
4919
|
+
|
|
4920
|
+
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}.
|
|
4921
|
+
|
|
4922
|
+
@category Object
|
|
4923
|
+
*/
|
|
4924
|
+
type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
|
|
4925
|
+
|
|
4926
|
+
/**
|
|
4927
|
+
Returns a boolean for whether the two given types are equal.
|
|
4928
|
+
|
|
4929
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
4930
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
4931
|
+
|
|
4932
|
+
Use-cases:
|
|
4933
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
4934
|
+
|
|
4935
|
+
@example
|
|
4936
|
+
```
|
|
4937
|
+
import type {IsEqual} from 'type-fest';
|
|
4938
|
+
|
|
4939
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
4940
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
4941
|
+
type Includes<Value extends readonly any[], Item> =
|
|
4942
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
4943
|
+
? IsEqual<Value[0], Item> extends true
|
|
4944
|
+
? true
|
|
4945
|
+
: Includes<rest, Item>
|
|
4946
|
+
: false;
|
|
4947
|
+
```
|
|
4948
|
+
|
|
4949
|
+
@category Type Guard
|
|
4950
|
+
@category Utilities
|
|
4951
|
+
*/
|
|
4952
|
+
type IsEqual$4<A, B> =
|
|
4953
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
4954
|
+
(<G>() => G extends B ? 1 : 2)
|
|
4955
|
+
? true
|
|
4956
|
+
: false;
|
|
4957
|
+
|
|
4958
|
+
/**
|
|
4959
|
+
Filter out keys from an object.
|
|
4960
|
+
|
|
4961
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
4962
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
4963
|
+
Returns `Key` otherwise.
|
|
4964
|
+
|
|
4965
|
+
@example
|
|
4966
|
+
```
|
|
4967
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
4968
|
+
//=> never
|
|
4969
|
+
```
|
|
4970
|
+
|
|
4971
|
+
@example
|
|
4972
|
+
```
|
|
4973
|
+
type Filtered = Filter<'bar', string>;
|
|
4974
|
+
//=> never
|
|
4975
|
+
```
|
|
4976
|
+
|
|
4977
|
+
@example
|
|
4978
|
+
```
|
|
4979
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
4980
|
+
//=> 'bar'
|
|
4981
|
+
```
|
|
4982
|
+
|
|
4983
|
+
@see {Except}
|
|
4984
|
+
*/
|
|
4985
|
+
type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
4986
|
+
|
|
4987
|
+
type ExceptOptions$4 = {
|
|
4988
|
+
/**
|
|
4989
|
+
Disallow assigning non-specified properties.
|
|
4990
|
+
|
|
4991
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
4992
|
+
|
|
4993
|
+
@default false
|
|
4994
|
+
*/
|
|
4995
|
+
requireExactProps?: boolean;
|
|
4996
|
+
};
|
|
4997
|
+
|
|
4998
|
+
/**
|
|
4999
|
+
Create a type from an object type without certain keys.
|
|
5000
|
+
|
|
5001
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
5002
|
+
|
|
5003
|
+
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.
|
|
5004
|
+
|
|
5005
|
+
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)).
|
|
5006
|
+
|
|
5007
|
+
@example
|
|
5008
|
+
```
|
|
5009
|
+
import type {Except} from 'type-fest';
|
|
5010
|
+
|
|
5011
|
+
type Foo = {
|
|
5012
|
+
a: number;
|
|
5013
|
+
b: string;
|
|
5014
|
+
};
|
|
5015
|
+
|
|
5016
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
5017
|
+
//=> {b: string}
|
|
5018
|
+
|
|
5019
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
5020
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
5021
|
+
|
|
5022
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
5023
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
5024
|
+
|
|
5025
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
5026
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
5027
|
+
```
|
|
5028
|
+
|
|
5029
|
+
@category Object
|
|
5030
|
+
*/
|
|
5031
|
+
type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
|
|
5032
|
+
[KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
|
|
5033
|
+
} & (Options['requireExactProps'] extends true
|
|
5034
|
+
? Partial<Record<KeysType, never>>
|
|
5035
|
+
: {});
|
|
5036
|
+
|
|
5037
|
+
/**
|
|
5038
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
5039
|
+
|
|
5040
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
5041
|
+
|
|
5042
|
+
@example
|
|
5043
|
+
```
|
|
5044
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5045
|
+
|
|
5046
|
+
interface Example {
|
|
5047
|
+
a: string;
|
|
5048
|
+
b: string | number;
|
|
5049
|
+
c?: string;
|
|
5050
|
+
d: {};
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
5054
|
+
//=> 'a'
|
|
5055
|
+
```
|
|
5056
|
+
|
|
5057
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
5058
|
+
|
|
5059
|
+
@example
|
|
5060
|
+
```
|
|
5061
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5062
|
+
|
|
5063
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
5064
|
+
//=> 'a' | 'c'
|
|
5065
|
+
```
|
|
5066
|
+
|
|
5067
|
+
@category Object
|
|
5068
|
+
*/
|
|
5069
|
+
type ConditionalKeys$4<Base, Condition> = NonNullable<
|
|
5070
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
5071
|
+
{
|
|
5072
|
+
// Map through all the keys of the given base type.
|
|
5073
|
+
[Key in keyof Base]:
|
|
5074
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
5075
|
+
Base[Key] extends Condition
|
|
5076
|
+
// Retain this key since the condition passes.
|
|
5077
|
+
? Key
|
|
5078
|
+
// Discard this key since the condition fails.
|
|
5079
|
+
: never;
|
|
5080
|
+
|
|
5081
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
5082
|
+
}[keyof Base]
|
|
5083
|
+
>;
|
|
5084
|
+
|
|
5085
|
+
/**
|
|
5086
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
5087
|
+
|
|
5088
|
+
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.
|
|
5089
|
+
|
|
5090
|
+
@example
|
|
5091
|
+
```
|
|
5092
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
5093
|
+
|
|
5094
|
+
class Awesome {
|
|
5095
|
+
name: string;
|
|
5096
|
+
successes: number;
|
|
5097
|
+
failures: bigint;
|
|
5098
|
+
|
|
5099
|
+
run() {}
|
|
5100
|
+
}
|
|
5101
|
+
|
|
5102
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
5103
|
+
//=> {run: () => void}
|
|
5104
|
+
```
|
|
5105
|
+
|
|
5106
|
+
@example
|
|
5107
|
+
```
|
|
5108
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
5109
|
+
|
|
5110
|
+
interface Example {
|
|
5111
|
+
a: string;
|
|
5112
|
+
b: string | number;
|
|
5113
|
+
c: () => void;
|
|
5114
|
+
d: {};
|
|
5115
|
+
}
|
|
5116
|
+
|
|
5117
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
5118
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
5119
|
+
```
|
|
5120
|
+
|
|
5121
|
+
@category Object
|
|
5122
|
+
*/
|
|
5123
|
+
type ConditionalExcept$4<Base, Condition> = Except$4<
|
|
5124
|
+
Base,
|
|
5125
|
+
ConditionalKeys$4<Base, Condition>
|
|
5126
|
+
>;
|
|
5127
|
+
|
|
5128
|
+
/**
|
|
5129
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
5130
|
+
* can either be a REST module or a host module.
|
|
5131
|
+
* This type is recursive, so it can describe nested modules.
|
|
5132
|
+
*/
|
|
5133
|
+
type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$8<any> | ServicePluginDefinition$4<any> | {
|
|
5134
|
+
[key: string]: Descriptors$4 | PublicMetadata$4 | any;
|
|
5135
|
+
};
|
|
5136
|
+
/**
|
|
5137
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
5138
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
5139
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
5140
|
+
* do not match the given host (as they will not work with the given host).
|
|
5141
|
+
*/
|
|
5142
|
+
type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
|
|
5143
|
+
done: T;
|
|
5144
|
+
recurse: T extends {
|
|
5145
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
|
|
5146
|
+
} ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$8<any> ? BuildEventDefinition$8<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
|
|
5147
|
+
[Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
|
|
5148
|
+
-1,
|
|
5149
|
+
0,
|
|
5150
|
+
1,
|
|
5151
|
+
2,
|
|
5152
|
+
3,
|
|
5153
|
+
4,
|
|
5154
|
+
5
|
|
5155
|
+
][Depth]> : never;
|
|
5156
|
+
}, EmptyObject$4>;
|
|
5157
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
5158
|
+
type PublicMetadata$4 = {
|
|
5159
|
+
PACKAGE_NAME?: string;
|
|
5160
|
+
};
|
|
5161
|
+
|
|
5162
|
+
declare global {
|
|
5163
|
+
interface ContextualClient {
|
|
5164
|
+
}
|
|
5165
|
+
}
|
|
5166
|
+
/**
|
|
5167
|
+
* A type used to create concerete types from SDK descriptors in
|
|
5168
|
+
* case a contextual client is available.
|
|
5169
|
+
*/
|
|
5170
|
+
type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
|
|
5171
|
+
host: Host$4;
|
|
5172
|
+
} ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
|
|
5173
|
+
|
|
5174
|
+
/**
|
|
5175
|
+
* Guidelines ensuring that members post responsibly and respectfully. Site owners can set up Group Rules in the dashboard.
|
|
5176
|
+
* >**Note:** Only admins can update the group rules.
|
|
5177
|
+
*/
|
|
5178
|
+
interface GroupRules {
|
|
5179
|
+
/** Group rules. */
|
|
5180
|
+
rules?: GroupRule[];
|
|
5181
|
+
}
|
|
5182
|
+
interface GroupRule {
|
|
5183
|
+
/** Rule title. */
|
|
5184
|
+
title?: string;
|
|
5185
|
+
/** Rule description. */
|
|
5186
|
+
description?: string;
|
|
5187
|
+
}
|
|
5188
|
+
interface ListRulesRequest {
|
|
5189
|
+
/** Group ID. */
|
|
5190
|
+
groupId: string;
|
|
5191
|
+
}
|
|
5192
|
+
interface ListRulesResponse {
|
|
3291
5193
|
/** Retrieved rules. */
|
|
3292
5194
|
rules?: GroupRule[];
|
|
3293
5195
|
}
|
|
@@ -3508,12 +5410,30 @@ interface CreateOrReplaceAllRulesSignature {
|
|
|
3508
5410
|
*/
|
|
3509
5411
|
(groupId: string, options?: CreateOrReplaceAllRulesOptions | undefined): Promise<CreateOrReplaceAllRulesResponse & CreateOrReplaceAllRulesResponseNonNullableFields>;
|
|
3510
5412
|
}
|
|
3511
|
-
declare const onGroupRulesUpdated$1: EventDefinition$
|
|
5413
|
+
declare const onGroupRulesUpdated$1: EventDefinition$8<GroupRulesUpdatedEnvelope, "wix.social_groups.v2.group_rules_updated">;
|
|
5414
|
+
|
|
5415
|
+
type EventDefinition$7<Payload = unknown, Type extends string = string> = {
|
|
5416
|
+
__type: 'event-definition';
|
|
5417
|
+
type: Type;
|
|
5418
|
+
isDomainEvent?: boolean;
|
|
5419
|
+
transformations?: (envelope: unknown) => Payload;
|
|
5420
|
+
__payload: Payload;
|
|
5421
|
+
};
|
|
5422
|
+
declare function EventDefinition$7<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$7<Payload, Type>;
|
|
5423
|
+
type EventHandler$7<T extends EventDefinition$7> = (payload: T['__payload']) => void | Promise<void>;
|
|
5424
|
+
type BuildEventDefinition$7<T extends EventDefinition$7<any, string>> = (handler: EventHandler$7<T>) => void;
|
|
5425
|
+
|
|
5426
|
+
declare global {
|
|
5427
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
5428
|
+
interface SymbolConstructor {
|
|
5429
|
+
readonly observable: symbol;
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
3512
5432
|
|
|
3513
|
-
declare function createEventModule$3<T extends EventDefinition$
|
|
5433
|
+
declare function createEventModule$3<T extends EventDefinition$7<any, string>>(eventDefinition: T): BuildEventDefinition$7<T> & T;
|
|
3514
5434
|
|
|
3515
|
-
declare const listRules: BuildRESTFunction$4<typeof listRules$1> & typeof listRules$1
|
|
3516
|
-
declare const createOrReplaceAllRules: BuildRESTFunction$4<typeof createOrReplaceAllRules$1> & typeof createOrReplaceAllRules$1
|
|
5435
|
+
declare const listRules: MaybeContext$4<BuildRESTFunction$4<typeof listRules$1> & typeof listRules$1>;
|
|
5436
|
+
declare const createOrReplaceAllRules: MaybeContext$4<BuildRESTFunction$4<typeof createOrReplaceAllRules$1> & typeof createOrReplaceAllRules$1>;
|
|
3517
5437
|
|
|
3518
5438
|
type _publicOnGroupRulesUpdatedType = typeof onGroupRulesUpdated$1;
|
|
3519
5439
|
/**
|
|
@@ -3541,11 +5461,50 @@ declare namespace context$4 {
|
|
|
3541
5461
|
export { type ActionEvent$3 as ActionEvent, type BaseEventMetadata$3 as BaseEventMetadata, type context$4_CreateOrReplaceAllRulesOptions as CreateOrReplaceAllRulesOptions, type context$4_CreateOrReplaceAllRulesRequest as CreateOrReplaceAllRulesRequest, type context$4_CreateOrReplaceAllRulesResponse as CreateOrReplaceAllRulesResponse, type context$4_CreateOrReplaceAllRulesResponseNonNullableFields as CreateOrReplaceAllRulesResponseNonNullableFields, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type context$4_Empty as Empty, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type EventMetadata$3 as EventMetadata, type context$4_GroupRule as GroupRule, type context$4_GroupRules as GroupRules, type context$4_GroupRulesUpdatedEnvelope as GroupRulesUpdatedEnvelope, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$4_ListRulesRequest as ListRulesRequest, type context$4_ListRulesResponse as ListRulesResponse, type context$4_ListRulesResponseNonNullableFields as ListRulesResponseNonNullableFields, type context$4_ListTemplatesResponse as ListTemplatesResponse, type MessageEnvelope$3 as MessageEnvelope, type RestoreInfo$3 as RestoreInfo, WebhookIdentityType$3 as WebhookIdentityType, type context$4__publicOnGroupRulesUpdatedType as _publicOnGroupRulesUpdatedType, context$4_createOrReplaceAllRules as createOrReplaceAllRules, context$4_listRules as listRules, context$4_onGroupRulesUpdated as onGroupRulesUpdated, onGroupRulesUpdated$1 as publicOnGroupRulesUpdated };
|
|
3542
5462
|
}
|
|
3543
5463
|
|
|
5464
|
+
type HostModule$3<T, H extends Host$3> = {
|
|
5465
|
+
__type: 'host';
|
|
5466
|
+
create(host: H): T;
|
|
5467
|
+
};
|
|
5468
|
+
type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
|
|
5469
|
+
type Host$3<Environment = unknown> = {
|
|
5470
|
+
channel: {
|
|
5471
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
5472
|
+
disconnect: () => void;
|
|
5473
|
+
} | Promise<{
|
|
5474
|
+
disconnect: () => void;
|
|
5475
|
+
}>;
|
|
5476
|
+
};
|
|
5477
|
+
environment?: Environment;
|
|
5478
|
+
/**
|
|
5479
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
5480
|
+
*/
|
|
5481
|
+
apiBaseUrl?: string;
|
|
5482
|
+
/**
|
|
5483
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
5484
|
+
* like internationalization, billing, etc.
|
|
5485
|
+
*/
|
|
5486
|
+
essentials?: {
|
|
5487
|
+
/**
|
|
5488
|
+
* The language of the currently viewed session
|
|
5489
|
+
*/
|
|
5490
|
+
language?: string;
|
|
5491
|
+
/**
|
|
5492
|
+
* The locale of the currently viewed session
|
|
5493
|
+
*/
|
|
5494
|
+
locale?: string;
|
|
5495
|
+
/**
|
|
5496
|
+
* Any headers that should be passed through to the API requests
|
|
5497
|
+
*/
|
|
5498
|
+
passThroughHeaders?: Record<string, string>;
|
|
5499
|
+
};
|
|
5500
|
+
};
|
|
5501
|
+
|
|
3544
5502
|
type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
|
|
3545
5503
|
interface HttpClient$3 {
|
|
3546
5504
|
request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
|
|
3547
5505
|
fetchWithAuth: typeof fetch;
|
|
3548
5506
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
5507
|
+
getActiveToken?: () => string | undefined;
|
|
3549
5508
|
}
|
|
3550
5509
|
type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
|
|
3551
5510
|
type HttpResponse$3<T = any> = {
|
|
@@ -3567,16 +5526,65 @@ type APIMetadata$3 = {
|
|
|
3567
5526
|
packageName?: string;
|
|
3568
5527
|
};
|
|
3569
5528
|
type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
|
|
3570
|
-
type EventDefinition$
|
|
5529
|
+
type EventDefinition$6<Payload = unknown, Type extends string = string> = {
|
|
3571
5530
|
__type: 'event-definition';
|
|
3572
5531
|
type: Type;
|
|
3573
5532
|
isDomainEvent?: boolean;
|
|
3574
5533
|
transformations?: (envelope: unknown) => Payload;
|
|
3575
5534
|
__payload: Payload;
|
|
3576
5535
|
};
|
|
3577
|
-
declare function EventDefinition$
|
|
3578
|
-
type EventHandler$
|
|
3579
|
-
type BuildEventDefinition$
|
|
5536
|
+
declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
|
|
5537
|
+
type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
|
|
5538
|
+
type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
|
|
5539
|
+
|
|
5540
|
+
type ServicePluginMethodInput$3 = {
|
|
5541
|
+
request: any;
|
|
5542
|
+
metadata: any;
|
|
5543
|
+
};
|
|
5544
|
+
type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
|
|
5545
|
+
type ServicePluginMethodMetadata$3 = {
|
|
5546
|
+
name: string;
|
|
5547
|
+
primaryHttpMappingPath: string;
|
|
5548
|
+
transformations: {
|
|
5549
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
|
|
5550
|
+
toREST: (...args: unknown[]) => unknown;
|
|
5551
|
+
};
|
|
5552
|
+
};
|
|
5553
|
+
type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
|
|
5554
|
+
__type: 'service-plugin-definition';
|
|
5555
|
+
componentType: string;
|
|
5556
|
+
methods: ServicePluginMethodMetadata$3[];
|
|
5557
|
+
__contract: Contract;
|
|
5558
|
+
};
|
|
5559
|
+
declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
|
|
5560
|
+
type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
|
|
5561
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
|
|
5562
|
+
|
|
5563
|
+
type RequestContext$3 = {
|
|
5564
|
+
isSSR: boolean;
|
|
5565
|
+
host: string;
|
|
5566
|
+
protocol?: string;
|
|
5567
|
+
};
|
|
5568
|
+
type ResponseTransformer$3 = (data: any, headers?: any) => any;
|
|
5569
|
+
/**
|
|
5570
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
5571
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
5572
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
5573
|
+
*/
|
|
5574
|
+
type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
5575
|
+
type AmbassadorRequestOptions$3<T = any> = {
|
|
5576
|
+
_?: T;
|
|
5577
|
+
url?: string;
|
|
5578
|
+
method?: Method$3;
|
|
5579
|
+
params?: any;
|
|
5580
|
+
data?: any;
|
|
5581
|
+
transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
|
|
5582
|
+
};
|
|
5583
|
+
type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
|
|
5584
|
+
__isAmbassador: boolean;
|
|
5585
|
+
};
|
|
5586
|
+
type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
|
|
5587
|
+
type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
3580
5588
|
|
|
3581
5589
|
declare global {
|
|
3582
5590
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -3585,6 +5593,284 @@ declare global {
|
|
|
3585
5593
|
}
|
|
3586
5594
|
}
|
|
3587
5595
|
|
|
5596
|
+
declare const emptyObjectSymbol$3: unique symbol;
|
|
5597
|
+
|
|
5598
|
+
/**
|
|
5599
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
5600
|
+
|
|
5601
|
+
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)).
|
|
5602
|
+
|
|
5603
|
+
@example
|
|
5604
|
+
```
|
|
5605
|
+
import type {EmptyObject} from 'type-fest';
|
|
5606
|
+
|
|
5607
|
+
// The following illustrates the problem with `{}`.
|
|
5608
|
+
const foo1: {} = {}; // Pass
|
|
5609
|
+
const foo2: {} = []; // Pass
|
|
5610
|
+
const foo3: {} = 42; // Pass
|
|
5611
|
+
const foo4: {} = {a: 1}; // Pass
|
|
5612
|
+
|
|
5613
|
+
// With `EmptyObject` only the first case is valid.
|
|
5614
|
+
const bar1: EmptyObject = {}; // Pass
|
|
5615
|
+
const bar2: EmptyObject = 42; // Fail
|
|
5616
|
+
const bar3: EmptyObject = []; // Fail
|
|
5617
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
5618
|
+
```
|
|
5619
|
+
|
|
5620
|
+
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}.
|
|
5621
|
+
|
|
5622
|
+
@category Object
|
|
5623
|
+
*/
|
|
5624
|
+
type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
|
|
5625
|
+
|
|
5626
|
+
/**
|
|
5627
|
+
Returns a boolean for whether the two given types are equal.
|
|
5628
|
+
|
|
5629
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
5630
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
5631
|
+
|
|
5632
|
+
Use-cases:
|
|
5633
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
5634
|
+
|
|
5635
|
+
@example
|
|
5636
|
+
```
|
|
5637
|
+
import type {IsEqual} from 'type-fest';
|
|
5638
|
+
|
|
5639
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
5640
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
5641
|
+
type Includes<Value extends readonly any[], Item> =
|
|
5642
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
5643
|
+
? IsEqual<Value[0], Item> extends true
|
|
5644
|
+
? true
|
|
5645
|
+
: Includes<rest, Item>
|
|
5646
|
+
: false;
|
|
5647
|
+
```
|
|
5648
|
+
|
|
5649
|
+
@category Type Guard
|
|
5650
|
+
@category Utilities
|
|
5651
|
+
*/
|
|
5652
|
+
type IsEqual$3<A, B> =
|
|
5653
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
5654
|
+
(<G>() => G extends B ? 1 : 2)
|
|
5655
|
+
? true
|
|
5656
|
+
: false;
|
|
5657
|
+
|
|
5658
|
+
/**
|
|
5659
|
+
Filter out keys from an object.
|
|
5660
|
+
|
|
5661
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
5662
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
5663
|
+
Returns `Key` otherwise.
|
|
5664
|
+
|
|
5665
|
+
@example
|
|
5666
|
+
```
|
|
5667
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
5668
|
+
//=> never
|
|
5669
|
+
```
|
|
5670
|
+
|
|
5671
|
+
@example
|
|
5672
|
+
```
|
|
5673
|
+
type Filtered = Filter<'bar', string>;
|
|
5674
|
+
//=> never
|
|
5675
|
+
```
|
|
5676
|
+
|
|
5677
|
+
@example
|
|
5678
|
+
```
|
|
5679
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
5680
|
+
//=> 'bar'
|
|
5681
|
+
```
|
|
5682
|
+
|
|
5683
|
+
@see {Except}
|
|
5684
|
+
*/
|
|
5685
|
+
type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
5686
|
+
|
|
5687
|
+
type ExceptOptions$3 = {
|
|
5688
|
+
/**
|
|
5689
|
+
Disallow assigning non-specified properties.
|
|
5690
|
+
|
|
5691
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
5692
|
+
|
|
5693
|
+
@default false
|
|
5694
|
+
*/
|
|
5695
|
+
requireExactProps?: boolean;
|
|
5696
|
+
};
|
|
5697
|
+
|
|
5698
|
+
/**
|
|
5699
|
+
Create a type from an object type without certain keys.
|
|
5700
|
+
|
|
5701
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
5702
|
+
|
|
5703
|
+
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.
|
|
5704
|
+
|
|
5705
|
+
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)).
|
|
5706
|
+
|
|
5707
|
+
@example
|
|
5708
|
+
```
|
|
5709
|
+
import type {Except} from 'type-fest';
|
|
5710
|
+
|
|
5711
|
+
type Foo = {
|
|
5712
|
+
a: number;
|
|
5713
|
+
b: string;
|
|
5714
|
+
};
|
|
5715
|
+
|
|
5716
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
5717
|
+
//=> {b: string}
|
|
5718
|
+
|
|
5719
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
5720
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
5721
|
+
|
|
5722
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
5723
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
5724
|
+
|
|
5725
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
5726
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
5727
|
+
```
|
|
5728
|
+
|
|
5729
|
+
@category Object
|
|
5730
|
+
*/
|
|
5731
|
+
type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
|
|
5732
|
+
[KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
|
|
5733
|
+
} & (Options['requireExactProps'] extends true
|
|
5734
|
+
? Partial<Record<KeysType, never>>
|
|
5735
|
+
: {});
|
|
5736
|
+
|
|
5737
|
+
/**
|
|
5738
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
5739
|
+
|
|
5740
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
5741
|
+
|
|
5742
|
+
@example
|
|
5743
|
+
```
|
|
5744
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5745
|
+
|
|
5746
|
+
interface Example {
|
|
5747
|
+
a: string;
|
|
5748
|
+
b: string | number;
|
|
5749
|
+
c?: string;
|
|
5750
|
+
d: {};
|
|
5751
|
+
}
|
|
5752
|
+
|
|
5753
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
5754
|
+
//=> 'a'
|
|
5755
|
+
```
|
|
5756
|
+
|
|
5757
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
5758
|
+
|
|
5759
|
+
@example
|
|
5760
|
+
```
|
|
5761
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
5762
|
+
|
|
5763
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
5764
|
+
//=> 'a' | 'c'
|
|
5765
|
+
```
|
|
5766
|
+
|
|
5767
|
+
@category Object
|
|
5768
|
+
*/
|
|
5769
|
+
type ConditionalKeys$3<Base, Condition> = NonNullable<
|
|
5770
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
5771
|
+
{
|
|
5772
|
+
// Map through all the keys of the given base type.
|
|
5773
|
+
[Key in keyof Base]:
|
|
5774
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
5775
|
+
Base[Key] extends Condition
|
|
5776
|
+
// Retain this key since the condition passes.
|
|
5777
|
+
? Key
|
|
5778
|
+
// Discard this key since the condition fails.
|
|
5779
|
+
: never;
|
|
5780
|
+
|
|
5781
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
5782
|
+
}[keyof Base]
|
|
5783
|
+
>;
|
|
5784
|
+
|
|
5785
|
+
/**
|
|
5786
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
5787
|
+
|
|
5788
|
+
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.
|
|
5789
|
+
|
|
5790
|
+
@example
|
|
5791
|
+
```
|
|
5792
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
5793
|
+
|
|
5794
|
+
class Awesome {
|
|
5795
|
+
name: string;
|
|
5796
|
+
successes: number;
|
|
5797
|
+
failures: bigint;
|
|
5798
|
+
|
|
5799
|
+
run() {}
|
|
5800
|
+
}
|
|
5801
|
+
|
|
5802
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
5803
|
+
//=> {run: () => void}
|
|
5804
|
+
```
|
|
5805
|
+
|
|
5806
|
+
@example
|
|
5807
|
+
```
|
|
5808
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
5809
|
+
|
|
5810
|
+
interface Example {
|
|
5811
|
+
a: string;
|
|
5812
|
+
b: string | number;
|
|
5813
|
+
c: () => void;
|
|
5814
|
+
d: {};
|
|
5815
|
+
}
|
|
5816
|
+
|
|
5817
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
5818
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
5819
|
+
```
|
|
5820
|
+
|
|
5821
|
+
@category Object
|
|
5822
|
+
*/
|
|
5823
|
+
type ConditionalExcept$3<Base, Condition> = Except$3<
|
|
5824
|
+
Base,
|
|
5825
|
+
ConditionalKeys$3<Base, Condition>
|
|
5826
|
+
>;
|
|
5827
|
+
|
|
5828
|
+
/**
|
|
5829
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
5830
|
+
* can either be a REST module or a host module.
|
|
5831
|
+
* This type is recursive, so it can describe nested modules.
|
|
5832
|
+
*/
|
|
5833
|
+
type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$6<any> | ServicePluginDefinition$3<any> | {
|
|
5834
|
+
[key: string]: Descriptors$3 | PublicMetadata$3 | any;
|
|
5835
|
+
};
|
|
5836
|
+
/**
|
|
5837
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
5838
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
5839
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
5840
|
+
* do not match the given host (as they will not work with the given host).
|
|
5841
|
+
*/
|
|
5842
|
+
type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
|
|
5843
|
+
done: T;
|
|
5844
|
+
recurse: T extends {
|
|
5845
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
|
|
5846
|
+
} ? 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<{
|
|
5847
|
+
[Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
|
|
5848
|
+
-1,
|
|
5849
|
+
0,
|
|
5850
|
+
1,
|
|
5851
|
+
2,
|
|
5852
|
+
3,
|
|
5853
|
+
4,
|
|
5854
|
+
5
|
|
5855
|
+
][Depth]> : never;
|
|
5856
|
+
}, EmptyObject$3>;
|
|
5857
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
5858
|
+
type PublicMetadata$3 = {
|
|
5859
|
+
PACKAGE_NAME?: string;
|
|
5860
|
+
};
|
|
5861
|
+
|
|
5862
|
+
declare global {
|
|
5863
|
+
interface ContextualClient {
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
/**
|
|
5867
|
+
* A type used to create concerete types from SDK descriptors in
|
|
5868
|
+
* case a contextual client is available.
|
|
5869
|
+
*/
|
|
5870
|
+
type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
|
|
5871
|
+
host: Host$3;
|
|
5872
|
+
} ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
|
|
5873
|
+
|
|
3588
5874
|
/**
|
|
3589
5875
|
* To join a private group, a site member must submit a Join Request, which can be approved or rejected by an admin.
|
|
3590
5876
|
* When the request is approved, the site member becomes a group member.
|
|
@@ -4206,16 +6492,34 @@ interface QueryJoinGroupRequestsSignature {
|
|
|
4206
6492
|
*/
|
|
4207
6493
|
(groupId: string, options?: QueryJoinGroupRequestsOptions | undefined): JoinGroupRequestsQueryBuilder;
|
|
4208
6494
|
}
|
|
4209
|
-
declare const onJoinGroupRequestCreated$1: EventDefinition$
|
|
4210
|
-
declare const onJoinGroupRequestApproved$1: EventDefinition$
|
|
4211
|
-
declare const onJoinGroupRequestRejected$1: EventDefinition$
|
|
6495
|
+
declare const onJoinGroupRequestCreated$1: EventDefinition$6<JoinGroupRequestCreatedEnvelope, "wix.social_groups.v2.join_group_request_created">;
|
|
6496
|
+
declare const onJoinGroupRequestApproved$1: EventDefinition$6<JoinGroupRequestApprovedEnvelope, "wix.social_groups.v2.join_group_request_approved">;
|
|
6497
|
+
declare const onJoinGroupRequestRejected$1: EventDefinition$6<JoinGroupRequestRejectedEnvelope, "wix.social_groups.v2.join_group_request_rejected">;
|
|
4212
6498
|
|
|
4213
|
-
|
|
6499
|
+
type EventDefinition$5<Payload = unknown, Type extends string = string> = {
|
|
6500
|
+
__type: 'event-definition';
|
|
6501
|
+
type: Type;
|
|
6502
|
+
isDomainEvent?: boolean;
|
|
6503
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6504
|
+
__payload: Payload;
|
|
6505
|
+
};
|
|
6506
|
+
declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
|
|
6507
|
+
type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
|
|
6508
|
+
type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
|
|
4214
6509
|
|
|
4215
|
-
declare
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
6510
|
+
declare global {
|
|
6511
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6512
|
+
interface SymbolConstructor {
|
|
6513
|
+
readonly observable: symbol;
|
|
6514
|
+
}
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
declare function createEventModule$2<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
|
|
6518
|
+
|
|
6519
|
+
declare const approveJoinGroupRequests: MaybeContext$3<BuildRESTFunction$3<typeof approveJoinGroupRequests$1> & typeof approveJoinGroupRequests$1>;
|
|
6520
|
+
declare const rejectJoinGroupRequests: MaybeContext$3<BuildRESTFunction$3<typeof rejectJoinGroupRequests$1> & typeof rejectJoinGroupRequests$1>;
|
|
6521
|
+
declare const listJoinGroupRequests: MaybeContext$3<BuildRESTFunction$3<typeof listJoinGroupRequests$1> & typeof listJoinGroupRequests$1>;
|
|
6522
|
+
declare const queryJoinGroupRequests: MaybeContext$3<BuildRESTFunction$3<typeof queryJoinGroupRequests$1> & typeof queryJoinGroupRequests$1>;
|
|
4219
6523
|
|
|
4220
6524
|
type _publicOnJoinGroupRequestCreatedType = typeof onJoinGroupRequestCreated$1;
|
|
4221
6525
|
/** */
|
|
@@ -4297,11 +6601,50 @@ declare namespace context$3 {
|
|
|
4297
6601
|
export { type ActionEvent$2 as ActionEvent, type context$3_ApproveAllJoinGroupRequestsRequest as ApproveAllJoinGroupRequestsRequest, type context$3_ApproveAllJoinGroupRequestsResponse as ApproveAllJoinGroupRequestsResponse, type context$3_ApproveJoinGroupRequestsOptions as ApproveJoinGroupRequestsOptions, type context$3_ApproveJoinGroupRequestsRequest as ApproveJoinGroupRequestsRequest, type context$3_ApproveJoinGroupRequestsResponse as ApproveJoinGroupRequestsResponse, type context$3_ApproveJoinGroupRequestsResponseNonNullableFields as ApproveJoinGroupRequestsResponseNonNullableFields, type BaseEventMetadata$2 as BaseEventMetadata, type context$3_CancelJoinGroupRequestRequest as CancelJoinGroupRequestRequest, type context$3_CancelJoinGroupRequestResponse as CancelJoinGroupRequestResponse, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventMetadata$2 as EventMetadata, type context$3_EventsViolationOptions as EventsViolationOptions, type context$3_GetJoinRequirementsRequest as GetJoinRequirementsRequest, type context$3_GetJoinRequirementsResponse as GetJoinRequirementsResponse, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, ItemsToUpdate$2 as ItemsToUpdate, type context$3_JoinGroupRequest as JoinGroupRequest, type context$3_JoinGroupRequestApproved as JoinGroupRequestApproved, type context$3_JoinGroupRequestApprovedEnvelope as JoinGroupRequestApprovedEnvelope, type context$3_JoinGroupRequestCancelled as JoinGroupRequestCancelled, type context$3_JoinGroupRequestCreatedEnvelope as JoinGroupRequestCreatedEnvelope, type context$3_JoinGroupRequestRejected as JoinGroupRequestRejected, type context$3_JoinGroupRequestRejectedEnvelope as JoinGroupRequestRejectedEnvelope, type context$3_JoinGroupRequestsQueryBuilder as JoinGroupRequestsQueryBuilder, type context$3_JoinGroupRequestsQueryResult as JoinGroupRequestsQueryResult, type context$3_JoinRequestsApproved as JoinRequestsApproved, type context$3_ListAllJoinGroupRequestsRequest as ListAllJoinGroupRequestsRequest, type context$3_ListAllJoinGroupRequestsResponse as ListAllJoinGroupRequestsResponse, type context$3_ListJoinGroupRequestsOptions as ListJoinGroupRequestsOptions, type context$3_ListJoinGroupRequestsRequest as ListJoinGroupRequestsRequest, type context$3_ListJoinGroupRequestsResponse as ListJoinGroupRequestsResponse, type context$3_ListJoinGroupRequestsResponseNonNullableFields as ListJoinGroupRequestsResponseNonNullableFields, type context$3_MemberJoinedGroup as MemberJoinedGroup, type context$3_MembersAddedToGroup as MembersAddedToGroup, type context$3_MembersInvitedToGroup as MembersInvitedToGroup, type MembershipQuestionAnswer$2 as MembershipQuestionAnswer, type context$3_MembershipQuestionViolationOptions as MembershipQuestionViolationOptions, type MessageEnvelope$2 as MessageEnvelope, OwnershipFilter$2 as OwnershipFilter, type Paging$3 as Paging, type PagingMetadata$3 as PagingMetadata, type context$3_PaidPlan as PaidPlan, type context$3_PricingPlanViolationOptions as PricingPlanViolationOptions, type Query$2 as Query, type context$3_QueryJoinGroupRequestsOptions as QueryJoinGroupRequestsOptions, type context$3_QueryJoinGroupRequestsRequest as QueryJoinGroupRequestsRequest, type context$3_QueryJoinGroupRequestsResponse as QueryJoinGroupRequestsResponse, type context$3_QueryJoinGroupRequestsResponseNonNullableFields as QueryJoinGroupRequestsResponseNonNullableFields, type context$3_RejectAllJoinGroupRequestsRequest as RejectAllJoinGroupRequestsRequest, type context$3_RejectAllJoinGroupRequestsResponse as RejectAllJoinGroupRequestsResponse, type context$3_RejectJoinGroupRequestsRequest as RejectJoinGroupRequestsRequest, type context$3_RejectJoinGroupRequestsResponse as RejectJoinGroupRequestsResponse, type context$3_RejectJoinGroupRequestsResponseNonNullableFields as RejectJoinGroupRequestsResponseNonNullableFields, type Rejection$2 as Rejection, type RequestDetails$2 as RequestDetails, RequestStatus$2 as RequestStatus, type RestoreInfo$2 as RestoreInfo, type context$3_SocialGroupsEvent as SocialGroupsEvent, type context$3_SocialGroupsEventPayloadOneOf as SocialGroupsEventPayloadOneOf, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type context$3_SubmitJoinGroupRequestRequest as SubmitJoinGroupRequestRequest, type context$3_SubmitJoinGroupRequestResponse as SubmitJoinGroupRequestResponse, type context$3_Violation as Violation, context$3_ViolationType as ViolationType, type context$3_ViolationViolationOptionsOneOf as ViolationViolationOptionsOneOf, WebhookIdentityType$2 as WebhookIdentityType, type context$3__publicOnJoinGroupRequestApprovedType as _publicOnJoinGroupRequestApprovedType, type context$3__publicOnJoinGroupRequestCreatedType as _publicOnJoinGroupRequestCreatedType, type context$3__publicOnJoinGroupRequestRejectedType as _publicOnJoinGroupRequestRejectedType, context$3_approveJoinGroupRequests as approveJoinGroupRequests, context$3_listJoinGroupRequests as listJoinGroupRequests, context$3_onJoinGroupRequestApproved as onJoinGroupRequestApproved, context$3_onJoinGroupRequestCreated as onJoinGroupRequestCreated, context$3_onJoinGroupRequestRejected as onJoinGroupRequestRejected, onJoinGroupRequestApproved$1 as publicOnJoinGroupRequestApproved, onJoinGroupRequestCreated$1 as publicOnJoinGroupRequestCreated, onJoinGroupRequestRejected$1 as publicOnJoinGroupRequestRejected, context$3_queryJoinGroupRequests as queryJoinGroupRequests, context$3_rejectJoinGroupRequests as rejectJoinGroupRequests };
|
|
4298
6602
|
}
|
|
4299
6603
|
|
|
6604
|
+
type HostModule$2<T, H extends Host$2> = {
|
|
6605
|
+
__type: 'host';
|
|
6606
|
+
create(host: H): T;
|
|
6607
|
+
};
|
|
6608
|
+
type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
|
|
6609
|
+
type Host$2<Environment = unknown> = {
|
|
6610
|
+
channel: {
|
|
6611
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
6612
|
+
disconnect: () => void;
|
|
6613
|
+
} | Promise<{
|
|
6614
|
+
disconnect: () => void;
|
|
6615
|
+
}>;
|
|
6616
|
+
};
|
|
6617
|
+
environment?: Environment;
|
|
6618
|
+
/**
|
|
6619
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
6620
|
+
*/
|
|
6621
|
+
apiBaseUrl?: string;
|
|
6622
|
+
/**
|
|
6623
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
6624
|
+
* like internationalization, billing, etc.
|
|
6625
|
+
*/
|
|
6626
|
+
essentials?: {
|
|
6627
|
+
/**
|
|
6628
|
+
* The language of the currently viewed session
|
|
6629
|
+
*/
|
|
6630
|
+
language?: string;
|
|
6631
|
+
/**
|
|
6632
|
+
* The locale of the currently viewed session
|
|
6633
|
+
*/
|
|
6634
|
+
locale?: string;
|
|
6635
|
+
/**
|
|
6636
|
+
* Any headers that should be passed through to the API requests
|
|
6637
|
+
*/
|
|
6638
|
+
passThroughHeaders?: Record<string, string>;
|
|
6639
|
+
};
|
|
6640
|
+
};
|
|
6641
|
+
|
|
4300
6642
|
type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
|
|
4301
6643
|
interface HttpClient$2 {
|
|
4302
6644
|
request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
|
|
4303
6645
|
fetchWithAuth: typeof fetch;
|
|
4304
6646
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
6647
|
+
getActiveToken?: () => string | undefined;
|
|
4305
6648
|
}
|
|
4306
6649
|
type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
|
|
4307
6650
|
type HttpResponse$2<T = any> = {
|
|
@@ -4311,25 +6654,362 @@ type HttpResponse$2<T = any> = {
|
|
|
4311
6654
|
headers: any;
|
|
4312
6655
|
request?: any;
|
|
4313
6656
|
};
|
|
4314
|
-
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
4315
|
-
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
4316
|
-
url: string;
|
|
4317
|
-
data?: Data;
|
|
4318
|
-
params?: URLSearchParams;
|
|
4319
|
-
} & APIMetadata$2;
|
|
4320
|
-
type APIMetadata$2 = {
|
|
4321
|
-
methodFqn?: string;
|
|
4322
|
-
entityFqdn?: string;
|
|
4323
|
-
packageName?: string;
|
|
6657
|
+
type RequestOptions$2<_TResponse = any, Data = any> = {
|
|
6658
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
6659
|
+
url: string;
|
|
6660
|
+
data?: Data;
|
|
6661
|
+
params?: URLSearchParams;
|
|
6662
|
+
} & APIMetadata$2;
|
|
6663
|
+
type APIMetadata$2 = {
|
|
6664
|
+
methodFqn?: string;
|
|
6665
|
+
entityFqdn?: string;
|
|
6666
|
+
packageName?: string;
|
|
6667
|
+
};
|
|
6668
|
+
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
6669
|
+
type EventDefinition$4<Payload = unknown, Type extends string = string> = {
|
|
6670
|
+
__type: 'event-definition';
|
|
6671
|
+
type: Type;
|
|
6672
|
+
isDomainEvent?: boolean;
|
|
6673
|
+
transformations?: (envelope: unknown) => Payload;
|
|
6674
|
+
__payload: Payload;
|
|
6675
|
+
};
|
|
6676
|
+
declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
|
|
6677
|
+
type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
|
|
6678
|
+
type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
|
|
6679
|
+
|
|
6680
|
+
type ServicePluginMethodInput$2 = {
|
|
6681
|
+
request: any;
|
|
6682
|
+
metadata: any;
|
|
6683
|
+
};
|
|
6684
|
+
type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
|
|
6685
|
+
type ServicePluginMethodMetadata$2 = {
|
|
6686
|
+
name: string;
|
|
6687
|
+
primaryHttpMappingPath: string;
|
|
6688
|
+
transformations: {
|
|
6689
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
|
|
6690
|
+
toREST: (...args: unknown[]) => unknown;
|
|
6691
|
+
};
|
|
6692
|
+
};
|
|
6693
|
+
type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
|
|
6694
|
+
__type: 'service-plugin-definition';
|
|
6695
|
+
componentType: string;
|
|
6696
|
+
methods: ServicePluginMethodMetadata$2[];
|
|
6697
|
+
__contract: Contract;
|
|
6698
|
+
};
|
|
6699
|
+
declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
|
|
6700
|
+
type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
|
|
6701
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
|
|
6702
|
+
|
|
6703
|
+
type RequestContext$2 = {
|
|
6704
|
+
isSSR: boolean;
|
|
6705
|
+
host: string;
|
|
6706
|
+
protocol?: string;
|
|
6707
|
+
};
|
|
6708
|
+
type ResponseTransformer$2 = (data: any, headers?: any) => any;
|
|
6709
|
+
/**
|
|
6710
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
6711
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
6712
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
6713
|
+
*/
|
|
6714
|
+
type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
6715
|
+
type AmbassadorRequestOptions$2<T = any> = {
|
|
6716
|
+
_?: T;
|
|
6717
|
+
url?: string;
|
|
6718
|
+
method?: Method$2;
|
|
6719
|
+
params?: any;
|
|
6720
|
+
data?: any;
|
|
6721
|
+
transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
|
|
6722
|
+
};
|
|
6723
|
+
type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
|
|
6724
|
+
__isAmbassador: boolean;
|
|
6725
|
+
};
|
|
6726
|
+
type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
|
|
6727
|
+
type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
6728
|
+
|
|
6729
|
+
declare global {
|
|
6730
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6731
|
+
interface SymbolConstructor {
|
|
6732
|
+
readonly observable: symbol;
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6735
|
+
|
|
6736
|
+
declare const emptyObjectSymbol$2: unique symbol;
|
|
6737
|
+
|
|
6738
|
+
/**
|
|
6739
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
6740
|
+
|
|
6741
|
+
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)).
|
|
6742
|
+
|
|
6743
|
+
@example
|
|
6744
|
+
```
|
|
6745
|
+
import type {EmptyObject} from 'type-fest';
|
|
6746
|
+
|
|
6747
|
+
// The following illustrates the problem with `{}`.
|
|
6748
|
+
const foo1: {} = {}; // Pass
|
|
6749
|
+
const foo2: {} = []; // Pass
|
|
6750
|
+
const foo3: {} = 42; // Pass
|
|
6751
|
+
const foo4: {} = {a: 1}; // Pass
|
|
6752
|
+
|
|
6753
|
+
// With `EmptyObject` only the first case is valid.
|
|
6754
|
+
const bar1: EmptyObject = {}; // Pass
|
|
6755
|
+
const bar2: EmptyObject = 42; // Fail
|
|
6756
|
+
const bar3: EmptyObject = []; // Fail
|
|
6757
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
6758
|
+
```
|
|
6759
|
+
|
|
6760
|
+
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}.
|
|
6761
|
+
|
|
6762
|
+
@category Object
|
|
6763
|
+
*/
|
|
6764
|
+
type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
|
|
6765
|
+
|
|
6766
|
+
/**
|
|
6767
|
+
Returns a boolean for whether the two given types are equal.
|
|
6768
|
+
|
|
6769
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
6770
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
6771
|
+
|
|
6772
|
+
Use-cases:
|
|
6773
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
6774
|
+
|
|
6775
|
+
@example
|
|
6776
|
+
```
|
|
6777
|
+
import type {IsEqual} from 'type-fest';
|
|
6778
|
+
|
|
6779
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
6780
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
6781
|
+
type Includes<Value extends readonly any[], Item> =
|
|
6782
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
6783
|
+
? IsEqual<Value[0], Item> extends true
|
|
6784
|
+
? true
|
|
6785
|
+
: Includes<rest, Item>
|
|
6786
|
+
: false;
|
|
6787
|
+
```
|
|
6788
|
+
|
|
6789
|
+
@category Type Guard
|
|
6790
|
+
@category Utilities
|
|
6791
|
+
*/
|
|
6792
|
+
type IsEqual$2<A, B> =
|
|
6793
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
6794
|
+
(<G>() => G extends B ? 1 : 2)
|
|
6795
|
+
? true
|
|
6796
|
+
: false;
|
|
6797
|
+
|
|
6798
|
+
/**
|
|
6799
|
+
Filter out keys from an object.
|
|
6800
|
+
|
|
6801
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
6802
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
6803
|
+
Returns `Key` otherwise.
|
|
6804
|
+
|
|
6805
|
+
@example
|
|
6806
|
+
```
|
|
6807
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
6808
|
+
//=> never
|
|
6809
|
+
```
|
|
6810
|
+
|
|
6811
|
+
@example
|
|
6812
|
+
```
|
|
6813
|
+
type Filtered = Filter<'bar', string>;
|
|
6814
|
+
//=> never
|
|
6815
|
+
```
|
|
6816
|
+
|
|
6817
|
+
@example
|
|
6818
|
+
```
|
|
6819
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
6820
|
+
//=> 'bar'
|
|
6821
|
+
```
|
|
6822
|
+
|
|
6823
|
+
@see {Except}
|
|
6824
|
+
*/
|
|
6825
|
+
type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
6826
|
+
|
|
6827
|
+
type ExceptOptions$2 = {
|
|
6828
|
+
/**
|
|
6829
|
+
Disallow assigning non-specified properties.
|
|
6830
|
+
|
|
6831
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
6832
|
+
|
|
6833
|
+
@default false
|
|
6834
|
+
*/
|
|
6835
|
+
requireExactProps?: boolean;
|
|
6836
|
+
};
|
|
6837
|
+
|
|
6838
|
+
/**
|
|
6839
|
+
Create a type from an object type without certain keys.
|
|
6840
|
+
|
|
6841
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
6842
|
+
|
|
6843
|
+
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.
|
|
6844
|
+
|
|
6845
|
+
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)).
|
|
6846
|
+
|
|
6847
|
+
@example
|
|
6848
|
+
```
|
|
6849
|
+
import type {Except} from 'type-fest';
|
|
6850
|
+
|
|
6851
|
+
type Foo = {
|
|
6852
|
+
a: number;
|
|
6853
|
+
b: string;
|
|
6854
|
+
};
|
|
6855
|
+
|
|
6856
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
6857
|
+
//=> {b: string}
|
|
6858
|
+
|
|
6859
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
6860
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
6861
|
+
|
|
6862
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
6863
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
6864
|
+
|
|
6865
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
6866
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
6867
|
+
```
|
|
6868
|
+
|
|
6869
|
+
@category Object
|
|
6870
|
+
*/
|
|
6871
|
+
type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
|
|
6872
|
+
[KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
|
|
6873
|
+
} & (Options['requireExactProps'] extends true
|
|
6874
|
+
? Partial<Record<KeysType, never>>
|
|
6875
|
+
: {});
|
|
6876
|
+
|
|
6877
|
+
/**
|
|
6878
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
6879
|
+
|
|
6880
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
6881
|
+
|
|
6882
|
+
@example
|
|
6883
|
+
```
|
|
6884
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6885
|
+
|
|
6886
|
+
interface Example {
|
|
6887
|
+
a: string;
|
|
6888
|
+
b: string | number;
|
|
6889
|
+
c?: string;
|
|
6890
|
+
d: {};
|
|
6891
|
+
}
|
|
6892
|
+
|
|
6893
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
6894
|
+
//=> 'a'
|
|
6895
|
+
```
|
|
6896
|
+
|
|
6897
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
6898
|
+
|
|
6899
|
+
@example
|
|
6900
|
+
```
|
|
6901
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
6902
|
+
|
|
6903
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
6904
|
+
//=> 'a' | 'c'
|
|
6905
|
+
```
|
|
6906
|
+
|
|
6907
|
+
@category Object
|
|
6908
|
+
*/
|
|
6909
|
+
type ConditionalKeys$2<Base, Condition> = NonNullable<
|
|
6910
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
6911
|
+
{
|
|
6912
|
+
// Map through all the keys of the given base type.
|
|
6913
|
+
[Key in keyof Base]:
|
|
6914
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
6915
|
+
Base[Key] extends Condition
|
|
6916
|
+
// Retain this key since the condition passes.
|
|
6917
|
+
? Key
|
|
6918
|
+
// Discard this key since the condition fails.
|
|
6919
|
+
: never;
|
|
6920
|
+
|
|
6921
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
6922
|
+
}[keyof Base]
|
|
6923
|
+
>;
|
|
6924
|
+
|
|
6925
|
+
/**
|
|
6926
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
6927
|
+
|
|
6928
|
+
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.
|
|
6929
|
+
|
|
6930
|
+
@example
|
|
6931
|
+
```
|
|
6932
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
6933
|
+
|
|
6934
|
+
class Awesome {
|
|
6935
|
+
name: string;
|
|
6936
|
+
successes: number;
|
|
6937
|
+
failures: bigint;
|
|
6938
|
+
|
|
6939
|
+
run() {}
|
|
6940
|
+
}
|
|
6941
|
+
|
|
6942
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
6943
|
+
//=> {run: () => void}
|
|
6944
|
+
```
|
|
6945
|
+
|
|
6946
|
+
@example
|
|
6947
|
+
```
|
|
6948
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
6949
|
+
|
|
6950
|
+
interface Example {
|
|
6951
|
+
a: string;
|
|
6952
|
+
b: string | number;
|
|
6953
|
+
c: () => void;
|
|
6954
|
+
d: {};
|
|
6955
|
+
}
|
|
6956
|
+
|
|
6957
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
6958
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
6959
|
+
```
|
|
6960
|
+
|
|
6961
|
+
@category Object
|
|
6962
|
+
*/
|
|
6963
|
+
type ConditionalExcept$2<Base, Condition> = Except$2<
|
|
6964
|
+
Base,
|
|
6965
|
+
ConditionalKeys$2<Base, Condition>
|
|
6966
|
+
>;
|
|
6967
|
+
|
|
6968
|
+
/**
|
|
6969
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
6970
|
+
* can either be a REST module or a host module.
|
|
6971
|
+
* This type is recursive, so it can describe nested modules.
|
|
6972
|
+
*/
|
|
6973
|
+
type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
|
|
6974
|
+
[key: string]: Descriptors$2 | PublicMetadata$2 | any;
|
|
6975
|
+
};
|
|
6976
|
+
/**
|
|
6977
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
6978
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
6979
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
6980
|
+
* do not match the given host (as they will not work with the given host).
|
|
6981
|
+
*/
|
|
6982
|
+
type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
|
|
6983
|
+
done: T;
|
|
6984
|
+
recurse: T extends {
|
|
6985
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
|
|
6986
|
+
} ? 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<{
|
|
6987
|
+
[Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
|
|
6988
|
+
-1,
|
|
6989
|
+
0,
|
|
6990
|
+
1,
|
|
6991
|
+
2,
|
|
6992
|
+
3,
|
|
6993
|
+
4,
|
|
6994
|
+
5
|
|
6995
|
+
][Depth]> : never;
|
|
6996
|
+
}, EmptyObject$2>;
|
|
6997
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
6998
|
+
type PublicMetadata$2 = {
|
|
6999
|
+
PACKAGE_NAME?: string;
|
|
4324
7000
|
};
|
|
4325
|
-
type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
|
|
4326
7001
|
|
|
4327
7002
|
declare global {
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
readonly observable: symbol;
|
|
4331
|
-
}
|
|
7003
|
+
interface ContextualClient {
|
|
7004
|
+
}
|
|
4332
7005
|
}
|
|
7006
|
+
/**
|
|
7007
|
+
* A type used to create concerete types from SDK descriptors in
|
|
7008
|
+
* case a contextual client is available.
|
|
7009
|
+
*/
|
|
7010
|
+
type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
|
|
7011
|
+
host: Host$2;
|
|
7012
|
+
} ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
|
|
4333
7013
|
|
|
4334
7014
|
/**
|
|
4335
7015
|
* Question asked to members when joining a group. Site owners can set whether it is required to answer the question in the dashboard.
|
|
@@ -4485,9 +7165,9 @@ interface ListAnswersSignature {
|
|
|
4485
7165
|
(groupId: string, options?: ListAnswersOptions | undefined): Promise<ListAnswersResponse & ListAnswersResponseNonNullableFields>;
|
|
4486
7166
|
}
|
|
4487
7167
|
|
|
4488
|
-
declare const listMembershipQuestions: BuildRESTFunction$2<typeof listMembershipQuestions$1> & typeof listMembershipQuestions$1
|
|
4489
|
-
declare const createOrReplaceAllMembershipQuestions: BuildRESTFunction$2<typeof createOrReplaceAllMembershipQuestions$1> & typeof createOrReplaceAllMembershipQuestions$1
|
|
4490
|
-
declare const listAnswers: BuildRESTFunction$2<typeof listAnswers$1> & typeof listAnswers$1
|
|
7168
|
+
declare const listMembershipQuestions: MaybeContext$2<BuildRESTFunction$2<typeof listMembershipQuestions$1> & typeof listMembershipQuestions$1>;
|
|
7169
|
+
declare const createOrReplaceAllMembershipQuestions: MaybeContext$2<BuildRESTFunction$2<typeof createOrReplaceAllMembershipQuestions$1> & typeof createOrReplaceAllMembershipQuestions$1>;
|
|
7170
|
+
declare const listAnswers: MaybeContext$2<BuildRESTFunction$2<typeof listAnswers$1> & typeof listAnswers$1>;
|
|
4491
7171
|
|
|
4492
7172
|
type context$2_CreateOrReplaceAllMembershipQuestionsOptions = CreateOrReplaceAllMembershipQuestionsOptions;
|
|
4493
7173
|
type context$2_CreateOrReplaceAllMembershipQuestionsRequest = CreateOrReplaceAllMembershipQuestionsRequest;
|
|
@@ -4512,11 +7192,50 @@ declare namespace context$2 {
|
|
|
4512
7192
|
export { type context$2_CreateOrReplaceAllMembershipQuestionsOptions as CreateOrReplaceAllMembershipQuestionsOptions, type context$2_CreateOrReplaceAllMembershipQuestionsRequest as CreateOrReplaceAllMembershipQuestionsRequest, type context$2_CreateOrReplaceAllMembershipQuestionsResponse as CreateOrReplaceAllMembershipQuestionsResponse, type context$2_CreateOrReplaceAllMembershipQuestionsResponseNonNullableFields as CreateOrReplaceAllMembershipQuestionsResponseNonNullableFields, type context$2_ListAnswerCountsRequest as ListAnswerCountsRequest, type context$2_ListAnswerCountsResponse as ListAnswerCountsResponse, type context$2_ListAnswersOptions as ListAnswersOptions, type context$2_ListAnswersRequest as ListAnswersRequest, type context$2_ListAnswersResponse as ListAnswersResponse, type context$2_ListAnswersResponseNonNullableFields as ListAnswersResponseNonNullableFields, type context$2_ListMembershipQuestionsRequest as ListMembershipQuestionsRequest, type context$2_ListMembershipQuestionsResponse as ListMembershipQuestionsResponse, type context$2_ListMembershipQuestionsResponseNonNullableFields as ListMembershipQuestionsResponseNonNullableFields, type context$2_MemberAnswerCount as MemberAnswerCount, type context$2_MemberMembershipQuestionAnswers as MemberMembershipQuestionAnswers, type context$2_MembershipQuestion as MembershipQuestion, type MembershipQuestionAnswer$1 as MembershipQuestionAnswer, type Paging$2 as Paging, type PagingMetadata$2 as PagingMetadata, context$2_createOrReplaceAllMembershipQuestions as createOrReplaceAllMembershipQuestions, context$2_listAnswers as listAnswers, context$2_listMembershipQuestions as listMembershipQuestions };
|
|
4513
7193
|
}
|
|
4514
7194
|
|
|
7195
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
7196
|
+
__type: 'host';
|
|
7197
|
+
create(host: H): T;
|
|
7198
|
+
};
|
|
7199
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
7200
|
+
type Host$1<Environment = unknown> = {
|
|
7201
|
+
channel: {
|
|
7202
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
7203
|
+
disconnect: () => void;
|
|
7204
|
+
} | Promise<{
|
|
7205
|
+
disconnect: () => void;
|
|
7206
|
+
}>;
|
|
7207
|
+
};
|
|
7208
|
+
environment?: Environment;
|
|
7209
|
+
/**
|
|
7210
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
7211
|
+
*/
|
|
7212
|
+
apiBaseUrl?: string;
|
|
7213
|
+
/**
|
|
7214
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
7215
|
+
* like internationalization, billing, etc.
|
|
7216
|
+
*/
|
|
7217
|
+
essentials?: {
|
|
7218
|
+
/**
|
|
7219
|
+
* The language of the currently viewed session
|
|
7220
|
+
*/
|
|
7221
|
+
language?: string;
|
|
7222
|
+
/**
|
|
7223
|
+
* The locale of the currently viewed session
|
|
7224
|
+
*/
|
|
7225
|
+
locale?: string;
|
|
7226
|
+
/**
|
|
7227
|
+
* Any headers that should be passed through to the API requests
|
|
7228
|
+
*/
|
|
7229
|
+
passThroughHeaders?: Record<string, string>;
|
|
7230
|
+
};
|
|
7231
|
+
};
|
|
7232
|
+
|
|
4515
7233
|
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
4516
7234
|
interface HttpClient$1 {
|
|
4517
7235
|
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
4518
7236
|
fetchWithAuth: typeof fetch;
|
|
4519
7237
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
7238
|
+
getActiveToken?: () => string | undefined;
|
|
4520
7239
|
}
|
|
4521
7240
|
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
4522
7241
|
type HttpResponse$1<T = any> = {
|
|
@@ -4538,16 +7257,65 @@ type APIMetadata$1 = {
|
|
|
4538
7257
|
packageName?: string;
|
|
4539
7258
|
};
|
|
4540
7259
|
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
4541
|
-
type EventDefinition$
|
|
7260
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
4542
7261
|
__type: 'event-definition';
|
|
4543
7262
|
type: Type;
|
|
4544
7263
|
isDomainEvent?: boolean;
|
|
4545
7264
|
transformations?: (envelope: unknown) => Payload;
|
|
4546
7265
|
__payload: Payload;
|
|
4547
7266
|
};
|
|
4548
|
-
declare function EventDefinition$
|
|
4549
|
-
type EventHandler$
|
|
4550
|
-
type BuildEventDefinition$
|
|
7267
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
7268
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
7269
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
7270
|
+
|
|
7271
|
+
type ServicePluginMethodInput$1 = {
|
|
7272
|
+
request: any;
|
|
7273
|
+
metadata: any;
|
|
7274
|
+
};
|
|
7275
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
7276
|
+
type ServicePluginMethodMetadata$1 = {
|
|
7277
|
+
name: string;
|
|
7278
|
+
primaryHttpMappingPath: string;
|
|
7279
|
+
transformations: {
|
|
7280
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
7281
|
+
toREST: (...args: unknown[]) => unknown;
|
|
7282
|
+
};
|
|
7283
|
+
};
|
|
7284
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
7285
|
+
__type: 'service-plugin-definition';
|
|
7286
|
+
componentType: string;
|
|
7287
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
7288
|
+
__contract: Contract;
|
|
7289
|
+
};
|
|
7290
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
7291
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
7292
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
7293
|
+
|
|
7294
|
+
type RequestContext$1 = {
|
|
7295
|
+
isSSR: boolean;
|
|
7296
|
+
host: string;
|
|
7297
|
+
protocol?: string;
|
|
7298
|
+
};
|
|
7299
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
7300
|
+
/**
|
|
7301
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
7302
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
7303
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
7304
|
+
*/
|
|
7305
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
7306
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
7307
|
+
_?: T;
|
|
7308
|
+
url?: string;
|
|
7309
|
+
method?: Method$1;
|
|
7310
|
+
params?: any;
|
|
7311
|
+
data?: any;
|
|
7312
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
7313
|
+
};
|
|
7314
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
7315
|
+
__isAmbassador: boolean;
|
|
7316
|
+
};
|
|
7317
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
7318
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
4551
7319
|
|
|
4552
7320
|
declare global {
|
|
4553
7321
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -4556,6 +7324,284 @@ declare global {
|
|
|
4556
7324
|
}
|
|
4557
7325
|
}
|
|
4558
7326
|
|
|
7327
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
7328
|
+
|
|
7329
|
+
/**
|
|
7330
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
7331
|
+
|
|
7332
|
+
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)).
|
|
7333
|
+
|
|
7334
|
+
@example
|
|
7335
|
+
```
|
|
7336
|
+
import type {EmptyObject} from 'type-fest';
|
|
7337
|
+
|
|
7338
|
+
// The following illustrates the problem with `{}`.
|
|
7339
|
+
const foo1: {} = {}; // Pass
|
|
7340
|
+
const foo2: {} = []; // Pass
|
|
7341
|
+
const foo3: {} = 42; // Pass
|
|
7342
|
+
const foo4: {} = {a: 1}; // Pass
|
|
7343
|
+
|
|
7344
|
+
// With `EmptyObject` only the first case is valid.
|
|
7345
|
+
const bar1: EmptyObject = {}; // Pass
|
|
7346
|
+
const bar2: EmptyObject = 42; // Fail
|
|
7347
|
+
const bar3: EmptyObject = []; // Fail
|
|
7348
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
7349
|
+
```
|
|
7350
|
+
|
|
7351
|
+
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}.
|
|
7352
|
+
|
|
7353
|
+
@category Object
|
|
7354
|
+
*/
|
|
7355
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
7356
|
+
|
|
7357
|
+
/**
|
|
7358
|
+
Returns a boolean for whether the two given types are equal.
|
|
7359
|
+
|
|
7360
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
7361
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
7362
|
+
|
|
7363
|
+
Use-cases:
|
|
7364
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
7365
|
+
|
|
7366
|
+
@example
|
|
7367
|
+
```
|
|
7368
|
+
import type {IsEqual} from 'type-fest';
|
|
7369
|
+
|
|
7370
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
7371
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
7372
|
+
type Includes<Value extends readonly any[], Item> =
|
|
7373
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
7374
|
+
? IsEqual<Value[0], Item> extends true
|
|
7375
|
+
? true
|
|
7376
|
+
: Includes<rest, Item>
|
|
7377
|
+
: false;
|
|
7378
|
+
```
|
|
7379
|
+
|
|
7380
|
+
@category Type Guard
|
|
7381
|
+
@category Utilities
|
|
7382
|
+
*/
|
|
7383
|
+
type IsEqual$1<A, B> =
|
|
7384
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
7385
|
+
(<G>() => G extends B ? 1 : 2)
|
|
7386
|
+
? true
|
|
7387
|
+
: false;
|
|
7388
|
+
|
|
7389
|
+
/**
|
|
7390
|
+
Filter out keys from an object.
|
|
7391
|
+
|
|
7392
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
7393
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
7394
|
+
Returns `Key` otherwise.
|
|
7395
|
+
|
|
7396
|
+
@example
|
|
7397
|
+
```
|
|
7398
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
7399
|
+
//=> never
|
|
7400
|
+
```
|
|
7401
|
+
|
|
7402
|
+
@example
|
|
7403
|
+
```
|
|
7404
|
+
type Filtered = Filter<'bar', string>;
|
|
7405
|
+
//=> never
|
|
7406
|
+
```
|
|
7407
|
+
|
|
7408
|
+
@example
|
|
7409
|
+
```
|
|
7410
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
7411
|
+
//=> 'bar'
|
|
7412
|
+
```
|
|
7413
|
+
|
|
7414
|
+
@see {Except}
|
|
7415
|
+
*/
|
|
7416
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
7417
|
+
|
|
7418
|
+
type ExceptOptions$1 = {
|
|
7419
|
+
/**
|
|
7420
|
+
Disallow assigning non-specified properties.
|
|
7421
|
+
|
|
7422
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
7423
|
+
|
|
7424
|
+
@default false
|
|
7425
|
+
*/
|
|
7426
|
+
requireExactProps?: boolean;
|
|
7427
|
+
};
|
|
7428
|
+
|
|
7429
|
+
/**
|
|
7430
|
+
Create a type from an object type without certain keys.
|
|
7431
|
+
|
|
7432
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
7433
|
+
|
|
7434
|
+
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.
|
|
7435
|
+
|
|
7436
|
+
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)).
|
|
7437
|
+
|
|
7438
|
+
@example
|
|
7439
|
+
```
|
|
7440
|
+
import type {Except} from 'type-fest';
|
|
7441
|
+
|
|
7442
|
+
type Foo = {
|
|
7443
|
+
a: number;
|
|
7444
|
+
b: string;
|
|
7445
|
+
};
|
|
7446
|
+
|
|
7447
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
7448
|
+
//=> {b: string}
|
|
7449
|
+
|
|
7450
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
7451
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
7452
|
+
|
|
7453
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
7454
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
7455
|
+
|
|
7456
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
7457
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
7458
|
+
```
|
|
7459
|
+
|
|
7460
|
+
@category Object
|
|
7461
|
+
*/
|
|
7462
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
7463
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
7464
|
+
} & (Options['requireExactProps'] extends true
|
|
7465
|
+
? Partial<Record<KeysType, never>>
|
|
7466
|
+
: {});
|
|
7467
|
+
|
|
7468
|
+
/**
|
|
7469
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
7470
|
+
|
|
7471
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
7472
|
+
|
|
7473
|
+
@example
|
|
7474
|
+
```
|
|
7475
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7476
|
+
|
|
7477
|
+
interface Example {
|
|
7478
|
+
a: string;
|
|
7479
|
+
b: string | number;
|
|
7480
|
+
c?: string;
|
|
7481
|
+
d: {};
|
|
7482
|
+
}
|
|
7483
|
+
|
|
7484
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
7485
|
+
//=> 'a'
|
|
7486
|
+
```
|
|
7487
|
+
|
|
7488
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
7489
|
+
|
|
7490
|
+
@example
|
|
7491
|
+
```
|
|
7492
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
7493
|
+
|
|
7494
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
7495
|
+
//=> 'a' | 'c'
|
|
7496
|
+
```
|
|
7497
|
+
|
|
7498
|
+
@category Object
|
|
7499
|
+
*/
|
|
7500
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
7501
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
7502
|
+
{
|
|
7503
|
+
// Map through all the keys of the given base type.
|
|
7504
|
+
[Key in keyof Base]:
|
|
7505
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
7506
|
+
Base[Key] extends Condition
|
|
7507
|
+
// Retain this key since the condition passes.
|
|
7508
|
+
? Key
|
|
7509
|
+
// Discard this key since the condition fails.
|
|
7510
|
+
: never;
|
|
7511
|
+
|
|
7512
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
7513
|
+
}[keyof Base]
|
|
7514
|
+
>;
|
|
7515
|
+
|
|
7516
|
+
/**
|
|
7517
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
7518
|
+
|
|
7519
|
+
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.
|
|
7520
|
+
|
|
7521
|
+
@example
|
|
7522
|
+
```
|
|
7523
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
7524
|
+
|
|
7525
|
+
class Awesome {
|
|
7526
|
+
name: string;
|
|
7527
|
+
successes: number;
|
|
7528
|
+
failures: bigint;
|
|
7529
|
+
|
|
7530
|
+
run() {}
|
|
7531
|
+
}
|
|
7532
|
+
|
|
7533
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
7534
|
+
//=> {run: () => void}
|
|
7535
|
+
```
|
|
7536
|
+
|
|
7537
|
+
@example
|
|
7538
|
+
```
|
|
7539
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
7540
|
+
|
|
7541
|
+
interface Example {
|
|
7542
|
+
a: string;
|
|
7543
|
+
b: string | number;
|
|
7544
|
+
c: () => void;
|
|
7545
|
+
d: {};
|
|
7546
|
+
}
|
|
7547
|
+
|
|
7548
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
7549
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
7550
|
+
```
|
|
7551
|
+
|
|
7552
|
+
@category Object
|
|
7553
|
+
*/
|
|
7554
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
7555
|
+
Base,
|
|
7556
|
+
ConditionalKeys$1<Base, Condition>
|
|
7557
|
+
>;
|
|
7558
|
+
|
|
7559
|
+
/**
|
|
7560
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
7561
|
+
* can either be a REST module or a host module.
|
|
7562
|
+
* This type is recursive, so it can describe nested modules.
|
|
7563
|
+
*/
|
|
7564
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$3<any> | ServicePluginDefinition$1<any> | {
|
|
7565
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
7566
|
+
};
|
|
7567
|
+
/**
|
|
7568
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
7569
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
7570
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
7571
|
+
* do not match the given host (as they will not work with the given host).
|
|
7572
|
+
*/
|
|
7573
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
7574
|
+
done: T;
|
|
7575
|
+
recurse: T extends {
|
|
7576
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
7577
|
+
} ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
|
|
7578
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
7579
|
+
-1,
|
|
7580
|
+
0,
|
|
7581
|
+
1,
|
|
7582
|
+
2,
|
|
7583
|
+
3,
|
|
7584
|
+
4,
|
|
7585
|
+
5
|
|
7586
|
+
][Depth]> : never;
|
|
7587
|
+
}, EmptyObject$1>;
|
|
7588
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
7589
|
+
type PublicMetadata$1 = {
|
|
7590
|
+
PACKAGE_NAME?: string;
|
|
7591
|
+
};
|
|
7592
|
+
|
|
7593
|
+
declare global {
|
|
7594
|
+
interface ContextualClient {
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
/**
|
|
7598
|
+
* A type used to create concerete types from SDK descriptors in
|
|
7599
|
+
* case a contextual client is available.
|
|
7600
|
+
*/
|
|
7601
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
7602
|
+
host: Host$1;
|
|
7603
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
7604
|
+
|
|
4559
7605
|
/**
|
|
4560
7606
|
* >**Notes:**
|
|
4561
7607
|
* > + Site owners may set that members are not permitted to create groups in the Wix Groups application settings.
|
|
@@ -5214,15 +8260,33 @@ interface QueryCreateRequestsSignature {
|
|
|
5214
8260
|
*/
|
|
5215
8261
|
(options?: QueryCreateRequestsOptions | undefined): Promise<QueryCreateRequestsResponse & QueryCreateRequestsResponseNonNullableFields>;
|
|
5216
8262
|
}
|
|
5217
|
-
declare const onCreateRequestApproved$1: EventDefinition$
|
|
5218
|
-
declare const onCreateRequestRejected$1: EventDefinition$
|
|
8263
|
+
declare const onCreateRequestApproved$1: EventDefinition$3<CreateRequestApprovedEnvelope, "wix.social_groups.v3.create_request_approved">;
|
|
8264
|
+
declare const onCreateRequestRejected$1: EventDefinition$3<CreateRequestRejectedEnvelope, "wix.social_groups.v3.create_request_rejected">;
|
|
8265
|
+
|
|
8266
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
8267
|
+
__type: 'event-definition';
|
|
8268
|
+
type: Type;
|
|
8269
|
+
isDomainEvent?: boolean;
|
|
8270
|
+
transformations?: (envelope: unknown) => Payload;
|
|
8271
|
+
__payload: Payload;
|
|
8272
|
+
};
|
|
8273
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
8274
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
8275
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
8276
|
+
|
|
8277
|
+
declare global {
|
|
8278
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
8279
|
+
interface SymbolConstructor {
|
|
8280
|
+
readonly observable: symbol;
|
|
8281
|
+
}
|
|
8282
|
+
}
|
|
5219
8283
|
|
|
5220
|
-
declare function createEventModule$1<T extends EventDefinition$
|
|
8284
|
+
declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
5221
8285
|
|
|
5222
|
-
declare const approveCreateRequests: BuildRESTFunction$1<typeof approveCreateRequests$1> & typeof approveCreateRequests$1
|
|
5223
|
-
declare const rejectCreateRequests: BuildRESTFunction$1<typeof rejectCreateRequests$1> & typeof rejectCreateRequests$1
|
|
5224
|
-
declare const listCreateRequests: BuildRESTFunction$1<typeof listCreateRequests$1> & typeof listCreateRequests$1
|
|
5225
|
-
declare const queryCreateRequests: BuildRESTFunction$1<typeof queryCreateRequests$1> & typeof queryCreateRequests$1
|
|
8286
|
+
declare const approveCreateRequests: MaybeContext$1<BuildRESTFunction$1<typeof approveCreateRequests$1> & typeof approveCreateRequests$1>;
|
|
8287
|
+
declare const rejectCreateRequests: MaybeContext$1<BuildRESTFunction$1<typeof rejectCreateRequests$1> & typeof rejectCreateRequests$1>;
|
|
8288
|
+
declare const listCreateRequests: MaybeContext$1<BuildRESTFunction$1<typeof listCreateRequests$1> & typeof listCreateRequests$1>;
|
|
8289
|
+
declare const queryCreateRequests: MaybeContext$1<BuildRESTFunction$1<typeof queryCreateRequests$1> & typeof queryCreateRequests$1>;
|
|
5226
8290
|
|
|
5227
8291
|
type _publicOnCreateRequestApprovedType = typeof onCreateRequestApproved$1;
|
|
5228
8292
|
/**
|
|
@@ -5296,11 +8360,50 @@ declare namespace context$1 {
|
|
|
5296
8360
|
export { type context$1_AccessRestriction as AccessRestriction, type context$1_AccessRestrictionDataOneOf as AccessRestrictionDataOneOf, type ActionEvent$1 as ActionEvent, context$1_AllowPolicy as AllowPolicy, type context$1_ApproveCreateRequestsOptions as ApproveCreateRequestsOptions, type context$1_ApproveCreateRequestsRequest as ApproveCreateRequestsRequest, type context$1_ApproveCreateRequestsResponse as ApproveCreateRequestsResponse, type context$1_ApproveCreateRequestsResponseNonNullableFields as ApproveCreateRequestsResponseNonNullableFields, type BaseEventMetadata$1 as BaseEventMetadata, type context$1_CancelCreateRequestRequest as CancelCreateRequestRequest, type context$1_CancelCreateRequestResponse as CancelCreateRequestResponse, type context$1_CoverImage as CoverImage, type context$1_CreateRequest as CreateRequest, type context$1_CreateRequestApproved as CreateRequestApproved, type context$1_CreateRequestApprovedEnvelope as CreateRequestApprovedEnvelope, type context$1_CreateRequestRejected as CreateRequestRejected, type context$1_CreateRequestRejectedEnvelope as CreateRequestRejectedEnvelope, 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 EventMetadata$1 as EventMetadata, type context$1_Events as Events, type context$1_Group as Group, type context$1_GroupDetails as GroupDetails, type context$1_GroupDetailsPosition as GroupDetailsPosition, type context$1_GroupSettings as GroupSettings, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type context$1_Identity as Identity, context$1_IdentityType as IdentityType, type context$1_Image as Image, ItemsToUpdate$1 as ItemsToUpdate, type context$1_ListCreateRequestsOptions as ListCreateRequestsOptions, type context$1_ListCreateRequestsRequest as ListCreateRequestsRequest, type context$1_ListCreateRequestsResponse as ListCreateRequestsResponse, type context$1_ListCreateRequestsResponseNonNullableFields as ListCreateRequestsResponseNonNullableFields, type context$1_Logo as Logo, type MessageEnvelope$1 as MessageEnvelope, type context$1_OnboardingStepSettings as OnboardingStepSettings, OwnershipFilter$1 as OwnershipFilter, type Paging$1 as Paging, type PagingMetadata$1 as PagingMetadata, type context$1_Position as Position, context$1_PrivacyStatus as PrivacyStatus, type Query$1 as Query, type context$1_QueryCreateRequestsOptions as QueryCreateRequestsOptions, type context$1_QueryCreateRequestsRequest as QueryCreateRequestsRequest, type context$1_QueryCreateRequestsResponse as QueryCreateRequestsResponse, type context$1_QueryCreateRequestsResponseNonNullableFields as QueryCreateRequestsResponseNonNullableFields, type context$1_RejectCreateRequestsOptions as RejectCreateRequestsOptions, type context$1_RejectCreateRequestsRequest as RejectCreateRequestsRequest, type context$1_RejectCreateRequestsResponse as RejectCreateRequestsResponse, type context$1_RejectCreateRequestsResponseNonNullableFields as RejectCreateRequestsResponseNonNullableFields, type Rejection$1 as Rejection, type RequestDetails$1 as RequestDetails, RequestStatus$1 as RequestStatus, type RestoreInfo$1 as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, context$1_StepKey as StepKey, type context$1_SubmitCreateRequestRequest as SubmitCreateRequestRequest, type context$1_SubmitCreateRequestResponse as SubmitCreateRequestResponse, context$1_Type as Type, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnCreateRequestApprovedType as _publicOnCreateRequestApprovedType, type context$1__publicOnCreateRequestRejectedType as _publicOnCreateRequestRejectedType, context$1_approveCreateRequests as approveCreateRequests, context$1_listCreateRequests as listCreateRequests, context$1_onCreateRequestApproved as onCreateRequestApproved, context$1_onCreateRequestRejected as onCreateRequestRejected, onCreateRequestApproved$1 as publicOnCreateRequestApproved, onCreateRequestRejected$1 as publicOnCreateRequestRejected, context$1_queryCreateRequests as queryCreateRequests, context$1_rejectCreateRequests as rejectCreateRequests };
|
|
5297
8361
|
}
|
|
5298
8362
|
|
|
8363
|
+
type HostModule<T, H extends Host> = {
|
|
8364
|
+
__type: 'host';
|
|
8365
|
+
create(host: H): T;
|
|
8366
|
+
};
|
|
8367
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
8368
|
+
type Host<Environment = unknown> = {
|
|
8369
|
+
channel: {
|
|
8370
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
8371
|
+
disconnect: () => void;
|
|
8372
|
+
} | Promise<{
|
|
8373
|
+
disconnect: () => void;
|
|
8374
|
+
}>;
|
|
8375
|
+
};
|
|
8376
|
+
environment?: Environment;
|
|
8377
|
+
/**
|
|
8378
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
8379
|
+
*/
|
|
8380
|
+
apiBaseUrl?: string;
|
|
8381
|
+
/**
|
|
8382
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
8383
|
+
* like internationalization, billing, etc.
|
|
8384
|
+
*/
|
|
8385
|
+
essentials?: {
|
|
8386
|
+
/**
|
|
8387
|
+
* The language of the currently viewed session
|
|
8388
|
+
*/
|
|
8389
|
+
language?: string;
|
|
8390
|
+
/**
|
|
8391
|
+
* The locale of the currently viewed session
|
|
8392
|
+
*/
|
|
8393
|
+
locale?: string;
|
|
8394
|
+
/**
|
|
8395
|
+
* Any headers that should be passed through to the API requests
|
|
8396
|
+
*/
|
|
8397
|
+
passThroughHeaders?: Record<string, string>;
|
|
8398
|
+
};
|
|
8399
|
+
};
|
|
8400
|
+
|
|
5299
8401
|
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
5300
8402
|
interface HttpClient {
|
|
5301
8403
|
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
5302
8404
|
fetchWithAuth: typeof fetch;
|
|
5303
8405
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
8406
|
+
getActiveToken?: () => string | undefined;
|
|
5304
8407
|
}
|
|
5305
8408
|
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
5306
8409
|
type HttpResponse<T = any> = {
|
|
@@ -5322,16 +8425,65 @@ type APIMetadata = {
|
|
|
5322
8425
|
packageName?: string;
|
|
5323
8426
|
};
|
|
5324
8427
|
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
5325
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
8428
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
5326
8429
|
__type: 'event-definition';
|
|
5327
8430
|
type: Type;
|
|
5328
8431
|
isDomainEvent?: boolean;
|
|
5329
8432
|
transformations?: (envelope: unknown) => Payload;
|
|
5330
8433
|
__payload: Payload;
|
|
5331
8434
|
};
|
|
5332
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
5333
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
5334
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
8435
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
8436
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
8437
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
8438
|
+
|
|
8439
|
+
type ServicePluginMethodInput = {
|
|
8440
|
+
request: any;
|
|
8441
|
+
metadata: any;
|
|
8442
|
+
};
|
|
8443
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
8444
|
+
type ServicePluginMethodMetadata = {
|
|
8445
|
+
name: string;
|
|
8446
|
+
primaryHttpMappingPath: string;
|
|
8447
|
+
transformations: {
|
|
8448
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
8449
|
+
toREST: (...args: unknown[]) => unknown;
|
|
8450
|
+
};
|
|
8451
|
+
};
|
|
8452
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
8453
|
+
__type: 'service-plugin-definition';
|
|
8454
|
+
componentType: string;
|
|
8455
|
+
methods: ServicePluginMethodMetadata[];
|
|
8456
|
+
__contract: Contract;
|
|
8457
|
+
};
|
|
8458
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
8459
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
8460
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
8461
|
+
|
|
8462
|
+
type RequestContext = {
|
|
8463
|
+
isSSR: boolean;
|
|
8464
|
+
host: string;
|
|
8465
|
+
protocol?: string;
|
|
8466
|
+
};
|
|
8467
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
8468
|
+
/**
|
|
8469
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
8470
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
8471
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
8472
|
+
*/
|
|
8473
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
8474
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
8475
|
+
_?: T;
|
|
8476
|
+
url?: string;
|
|
8477
|
+
method?: Method;
|
|
8478
|
+
params?: any;
|
|
8479
|
+
data?: any;
|
|
8480
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
8481
|
+
};
|
|
8482
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
8483
|
+
__isAmbassador: boolean;
|
|
8484
|
+
};
|
|
8485
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
8486
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
5335
8487
|
|
|
5336
8488
|
declare global {
|
|
5337
8489
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -5340,6 +8492,284 @@ declare global {
|
|
|
5340
8492
|
}
|
|
5341
8493
|
}
|
|
5342
8494
|
|
|
8495
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
8496
|
+
|
|
8497
|
+
/**
|
|
8498
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
8499
|
+
|
|
8500
|
+
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)).
|
|
8501
|
+
|
|
8502
|
+
@example
|
|
8503
|
+
```
|
|
8504
|
+
import type {EmptyObject} from 'type-fest';
|
|
8505
|
+
|
|
8506
|
+
// The following illustrates the problem with `{}`.
|
|
8507
|
+
const foo1: {} = {}; // Pass
|
|
8508
|
+
const foo2: {} = []; // Pass
|
|
8509
|
+
const foo3: {} = 42; // Pass
|
|
8510
|
+
const foo4: {} = {a: 1}; // Pass
|
|
8511
|
+
|
|
8512
|
+
// With `EmptyObject` only the first case is valid.
|
|
8513
|
+
const bar1: EmptyObject = {}; // Pass
|
|
8514
|
+
const bar2: EmptyObject = 42; // Fail
|
|
8515
|
+
const bar3: EmptyObject = []; // Fail
|
|
8516
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
8517
|
+
```
|
|
8518
|
+
|
|
8519
|
+
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}.
|
|
8520
|
+
|
|
8521
|
+
@category Object
|
|
8522
|
+
*/
|
|
8523
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
8524
|
+
|
|
8525
|
+
/**
|
|
8526
|
+
Returns a boolean for whether the two given types are equal.
|
|
8527
|
+
|
|
8528
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
8529
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
8530
|
+
|
|
8531
|
+
Use-cases:
|
|
8532
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
8533
|
+
|
|
8534
|
+
@example
|
|
8535
|
+
```
|
|
8536
|
+
import type {IsEqual} from 'type-fest';
|
|
8537
|
+
|
|
8538
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
8539
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
8540
|
+
type Includes<Value extends readonly any[], Item> =
|
|
8541
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
8542
|
+
? IsEqual<Value[0], Item> extends true
|
|
8543
|
+
? true
|
|
8544
|
+
: Includes<rest, Item>
|
|
8545
|
+
: false;
|
|
8546
|
+
```
|
|
8547
|
+
|
|
8548
|
+
@category Type Guard
|
|
8549
|
+
@category Utilities
|
|
8550
|
+
*/
|
|
8551
|
+
type IsEqual<A, B> =
|
|
8552
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
8553
|
+
(<G>() => G extends B ? 1 : 2)
|
|
8554
|
+
? true
|
|
8555
|
+
: false;
|
|
8556
|
+
|
|
8557
|
+
/**
|
|
8558
|
+
Filter out keys from an object.
|
|
8559
|
+
|
|
8560
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
8561
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
8562
|
+
Returns `Key` otherwise.
|
|
8563
|
+
|
|
8564
|
+
@example
|
|
8565
|
+
```
|
|
8566
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
8567
|
+
//=> never
|
|
8568
|
+
```
|
|
8569
|
+
|
|
8570
|
+
@example
|
|
8571
|
+
```
|
|
8572
|
+
type Filtered = Filter<'bar', string>;
|
|
8573
|
+
//=> never
|
|
8574
|
+
```
|
|
8575
|
+
|
|
8576
|
+
@example
|
|
8577
|
+
```
|
|
8578
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
8579
|
+
//=> 'bar'
|
|
8580
|
+
```
|
|
8581
|
+
|
|
8582
|
+
@see {Except}
|
|
8583
|
+
*/
|
|
8584
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
8585
|
+
|
|
8586
|
+
type ExceptOptions = {
|
|
8587
|
+
/**
|
|
8588
|
+
Disallow assigning non-specified properties.
|
|
8589
|
+
|
|
8590
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
8591
|
+
|
|
8592
|
+
@default false
|
|
8593
|
+
*/
|
|
8594
|
+
requireExactProps?: boolean;
|
|
8595
|
+
};
|
|
8596
|
+
|
|
8597
|
+
/**
|
|
8598
|
+
Create a type from an object type without certain keys.
|
|
8599
|
+
|
|
8600
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
8601
|
+
|
|
8602
|
+
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.
|
|
8603
|
+
|
|
8604
|
+
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)).
|
|
8605
|
+
|
|
8606
|
+
@example
|
|
8607
|
+
```
|
|
8608
|
+
import type {Except} from 'type-fest';
|
|
8609
|
+
|
|
8610
|
+
type Foo = {
|
|
8611
|
+
a: number;
|
|
8612
|
+
b: string;
|
|
8613
|
+
};
|
|
8614
|
+
|
|
8615
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
8616
|
+
//=> {b: string}
|
|
8617
|
+
|
|
8618
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
8619
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
8620
|
+
|
|
8621
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
8622
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
8623
|
+
|
|
8624
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
8625
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
8626
|
+
```
|
|
8627
|
+
|
|
8628
|
+
@category Object
|
|
8629
|
+
*/
|
|
8630
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
8631
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
8632
|
+
} & (Options['requireExactProps'] extends true
|
|
8633
|
+
? Partial<Record<KeysType, never>>
|
|
8634
|
+
: {});
|
|
8635
|
+
|
|
8636
|
+
/**
|
|
8637
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
8638
|
+
|
|
8639
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
8640
|
+
|
|
8641
|
+
@example
|
|
8642
|
+
```
|
|
8643
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
8644
|
+
|
|
8645
|
+
interface Example {
|
|
8646
|
+
a: string;
|
|
8647
|
+
b: string | number;
|
|
8648
|
+
c?: string;
|
|
8649
|
+
d: {};
|
|
8650
|
+
}
|
|
8651
|
+
|
|
8652
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
8653
|
+
//=> 'a'
|
|
8654
|
+
```
|
|
8655
|
+
|
|
8656
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
8657
|
+
|
|
8658
|
+
@example
|
|
8659
|
+
```
|
|
8660
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
8661
|
+
|
|
8662
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
8663
|
+
//=> 'a' | 'c'
|
|
8664
|
+
```
|
|
8665
|
+
|
|
8666
|
+
@category Object
|
|
8667
|
+
*/
|
|
8668
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
8669
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
8670
|
+
{
|
|
8671
|
+
// Map through all the keys of the given base type.
|
|
8672
|
+
[Key in keyof Base]:
|
|
8673
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
8674
|
+
Base[Key] extends Condition
|
|
8675
|
+
// Retain this key since the condition passes.
|
|
8676
|
+
? Key
|
|
8677
|
+
// Discard this key since the condition fails.
|
|
8678
|
+
: never;
|
|
8679
|
+
|
|
8680
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
8681
|
+
}[keyof Base]
|
|
8682
|
+
>;
|
|
8683
|
+
|
|
8684
|
+
/**
|
|
8685
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
8686
|
+
|
|
8687
|
+
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.
|
|
8688
|
+
|
|
8689
|
+
@example
|
|
8690
|
+
```
|
|
8691
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
8692
|
+
|
|
8693
|
+
class Awesome {
|
|
8694
|
+
name: string;
|
|
8695
|
+
successes: number;
|
|
8696
|
+
failures: bigint;
|
|
8697
|
+
|
|
8698
|
+
run() {}
|
|
8699
|
+
}
|
|
8700
|
+
|
|
8701
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
8702
|
+
//=> {run: () => void}
|
|
8703
|
+
```
|
|
8704
|
+
|
|
8705
|
+
@example
|
|
8706
|
+
```
|
|
8707
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
8708
|
+
|
|
8709
|
+
interface Example {
|
|
8710
|
+
a: string;
|
|
8711
|
+
b: string | number;
|
|
8712
|
+
c: () => void;
|
|
8713
|
+
d: {};
|
|
8714
|
+
}
|
|
8715
|
+
|
|
8716
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
8717
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
8718
|
+
```
|
|
8719
|
+
|
|
8720
|
+
@category Object
|
|
8721
|
+
*/
|
|
8722
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
8723
|
+
Base,
|
|
8724
|
+
ConditionalKeys<Base, Condition>
|
|
8725
|
+
>;
|
|
8726
|
+
|
|
8727
|
+
/**
|
|
8728
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
8729
|
+
* can either be a REST module or a host module.
|
|
8730
|
+
* This type is recursive, so it can describe nested modules.
|
|
8731
|
+
*/
|
|
8732
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
8733
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
8734
|
+
};
|
|
8735
|
+
/**
|
|
8736
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
8737
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
8738
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
8739
|
+
* do not match the given host (as they will not work with the given host).
|
|
8740
|
+
*/
|
|
8741
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
8742
|
+
done: T;
|
|
8743
|
+
recurse: T extends {
|
|
8744
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
8745
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
8746
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
8747
|
+
-1,
|
|
8748
|
+
0,
|
|
8749
|
+
1,
|
|
8750
|
+
2,
|
|
8751
|
+
3,
|
|
8752
|
+
4,
|
|
8753
|
+
5
|
|
8754
|
+
][Depth]> : never;
|
|
8755
|
+
}, EmptyObject>;
|
|
8756
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
8757
|
+
type PublicMetadata = {
|
|
8758
|
+
PACKAGE_NAME?: string;
|
|
8759
|
+
};
|
|
8760
|
+
|
|
8761
|
+
declare global {
|
|
8762
|
+
interface ContextualClient {
|
|
8763
|
+
}
|
|
8764
|
+
}
|
|
8765
|
+
/**
|
|
8766
|
+
* A type used to create concerete types from SDK descriptors in
|
|
8767
|
+
* case a contextual client is available.
|
|
8768
|
+
*/
|
|
8769
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
8770
|
+
host: Host;
|
|
8771
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
8772
|
+
|
|
5343
8773
|
/**
|
|
5344
8774
|
* To join a private group, a site member must submit a Join Request, which can be approved or rejected by an admin.
|
|
5345
8775
|
* When the request is approved, the site member becomes a group member.
|
|
@@ -5765,15 +9195,33 @@ interface QueryJoinRequestsSignature {
|
|
|
5765
9195
|
*/
|
|
5766
9196
|
(groupId: string, options?: QueryJoinRequestsOptions | undefined): Promise<QueryJoinRequestsResponse & QueryJoinRequestsResponseNonNullableFields>;
|
|
5767
9197
|
}
|
|
5768
|
-
declare const onJoinRequestApproved$1: EventDefinition<JoinRequestApprovedEnvelope, "wix.social_groups.v3.join_request_approved">;
|
|
5769
|
-
declare const onJoinRequestRejected$1: EventDefinition<JoinRequestRejectedEnvelope, "wix.social_groups.v3.join_request_rejected">;
|
|
9198
|
+
declare const onJoinRequestApproved$1: EventDefinition$1<JoinRequestApprovedEnvelope, "wix.social_groups.v3.join_request_approved">;
|
|
9199
|
+
declare const onJoinRequestRejected$1: EventDefinition$1<JoinRequestRejectedEnvelope, "wix.social_groups.v3.join_request_rejected">;
|
|
9200
|
+
|
|
9201
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
9202
|
+
__type: 'event-definition';
|
|
9203
|
+
type: Type;
|
|
9204
|
+
isDomainEvent?: boolean;
|
|
9205
|
+
transformations?: (envelope: unknown) => Payload;
|
|
9206
|
+
__payload: Payload;
|
|
9207
|
+
};
|
|
9208
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
9209
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
9210
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
9211
|
+
|
|
9212
|
+
declare global {
|
|
9213
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
9214
|
+
interface SymbolConstructor {
|
|
9215
|
+
readonly observable: symbol;
|
|
9216
|
+
}
|
|
9217
|
+
}
|
|
5770
9218
|
|
|
5771
9219
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
5772
9220
|
|
|
5773
|
-
declare const approveJoinRequests: BuildRESTFunction<typeof approveJoinRequests$1> & typeof approveJoinRequests$1
|
|
5774
|
-
declare const rejectJoinRequests: BuildRESTFunction<typeof rejectJoinRequests$1> & typeof rejectJoinRequests$1
|
|
5775
|
-
declare const listJoinRequests: BuildRESTFunction<typeof listJoinRequests$1> & typeof listJoinRequests$1
|
|
5776
|
-
declare const queryJoinRequests: BuildRESTFunction<typeof queryJoinRequests$1> & typeof queryJoinRequests$1
|
|
9221
|
+
declare const approveJoinRequests: MaybeContext<BuildRESTFunction<typeof approveJoinRequests$1> & typeof approveJoinRequests$1>;
|
|
9222
|
+
declare const rejectJoinRequests: MaybeContext<BuildRESTFunction<typeof rejectJoinRequests$1> & typeof rejectJoinRequests$1>;
|
|
9223
|
+
declare const listJoinRequests: MaybeContext<BuildRESTFunction<typeof listJoinRequests$1> & typeof listJoinRequests$1>;
|
|
9224
|
+
declare const queryJoinRequests: MaybeContext<BuildRESTFunction<typeof queryJoinRequests$1> & typeof queryJoinRequests$1>;
|
|
5777
9225
|
|
|
5778
9226
|
type _publicOnJoinRequestApprovedType = typeof onJoinRequestApproved$1;
|
|
5779
9227
|
/**
|