@wix/echo 1.0.43 → 1.0.45
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 -1
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/meta.js +1 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/es/context.js +1 -0
- package/build/es/context.js.map +1 -0
- package/build/es/index.js +1 -1
- package/build/es/index.js.map +1 -0
- package/build/es/meta.js +1 -0
- package/build/es/meta.js.map +1 -0
- package/package.json +4 -9
- package/type-bundles/context.bundle.d.ts +138 -498
- package/type-bundles/index.bundle.d.ts +138 -498
- package/type-bundles/meta.bundle.d.ts +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type HostModule
|
|
1
|
+
type HostModule<T, H extends Host> = {
|
|
2
2
|
__type: 'host';
|
|
3
3
|
create(host: H): T;
|
|
4
4
|
};
|
|
5
|
-
type HostModuleAPI
|
|
6
|
-
type Host
|
|
5
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
+
type Host<Environment = unknown> = {
|
|
7
7
|
channel: {
|
|
8
8
|
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
9
|
disconnect: () => void;
|
|
@@ -12,6 +12,10 @@ type Host$1<Environment = unknown> = {
|
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional name of the environment, use for logging
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
15
19
|
/**
|
|
16
20
|
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
21
|
*/
|
|
@@ -36,92 +40,92 @@ type Host$1<Environment = unknown> = {
|
|
|
36
40
|
};
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
type RESTFunctionDescriptor
|
|
40
|
-
interface HttpClient
|
|
41
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory
|
|
43
|
+
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
44
|
+
interface HttpClient {
|
|
45
|
+
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
42
46
|
fetchWithAuth: typeof fetch;
|
|
43
47
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
48
|
getActiveToken?: () => string | undefined;
|
|
45
49
|
}
|
|
46
|
-
type RequestOptionsFactory
|
|
47
|
-
type HttpResponse
|
|
50
|
+
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
51
|
+
type HttpResponse<T = any> = {
|
|
48
52
|
data: T;
|
|
49
53
|
status: number;
|
|
50
54
|
statusText: string;
|
|
51
55
|
headers: any;
|
|
52
56
|
request?: any;
|
|
53
57
|
};
|
|
54
|
-
type RequestOptions
|
|
58
|
+
type RequestOptions<_TResponse = any, Data = any> = {
|
|
55
59
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
56
60
|
url: string;
|
|
57
61
|
data?: Data;
|
|
58
62
|
params?: URLSearchParams;
|
|
59
|
-
} & APIMetadata
|
|
60
|
-
type APIMetadata
|
|
63
|
+
} & APIMetadata;
|
|
64
|
+
type APIMetadata = {
|
|
61
65
|
methodFqn?: string;
|
|
62
66
|
entityFqdn?: string;
|
|
63
67
|
packageName?: string;
|
|
64
68
|
};
|
|
65
|
-
type BuildRESTFunction
|
|
66
|
-
type EventDefinition
|
|
69
|
+
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
70
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
67
71
|
__type: 'event-definition';
|
|
68
72
|
type: Type;
|
|
69
73
|
isDomainEvent?: boolean;
|
|
70
74
|
transformations?: (envelope: unknown) => Payload;
|
|
71
75
|
__payload: Payload;
|
|
72
76
|
};
|
|
73
|
-
declare function EventDefinition
|
|
74
|
-
type EventHandler
|
|
75
|
-
type BuildEventDefinition
|
|
77
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
78
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
79
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
76
80
|
|
|
77
|
-
type ServicePluginMethodInput
|
|
81
|
+
type ServicePluginMethodInput = {
|
|
78
82
|
request: any;
|
|
79
83
|
metadata: any;
|
|
80
84
|
};
|
|
81
|
-
type ServicePluginContract
|
|
82
|
-
type ServicePluginMethodMetadata
|
|
85
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
86
|
+
type ServicePluginMethodMetadata = {
|
|
83
87
|
name: string;
|
|
84
88
|
primaryHttpMappingPath: string;
|
|
85
89
|
transformations: {
|
|
86
|
-
fromREST: (...args: unknown[]) => ServicePluginMethodInput
|
|
90
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
87
91
|
toREST: (...args: unknown[]) => unknown;
|
|
88
92
|
};
|
|
89
93
|
};
|
|
90
|
-
type ServicePluginDefinition
|
|
94
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
91
95
|
__type: 'service-plugin-definition';
|
|
92
96
|
componentType: string;
|
|
93
|
-
methods: ServicePluginMethodMetadata
|
|
97
|
+
methods: ServicePluginMethodMetadata[];
|
|
94
98
|
__contract: Contract;
|
|
95
99
|
};
|
|
96
|
-
declare function ServicePluginDefinition
|
|
97
|
-
type BuildServicePluginDefinition
|
|
98
|
-
declare const SERVICE_PLUGIN_ERROR_TYPE
|
|
100
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
101
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
102
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
99
103
|
|
|
100
|
-
type RequestContext
|
|
104
|
+
type RequestContext = {
|
|
101
105
|
isSSR: boolean;
|
|
102
106
|
host: string;
|
|
103
107
|
protocol?: string;
|
|
104
108
|
};
|
|
105
|
-
type ResponseTransformer
|
|
109
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
106
110
|
/**
|
|
107
111
|
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
112
|
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
113
|
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
114
|
*/
|
|
111
|
-
type Method
|
|
112
|
-
type AmbassadorRequestOptions
|
|
115
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
116
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
113
117
|
_?: T;
|
|
114
118
|
url?: string;
|
|
115
|
-
method?: Method
|
|
119
|
+
method?: Method;
|
|
116
120
|
params?: any;
|
|
117
121
|
data?: any;
|
|
118
|
-
transformResponse?: ResponseTransformer
|
|
122
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
119
123
|
};
|
|
120
|
-
type AmbassadorFactory
|
|
124
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
121
125
|
__isAmbassador: boolean;
|
|
122
126
|
};
|
|
123
|
-
type AmbassadorFunctionDescriptor
|
|
124
|
-
type BuildAmbassadorFunction
|
|
127
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
128
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
125
129
|
|
|
126
130
|
declare global {
|
|
127
131
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -130,7 +134,7 @@ declare global {
|
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
declare const emptyObjectSymbol
|
|
137
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
134
138
|
|
|
135
139
|
/**
|
|
136
140
|
Represents a strictly empty plain object, the `{}` value.
|
|
@@ -158,7 +162,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
|
|
|
158
162
|
|
|
159
163
|
@category Object
|
|
160
164
|
*/
|
|
161
|
-
type EmptyObject
|
|
165
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
162
166
|
|
|
163
167
|
/**
|
|
164
168
|
Returns a boolean for whether the two given types are equal.
|
|
@@ -186,7 +190,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
186
190
|
@category Type Guard
|
|
187
191
|
@category Utilities
|
|
188
192
|
*/
|
|
189
|
-
type IsEqual
|
|
193
|
+
type IsEqual<A, B> =
|
|
190
194
|
(<G>() => G extends A ? 1 : 2) extends
|
|
191
195
|
(<G>() => G extends B ? 1 : 2)
|
|
192
196
|
? true
|
|
@@ -219,9 +223,9 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
219
223
|
|
|
220
224
|
@see {Except}
|
|
221
225
|
*/
|
|
222
|
-
type Filter
|
|
226
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
227
|
|
|
224
|
-
type ExceptOptions
|
|
228
|
+
type ExceptOptions = {
|
|
225
229
|
/**
|
|
226
230
|
Disallow assigning non-specified properties.
|
|
227
231
|
|
|
@@ -265,12 +269,78 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
|
265
269
|
|
|
266
270
|
@category Object
|
|
267
271
|
*/
|
|
268
|
-
type Except
|
|
269
|
-
[KeyType in keyof ObjectType as Filter
|
|
272
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
273
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
274
|
} & (Options['requireExactProps'] extends true
|
|
271
275
|
? Partial<Record<KeysType, never>>
|
|
272
276
|
: {});
|
|
273
277
|
|
|
278
|
+
/**
|
|
279
|
+
Returns a boolean for whether the given type is `never`.
|
|
280
|
+
|
|
281
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
282
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
283
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
284
|
+
|
|
285
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
286
|
+
|
|
287
|
+
@example
|
|
288
|
+
```
|
|
289
|
+
import type {IsNever, And} from 'type-fest';
|
|
290
|
+
|
|
291
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
292
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
293
|
+
And<
|
|
294
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
295
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
296
|
+
>;
|
|
297
|
+
|
|
298
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
299
|
+
AreStringsEqual<I, O> extends true
|
|
300
|
+
? never
|
|
301
|
+
: void;
|
|
302
|
+
|
|
303
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
304
|
+
if (input === output) {
|
|
305
|
+
process.exit(0);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
endIfEqual('abc', 'abc');
|
|
310
|
+
//=> never
|
|
311
|
+
|
|
312
|
+
endIfEqual('abc', '123');
|
|
313
|
+
//=> void
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
@category Type Guard
|
|
317
|
+
@category Utilities
|
|
318
|
+
*/
|
|
319
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
323
|
+
|
|
324
|
+
@see {@link IsNever}
|
|
325
|
+
|
|
326
|
+
@example
|
|
327
|
+
```
|
|
328
|
+
import type {IfNever} from 'type-fest';
|
|
329
|
+
|
|
330
|
+
type ShouldBeTrue = IfNever<never>;
|
|
331
|
+
//=> true
|
|
332
|
+
|
|
333
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
334
|
+
//=> 'bar'
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
@category Type Guard
|
|
338
|
+
@category Utilities
|
|
339
|
+
*/
|
|
340
|
+
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
341
|
+
IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
342
|
+
);
|
|
343
|
+
|
|
274
344
|
/**
|
|
275
345
|
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
346
|
|
|
@@ -303,21 +373,19 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
|
303
373
|
|
|
304
374
|
@category Object
|
|
305
375
|
*/
|
|
306
|
-
type ConditionalKeys
|
|
307
|
-
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
376
|
+
type ConditionalKeys<Base, Condition> =
|
|
308
377
|
{
|
|
309
378
|
// Map through all the keys of the given base type.
|
|
310
|
-
[Key in keyof Base]
|
|
379
|
+
[Key in keyof Base]-?:
|
|
311
380
|
// Pick only keys with types extending the given `Condition` type.
|
|
312
381
|
Base[Key] extends Condition
|
|
313
|
-
// Retain this key
|
|
314
|
-
|
|
382
|
+
// Retain this key
|
|
383
|
+
// If the value for the key extends never, only include it if `Condition` also extends never
|
|
384
|
+
? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
|
|
315
385
|
// Discard this key since the condition fails.
|
|
316
386
|
: never;
|
|
317
|
-
|
|
318
387
|
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
-
}[keyof Base]
|
|
320
|
-
>;
|
|
388
|
+
}[keyof Base];
|
|
321
389
|
|
|
322
390
|
/**
|
|
323
391
|
Exclude keys from a shape that matches the given `Condition`.
|
|
@@ -357,9 +425,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
|
357
425
|
|
|
358
426
|
@category Object
|
|
359
427
|
*/
|
|
360
|
-
type ConditionalExcept
|
|
428
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
361
429
|
Base,
|
|
362
|
-
ConditionalKeys
|
|
430
|
+
ConditionalKeys<Base, Condition>
|
|
363
431
|
>;
|
|
364
432
|
|
|
365
433
|
/**
|
|
@@ -367,8 +435,8 @@ ConditionalKeys$1<Base, Condition>
|
|
|
367
435
|
* can either be a REST module or a host module.
|
|
368
436
|
* This type is recursive, so it can describe nested modules.
|
|
369
437
|
*/
|
|
370
|
-
type Descriptors
|
|
371
|
-
[key: string]: Descriptors
|
|
438
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
439
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
372
440
|
};
|
|
373
441
|
/**
|
|
374
442
|
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
@@ -376,12 +444,12 @@ type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 |
|
|
|
376
444
|
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
445
|
* do not match the given host (as they will not work with the given host).
|
|
378
446
|
*/
|
|
379
|
-
type BuildDescriptors
|
|
447
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
380
448
|
done: T;
|
|
381
449
|
recurse: T extends {
|
|
382
|
-
__type: typeof SERVICE_PLUGIN_ERROR_TYPE
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor
|
|
384
|
-
[Key in keyof T]: T[Key] extends Descriptors
|
|
450
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
451
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
452
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
385
453
|
-1,
|
|
386
454
|
0,
|
|
387
455
|
1,
|
|
@@ -390,9 +458,9 @@ type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefin
|
|
|
390
458
|
4,
|
|
391
459
|
5
|
|
392
460
|
][Depth]> : never;
|
|
393
|
-
}, EmptyObject
|
|
461
|
+
}, EmptyObject>;
|
|
394
462
|
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
-
type PublicMetadata
|
|
463
|
+
type PublicMetadata = {
|
|
396
464
|
PACKAGE_NAME?: string;
|
|
397
465
|
};
|
|
398
466
|
|
|
@@ -404,9 +472,9 @@ declare global {
|
|
|
404
472
|
* A type used to create concerete types from SDK descriptors in
|
|
405
473
|
* case a contextual client is available.
|
|
406
474
|
*/
|
|
407
|
-
type MaybeContext
|
|
408
|
-
host: Host
|
|
409
|
-
} ? BuildDescriptors
|
|
475
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
476
|
+
host: Host;
|
|
477
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
410
478
|
|
|
411
479
|
interface CalculateMessage {
|
|
412
480
|
/** result of the calculation */
|
|
@@ -449,13 +517,13 @@ interface CalculateIdentifiers {
|
|
|
449
517
|
operation: CalculateOperation;
|
|
450
518
|
}
|
|
451
519
|
|
|
452
|
-
declare function calculate$1(httpClient: HttpClient
|
|
520
|
+
declare function calculate$1(httpClient: HttpClient): CalculateSignature;
|
|
453
521
|
interface CalculateSignature {
|
|
454
522
|
/** */
|
|
455
523
|
(identifiers: CalculateIdentifiers): Promise<CalculateResponse & CalculateResponseNonNullableFields>;
|
|
456
524
|
}
|
|
457
525
|
|
|
458
|
-
declare const calculate: MaybeContext
|
|
526
|
+
declare const calculate: MaybeContext<BuildRESTFunction<typeof calculate$1> & typeof calculate$1>;
|
|
459
527
|
|
|
460
528
|
type index_d$1_CalculateIdentifiers = CalculateIdentifiers;
|
|
461
529
|
type index_d$1_CalculateMessage = CalculateMessage;
|
|
@@ -469,416 +537,6 @@ declare namespace index_d$1 {
|
|
|
469
537
|
export { type index_d$1_CalculateIdentifiers as CalculateIdentifiers, type index_d$1_CalculateMessage as CalculateMessage, index_d$1_CalculateOperation as CalculateOperation, type index_d$1_CalculateRequest as CalculateRequest, type index_d$1_CalculateResponse as CalculateResponse, type index_d$1_CalculateResponseNonNullableFields as CalculateResponseNonNullableFields, index_d$1_calculate as calculate };
|
|
470
538
|
}
|
|
471
539
|
|
|
472
|
-
type HostModule<T, H extends Host> = {
|
|
473
|
-
__type: 'host';
|
|
474
|
-
create(host: H): T;
|
|
475
|
-
};
|
|
476
|
-
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
477
|
-
type Host<Environment = unknown> = {
|
|
478
|
-
channel: {
|
|
479
|
-
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
480
|
-
disconnect: () => void;
|
|
481
|
-
} | Promise<{
|
|
482
|
-
disconnect: () => void;
|
|
483
|
-
}>;
|
|
484
|
-
};
|
|
485
|
-
environment?: Environment;
|
|
486
|
-
/**
|
|
487
|
-
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
488
|
-
*/
|
|
489
|
-
apiBaseUrl?: string;
|
|
490
|
-
/**
|
|
491
|
-
* Possible data to be provided by every host, for cross cutting concerns
|
|
492
|
-
* like internationalization, billing, etc.
|
|
493
|
-
*/
|
|
494
|
-
essentials?: {
|
|
495
|
-
/**
|
|
496
|
-
* The language of the currently viewed session
|
|
497
|
-
*/
|
|
498
|
-
language?: string;
|
|
499
|
-
/**
|
|
500
|
-
* The locale of the currently viewed session
|
|
501
|
-
*/
|
|
502
|
-
locale?: string;
|
|
503
|
-
/**
|
|
504
|
-
* Any headers that should be passed through to the API requests
|
|
505
|
-
*/
|
|
506
|
-
passThroughHeaders?: Record<string, string>;
|
|
507
|
-
};
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
511
|
-
interface HttpClient {
|
|
512
|
-
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
513
|
-
fetchWithAuth: typeof fetch;
|
|
514
|
-
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
515
|
-
getActiveToken?: () => string | undefined;
|
|
516
|
-
}
|
|
517
|
-
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
518
|
-
type HttpResponse<T = any> = {
|
|
519
|
-
data: T;
|
|
520
|
-
status: number;
|
|
521
|
-
statusText: string;
|
|
522
|
-
headers: any;
|
|
523
|
-
request?: any;
|
|
524
|
-
};
|
|
525
|
-
type RequestOptions<_TResponse = any, Data = any> = {
|
|
526
|
-
method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
527
|
-
url: string;
|
|
528
|
-
data?: Data;
|
|
529
|
-
params?: URLSearchParams;
|
|
530
|
-
} & APIMetadata;
|
|
531
|
-
type APIMetadata = {
|
|
532
|
-
methodFqn?: string;
|
|
533
|
-
entityFqdn?: string;
|
|
534
|
-
packageName?: string;
|
|
535
|
-
};
|
|
536
|
-
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
537
|
-
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
538
|
-
__type: 'event-definition';
|
|
539
|
-
type: Type;
|
|
540
|
-
isDomainEvent?: boolean;
|
|
541
|
-
transformations?: (envelope: unknown) => Payload;
|
|
542
|
-
__payload: Payload;
|
|
543
|
-
};
|
|
544
|
-
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
545
|
-
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
546
|
-
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
547
|
-
|
|
548
|
-
type ServicePluginMethodInput = {
|
|
549
|
-
request: any;
|
|
550
|
-
metadata: any;
|
|
551
|
-
};
|
|
552
|
-
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
553
|
-
type ServicePluginMethodMetadata = {
|
|
554
|
-
name: string;
|
|
555
|
-
primaryHttpMappingPath: string;
|
|
556
|
-
transformations: {
|
|
557
|
-
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
558
|
-
toREST: (...args: unknown[]) => unknown;
|
|
559
|
-
};
|
|
560
|
-
};
|
|
561
|
-
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
562
|
-
__type: 'service-plugin-definition';
|
|
563
|
-
componentType: string;
|
|
564
|
-
methods: ServicePluginMethodMetadata[];
|
|
565
|
-
__contract: Contract;
|
|
566
|
-
};
|
|
567
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
568
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
569
|
-
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
570
|
-
|
|
571
|
-
type RequestContext = {
|
|
572
|
-
isSSR: boolean;
|
|
573
|
-
host: string;
|
|
574
|
-
protocol?: string;
|
|
575
|
-
};
|
|
576
|
-
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
577
|
-
/**
|
|
578
|
-
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
579
|
-
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
580
|
-
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
581
|
-
*/
|
|
582
|
-
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
583
|
-
type AmbassadorRequestOptions<T = any> = {
|
|
584
|
-
_?: T;
|
|
585
|
-
url?: string;
|
|
586
|
-
method?: Method;
|
|
587
|
-
params?: any;
|
|
588
|
-
data?: any;
|
|
589
|
-
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
590
|
-
};
|
|
591
|
-
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
592
|
-
__isAmbassador: boolean;
|
|
593
|
-
};
|
|
594
|
-
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
595
|
-
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
596
|
-
|
|
597
|
-
declare global {
|
|
598
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
599
|
-
interface SymbolConstructor {
|
|
600
|
-
readonly observable: symbol;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
declare const emptyObjectSymbol: unique symbol;
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
Represents a strictly empty plain object, the `{}` value.
|
|
608
|
-
|
|
609
|
-
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)).
|
|
610
|
-
|
|
611
|
-
@example
|
|
612
|
-
```
|
|
613
|
-
import type {EmptyObject} from 'type-fest';
|
|
614
|
-
|
|
615
|
-
// The following illustrates the problem with `{}`.
|
|
616
|
-
const foo1: {} = {}; // Pass
|
|
617
|
-
const foo2: {} = []; // Pass
|
|
618
|
-
const foo3: {} = 42; // Pass
|
|
619
|
-
const foo4: {} = {a: 1}; // Pass
|
|
620
|
-
|
|
621
|
-
// With `EmptyObject` only the first case is valid.
|
|
622
|
-
const bar1: EmptyObject = {}; // Pass
|
|
623
|
-
const bar2: EmptyObject = 42; // Fail
|
|
624
|
-
const bar3: EmptyObject = []; // Fail
|
|
625
|
-
const bar4: EmptyObject = {a: 1}; // Fail
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
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}.
|
|
629
|
-
|
|
630
|
-
@category Object
|
|
631
|
-
*/
|
|
632
|
-
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
Returns a boolean for whether the two given types are equal.
|
|
636
|
-
|
|
637
|
-
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
638
|
-
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
639
|
-
|
|
640
|
-
Use-cases:
|
|
641
|
-
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
642
|
-
|
|
643
|
-
@example
|
|
644
|
-
```
|
|
645
|
-
import type {IsEqual} from 'type-fest';
|
|
646
|
-
|
|
647
|
-
// This type returns a boolean for whether the given array includes the given item.
|
|
648
|
-
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
649
|
-
type Includes<Value extends readonly any[], Item> =
|
|
650
|
-
Value extends readonly [Value[0], ...infer rest]
|
|
651
|
-
? IsEqual<Value[0], Item> extends true
|
|
652
|
-
? true
|
|
653
|
-
: Includes<rest, Item>
|
|
654
|
-
: false;
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
@category Type Guard
|
|
658
|
-
@category Utilities
|
|
659
|
-
*/
|
|
660
|
-
type IsEqual<A, B> =
|
|
661
|
-
(<G>() => G extends A ? 1 : 2) extends
|
|
662
|
-
(<G>() => G extends B ? 1 : 2)
|
|
663
|
-
? true
|
|
664
|
-
: false;
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
Filter out keys from an object.
|
|
668
|
-
|
|
669
|
-
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
670
|
-
Returns `never` if `Key` extends `Exclude`.
|
|
671
|
-
Returns `Key` otherwise.
|
|
672
|
-
|
|
673
|
-
@example
|
|
674
|
-
```
|
|
675
|
-
type Filtered = Filter<'foo', 'foo'>;
|
|
676
|
-
//=> never
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
@example
|
|
680
|
-
```
|
|
681
|
-
type Filtered = Filter<'bar', string>;
|
|
682
|
-
//=> never
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
@example
|
|
686
|
-
```
|
|
687
|
-
type Filtered = Filter<'bar', 'foo'>;
|
|
688
|
-
//=> 'bar'
|
|
689
|
-
```
|
|
690
|
-
|
|
691
|
-
@see {Except}
|
|
692
|
-
*/
|
|
693
|
-
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
694
|
-
|
|
695
|
-
type ExceptOptions = {
|
|
696
|
-
/**
|
|
697
|
-
Disallow assigning non-specified properties.
|
|
698
|
-
|
|
699
|
-
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
700
|
-
|
|
701
|
-
@default false
|
|
702
|
-
*/
|
|
703
|
-
requireExactProps?: boolean;
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
Create a type from an object type without certain keys.
|
|
708
|
-
|
|
709
|
-
We recommend setting the `requireExactProps` option to `true`.
|
|
710
|
-
|
|
711
|
-
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.
|
|
712
|
-
|
|
713
|
-
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)).
|
|
714
|
-
|
|
715
|
-
@example
|
|
716
|
-
```
|
|
717
|
-
import type {Except} from 'type-fest';
|
|
718
|
-
|
|
719
|
-
type Foo = {
|
|
720
|
-
a: number;
|
|
721
|
-
b: string;
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
type FooWithoutA = Except<Foo, 'a'>;
|
|
725
|
-
//=> {b: string}
|
|
726
|
-
|
|
727
|
-
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
728
|
-
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
729
|
-
|
|
730
|
-
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
731
|
-
//=> {a: number} & Partial<Record<"b", never>>
|
|
732
|
-
|
|
733
|
-
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
734
|
-
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
@category Object
|
|
738
|
-
*/
|
|
739
|
-
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
740
|
-
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
741
|
-
} & (Options['requireExactProps'] extends true
|
|
742
|
-
? Partial<Record<KeysType, never>>
|
|
743
|
-
: {});
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
747
|
-
|
|
748
|
-
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
749
|
-
|
|
750
|
-
@example
|
|
751
|
-
```
|
|
752
|
-
import type {ConditionalKeys} from 'type-fest';
|
|
753
|
-
|
|
754
|
-
interface Example {
|
|
755
|
-
a: string;
|
|
756
|
-
b: string | number;
|
|
757
|
-
c?: string;
|
|
758
|
-
d: {};
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
762
|
-
//=> 'a'
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
766
|
-
|
|
767
|
-
@example
|
|
768
|
-
```
|
|
769
|
-
import type {ConditionalKeys} from 'type-fest';
|
|
770
|
-
|
|
771
|
-
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
772
|
-
//=> 'a' | 'c'
|
|
773
|
-
```
|
|
774
|
-
|
|
775
|
-
@category Object
|
|
776
|
-
*/
|
|
777
|
-
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
778
|
-
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
779
|
-
{
|
|
780
|
-
// Map through all the keys of the given base type.
|
|
781
|
-
[Key in keyof Base]:
|
|
782
|
-
// Pick only keys with types extending the given `Condition` type.
|
|
783
|
-
Base[Key] extends Condition
|
|
784
|
-
// Retain this key since the condition passes.
|
|
785
|
-
? Key
|
|
786
|
-
// Discard this key since the condition fails.
|
|
787
|
-
: never;
|
|
788
|
-
|
|
789
|
-
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
790
|
-
}[keyof Base]
|
|
791
|
-
>;
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
Exclude keys from a shape that matches the given `Condition`.
|
|
795
|
-
|
|
796
|
-
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.
|
|
797
|
-
|
|
798
|
-
@example
|
|
799
|
-
```
|
|
800
|
-
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
801
|
-
|
|
802
|
-
class Awesome {
|
|
803
|
-
name: string;
|
|
804
|
-
successes: number;
|
|
805
|
-
failures: bigint;
|
|
806
|
-
|
|
807
|
-
run() {}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
811
|
-
//=> {run: () => void}
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
@example
|
|
815
|
-
```
|
|
816
|
-
import type {ConditionalExcept} from 'type-fest';
|
|
817
|
-
|
|
818
|
-
interface Example {
|
|
819
|
-
a: string;
|
|
820
|
-
b: string | number;
|
|
821
|
-
c: () => void;
|
|
822
|
-
d: {};
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
826
|
-
//=> {b: string | number; c: () => void; d: {}}
|
|
827
|
-
```
|
|
828
|
-
|
|
829
|
-
@category Object
|
|
830
|
-
*/
|
|
831
|
-
type ConditionalExcept<Base, Condition> = Except<
|
|
832
|
-
Base,
|
|
833
|
-
ConditionalKeys<Base, Condition>
|
|
834
|
-
>;
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Descriptors are objects that describe the API of a module, and the module
|
|
838
|
-
* can either be a REST module or a host module.
|
|
839
|
-
* This type is recursive, so it can describe nested modules.
|
|
840
|
-
*/
|
|
841
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$1<any> | ServicePluginDefinition<any> | {
|
|
842
|
-
[key: string]: Descriptors | PublicMetadata | any;
|
|
843
|
-
};
|
|
844
|
-
/**
|
|
845
|
-
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
846
|
-
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
847
|
-
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
848
|
-
* do not match the given host (as they will not work with the given host).
|
|
849
|
-
*/
|
|
850
|
-
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
851
|
-
done: T;
|
|
852
|
-
recurse: T extends {
|
|
853
|
-
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
854
|
-
} ? 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<{
|
|
855
|
-
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
856
|
-
-1,
|
|
857
|
-
0,
|
|
858
|
-
1,
|
|
859
|
-
2,
|
|
860
|
-
3,
|
|
861
|
-
4,
|
|
862
|
-
5
|
|
863
|
-
][Depth]> : never;
|
|
864
|
-
}, EmptyObject>;
|
|
865
|
-
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
866
|
-
type PublicMetadata = {
|
|
867
|
-
PACKAGE_NAME?: string;
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
declare global {
|
|
871
|
-
interface ContextualClient {
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* A type used to create concerete types from SDK descriptors in
|
|
876
|
-
* case a contextual client is available.
|
|
877
|
-
*/
|
|
878
|
-
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
879
|
-
host: Host;
|
|
880
|
-
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
881
|
-
|
|
882
540
|
interface MessageItem {
|
|
883
541
|
/** inner_message comment from EchoMessage proto def */
|
|
884
542
|
innerMessage?: string;
|
|
@@ -891,7 +549,7 @@ interface EchoRequest {
|
|
|
891
549
|
/** this field test translatable annotation */
|
|
892
550
|
titleField?: string;
|
|
893
551
|
someInt32?: number;
|
|
894
|
-
someDate?: Date;
|
|
552
|
+
someDate?: Date | null;
|
|
895
553
|
}
|
|
896
554
|
interface EchoResponse {
|
|
897
555
|
/**
|
|
@@ -930,7 +588,7 @@ interface DomainEvent extends DomainEventBodyOneOf {
|
|
|
930
588
|
/** ID of the entity associated with the event. */
|
|
931
589
|
entityId?: string;
|
|
932
590
|
/** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
|
|
933
|
-
eventTime?: Date;
|
|
591
|
+
eventTime?: Date | null;
|
|
934
592
|
/**
|
|
935
593
|
* Whether the event was triggered as a result of a privacy regulation application
|
|
936
594
|
* (for example, GDPR).
|
|
@@ -959,7 +617,7 @@ interface EntityCreatedEvent {
|
|
|
959
617
|
entity?: string;
|
|
960
618
|
}
|
|
961
619
|
interface RestoreInfo {
|
|
962
|
-
deletedDate?: Date;
|
|
620
|
+
deletedDate?: Date | null;
|
|
963
621
|
}
|
|
964
622
|
interface EntityUpdatedEvent {
|
|
965
623
|
/**
|
|
@@ -1060,7 +718,7 @@ interface EventMetadata extends BaseEventMetadata {
|
|
|
1060
718
|
/** ID of the entity associated with the event. */
|
|
1061
719
|
entityId?: string;
|
|
1062
720
|
/** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
|
|
1063
|
-
eventTime?: Date;
|
|
721
|
+
eventTime?: Date | null;
|
|
1064
722
|
/**
|
|
1065
723
|
* Whether the event was triggered as a result of a privacy regulation application
|
|
1066
724
|
* (for example, GDPR).
|
|
@@ -1088,7 +746,7 @@ interface EchoOptions {
|
|
|
1088
746
|
/** this field test translatable annotation */
|
|
1089
747
|
titleField?: string;
|
|
1090
748
|
someInt32?: number;
|
|
1091
|
-
someDate?: Date;
|
|
749
|
+
someDate?: Date | null;
|
|
1092
750
|
}
|
|
1093
751
|
|
|
1094
752
|
declare function echo$1(httpClient: HttpClient): EchoSignature;
|
|
@@ -1101,25 +759,7 @@ interface EchoSignature {
|
|
|
1101
759
|
*/
|
|
1102
760
|
(arg1: string, options?: EchoOptions | undefined): Promise<string>;
|
|
1103
761
|
}
|
|
1104
|
-
declare const onEchoDispatched$1: EventDefinition
|
|
1105
|
-
|
|
1106
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
1107
|
-
__type: 'event-definition';
|
|
1108
|
-
type: Type;
|
|
1109
|
-
isDomainEvent?: boolean;
|
|
1110
|
-
transformations?: (envelope: unknown) => Payload;
|
|
1111
|
-
__payload: Payload;
|
|
1112
|
-
};
|
|
1113
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
1114
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
1115
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
1116
|
-
|
|
1117
|
-
declare global {
|
|
1118
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1119
|
-
interface SymbolConstructor {
|
|
1120
|
-
readonly observable: symbol;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
762
|
+
declare const onEchoDispatched$1: EventDefinition<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
|
|
1123
763
|
|
|
1124
764
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
1125
765
|
|