@wix/categories 1.0.53 → 1.0.55

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/categories",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -18,7 +18,7 @@
18
18
  "type-bundles"
19
19
  ],
20
20
  "dependencies": {
21
- "@wix/categories_categories": "1.0.30"
21
+ "@wix/categories_categories": "1.0.32"
22
22
  },
23
23
  "devDependencies": {
24
24
  "glob": "^10.4.1",
@@ -43,5 +43,5 @@
43
43
  "fqdn": ""
44
44
  }
45
45
  },
46
- "falconPackageHash": "73f1bde5d3e8040cb620d80ef7f62802278eda1a8c9eeddf4925a052"
46
+ "falconPackageHash": "ba141dc4ec4354746f011c455c43cc9d5ebb4e6fba61e2d1223a8340"
47
47
  }
@@ -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$1<Payload = unknown, Type extends string = string> = {
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$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
74
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
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> = NonNullable<
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 since the condition passes.
314
- ? Key
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$1<any> | ServicePluginDefinition<any> | {
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$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
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,
@@ -537,7 +605,7 @@ interface Keyword {
537
605
  term?: string;
538
606
  /** Whether the keyword is the main focus keyword. */
539
607
  isMain?: boolean;
540
- /** Who added the keyword to the settings */
608
+ /** The source that added the keyword terms to the SEO settings. */
541
609
  origin?: string | null;
542
610
  }
543
611
  interface Tag {
@@ -4169,31 +4237,13 @@ interface GetArrangedItemsSignature {
4169
4237
  */
4170
4238
  (categoryId: string, treeReference: TreeReference): Promise<GetArrangedItemsResponse & GetArrangedItemsResponseNonNullableFields>;
4171
4239
  }
4172
- declare const onCategoryCreated$1: EventDefinition$1<CategoryCreatedEnvelope, "wix.categories.v1.category_created">;
4173
- declare const onCategoryUpdated$1: EventDefinition$1<CategoryUpdatedEnvelope, "wix.categories.v1.category_updated">;
4174
- declare const onCategoryDeleted$1: EventDefinition$1<CategoryDeletedEnvelope, "wix.categories.v1.category_deleted">;
4175
- declare const onCategoryMoved$1: EventDefinition$1<CategoryMovedEnvelope, "wix.categories.v1.category_category_moved">;
4176
- declare const onCategoryItemAddedToCategory$1: EventDefinition$1<CategoryItemAddedToCategoryEnvelope, "wix.categories.v1.category_item_added_to_category">;
4177
- declare const onCategoryItemRemovedFromCategory$1: EventDefinition$1<CategoryItemRemovedFromCategoryEnvelope, "wix.categories.v1.category_item_removed_from_category">;
4178
- declare const onCategoryItemsArrangedInCategory$1: EventDefinition$1<CategoryItemsArrangedInCategoryEnvelope, "wix.categories.v1.category_items_arranged_in_category">;
4179
-
4180
- type EventDefinition<Payload = unknown, Type extends string = string> = {
4181
- __type: 'event-definition';
4182
- type: Type;
4183
- isDomainEvent?: boolean;
4184
- transformations?: (envelope: unknown) => Payload;
4185
- __payload: Payload;
4186
- };
4187
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
4188
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
4189
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
4190
-
4191
- declare global {
4192
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4193
- interface SymbolConstructor {
4194
- readonly observable: symbol;
4195
- }
4196
- }
4240
+ declare const onCategoryCreated$1: EventDefinition<CategoryCreatedEnvelope, "wix.categories.v1.category_created">;
4241
+ declare const onCategoryUpdated$1: EventDefinition<CategoryUpdatedEnvelope, "wix.categories.v1.category_updated">;
4242
+ declare const onCategoryDeleted$1: EventDefinition<CategoryDeletedEnvelope, "wix.categories.v1.category_deleted">;
4243
+ declare const onCategoryMoved$1: EventDefinition<CategoryMovedEnvelope, "wix.categories.v1.category_category_moved">;
4244
+ declare const onCategoryItemAddedToCategory$1: EventDefinition<CategoryItemAddedToCategoryEnvelope, "wix.categories.v1.category_item_added_to_category">;
4245
+ declare const onCategoryItemRemovedFromCategory$1: EventDefinition<CategoryItemRemovedFromCategoryEnvelope, "wix.categories.v1.category_item_removed_from_category">;
4246
+ declare const onCategoryItemsArrangedInCategory$1: EventDefinition<CategoryItemsArrangedInCategoryEnvelope, "wix.categories.v1.category_items_arranged_in_category">;
4197
4247
 
4198
4248
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
4199
4249
 
@@ -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$1<Payload = unknown, Type extends string = string> = {
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$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
74
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
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> = NonNullable<
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 since the condition passes.
314
- ? Key
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$1<any> | ServicePluginDefinition<any> | {
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$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
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,
@@ -537,7 +605,7 @@ interface Keyword {
537
605
  term?: string;
538
606
  /** Whether the keyword is the main focus keyword. */
539
607
  isMain?: boolean;
540
- /** Who added the keyword to the settings */
608
+ /** The source that added the keyword terms to the SEO settings. */
541
609
  origin?: string | null;
542
610
  }
543
611
  interface Tag {
@@ -4169,31 +4237,13 @@ interface GetArrangedItemsSignature {
4169
4237
  */
4170
4238
  (categoryId: string, treeReference: TreeReference): Promise<GetArrangedItemsResponse & GetArrangedItemsResponseNonNullableFields>;
4171
4239
  }
4172
- declare const onCategoryCreated$1: EventDefinition$1<CategoryCreatedEnvelope, "wix.categories.v1.category_created">;
4173
- declare const onCategoryUpdated$1: EventDefinition$1<CategoryUpdatedEnvelope, "wix.categories.v1.category_updated">;
4174
- declare const onCategoryDeleted$1: EventDefinition$1<CategoryDeletedEnvelope, "wix.categories.v1.category_deleted">;
4175
- declare const onCategoryMoved$1: EventDefinition$1<CategoryMovedEnvelope, "wix.categories.v1.category_category_moved">;
4176
- declare const onCategoryItemAddedToCategory$1: EventDefinition$1<CategoryItemAddedToCategoryEnvelope, "wix.categories.v1.category_item_added_to_category">;
4177
- declare const onCategoryItemRemovedFromCategory$1: EventDefinition$1<CategoryItemRemovedFromCategoryEnvelope, "wix.categories.v1.category_item_removed_from_category">;
4178
- declare const onCategoryItemsArrangedInCategory$1: EventDefinition$1<CategoryItemsArrangedInCategoryEnvelope, "wix.categories.v1.category_items_arranged_in_category">;
4179
-
4180
- type EventDefinition<Payload = unknown, Type extends string = string> = {
4181
- __type: 'event-definition';
4182
- type: Type;
4183
- isDomainEvent?: boolean;
4184
- transformations?: (envelope: unknown) => Payload;
4185
- __payload: Payload;
4186
- };
4187
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
4188
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
4189
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
4190
-
4191
- declare global {
4192
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4193
- interface SymbolConstructor {
4194
- readonly observable: symbol;
4195
- }
4196
- }
4240
+ declare const onCategoryCreated$1: EventDefinition<CategoryCreatedEnvelope, "wix.categories.v1.category_created">;
4241
+ declare const onCategoryUpdated$1: EventDefinition<CategoryUpdatedEnvelope, "wix.categories.v1.category_updated">;
4242
+ declare const onCategoryDeleted$1: EventDefinition<CategoryDeletedEnvelope, "wix.categories.v1.category_deleted">;
4243
+ declare const onCategoryMoved$1: EventDefinition<CategoryMovedEnvelope, "wix.categories.v1.category_category_moved">;
4244
+ declare const onCategoryItemAddedToCategory$1: EventDefinition<CategoryItemAddedToCategoryEnvelope, "wix.categories.v1.category_item_added_to_category">;
4245
+ declare const onCategoryItemRemovedFromCategory$1: EventDefinition<CategoryItemRemovedFromCategoryEnvelope, "wix.categories.v1.category_item_removed_from_category">;
4246
+ declare const onCategoryItemsArrangedInCategory$1: EventDefinition<CategoryItemsArrangedInCategoryEnvelope, "wix.categories.v1.category_items_arranged_in_category">;
4197
4247
 
4198
4248
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
4199
4249