@wix/seatings 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/type-bundles/context.bundle.d.ts +493 -83
- package/type-bundles/index.bundle.d.ts +493 -83
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type HostModule<T, H extends Host> = {
|
|
1
|
+
type HostModule$1<T, H extends Host$1> = {
|
|
2
2
|
__type: 'host';
|
|
3
3
|
create(host: H): T;
|
|
4
4
|
};
|
|
5
|
-
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
-
type Host<Environment = unknown> = {
|
|
5
|
+
type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
|
|
6
|
+
type Host$1<Environment = unknown> = {
|
|
7
7
|
channel: {
|
|
8
8
|
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
9
|
disconnect: () => void;
|
|
@@ -36,92 +36,92 @@ type Host<Environment = unknown> = {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
40
|
-
interface HttpClient {
|
|
41
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
39
|
+
type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
|
|
40
|
+
interface HttpClient$1 {
|
|
41
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
|
|
42
42
|
fetchWithAuth: typeof fetch;
|
|
43
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
44
|
getActiveToken?: () => string | undefined;
|
|
45
45
|
}
|
|
46
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
47
|
-
type HttpResponse<T = any> = {
|
|
46
|
+
type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
|
|
47
|
+
type HttpResponse$1<T = any> = {
|
|
48
48
|
data: T;
|
|
49
49
|
status: number;
|
|
50
50
|
statusText: string;
|
|
51
51
|
headers: any;
|
|
52
52
|
request?: any;
|
|
53
53
|
};
|
|
54
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
54
|
+
type RequestOptions$1<_TResponse = any, Data = any> = {
|
|
55
55
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
56
56
|
url: string;
|
|
57
57
|
data?: Data;
|
|
58
58
|
params?: URLSearchParams;
|
|
59
|
-
} & APIMetadata;
|
|
60
|
-
type APIMetadata = {
|
|
59
|
+
} & APIMetadata$1;
|
|
60
|
+
type APIMetadata$1 = {
|
|
61
61
|
methodFqn?: string;
|
|
62
62
|
entityFqdn?: string;
|
|
63
63
|
packageName?: string;
|
|
64
64
|
};
|
|
65
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
-
type EventDefinition$
|
|
65
|
+
type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
|
|
66
|
+
type EventDefinition$3<Payload = unknown, Type extends string = string> = {
|
|
67
67
|
__type: 'event-definition';
|
|
68
68
|
type: Type;
|
|
69
69
|
isDomainEvent?: boolean;
|
|
70
70
|
transformations?: (envelope: unknown) => Payload;
|
|
71
71
|
__payload: Payload;
|
|
72
72
|
};
|
|
73
|
-
declare function EventDefinition$
|
|
74
|
-
type EventHandler$
|
|
75
|
-
type BuildEventDefinition$
|
|
73
|
+
declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
|
|
74
|
+
type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
|
|
76
76
|
|
|
77
|
-
type ServicePluginMethodInput = {
|
|
77
|
+
type ServicePluginMethodInput$1 = {
|
|
78
78
|
request: any;
|
|
79
79
|
metadata: any;
|
|
80
80
|
};
|
|
81
|
-
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
82
|
-
type ServicePluginMethodMetadata = {
|
|
81
|
+
type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata$1 = {
|
|
83
83
|
name: string;
|
|
84
84
|
primaryHttpMappingPath: string;
|
|
85
85
|
transformations: {
|
|
86
|
-
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
|
|
87
87
|
toREST: (...args: unknown[]) => unknown;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
90
|
+
type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
|
|
91
91
|
__type: 'service-plugin-definition';
|
|
92
92
|
componentType: string;
|
|
93
|
-
methods: ServicePluginMethodMetadata[];
|
|
93
|
+
methods: ServicePluginMethodMetadata$1[];
|
|
94
94
|
__contract: Contract;
|
|
95
95
|
};
|
|
96
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
97
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
98
|
-
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
96
|
+
declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
|
|
99
99
|
|
|
100
|
-
type RequestContext = {
|
|
100
|
+
type RequestContext$1 = {
|
|
101
101
|
isSSR: boolean;
|
|
102
102
|
host: string;
|
|
103
103
|
protocol?: string;
|
|
104
104
|
};
|
|
105
|
-
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
105
|
+
type ResponseTransformer$1 = (data: any, headers?: any) => any;
|
|
106
106
|
/**
|
|
107
107
|
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
108
|
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
109
|
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
110
|
*/
|
|
111
|
-
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
-
type AmbassadorRequestOptions<T = any> = {
|
|
111
|
+
type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions$1<T = any> = {
|
|
113
113
|
_?: T;
|
|
114
114
|
url?: string;
|
|
115
|
-
method?: Method;
|
|
115
|
+
method?: Method$1;
|
|
116
116
|
params?: any;
|
|
117
117
|
data?: any;
|
|
118
|
-
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
118
|
+
transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
|
|
119
119
|
};
|
|
120
|
-
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
120
|
+
type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
|
|
121
121
|
__isAmbassador: boolean;
|
|
122
122
|
};
|
|
123
|
-
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
124
|
-
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
123
|
+
type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
125
125
|
|
|
126
126
|
declare global {
|
|
127
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -130,7 +130,7 @@ declare global {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
declare const emptyObjectSymbol: unique symbol;
|
|
133
|
+
declare const emptyObjectSymbol$1: unique symbol;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
Represents a strictly empty plain object, the `{}` value.
|
|
@@ -158,7 +158,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
|
|
|
158
158
|
|
|
159
159
|
@category Object
|
|
160
160
|
*/
|
|
161
|
-
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
161
|
+
type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
Returns a boolean for whether the two given types are equal.
|
|
@@ -186,7 +186,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
186
186
|
@category Type Guard
|
|
187
187
|
@category Utilities
|
|
188
188
|
*/
|
|
189
|
-
type IsEqual<A, B> =
|
|
189
|
+
type IsEqual$1<A, B> =
|
|
190
190
|
(<G>() => G extends A ? 1 : 2) extends
|
|
191
191
|
(<G>() => G extends B ? 1 : 2)
|
|
192
192
|
? true
|
|
@@ -219,9 +219,9 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
219
219
|
|
|
220
220
|
@see {Except}
|
|
221
221
|
*/
|
|
222
|
-
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
222
|
+
type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
223
|
|
|
224
|
-
type ExceptOptions = {
|
|
224
|
+
type ExceptOptions$1 = {
|
|
225
225
|
/**
|
|
226
226
|
Disallow assigning non-specified properties.
|
|
227
227
|
|
|
@@ -265,8 +265,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
|
265
265
|
|
|
266
266
|
@category Object
|
|
267
267
|
*/
|
|
268
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
269
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
268
|
+
type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
270
|
} & (Options['requireExactProps'] extends true
|
|
271
271
|
? Partial<Record<KeysType, never>>
|
|
272
272
|
: {});
|
|
@@ -303,7 +303,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
|
303
303
|
|
|
304
304
|
@category Object
|
|
305
305
|
*/
|
|
306
|
-
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
306
|
+
type ConditionalKeys$1<Base, Condition> = NonNullable<
|
|
307
307
|
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
308
|
{
|
|
309
309
|
// Map through all the keys of the given base type.
|
|
@@ -357,9 +357,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
|
357
357
|
|
|
358
358
|
@category Object
|
|
359
359
|
*/
|
|
360
|
-
type ConditionalExcept<Base, Condition> = Except<
|
|
360
|
+
type ConditionalExcept$1<Base, Condition> = Except$1<
|
|
361
361
|
Base,
|
|
362
|
-
ConditionalKeys<Base, Condition>
|
|
362
|
+
ConditionalKeys$1<Base, Condition>
|
|
363
363
|
>;
|
|
364
364
|
|
|
365
365
|
/**
|
|
@@ -367,8 +367,8 @@ ConditionalKeys<Base, Condition>
|
|
|
367
367
|
* can either be a REST module or a host module.
|
|
368
368
|
* This type is recursive, so it can describe nested modules.
|
|
369
369
|
*/
|
|
370
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$
|
|
371
|
-
[key: string]: Descriptors | PublicMetadata | any;
|
|
370
|
+
type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$3<any> | ServicePluginDefinition$1<any> | {
|
|
371
|
+
[key: string]: Descriptors$1 | PublicMetadata$1 | any;
|
|
372
372
|
};
|
|
373
373
|
/**
|
|
374
374
|
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
@@ -376,12 +376,12 @@ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostM
|
|
|
376
376
|
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
377
|
* do not match the given host (as they will not work with the given host).
|
|
378
378
|
*/
|
|
379
|
-
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
379
|
+
type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
|
|
380
380
|
done: T;
|
|
381
381
|
recurse: T extends {
|
|
382
|
-
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$
|
|
384
|
-
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
|
|
383
|
+
} ? 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<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
|
|
385
385
|
-1,
|
|
386
386
|
0,
|
|
387
387
|
1,
|
|
@@ -390,9 +390,9 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
|
|
|
390
390
|
4,
|
|
391
391
|
5
|
|
392
392
|
][Depth]> : never;
|
|
393
|
-
}, EmptyObject>;
|
|
393
|
+
}, EmptyObject$1>;
|
|
394
394
|
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
-
type PublicMetadata = {
|
|
395
|
+
type PublicMetadata$1 = {
|
|
396
396
|
PACKAGE_NAME?: string;
|
|
397
397
|
};
|
|
398
398
|
|
|
@@ -404,9 +404,9 @@ declare global {
|
|
|
404
404
|
* A type used to create concerete types from SDK descriptors in
|
|
405
405
|
* case a contextual client is available.
|
|
406
406
|
*/
|
|
407
|
-
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
408
|
-
host: Host;
|
|
409
|
-
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
407
|
+
type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host$1;
|
|
409
|
+
} ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
|
|
410
410
|
|
|
411
411
|
interface SeatingPlan$1 {
|
|
412
412
|
/**
|
|
@@ -1337,7 +1337,7 @@ interface FindSeatingPlanOptions {
|
|
|
1337
1337
|
seatingPlanMask?: SeatingPlanMask;
|
|
1338
1338
|
}
|
|
1339
1339
|
|
|
1340
|
-
declare function createSeatingPlan$1(httpClient: HttpClient): CreateSeatingPlanSignature;
|
|
1340
|
+
declare function createSeatingPlan$1(httpClient: HttpClient$1): CreateSeatingPlanSignature;
|
|
1341
1341
|
interface CreateSeatingPlanSignature {
|
|
1342
1342
|
/**
|
|
1343
1343
|
* Crates a seating plan
|
|
@@ -1346,7 +1346,7 @@ interface CreateSeatingPlanSignature {
|
|
|
1346
1346
|
*/
|
|
1347
1347
|
(plan: SeatingPlan$1): Promise<SeatingPlan$1 & SeatingPlanNonNullableFields$1>;
|
|
1348
1348
|
}
|
|
1349
|
-
declare function updateSeatingPlan$1(httpClient: HttpClient): UpdateSeatingPlanSignature;
|
|
1349
|
+
declare function updateSeatingPlan$1(httpClient: HttpClient$1): UpdateSeatingPlanSignature;
|
|
1350
1350
|
interface UpdateSeatingPlanSignature {
|
|
1351
1351
|
/**
|
|
1352
1352
|
* Updates the seating plan
|
|
@@ -1354,7 +1354,7 @@ interface UpdateSeatingPlanSignature {
|
|
|
1354
1354
|
*/
|
|
1355
1355
|
(options?: UpdateSeatingPlanOptions | undefined): Promise<SeatingPlan$1 & SeatingPlanNonNullableFields$1>;
|
|
1356
1356
|
}
|
|
1357
|
-
declare function copySeatingPlan$1(httpClient: HttpClient): CopySeatingPlanSignature;
|
|
1357
|
+
declare function copySeatingPlan$1(httpClient: HttpClient$1): CopySeatingPlanSignature;
|
|
1358
1358
|
interface CopySeatingPlanSignature {
|
|
1359
1359
|
/**
|
|
1360
1360
|
* Copies the seating plan
|
|
@@ -1362,14 +1362,14 @@ interface CopySeatingPlanSignature {
|
|
|
1362
1362
|
*/
|
|
1363
1363
|
(_id: string | null, options: CopySeatingPlanOptions): Promise<CopySeatingPlanResponse & CopySeatingPlanResponseNonNullableFields>;
|
|
1364
1364
|
}
|
|
1365
|
-
declare function querySeatingPlan$1(httpClient: HttpClient): QuerySeatingPlanSignature;
|
|
1365
|
+
declare function querySeatingPlan$1(httpClient: HttpClient$1): QuerySeatingPlanSignature;
|
|
1366
1366
|
interface QuerySeatingPlanSignature {
|
|
1367
1367
|
/**
|
|
1368
1368
|
* Lists seating plans by provided query request
|
|
1369
1369
|
*/
|
|
1370
1370
|
(options?: QuerySeatingPlanOptions | undefined): PlansQueryBuilder;
|
|
1371
1371
|
}
|
|
1372
|
-
declare function getSeatingPlan$1(httpClient: HttpClient): GetSeatingPlanSignature;
|
|
1372
|
+
declare function getSeatingPlan$1(httpClient: HttpClient$1): GetSeatingPlanSignature;
|
|
1373
1373
|
interface GetSeatingPlanSignature {
|
|
1374
1374
|
/**
|
|
1375
1375
|
* Returns the seating plan. Fails of not fond.
|
|
@@ -1378,7 +1378,7 @@ interface GetSeatingPlanSignature {
|
|
|
1378
1378
|
*/
|
|
1379
1379
|
(_id: string | null, options?: GetSeatingPlanOptions | undefined): Promise<SeatingPlan$1 & SeatingPlanNonNullableFields$1>;
|
|
1380
1380
|
}
|
|
1381
|
-
declare function findSeatingPlan$1(httpClient: HttpClient): FindSeatingPlanSignature;
|
|
1381
|
+
declare function findSeatingPlan$1(httpClient: HttpClient$1): FindSeatingPlanSignature;
|
|
1382
1382
|
interface FindSeatingPlanSignature {
|
|
1383
1383
|
/**
|
|
1384
1384
|
* Returns the first seating plan found by filter request.
|
|
@@ -1386,7 +1386,7 @@ interface FindSeatingPlanSignature {
|
|
|
1386
1386
|
*/
|
|
1387
1387
|
(filter: Record<string, any> | null, options?: FindSeatingPlanOptions | undefined): Promise<FindSeatingPlanResponse & FindSeatingPlanResponseNonNullableFields>;
|
|
1388
1388
|
}
|
|
1389
|
-
declare function deleteSeatingPlan$1(httpClient: HttpClient): DeleteSeatingPlanSignature;
|
|
1389
|
+
declare function deleteSeatingPlan$1(httpClient: HttpClient$1): DeleteSeatingPlanSignature;
|
|
1390
1390
|
interface DeleteSeatingPlanSignature {
|
|
1391
1391
|
/**
|
|
1392
1392
|
* Deletes the seating plan.
|
|
@@ -1394,34 +1394,34 @@ interface DeleteSeatingPlanSignature {
|
|
|
1394
1394
|
*/
|
|
1395
1395
|
(_id: string | null): Promise<DeleteSeatingPlanResponse & DeleteSeatingPlanResponseNonNullableFields>;
|
|
1396
1396
|
}
|
|
1397
|
-
declare function updateSeatingPlanThumbnail$1(httpClient: HttpClient): UpdateSeatingPlanThumbnailSignature;
|
|
1397
|
+
declare function updateSeatingPlanThumbnail$1(httpClient: HttpClient$1): UpdateSeatingPlanThumbnailSignature;
|
|
1398
1398
|
interface UpdateSeatingPlanThumbnailSignature {
|
|
1399
1399
|
/**
|
|
1400
1400
|
* Updates seating plan thumbnail.
|
|
1401
1401
|
*/
|
|
1402
1402
|
(thumbnail: SeatingPlanThumbnail): Promise<UpdateSeatingPlanThumbnailResponse>;
|
|
1403
1403
|
}
|
|
1404
|
-
declare function getSeatingPlanThumbnail$1(httpClient: HttpClient): GetSeatingPlanThumbnailSignature;
|
|
1404
|
+
declare function getSeatingPlanThumbnail$1(httpClient: HttpClient$1): GetSeatingPlanThumbnailSignature;
|
|
1405
1405
|
interface GetSeatingPlanThumbnailSignature {
|
|
1406
1406
|
/**
|
|
1407
1407
|
* Get seating plan thumbnail.
|
|
1408
1408
|
*/
|
|
1409
1409
|
(_id: string | null): Promise<GetSeatingPlanThumbnailResponse>;
|
|
1410
1410
|
}
|
|
1411
|
-
declare const onSeatingPlanCreated$1: EventDefinition$
|
|
1412
|
-
declare const onSeatingPlanUpdated$1: EventDefinition$
|
|
1413
|
-
declare const onSeatingPlanDeleted$1: EventDefinition$
|
|
1411
|
+
declare const onSeatingPlanCreated$1: EventDefinition$3<SeatingPlanCreatedEnvelope, "wix.seating.v1.seating_plan_created">;
|
|
1412
|
+
declare const onSeatingPlanUpdated$1: EventDefinition$3<SeatingPlanUpdatedEnvelope, "wix.seating.v1.seating_plan_updated">;
|
|
1413
|
+
declare const onSeatingPlanDeleted$1: EventDefinition$3<SeatingPlanDeletedEnvelope, "wix.seating.v1.seating_plan_deleted">;
|
|
1414
1414
|
|
|
1415
|
-
type EventDefinition$
|
|
1415
|
+
type EventDefinition$2<Payload = unknown, Type extends string = string> = {
|
|
1416
1416
|
__type: 'event-definition';
|
|
1417
1417
|
type: Type;
|
|
1418
1418
|
isDomainEvent?: boolean;
|
|
1419
1419
|
transformations?: (envelope: unknown) => Payload;
|
|
1420
1420
|
__payload: Payload;
|
|
1421
1421
|
};
|
|
1422
|
-
declare function EventDefinition$
|
|
1423
|
-
type EventHandler$
|
|
1424
|
-
type BuildEventDefinition$
|
|
1422
|
+
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
1423
|
+
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
1424
|
+
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
1425
1425
|
|
|
1426
1426
|
declare global {
|
|
1427
1427
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -1430,17 +1430,17 @@ declare global {
|
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
1433
|
-
declare function createEventModule$1<T extends EventDefinition$
|
|
1433
|
+
declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
1434
1434
|
|
|
1435
|
-
declare const createSeatingPlan: MaybeContext<BuildRESTFunction<typeof createSeatingPlan$1> & typeof createSeatingPlan$1>;
|
|
1436
|
-
declare const updateSeatingPlan: MaybeContext<BuildRESTFunction<typeof updateSeatingPlan$1> & typeof updateSeatingPlan$1>;
|
|
1437
|
-
declare const copySeatingPlan: MaybeContext<BuildRESTFunction<typeof copySeatingPlan$1> & typeof copySeatingPlan$1>;
|
|
1438
|
-
declare const querySeatingPlan: MaybeContext<BuildRESTFunction<typeof querySeatingPlan$1> & typeof querySeatingPlan$1>;
|
|
1439
|
-
declare const getSeatingPlan: MaybeContext<BuildRESTFunction<typeof getSeatingPlan$1> & typeof getSeatingPlan$1>;
|
|
1440
|
-
declare const findSeatingPlan: MaybeContext<BuildRESTFunction<typeof findSeatingPlan$1> & typeof findSeatingPlan$1>;
|
|
1441
|
-
declare const deleteSeatingPlan: MaybeContext<BuildRESTFunction<typeof deleteSeatingPlan$1> & typeof deleteSeatingPlan$1>;
|
|
1442
|
-
declare const updateSeatingPlanThumbnail: MaybeContext<BuildRESTFunction<typeof updateSeatingPlanThumbnail$1> & typeof updateSeatingPlanThumbnail$1>;
|
|
1443
|
-
declare const getSeatingPlanThumbnail: MaybeContext<BuildRESTFunction<typeof getSeatingPlanThumbnail$1> & typeof getSeatingPlanThumbnail$1>;
|
|
1435
|
+
declare const createSeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof createSeatingPlan$1> & typeof createSeatingPlan$1>;
|
|
1436
|
+
declare const updateSeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof updateSeatingPlan$1> & typeof updateSeatingPlan$1>;
|
|
1437
|
+
declare const copySeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof copySeatingPlan$1> & typeof copySeatingPlan$1>;
|
|
1438
|
+
declare const querySeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof querySeatingPlan$1> & typeof querySeatingPlan$1>;
|
|
1439
|
+
declare const getSeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof getSeatingPlan$1> & typeof getSeatingPlan$1>;
|
|
1440
|
+
declare const findSeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof findSeatingPlan$1> & typeof findSeatingPlan$1>;
|
|
1441
|
+
declare const deleteSeatingPlan: MaybeContext$1<BuildRESTFunction$1<typeof deleteSeatingPlan$1> & typeof deleteSeatingPlan$1>;
|
|
1442
|
+
declare const updateSeatingPlanThumbnail: MaybeContext$1<BuildRESTFunction$1<typeof updateSeatingPlanThumbnail$1> & typeof updateSeatingPlanThumbnail$1>;
|
|
1443
|
+
declare const getSeatingPlanThumbnail: MaybeContext$1<BuildRESTFunction$1<typeof getSeatingPlanThumbnail$1> & typeof getSeatingPlanThumbnail$1>;
|
|
1444
1444
|
|
|
1445
1445
|
type _publicOnSeatingPlanCreatedType = typeof onSeatingPlanCreated$1;
|
|
1446
1446
|
/** */
|
|
@@ -1521,6 +1521,416 @@ declare namespace index_d$1 {
|
|
|
1521
1521
|
export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$1_CapacityExceededViolation as CapacityExceededViolation, type Category$1 as Category, type index_d$1_CopySeatingPlanOptions as CopySeatingPlanOptions, type index_d$1_CopySeatingPlanRequest as CopySeatingPlanRequest, type index_d$1_CopySeatingPlanResponse as CopySeatingPlanResponse, type index_d$1_CopySeatingPlanResponseNonNullableFields as CopySeatingPlanResponseNonNullableFields, type index_d$1_CreateSeatingPlanRequest as CreateSeatingPlanRequest, type index_d$1_CreateSeatingPlanResponse as CreateSeatingPlanResponse, type index_d$1_CreateSeatingPlanResponseNonNullableFields as CreateSeatingPlanResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type Cursors$1 as Cursors, type index_d$1_DeleteSeatingPlanRequest as DeleteSeatingPlanRequest, type index_d$1_DeleteSeatingPlanResponse as DeleteSeatingPlanResponse, type index_d$1_DeleteSeatingPlanResponseNonNullableFields as DeleteSeatingPlanResponseNonNullableFields, type index_d$1_DiscardSeatingPlanVersionsRequest as DiscardSeatingPlanVersionsRequest, type index_d$1_DiscardSeatingPlanVersionsResponse as DiscardSeatingPlanVersionsResponse, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type Element$1 as Element, type ElementGroup$1 as ElementGroup, type ElementGroupUiProperties$1 as ElementGroupUiProperties, type ElementUiProperties$1 as ElementUiProperties, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type ExtendedFields$1 as ExtendedFields, index_d$1_Fieldset as Fieldset, type index_d$1_FindSeatingPlanOptions as FindSeatingPlanOptions, type index_d$1_FindSeatingPlanRequest as FindSeatingPlanRequest, type index_d$1_FindSeatingPlanResponse as FindSeatingPlanResponse, type index_d$1_FindSeatingPlanResponseNonNullableFields as FindSeatingPlanResponseNonNullableFields, type index_d$1_GetSeatingPlanOptions as GetSeatingPlanOptions, type index_d$1_GetSeatingPlanRequest as GetSeatingPlanRequest, type index_d$1_GetSeatingPlanResponse as GetSeatingPlanResponse, type index_d$1_GetSeatingPlanResponseNonNullableFields as GetSeatingPlanResponseNonNullableFields, type index_d$1_GetSeatingPlanThumbnailRequest as GetSeatingPlanThumbnailRequest, type index_d$1_GetSeatingPlanThumbnailResponse as GetSeatingPlanThumbnailResponse, Icon$1 as Icon, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type Image$1 as Image, type MessageEnvelope$1 as MessageEnvelope, type MultiRowProperties$1 as MultiRowProperties, Numbering$1 as Numbering, type Paging$1 as Paging, type PagingMetadataV2$1 as PagingMetadataV2, type Place$1 as Place, PlaceTypeEnumType$1 as PlaceTypeEnumType, type index_d$1_PlansQueryBuilder as PlansQueryBuilder, type index_d$1_PlansQueryResult as PlansQueryResult, Position$1 as Position, type index_d$1_QuerySeatingPlanOptions as QuerySeatingPlanOptions, type index_d$1_QuerySeatingPlanRequest as QuerySeatingPlanRequest, type index_d$1_QuerySeatingPlanResponse as QuerySeatingPlanResponse, type index_d$1_QuerySeatingPlanResponseNonNullableFields as QuerySeatingPlanResponseNonNullableFields, type index_d$1_QuerySeatingPlanVersionsRequest as QuerySeatingPlanVersionsRequest, type index_d$1_QuerySeatingPlanVersionsResponse as QuerySeatingPlanVersionsResponse, type QueryV2$1 as QueryV2, type QueryV2PagingMethodOneOf$1 as QueryV2PagingMethodOneOf, type ReservationOptions$1 as ReservationOptions, type RestoreInfo$1 as RestoreInfo, type index_d$1_RestoreSeatingPlanRequest as RestoreSeatingPlanRequest, type index_d$1_RestoreSeatingPlanResponse as RestoreSeatingPlanResponse, type RowElement$1 as RowElement, type RowElementUiProperties$1 as RowElementUiProperties, type index_d$1_SaveSeatingPlanVersionRequest as SaveSeatingPlanVersionRequest, type index_d$1_SaveSeatingPlanVersionResponse as SaveSeatingPlanVersionResponse, type SeatingPlan$1 as SeatingPlan, type index_d$1_SeatingPlanCreatedEnvelope as SeatingPlanCreatedEnvelope, type index_d$1_SeatingPlanDeletedEnvelope as SeatingPlanDeletedEnvelope, type index_d$1_SeatingPlanMask as SeatingPlanMask, type SeatingPlanNonNullableFields$1 as SeatingPlanNonNullableFields, type index_d$1_SeatingPlanThumbnail as SeatingPlanThumbnail, type SeatingPlanUiProperties$1 as SeatingPlanUiProperties, type index_d$1_SeatingPlanUpdatedEnvelope as SeatingPlanUpdatedEnvelope, type Section$1 as Section, type Sequencing$1 as Sequencing, ShapeTypeEnumType$1 as ShapeTypeEnumType, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, Type$1 as Type, type index_d$1_UpdateSeatingPlanOptions as UpdateSeatingPlanOptions, type index_d$1_UpdateSeatingPlanRequest as UpdateSeatingPlanRequest, type index_d$1_UpdateSeatingPlanResponse as UpdateSeatingPlanResponse, type index_d$1_UpdateSeatingPlanResponseNonNullableFields as UpdateSeatingPlanResponseNonNullableFields, type index_d$1_UpdateSeatingPlanThumbnailRequest as UpdateSeatingPlanThumbnailRequest, type index_d$1_UpdateSeatingPlanThumbnailResponse as UpdateSeatingPlanThumbnailResponse, type VerticalSequencing$1 as VerticalSequencing, WebhookIdentityType$1 as WebhookIdentityType, type index_d$1__publicOnSeatingPlanCreatedType as _publicOnSeatingPlanCreatedType, type index_d$1__publicOnSeatingPlanDeletedType as _publicOnSeatingPlanDeletedType, type index_d$1__publicOnSeatingPlanUpdatedType as _publicOnSeatingPlanUpdatedType, index_d$1_copySeatingPlan as copySeatingPlan, index_d$1_createSeatingPlan as createSeatingPlan, index_d$1_deleteSeatingPlan as deleteSeatingPlan, index_d$1_findSeatingPlan as findSeatingPlan, index_d$1_getSeatingPlan as getSeatingPlan, index_d$1_getSeatingPlanThumbnail as getSeatingPlanThumbnail, index_d$1_onSeatingPlanCreated as onSeatingPlanCreated, index_d$1_onSeatingPlanDeleted as onSeatingPlanDeleted, index_d$1_onSeatingPlanUpdated as onSeatingPlanUpdated, onSeatingPlanCreated$1 as publicOnSeatingPlanCreated, onSeatingPlanDeleted$1 as publicOnSeatingPlanDeleted, onSeatingPlanUpdated$1 as publicOnSeatingPlanUpdated, index_d$1_querySeatingPlan as querySeatingPlan, index_d$1_updateSeatingPlan as updateSeatingPlan, index_d$1_updateSeatingPlanThumbnail as updateSeatingPlanThumbnail };
|
|
1522
1522
|
}
|
|
1523
1523
|
|
|
1524
|
+
type HostModule<T, H extends Host> = {
|
|
1525
|
+
__type: 'host';
|
|
1526
|
+
create(host: H): T;
|
|
1527
|
+
};
|
|
1528
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
1529
|
+
type Host<Environment = unknown> = {
|
|
1530
|
+
channel: {
|
|
1531
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
1532
|
+
disconnect: () => void;
|
|
1533
|
+
} | Promise<{
|
|
1534
|
+
disconnect: () => void;
|
|
1535
|
+
}>;
|
|
1536
|
+
};
|
|
1537
|
+
environment?: Environment;
|
|
1538
|
+
/**
|
|
1539
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
1540
|
+
*/
|
|
1541
|
+
apiBaseUrl?: string;
|
|
1542
|
+
/**
|
|
1543
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
1544
|
+
* like internationalization, billing, etc.
|
|
1545
|
+
*/
|
|
1546
|
+
essentials?: {
|
|
1547
|
+
/**
|
|
1548
|
+
* The language of the currently viewed session
|
|
1549
|
+
*/
|
|
1550
|
+
language?: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* The locale of the currently viewed session
|
|
1553
|
+
*/
|
|
1554
|
+
locale?: string;
|
|
1555
|
+
/**
|
|
1556
|
+
* Any headers that should be passed through to the API requests
|
|
1557
|
+
*/
|
|
1558
|
+
passThroughHeaders?: Record<string, string>;
|
|
1559
|
+
};
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
1563
|
+
interface HttpClient {
|
|
1564
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
1565
|
+
fetchWithAuth: typeof fetch;
|
|
1566
|
+
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
1567
|
+
getActiveToken?: () => string | undefined;
|
|
1568
|
+
}
|
|
1569
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
1570
|
+
type HttpResponse<T = any> = {
|
|
1571
|
+
data: T;
|
|
1572
|
+
status: number;
|
|
1573
|
+
statusText: string;
|
|
1574
|
+
headers: any;
|
|
1575
|
+
request?: any;
|
|
1576
|
+
};
|
|
1577
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
1578
|
+
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
1579
|
+
url: string;
|
|
1580
|
+
data?: Data;
|
|
1581
|
+
params?: URLSearchParams;
|
|
1582
|
+
} & APIMetadata;
|
|
1583
|
+
type APIMetadata = {
|
|
1584
|
+
methodFqn?: string;
|
|
1585
|
+
entityFqdn?: string;
|
|
1586
|
+
packageName?: string;
|
|
1587
|
+
};
|
|
1588
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
1589
|
+
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
1590
|
+
__type: 'event-definition';
|
|
1591
|
+
type: Type;
|
|
1592
|
+
isDomainEvent?: boolean;
|
|
1593
|
+
transformations?: (envelope: unknown) => Payload;
|
|
1594
|
+
__payload: Payload;
|
|
1595
|
+
};
|
|
1596
|
+
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
1597
|
+
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
1598
|
+
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
1599
|
+
|
|
1600
|
+
type ServicePluginMethodInput = {
|
|
1601
|
+
request: any;
|
|
1602
|
+
metadata: any;
|
|
1603
|
+
};
|
|
1604
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
1605
|
+
type ServicePluginMethodMetadata = {
|
|
1606
|
+
name: string;
|
|
1607
|
+
primaryHttpMappingPath: string;
|
|
1608
|
+
transformations: {
|
|
1609
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
1610
|
+
toREST: (...args: unknown[]) => unknown;
|
|
1611
|
+
};
|
|
1612
|
+
};
|
|
1613
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
1614
|
+
__type: 'service-plugin-definition';
|
|
1615
|
+
componentType: string;
|
|
1616
|
+
methods: ServicePluginMethodMetadata[];
|
|
1617
|
+
__contract: Contract;
|
|
1618
|
+
};
|
|
1619
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
1620
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
1621
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
1622
|
+
|
|
1623
|
+
type RequestContext = {
|
|
1624
|
+
isSSR: boolean;
|
|
1625
|
+
host: string;
|
|
1626
|
+
protocol?: string;
|
|
1627
|
+
};
|
|
1628
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
1629
|
+
/**
|
|
1630
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
1631
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
1632
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
1633
|
+
*/
|
|
1634
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
1635
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
1636
|
+
_?: T;
|
|
1637
|
+
url?: string;
|
|
1638
|
+
method?: Method;
|
|
1639
|
+
params?: any;
|
|
1640
|
+
data?: any;
|
|
1641
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
1642
|
+
};
|
|
1643
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
1644
|
+
__isAmbassador: boolean;
|
|
1645
|
+
};
|
|
1646
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
1647
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
1648
|
+
|
|
1649
|
+
declare global {
|
|
1650
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1651
|
+
interface SymbolConstructor {
|
|
1652
|
+
readonly observable: symbol;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
1660
|
+
|
|
1661
|
+
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)).
|
|
1662
|
+
|
|
1663
|
+
@example
|
|
1664
|
+
```
|
|
1665
|
+
import type {EmptyObject} from 'type-fest';
|
|
1666
|
+
|
|
1667
|
+
// The following illustrates the problem with `{}`.
|
|
1668
|
+
const foo1: {} = {}; // Pass
|
|
1669
|
+
const foo2: {} = []; // Pass
|
|
1670
|
+
const foo3: {} = 42; // Pass
|
|
1671
|
+
const foo4: {} = {a: 1}; // Pass
|
|
1672
|
+
|
|
1673
|
+
// With `EmptyObject` only the first case is valid.
|
|
1674
|
+
const bar1: EmptyObject = {}; // Pass
|
|
1675
|
+
const bar2: EmptyObject = 42; // Fail
|
|
1676
|
+
const bar3: EmptyObject = []; // Fail
|
|
1677
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
1678
|
+
```
|
|
1679
|
+
|
|
1680
|
+
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}.
|
|
1681
|
+
|
|
1682
|
+
@category Object
|
|
1683
|
+
*/
|
|
1684
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
Returns a boolean for whether the two given types are equal.
|
|
1688
|
+
|
|
1689
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
1690
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
1691
|
+
|
|
1692
|
+
Use-cases:
|
|
1693
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
1694
|
+
|
|
1695
|
+
@example
|
|
1696
|
+
```
|
|
1697
|
+
import type {IsEqual} from 'type-fest';
|
|
1698
|
+
|
|
1699
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
1700
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
1701
|
+
type Includes<Value extends readonly any[], Item> =
|
|
1702
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
1703
|
+
? IsEqual<Value[0], Item> extends true
|
|
1704
|
+
? true
|
|
1705
|
+
: Includes<rest, Item>
|
|
1706
|
+
: false;
|
|
1707
|
+
```
|
|
1708
|
+
|
|
1709
|
+
@category Type Guard
|
|
1710
|
+
@category Utilities
|
|
1711
|
+
*/
|
|
1712
|
+
type IsEqual<A, B> =
|
|
1713
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
1714
|
+
(<G>() => G extends B ? 1 : 2)
|
|
1715
|
+
? true
|
|
1716
|
+
: false;
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
Filter out keys from an object.
|
|
1720
|
+
|
|
1721
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
1722
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
1723
|
+
Returns `Key` otherwise.
|
|
1724
|
+
|
|
1725
|
+
@example
|
|
1726
|
+
```
|
|
1727
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
1728
|
+
//=> never
|
|
1729
|
+
```
|
|
1730
|
+
|
|
1731
|
+
@example
|
|
1732
|
+
```
|
|
1733
|
+
type Filtered = Filter<'bar', string>;
|
|
1734
|
+
//=> never
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
@example
|
|
1738
|
+
```
|
|
1739
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
1740
|
+
//=> 'bar'
|
|
1741
|
+
```
|
|
1742
|
+
|
|
1743
|
+
@see {Except}
|
|
1744
|
+
*/
|
|
1745
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
1746
|
+
|
|
1747
|
+
type ExceptOptions = {
|
|
1748
|
+
/**
|
|
1749
|
+
Disallow assigning non-specified properties.
|
|
1750
|
+
|
|
1751
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
1752
|
+
|
|
1753
|
+
@default false
|
|
1754
|
+
*/
|
|
1755
|
+
requireExactProps?: boolean;
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
Create a type from an object type without certain keys.
|
|
1760
|
+
|
|
1761
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
1762
|
+
|
|
1763
|
+
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.
|
|
1764
|
+
|
|
1765
|
+
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)).
|
|
1766
|
+
|
|
1767
|
+
@example
|
|
1768
|
+
```
|
|
1769
|
+
import type {Except} from 'type-fest';
|
|
1770
|
+
|
|
1771
|
+
type Foo = {
|
|
1772
|
+
a: number;
|
|
1773
|
+
b: string;
|
|
1774
|
+
};
|
|
1775
|
+
|
|
1776
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
1777
|
+
//=> {b: string}
|
|
1778
|
+
|
|
1779
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
1780
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
1781
|
+
|
|
1782
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
1783
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
1784
|
+
|
|
1785
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
1786
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
1787
|
+
```
|
|
1788
|
+
|
|
1789
|
+
@category Object
|
|
1790
|
+
*/
|
|
1791
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
1792
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
1793
|
+
} & (Options['requireExactProps'] extends true
|
|
1794
|
+
? Partial<Record<KeysType, never>>
|
|
1795
|
+
: {});
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
1799
|
+
|
|
1800
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
1801
|
+
|
|
1802
|
+
@example
|
|
1803
|
+
```
|
|
1804
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1805
|
+
|
|
1806
|
+
interface Example {
|
|
1807
|
+
a: string;
|
|
1808
|
+
b: string | number;
|
|
1809
|
+
c?: string;
|
|
1810
|
+
d: {};
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
1814
|
+
//=> 'a'
|
|
1815
|
+
```
|
|
1816
|
+
|
|
1817
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
1818
|
+
|
|
1819
|
+
@example
|
|
1820
|
+
```
|
|
1821
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
1822
|
+
|
|
1823
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
1824
|
+
//=> 'a' | 'c'
|
|
1825
|
+
```
|
|
1826
|
+
|
|
1827
|
+
@category Object
|
|
1828
|
+
*/
|
|
1829
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
1830
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
1831
|
+
{
|
|
1832
|
+
// Map through all the keys of the given base type.
|
|
1833
|
+
[Key in keyof Base]:
|
|
1834
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
1835
|
+
Base[Key] extends Condition
|
|
1836
|
+
// Retain this key since the condition passes.
|
|
1837
|
+
? Key
|
|
1838
|
+
// Discard this key since the condition fails.
|
|
1839
|
+
: never;
|
|
1840
|
+
|
|
1841
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
1842
|
+
}[keyof Base]
|
|
1843
|
+
>;
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
1847
|
+
|
|
1848
|
+
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.
|
|
1849
|
+
|
|
1850
|
+
@example
|
|
1851
|
+
```
|
|
1852
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
1853
|
+
|
|
1854
|
+
class Awesome {
|
|
1855
|
+
name: string;
|
|
1856
|
+
successes: number;
|
|
1857
|
+
failures: bigint;
|
|
1858
|
+
|
|
1859
|
+
run() {}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
1863
|
+
//=> {run: () => void}
|
|
1864
|
+
```
|
|
1865
|
+
|
|
1866
|
+
@example
|
|
1867
|
+
```
|
|
1868
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
1869
|
+
|
|
1870
|
+
interface Example {
|
|
1871
|
+
a: string;
|
|
1872
|
+
b: string | number;
|
|
1873
|
+
c: () => void;
|
|
1874
|
+
d: {};
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
1878
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
1879
|
+
```
|
|
1880
|
+
|
|
1881
|
+
@category Object
|
|
1882
|
+
*/
|
|
1883
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
1884
|
+
Base,
|
|
1885
|
+
ConditionalKeys<Base, Condition>
|
|
1886
|
+
>;
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
1890
|
+
* can either be a REST module or a host module.
|
|
1891
|
+
* This type is recursive, so it can describe nested modules.
|
|
1892
|
+
*/
|
|
1893
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
1894
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
1895
|
+
};
|
|
1896
|
+
/**
|
|
1897
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
1898
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
1899
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
1900
|
+
* do not match the given host (as they will not work with the given host).
|
|
1901
|
+
*/
|
|
1902
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
1903
|
+
done: T;
|
|
1904
|
+
recurse: T extends {
|
|
1905
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
1906
|
+
} ? 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<{
|
|
1907
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
1908
|
+
-1,
|
|
1909
|
+
0,
|
|
1910
|
+
1,
|
|
1911
|
+
2,
|
|
1912
|
+
3,
|
|
1913
|
+
4,
|
|
1914
|
+
5
|
|
1915
|
+
][Depth]> : never;
|
|
1916
|
+
}, EmptyObject>;
|
|
1917
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
1918
|
+
type PublicMetadata = {
|
|
1919
|
+
PACKAGE_NAME?: string;
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
declare global {
|
|
1923
|
+
interface ContextualClient {
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* A type used to create concerete types from SDK descriptors in
|
|
1928
|
+
* case a contextual client is available.
|
|
1929
|
+
*/
|
|
1930
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
1931
|
+
host: Host;
|
|
1932
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
1933
|
+
|
|
1524
1934
|
interface SeatingReservation {
|
|
1525
1935
|
/**
|
|
1526
1936
|
* The id of the reservation
|
|
@@ -2544,8 +2954,8 @@ interface GetSeatingReservationsSummarySignature {
|
|
|
2544
2954
|
/** @param - Filter for seating plan */
|
|
2545
2955
|
(filter: Record<string, any> | null): Promise<GetSeatingReservationsSummaryResponse & GetSeatingReservationsSummaryResponseNonNullableFields>;
|
|
2546
2956
|
}
|
|
2547
|
-
declare const onSeatingReservationCreated$1: EventDefinition$
|
|
2548
|
-
declare const onSeatingReservationDeleted$1: EventDefinition$
|
|
2957
|
+
declare const onSeatingReservationCreated$1: EventDefinition$1<SeatingReservationCreatedEnvelope, "wix.seating.v1.seating_reservation_created">;
|
|
2958
|
+
declare const onSeatingReservationDeleted$1: EventDefinition$1<SeatingReservationDeletedEnvelope, "wix.seating.v1.seating_reservation_deleted">;
|
|
2549
2959
|
|
|
2550
2960
|
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
2551
2961
|
__type: 'event-definition';
|