@wix/multilingual 1.0.68 → 1.0.70
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/multilingual",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"type-bundles"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@wix/multilingual_entity-mapper": "1.0.
|
|
22
|
-
"@wix/multilingual_machine-translation": "1.0.
|
|
23
|
-
"@wix/multilingual_site-translator": "1.0.
|
|
24
|
-
"@wix/multilingual_translation-contents": "1.0.
|
|
25
|
-
"@wix/multilingual_translation-published-contents": "1.0.
|
|
26
|
-
"@wix/multilingual_translation-schemas": "1.0.
|
|
21
|
+
"@wix/multilingual_entity-mapper": "1.0.19",
|
|
22
|
+
"@wix/multilingual_machine-translation": "1.0.32",
|
|
23
|
+
"@wix/multilingual_site-translator": "1.0.17",
|
|
24
|
+
"@wix/multilingual_translation-contents": "1.0.36",
|
|
25
|
+
"@wix/multilingual_translation-published-contents": "1.0.14",
|
|
26
|
+
"@wix/multilingual_translation-schemas": "1.0.32"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"glob": "^10.4.1",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"fqdn": ""
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
-
"falconPackageHash": "
|
|
51
|
+
"falconPackageHash": "80c8ab9808e303f8b907b258d360d2d96430c3d96cfd2b32065f4e18"
|
|
52
52
|
}
|
|
@@ -12,6 +12,10 @@ type Host<Environment = unknown> = {
|
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional name of the environment, use for logging
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
15
19
|
/**
|
|
16
20
|
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
21
|
*/
|
|
@@ -63,16 +67,16 @@ type APIMetadata = {
|
|
|
63
67
|
packageName?: string;
|
|
64
68
|
};
|
|
65
69
|
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
-
type EventDefinition
|
|
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
81
|
type ServicePluginMethodInput = {
|
|
78
82
|
request: any;
|
|
@@ -271,6 +275,72 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
|
|
|
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<Base, Condition> =
|
|
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`.
|
|
@@ -367,7 +435,7 @@ ConditionalKeys<Base, Condition>
|
|
|
367
435
|
* can either be a REST module or a host module.
|
|
368
436
|
* This type is recursive, so it can describe nested modules.
|
|
369
437
|
*/
|
|
370
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition
|
|
438
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
371
439
|
[key: string]: Descriptors | PublicMetadata | any;
|
|
372
440
|
};
|
|
373
441
|
/**
|
|
@@ -380,7 +448,7 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
|
|
|
380
448
|
done: T;
|
|
381
449
|
recurse: T extends {
|
|
382
450
|
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition
|
|
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<{
|
|
384
452
|
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
385
453
|
-1,
|
|
386
454
|
0,
|
|
@@ -2841,29 +2909,11 @@ interface QueryPublishedContentSignature {
|
|
|
2841
2909
|
*/
|
|
2842
2910
|
(): PublishedContentQueryBuilder;
|
|
2843
2911
|
}
|
|
2844
|
-
declare const onPublishedContentCreated$1: EventDefinition
|
|
2845
|
-
declare const onPublishedContentUpdated$1: EventDefinition
|
|
2846
|
-
declare const onPublishedContentDeleted$1: EventDefinition
|
|
2912
|
+
declare const onPublishedContentCreated$1: EventDefinition<PublishedContentCreatedEnvelope, "wix.multilingual.localization_public.v3.published_content_created">;
|
|
2913
|
+
declare const onPublishedContentUpdated$1: EventDefinition<PublishedContentUpdatedEnvelope, "wix.multilingual.localization_public.v3.published_content_updated">;
|
|
2914
|
+
declare const onPublishedContentDeleted$1: EventDefinition<PublishedContentDeletedEnvelope, "wix.multilingual.localization_public.v3.published_content_deleted">;
|
|
2847
2915
|
|
|
2848
|
-
|
|
2849
|
-
__type: 'event-definition';
|
|
2850
|
-
type: Type;
|
|
2851
|
-
isDomainEvent?: boolean;
|
|
2852
|
-
transformations?: (envelope: unknown) => Payload;
|
|
2853
|
-
__payload: Payload;
|
|
2854
|
-
};
|
|
2855
|
-
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
2856
|
-
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
2857
|
-
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
2858
|
-
|
|
2859
|
-
declare global {
|
|
2860
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2861
|
-
interface SymbolConstructor {
|
|
2862
|
-
readonly observable: symbol;
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
2916
|
+
declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
2867
2917
|
|
|
2868
2918
|
declare const queryPublishedContent: MaybeContext<BuildRESTFunction<typeof queryPublishedContent$1> & typeof queryPublishedContent$1>;
|
|
2869
2919
|
|
|
@@ -8205,29 +8255,11 @@ interface BulkDeleteContentSignature {
|
|
|
8205
8255
|
*/
|
|
8206
8256
|
(contentIds: string[]): Promise<BulkDeleteContentResponse & BulkDeleteContentResponseNonNullableFields>;
|
|
8207
8257
|
}
|
|
8208
|
-
declare const onContentCreated$1: EventDefinition
|
|
8209
|
-
declare const onContentUpdated$1: EventDefinition
|
|
8210
|
-
declare const onContentDeleted$1: EventDefinition
|
|
8211
|
-
|
|
8212
|
-
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
8213
|
-
__type: 'event-definition';
|
|
8214
|
-
type: Type;
|
|
8215
|
-
isDomainEvent?: boolean;
|
|
8216
|
-
transformations?: (envelope: unknown) => Payload;
|
|
8217
|
-
__payload: Payload;
|
|
8218
|
-
};
|
|
8219
|
-
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
8220
|
-
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
8221
|
-
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
8222
|
-
|
|
8223
|
-
declare global {
|
|
8224
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
8225
|
-
interface SymbolConstructor {
|
|
8226
|
-
readonly observable: symbol;
|
|
8227
|
-
}
|
|
8228
|
-
}
|
|
8258
|
+
declare const onContentCreated$1: EventDefinition<ContentCreatedEnvelope, "wix.multilingual.translation.v1.content_created">;
|
|
8259
|
+
declare const onContentUpdated$1: EventDefinition<ContentUpdatedEnvelope, "wix.multilingual.translation.v1.content_updated">;
|
|
8260
|
+
declare const onContentDeleted$1: EventDefinition<ContentDeletedEnvelope, "wix.multilingual.translation.v1.content_deleted">;
|
|
8229
8261
|
|
|
8230
|
-
declare function createEventModule$1<T extends EventDefinition
|
|
8262
|
+
declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
8231
8263
|
|
|
8232
8264
|
declare const createContent: MaybeContext<BuildRESTFunction<typeof createContent$1> & typeof createContent$1>;
|
|
8233
8265
|
declare const getContent: MaybeContext<BuildRESTFunction<typeof getContent$1> & typeof getContent$1>;
|
|
@@ -9524,27 +9556,9 @@ interface ListSiteSchemasSignature {
|
|
|
9524
9556
|
*/
|
|
9525
9557
|
(options?: ListSiteSchemasOptions | undefined): Promise<ListSiteSchemasResponse & ListSiteSchemasResponseNonNullableFields>;
|
|
9526
9558
|
}
|
|
9527
|
-
declare const onSchemaCreated$1: EventDefinition
|
|
9528
|
-
declare const onSchemaUpdated$1: EventDefinition
|
|
9529
|
-
declare const onSchemaDeleted$1: EventDefinition
|
|
9530
|
-
|
|
9531
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
9532
|
-
__type: 'event-definition';
|
|
9533
|
-
type: Type;
|
|
9534
|
-
isDomainEvent?: boolean;
|
|
9535
|
-
transformations?: (envelope: unknown) => Payload;
|
|
9536
|
-
__payload: Payload;
|
|
9537
|
-
};
|
|
9538
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
9539
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
9540
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
9541
|
-
|
|
9542
|
-
declare global {
|
|
9543
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
9544
|
-
interface SymbolConstructor {
|
|
9545
|
-
readonly observable: symbol;
|
|
9546
|
-
}
|
|
9547
|
-
}
|
|
9559
|
+
declare const onSchemaCreated$1: EventDefinition<SchemaCreatedEnvelope, "wix.multilingual.translation.v1.schema_created">;
|
|
9560
|
+
declare const onSchemaUpdated$1: EventDefinition<SchemaUpdatedEnvelope, "wix.multilingual.translation.v1.schema_updated">;
|
|
9561
|
+
declare const onSchemaDeleted$1: EventDefinition<SchemaDeletedEnvelope, "wix.multilingual.translation.v1.schema_deleted">;
|
|
9548
9562
|
|
|
9549
9563
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
9550
9564
|
|
|
@@ -12,6 +12,10 @@ type Host<Environment = unknown> = {
|
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional name of the environment, use for logging
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
15
19
|
/**
|
|
16
20
|
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
21
|
*/
|
|
@@ -63,16 +67,16 @@ type APIMetadata = {
|
|
|
63
67
|
packageName?: string;
|
|
64
68
|
};
|
|
65
69
|
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
-
type EventDefinition
|
|
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
81
|
type ServicePluginMethodInput = {
|
|
78
82
|
request: any;
|
|
@@ -271,6 +275,72 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
|
|
|
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<Base, Condition> =
|
|
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`.
|
|
@@ -367,7 +435,7 @@ ConditionalKeys<Base, Condition>
|
|
|
367
435
|
* can either be a REST module or a host module.
|
|
368
436
|
* This type is recursive, so it can describe nested modules.
|
|
369
437
|
*/
|
|
370
|
-
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition
|
|
438
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
371
439
|
[key: string]: Descriptors | PublicMetadata | any;
|
|
372
440
|
};
|
|
373
441
|
/**
|
|
@@ -380,7 +448,7 @@ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, De
|
|
|
380
448
|
done: T;
|
|
381
449
|
recurse: T extends {
|
|
382
450
|
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
-
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition
|
|
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<{
|
|
384
452
|
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
385
453
|
-1,
|
|
386
454
|
0,
|
|
@@ -2841,29 +2909,11 @@ interface QueryPublishedContentSignature {
|
|
|
2841
2909
|
*/
|
|
2842
2910
|
(): PublishedContentQueryBuilder;
|
|
2843
2911
|
}
|
|
2844
|
-
declare const onPublishedContentCreated$1: EventDefinition
|
|
2845
|
-
declare const onPublishedContentUpdated$1: EventDefinition
|
|
2846
|
-
declare const onPublishedContentDeleted$1: EventDefinition
|
|
2912
|
+
declare const onPublishedContentCreated$1: EventDefinition<PublishedContentCreatedEnvelope, "wix.multilingual.localization_public.v3.published_content_created">;
|
|
2913
|
+
declare const onPublishedContentUpdated$1: EventDefinition<PublishedContentUpdatedEnvelope, "wix.multilingual.localization_public.v3.published_content_updated">;
|
|
2914
|
+
declare const onPublishedContentDeleted$1: EventDefinition<PublishedContentDeletedEnvelope, "wix.multilingual.localization_public.v3.published_content_deleted">;
|
|
2847
2915
|
|
|
2848
|
-
|
|
2849
|
-
__type: 'event-definition';
|
|
2850
|
-
type: Type;
|
|
2851
|
-
isDomainEvent?: boolean;
|
|
2852
|
-
transformations?: (envelope: unknown) => Payload;
|
|
2853
|
-
__payload: Payload;
|
|
2854
|
-
};
|
|
2855
|
-
declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
|
|
2856
|
-
type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
|
|
2857
|
-
type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
|
|
2858
|
-
|
|
2859
|
-
declare global {
|
|
2860
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2861
|
-
interface SymbolConstructor {
|
|
2862
|
-
readonly observable: symbol;
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
|
|
2916
|
+
declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
2867
2917
|
|
|
2868
2918
|
declare const queryPublishedContent: MaybeContext<BuildRESTFunction<typeof queryPublishedContent$1> & typeof queryPublishedContent$1>;
|
|
2869
2919
|
|
|
@@ -8205,29 +8255,11 @@ interface BulkDeleteContentSignature {
|
|
|
8205
8255
|
*/
|
|
8206
8256
|
(contentIds: string[]): Promise<BulkDeleteContentResponse & BulkDeleteContentResponseNonNullableFields>;
|
|
8207
8257
|
}
|
|
8208
|
-
declare const onContentCreated$1: EventDefinition
|
|
8209
|
-
declare const onContentUpdated$1: EventDefinition
|
|
8210
|
-
declare const onContentDeleted$1: EventDefinition
|
|
8211
|
-
|
|
8212
|
-
type EventDefinition$1<Payload = unknown, Type extends string = string> = {
|
|
8213
|
-
__type: 'event-definition';
|
|
8214
|
-
type: Type;
|
|
8215
|
-
isDomainEvent?: boolean;
|
|
8216
|
-
transformations?: (envelope: unknown) => Payload;
|
|
8217
|
-
__payload: Payload;
|
|
8218
|
-
};
|
|
8219
|
-
declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
|
|
8220
|
-
type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
|
|
8221
|
-
type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
|
|
8222
|
-
|
|
8223
|
-
declare global {
|
|
8224
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
8225
|
-
interface SymbolConstructor {
|
|
8226
|
-
readonly observable: symbol;
|
|
8227
|
-
}
|
|
8228
|
-
}
|
|
8258
|
+
declare const onContentCreated$1: EventDefinition<ContentCreatedEnvelope, "wix.multilingual.translation.v1.content_created">;
|
|
8259
|
+
declare const onContentUpdated$1: EventDefinition<ContentUpdatedEnvelope, "wix.multilingual.translation.v1.content_updated">;
|
|
8260
|
+
declare const onContentDeleted$1: EventDefinition<ContentDeletedEnvelope, "wix.multilingual.translation.v1.content_deleted">;
|
|
8229
8261
|
|
|
8230
|
-
declare function createEventModule$1<T extends EventDefinition
|
|
8262
|
+
declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
8231
8263
|
|
|
8232
8264
|
declare const createContent: MaybeContext<BuildRESTFunction<typeof createContent$1> & typeof createContent$1>;
|
|
8233
8265
|
declare const getContent: MaybeContext<BuildRESTFunction<typeof getContent$1> & typeof getContent$1>;
|
|
@@ -9524,27 +9556,9 @@ interface ListSiteSchemasSignature {
|
|
|
9524
9556
|
*/
|
|
9525
9557
|
(options?: ListSiteSchemasOptions | undefined): Promise<ListSiteSchemasResponse & ListSiteSchemasResponseNonNullableFields>;
|
|
9526
9558
|
}
|
|
9527
|
-
declare const onSchemaCreated$1: EventDefinition
|
|
9528
|
-
declare const onSchemaUpdated$1: EventDefinition
|
|
9529
|
-
declare const onSchemaDeleted$1: EventDefinition
|
|
9530
|
-
|
|
9531
|
-
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
9532
|
-
__type: 'event-definition';
|
|
9533
|
-
type: Type;
|
|
9534
|
-
isDomainEvent?: boolean;
|
|
9535
|
-
transformations?: (envelope: unknown) => Payload;
|
|
9536
|
-
__payload: Payload;
|
|
9537
|
-
};
|
|
9538
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
9539
|
-
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
9540
|
-
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
9541
|
-
|
|
9542
|
-
declare global {
|
|
9543
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
9544
|
-
interface SymbolConstructor {
|
|
9545
|
-
readonly observable: symbol;
|
|
9546
|
-
}
|
|
9547
|
-
}
|
|
9559
|
+
declare const onSchemaCreated$1: EventDefinition<SchemaCreatedEnvelope, "wix.multilingual.translation.v1.schema_created">;
|
|
9560
|
+
declare const onSchemaUpdated$1: EventDefinition<SchemaUpdatedEnvelope, "wix.multilingual.translation.v1.schema_updated">;
|
|
9561
|
+
declare const onSchemaDeleted$1: EventDefinition<SchemaDeletedEnvelope, "wix.multilingual.translation.v1.schema_deleted">;
|
|
9548
9562
|
|
|
9549
9563
|
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
9550
9564
|
|