@wix/blog 1.0.289 → 1.0.291

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.
@@ -1,8 +1,47 @@
1
+ type HostModule<T, H extends Host> = {
2
+ __type: 'host';
3
+ create(host: H): T;
4
+ };
5
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
+ type Host<Environment = unknown> = {
7
+ channel: {
8
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
+ disconnect: () => void;
10
+ } | Promise<{
11
+ disconnect: () => void;
12
+ }>;
13
+ };
14
+ environment?: Environment;
15
+ /**
16
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
17
+ */
18
+ apiBaseUrl?: string;
19
+ /**
20
+ * Possible data to be provided by every host, for cross cutting concerns
21
+ * like internationalization, billing, etc.
22
+ */
23
+ essentials?: {
24
+ /**
25
+ * The language of the currently viewed session
26
+ */
27
+ language?: string;
28
+ /**
29
+ * The locale of the currently viewed session
30
+ */
31
+ locale?: string;
32
+ /**
33
+ * Any headers that should be passed through to the API requests
34
+ */
35
+ passThroughHeaders?: Record<string, string>;
36
+ };
37
+ };
38
+
1
39
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
40
  interface HttpClient {
3
41
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
42
  fetchWithAuth: typeof fetch;
5
43
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
+ getActiveToken?: () => string | undefined;
6
45
  }
7
46
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
47
  type HttpResponse<T = any> = {
@@ -24,16 +63,65 @@ type APIMetadata = {
24
63
  packageName?: string;
25
64
  };
26
65
  type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
27
- type EventDefinition<Payload = unknown, Type extends string = string> = {
66
+ type EventDefinition$4<Payload = unknown, Type extends string = string> = {
28
67
  __type: 'event-definition';
29
68
  type: Type;
30
69
  isDomainEvent?: boolean;
31
70
  transformations?: (envelope: unknown) => Payload;
32
71
  __payload: Payload;
33
72
  };
34
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
35
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
36
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
73
+ declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
74
+ type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
75
+ type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
76
+
77
+ type ServicePluginMethodInput = {
78
+ request: any;
79
+ metadata: any;
80
+ };
81
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
82
+ type ServicePluginMethodMetadata = {
83
+ name: string;
84
+ primaryHttpMappingPath: string;
85
+ transformations: {
86
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
87
+ toREST: (...args: unknown[]) => unknown;
88
+ };
89
+ };
90
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
91
+ __type: 'service-plugin-definition';
92
+ componentType: string;
93
+ methods: ServicePluginMethodMetadata[];
94
+ __contract: Contract;
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";
99
+
100
+ type RequestContext = {
101
+ isSSR: boolean;
102
+ host: string;
103
+ protocol?: string;
104
+ };
105
+ type ResponseTransformer = (data: any, headers?: any) => any;
106
+ /**
107
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
+ */
111
+ type Method = '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> = {
113
+ _?: T;
114
+ url?: string;
115
+ method?: Method;
116
+ params?: any;
117
+ data?: any;
118
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
119
+ };
120
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
121
+ __isAmbassador: boolean;
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;
37
125
 
38
126
  declare global {
39
127
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -42,6 +130,284 @@ declare global {
42
130
  }
43
131
  }
44
132
 
133
+ declare const emptyObjectSymbol: unique symbol;
134
+
135
+ /**
136
+ Represents a strictly empty plain object, the `{}` value.
137
+
138
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
139
+
140
+ @example
141
+ ```
142
+ import type {EmptyObject} from 'type-fest';
143
+
144
+ // The following illustrates the problem with `{}`.
145
+ const foo1: {} = {}; // Pass
146
+ const foo2: {} = []; // Pass
147
+ const foo3: {} = 42; // Pass
148
+ const foo4: {} = {a: 1}; // Pass
149
+
150
+ // With `EmptyObject` only the first case is valid.
151
+ const bar1: EmptyObject = {}; // Pass
152
+ const bar2: EmptyObject = 42; // Fail
153
+ const bar3: EmptyObject = []; // Fail
154
+ const bar4: EmptyObject = {a: 1}; // Fail
155
+ ```
156
+
157
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
158
+
159
+ @category Object
160
+ */
161
+ type EmptyObject = {[emptyObjectSymbol]?: never};
162
+
163
+ /**
164
+ Returns a boolean for whether the two given types are equal.
165
+
166
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
167
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
168
+
169
+ Use-cases:
170
+ - If you want to make a conditional branch based on the result of a comparison of two types.
171
+
172
+ @example
173
+ ```
174
+ import type {IsEqual} from 'type-fest';
175
+
176
+ // This type returns a boolean for whether the given array includes the given item.
177
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
178
+ type Includes<Value extends readonly any[], Item> =
179
+ Value extends readonly [Value[0], ...infer rest]
180
+ ? IsEqual<Value[0], Item> extends true
181
+ ? true
182
+ : Includes<rest, Item>
183
+ : false;
184
+ ```
185
+
186
+ @category Type Guard
187
+ @category Utilities
188
+ */
189
+ type IsEqual<A, B> =
190
+ (<G>() => G extends A ? 1 : 2) extends
191
+ (<G>() => G extends B ? 1 : 2)
192
+ ? true
193
+ : false;
194
+
195
+ /**
196
+ Filter out keys from an object.
197
+
198
+ Returns `never` if `Exclude` is strictly equal to `Key`.
199
+ Returns `never` if `Key` extends `Exclude`.
200
+ Returns `Key` otherwise.
201
+
202
+ @example
203
+ ```
204
+ type Filtered = Filter<'foo', 'foo'>;
205
+ //=> never
206
+ ```
207
+
208
+ @example
209
+ ```
210
+ type Filtered = Filter<'bar', string>;
211
+ //=> never
212
+ ```
213
+
214
+ @example
215
+ ```
216
+ type Filtered = Filter<'bar', 'foo'>;
217
+ //=> 'bar'
218
+ ```
219
+
220
+ @see {Except}
221
+ */
222
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
+
224
+ type ExceptOptions = {
225
+ /**
226
+ Disallow assigning non-specified properties.
227
+
228
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
229
+
230
+ @default false
231
+ */
232
+ requireExactProps?: boolean;
233
+ };
234
+
235
+ /**
236
+ Create a type from an object type without certain keys.
237
+
238
+ We recommend setting the `requireExactProps` option to `true`.
239
+
240
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
241
+
242
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
243
+
244
+ @example
245
+ ```
246
+ import type {Except} from 'type-fest';
247
+
248
+ type Foo = {
249
+ a: number;
250
+ b: string;
251
+ };
252
+
253
+ type FooWithoutA = Except<Foo, 'a'>;
254
+ //=> {b: string}
255
+
256
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
257
+ //=> errors: 'a' does not exist in type '{ b: string; }'
258
+
259
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
260
+ //=> {a: number} & Partial<Record<"b", never>>
261
+
262
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
263
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
264
+ ```
265
+
266
+ @category Object
267
+ */
268
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
269
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
270
+ } & (Options['requireExactProps'] extends true
271
+ ? Partial<Record<KeysType, never>>
272
+ : {});
273
+
274
+ /**
275
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
276
+
277
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
278
+
279
+ @example
280
+ ```
281
+ import type {ConditionalKeys} from 'type-fest';
282
+
283
+ interface Example {
284
+ a: string;
285
+ b: string | number;
286
+ c?: string;
287
+ d: {};
288
+ }
289
+
290
+ type StringKeysOnly = ConditionalKeys<Example, string>;
291
+ //=> 'a'
292
+ ```
293
+
294
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
295
+
296
+ @example
297
+ ```
298
+ import type {ConditionalKeys} from 'type-fest';
299
+
300
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
301
+ //=> 'a' | 'c'
302
+ ```
303
+
304
+ @category Object
305
+ */
306
+ type ConditionalKeys<Base, Condition> = NonNullable<
307
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
308
+ {
309
+ // Map through all the keys of the given base type.
310
+ [Key in keyof Base]:
311
+ // Pick only keys with types extending the given `Condition` type.
312
+ Base[Key] extends Condition
313
+ // Retain this key since the condition passes.
314
+ ? Key
315
+ // Discard this key since the condition fails.
316
+ : never;
317
+
318
+ // Convert the produced object into a union type of the keys which passed the conditional test.
319
+ }[keyof Base]
320
+ >;
321
+
322
+ /**
323
+ Exclude keys from a shape that matches the given `Condition`.
324
+
325
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
326
+
327
+ @example
328
+ ```
329
+ import type {Primitive, ConditionalExcept} from 'type-fest';
330
+
331
+ class Awesome {
332
+ name: string;
333
+ successes: number;
334
+ failures: bigint;
335
+
336
+ run() {}
337
+ }
338
+
339
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
340
+ //=> {run: () => void}
341
+ ```
342
+
343
+ @example
344
+ ```
345
+ import type {ConditionalExcept} from 'type-fest';
346
+
347
+ interface Example {
348
+ a: string;
349
+ b: string | number;
350
+ c: () => void;
351
+ d: {};
352
+ }
353
+
354
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
355
+ //=> {b: string | number; c: () => void; d: {}}
356
+ ```
357
+
358
+ @category Object
359
+ */
360
+ type ConditionalExcept<Base, Condition> = Except<
361
+ Base,
362
+ ConditionalKeys<Base, Condition>
363
+ >;
364
+
365
+ /**
366
+ * Descriptors are objects that describe the API of a module, and the module
367
+ * can either be a REST module or a host module.
368
+ * This type is recursive, so it can describe nested modules.
369
+ */
370
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$4<any> | ServicePluginDefinition<any> | {
371
+ [key: string]: Descriptors | PublicMetadata | any;
372
+ };
373
+ /**
374
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
375
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
376
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
377
+ * do not match the given host (as they will not work with the given host).
378
+ */
379
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
380
+ done: T;
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$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
384
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
385
+ -1,
386
+ 0,
387
+ 1,
388
+ 2,
389
+ 3,
390
+ 4,
391
+ 5
392
+ ][Depth]> : never;
393
+ }, EmptyObject>;
394
+ }[Depth extends -1 ? 'done' : 'recurse'];
395
+ type PublicMetadata = {
396
+ PACKAGE_NAME?: string;
397
+ };
398
+
399
+ declare global {
400
+ interface ContextualClient {
401
+ }
402
+ }
403
+ /**
404
+ * A type used to create concerete types from SDK descriptors in
405
+ * case a contextual client is available.
406
+ */
407
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
408
+ host: Host;
409
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
410
+
45
411
  /** BlogCache is the main entity of BlogCacheService */
46
412
  interface BlogCache {
47
413
  /**
@@ -756,7 +1122,7 @@ interface GetBlogCacheSignature {
756
1122
  (): Promise<GetBlogCacheResponse & GetBlogCacheResponseNonNullableFields>;
757
1123
  }
758
1124
 
759
- declare const getBlogCache: BuildRESTFunction<typeof getBlogCache$1> & typeof getBlogCache$1;
1125
+ declare const getBlogCache: MaybeContext<BuildRESTFunction<typeof getBlogCache$1> & typeof getBlogCache$1>;
760
1126
 
761
1127
  type index_d$5_Address = Address;
762
1128
  type index_d$5_AddressHint = AddressHint;
@@ -907,10 +1273,10 @@ interface GetNotImportedPostsSignature {
907
1273
  (): Promise<GetNotImportedPostsResponse & GetNotImportedPostsResponseNonNullableFields>;
908
1274
  }
909
1275
 
910
- declare const startImport: BuildRESTFunction<typeof startImport$1> & typeof startImport$1;
911
- declare const submitUrlForImport: BuildRESTFunction<typeof submitUrlForImport$1> & typeof submitUrlForImport$1;
912
- declare const getImportStatus: BuildRESTFunction<typeof getImportStatus$1> & typeof getImportStatus$1;
913
- declare const getNotImportedPosts: BuildRESTFunction<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1;
1276
+ declare const startImport: MaybeContext<BuildRESTFunction<typeof startImport$1> & typeof startImport$1>;
1277
+ declare const submitUrlForImport: MaybeContext<BuildRESTFunction<typeof submitUrlForImport$1> & typeof submitUrlForImport$1>;
1278
+ declare const getImportStatus: MaybeContext<BuildRESTFunction<typeof getImportStatus$1> & typeof getImportStatus$1>;
1279
+ declare const getNotImportedPosts: MaybeContext<BuildRESTFunction<typeof getNotImportedPosts$1> & typeof getNotImportedPosts$1>;
914
1280
 
915
1281
  type index_d$4_GetImportStatusRequest = GetImportStatusRequest;
916
1282
  type index_d$4_GetImportStatusResponse = GetImportStatusResponse;
@@ -1637,27 +2003,27 @@ interface CategoriesQueryBuilder {
1637
2003
  /** @param propertyName - Property whose value is compared with `value`.
1638
2004
  * @param value - Value to compare against.
1639
2005
  */
1640
- eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'rank' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
2006
+ eq: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
1641
2007
  /** @param propertyName - Property whose value is compared with `value`.
1642
2008
  * @param value - Value to compare against.
1643
2009
  */
1644
- ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'rank' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
2010
+ ne: (propertyName: '_id' | 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
1645
2011
  /** @param propertyName - Property whose value is compared with `value`.
1646
2012
  * @param value - Value to compare against.
1647
2013
  */
1648
- ge: (propertyName: 'postCount' | 'rank' | 'displayPosition', value: any) => CategoriesQueryBuilder;
2014
+ ge: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
1649
2015
  /** @param propertyName - Property whose value is compared with `value`.
1650
2016
  * @param value - Value to compare against.
1651
2017
  */
1652
- gt: (propertyName: 'postCount' | 'rank' | 'displayPosition', value: any) => CategoriesQueryBuilder;
2018
+ gt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
1653
2019
  /** @param propertyName - Property whose value is compared with `value`.
1654
2020
  * @param value - Value to compare against.
1655
2021
  */
1656
- le: (propertyName: 'postCount' | 'rank' | 'displayPosition', value: any) => CategoriesQueryBuilder;
2022
+ le: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
1657
2023
  /** @param propertyName - Property whose value is compared with `value`.
1658
2024
  * @param value - Value to compare against.
1659
2025
  */
1660
- lt: (propertyName: 'postCount' | 'rank' | 'displayPosition', value: any) => CategoriesQueryBuilder;
2026
+ lt: (propertyName: 'postCount' | 'displayPosition', value: any) => CategoriesQueryBuilder;
1661
2027
  /** @param propertyName - Property whose value is compared with `string`.
1662
2028
  * @param string - String to compare against. Case-insensitive.
1663
2029
  */
@@ -1666,12 +2032,12 @@ interface CategoriesQueryBuilder {
1666
2032
  * @param values - List of values to compare against.
1667
2033
  */
1668
2034
  hasSome: (propertyName: '_id' | 'label' | 'title' | 'slug', value: any[]) => CategoriesQueryBuilder;
1669
- in: (propertyName: 'label' | 'postCount' | 'title' | 'rank' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
2035
+ in: (propertyName: 'label' | 'postCount' | 'title' | 'displayPosition' | 'translationId' | 'language', value: any) => CategoriesQueryBuilder;
1670
2036
  exists: (propertyName: 'label' | 'title' | 'translationId' | 'language', value: boolean) => CategoriesQueryBuilder;
1671
2037
  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1672
- ascending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'rank' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
2038
+ ascending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
1673
2039
  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
1674
- descending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'rank' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
2040
+ descending: (...propertyNames: Array<'label' | 'postCount' | 'title' | 'displayPosition' | 'language' | 'slug'>) => CategoriesQueryBuilder;
1675
2041
  /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
1676
2042
  limit: (limit: number) => CategoriesQueryBuilder;
1677
2043
  /** @param skip - Number of items to skip in the query results before returning the results. */
@@ -1741,16 +2107,34 @@ interface QueryCategoriesSignature {
1741
2107
  */
1742
2108
  (options?: QueryCategoriesOptions | undefined): CategoriesQueryBuilder;
1743
2109
  }
1744
- declare const onCategoryCreated$1: EventDefinition<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
1745
- declare const onCategoryUpdated$1: EventDefinition<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
1746
- declare const onCategoryDeleted$1: EventDefinition<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
2110
+ declare const onCategoryCreated$1: EventDefinition$4<CategoryCreatedEnvelope, "wix.blog.v3.category_created">;
2111
+ declare const onCategoryUpdated$1: EventDefinition$4<CategoryUpdatedEnvelope, "wix.blog.v3.category_updated">;
2112
+ declare const onCategoryDeleted$1: EventDefinition$4<CategoryDeletedEnvelope, "wix.blog.v3.category_deleted">;
1747
2113
 
1748
- declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
2114
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
2115
+ __type: 'event-definition';
2116
+ type: Type;
2117
+ isDomainEvent?: boolean;
2118
+ transformations?: (envelope: unknown) => Payload;
2119
+ __payload: Payload;
2120
+ };
2121
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
2122
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
2123
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
1749
2124
 
1750
- declare const getCategory: BuildRESTFunction<typeof getCategory$1> & typeof getCategory$1;
1751
- declare const getCategoryBySlug: BuildRESTFunction<typeof getCategoryBySlug$1> & typeof getCategoryBySlug$1;
1752
- declare const listCategories: BuildRESTFunction<typeof listCategories$1> & typeof listCategories$1;
1753
- declare const queryCategories: BuildRESTFunction<typeof queryCategories$1> & typeof queryCategories$1;
2125
+ declare global {
2126
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2127
+ interface SymbolConstructor {
2128
+ readonly observable: symbol;
2129
+ }
2130
+ }
2131
+
2132
+ declare function createEventModule$3<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
2133
+
2134
+ declare const getCategory: MaybeContext<BuildRESTFunction<typeof getCategory$1> & typeof getCategory$1>;
2135
+ declare const getCategoryBySlug: MaybeContext<BuildRESTFunction<typeof getCategoryBySlug$1> & typeof getCategoryBySlug$1>;
2136
+ declare const listCategories: MaybeContext<BuildRESTFunction<typeof listCategories$1> & typeof listCategories$1>;
2137
+ declare const queryCategories: MaybeContext<BuildRESTFunction<typeof queryCategories$1> & typeof queryCategories$1>;
1754
2138
 
1755
2139
  type _publicOnCategoryCreatedType = typeof onCategoryCreated$1;
1756
2140
  /**
@@ -5289,26 +5673,44 @@ interface PublishDraftPostSignature {
5289
5673
  */
5290
5674
  (draftPostId: string): Promise<PublishDraftPostResponse & PublishDraftPostResponseNonNullableFields>;
5291
5675
  }
5292
- declare const onDraftCreated$1: EventDefinition<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
5293
- declare const onDraftUpdated$1: EventDefinition<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
5294
- declare const onDraftDeleted$1: EventDefinition<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
5676
+ declare const onDraftCreated$1: EventDefinition$4<DraftCreatedEnvelope, "wix.blog.v3.draft_created">;
5677
+ declare const onDraftUpdated$1: EventDefinition$4<DraftUpdatedEnvelope, "wix.blog.v3.draft_updated">;
5678
+ declare const onDraftDeleted$1: EventDefinition$4<DraftDeletedEnvelope, "wix.blog.v3.draft_deleted">;
5679
+
5680
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
5681
+ __type: 'event-definition';
5682
+ type: Type;
5683
+ isDomainEvent?: boolean;
5684
+ transformations?: (envelope: unknown) => Payload;
5685
+ __payload: Payload;
5686
+ };
5687
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
5688
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
5689
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
5690
+
5691
+ declare global {
5692
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5693
+ interface SymbolConstructor {
5694
+ readonly observable: symbol;
5695
+ }
5696
+ }
5295
5697
 
5296
- declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
5698
+ declare function createEventModule$2<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
5297
5699
 
5298
- declare const createDraftPost: BuildRESTFunction<typeof createDraftPost$1> & typeof createDraftPost$1;
5299
- declare const bulkCreateDraftPosts: BuildRESTFunction<typeof bulkCreateDraftPosts$1> & typeof bulkCreateDraftPosts$1;
5300
- declare const bulkUpdateDraftPosts: BuildRESTFunction<typeof bulkUpdateDraftPosts$1> & typeof bulkUpdateDraftPosts$1;
5301
- declare const listDeletedDraftPosts: BuildRESTFunction<typeof listDeletedDraftPosts$1> & typeof listDeletedDraftPosts$1;
5302
- declare const getDraftPost: BuildRESTFunction<typeof getDraftPost$1> & typeof getDraftPost$1;
5303
- declare const updateDraftPost: BuildRESTFunction<typeof updateDraftPost$1> & typeof updateDraftPost$1;
5304
- declare const deleteDraftPost: BuildRESTFunction<typeof deleteDraftPost$1> & typeof deleteDraftPost$1;
5305
- declare const removeFromTrashBin: BuildRESTFunction<typeof removeFromTrashBin$1> & typeof removeFromTrashBin$1;
5306
- declare const bulkDeleteDraftPosts: BuildRESTFunction<typeof bulkDeleteDraftPosts$1> & typeof bulkDeleteDraftPosts$1;
5307
- declare const listDraftPosts: BuildRESTFunction<typeof listDraftPosts$1> & typeof listDraftPosts$1;
5308
- declare const getDeletedDraftPost: BuildRESTFunction<typeof getDeletedDraftPost$1> & typeof getDeletedDraftPost$1;
5309
- declare const restoreFromTrashBin: BuildRESTFunction<typeof restoreFromTrashBin$1> & typeof restoreFromTrashBin$1;
5310
- declare const queryDraftPosts: BuildRESTFunction<typeof queryDraftPosts$1> & typeof queryDraftPosts$1;
5311
- declare const publishDraftPost: BuildRESTFunction<typeof publishDraftPost$1> & typeof publishDraftPost$1;
5700
+ declare const createDraftPost: MaybeContext<BuildRESTFunction<typeof createDraftPost$1> & typeof createDraftPost$1>;
5701
+ declare const bulkCreateDraftPosts: MaybeContext<BuildRESTFunction<typeof bulkCreateDraftPosts$1> & typeof bulkCreateDraftPosts$1>;
5702
+ declare const bulkUpdateDraftPosts: MaybeContext<BuildRESTFunction<typeof bulkUpdateDraftPosts$1> & typeof bulkUpdateDraftPosts$1>;
5703
+ declare const listDeletedDraftPosts: MaybeContext<BuildRESTFunction<typeof listDeletedDraftPosts$1> & typeof listDeletedDraftPosts$1>;
5704
+ declare const getDraftPost: MaybeContext<BuildRESTFunction<typeof getDraftPost$1> & typeof getDraftPost$1>;
5705
+ declare const updateDraftPost: MaybeContext<BuildRESTFunction<typeof updateDraftPost$1> & typeof updateDraftPost$1>;
5706
+ declare const deleteDraftPost: MaybeContext<BuildRESTFunction<typeof deleteDraftPost$1> & typeof deleteDraftPost$1>;
5707
+ declare const removeFromTrashBin: MaybeContext<BuildRESTFunction<typeof removeFromTrashBin$1> & typeof removeFromTrashBin$1>;
5708
+ declare const bulkDeleteDraftPosts: MaybeContext<BuildRESTFunction<typeof bulkDeleteDraftPosts$1> & typeof bulkDeleteDraftPosts$1>;
5709
+ declare const listDraftPosts: MaybeContext<BuildRESTFunction<typeof listDraftPosts$1> & typeof listDraftPosts$1>;
5710
+ declare const getDeletedDraftPost: MaybeContext<BuildRESTFunction<typeof getDeletedDraftPost$1> & typeof getDeletedDraftPost$1>;
5711
+ declare const restoreFromTrashBin: MaybeContext<BuildRESTFunction<typeof restoreFromTrashBin$1> & typeof restoreFromTrashBin$1>;
5712
+ declare const queryDraftPosts: MaybeContext<BuildRESTFunction<typeof queryDraftPosts$1> & typeof queryDraftPosts$1>;
5713
+ declare const publishDraftPost: MaybeContext<BuildRESTFunction<typeof publishDraftPost$1> & typeof publishDraftPost$1>;
5312
5714
 
5313
5715
  type _publicOnDraftCreatedType = typeof onDraftCreated$1;
5314
5716
  /**
@@ -9051,21 +9453,39 @@ interface GetTotalPostsSignature {
9051
9453
  */
9052
9454
  (options?: GetTotalPostsOptions | undefined): Promise<GetTotalPostsResponse & GetTotalPostsResponseNonNullableFields>;
9053
9455
  }
9054
- declare const onPostCreated$1: EventDefinition<PostCreatedEnvelope, "wix.blog.v3.post_created">;
9055
- declare const onPostUpdated$1: EventDefinition<PostUpdatedEnvelope, "wix.blog.v3.post_updated">;
9056
- declare const onPostDeleted$1: EventDefinition<PostDeletedEnvelope, "wix.blog.v3.post_deleted">;
9057
- declare const onPostLiked$1: EventDefinition<PostLikedEnvelope, "wix.blog.v3.post_liked">;
9058
- declare const onPostUnliked$1: EventDefinition<PostUnlikedEnvelope, "wix.blog.v3.post_unliked">;
9456
+ declare const onPostCreated$1: EventDefinition$4<PostCreatedEnvelope, "wix.blog.v3.post_created">;
9457
+ declare const onPostUpdated$1: EventDefinition$4<PostUpdatedEnvelope, "wix.blog.v3.post_updated">;
9458
+ declare const onPostDeleted$1: EventDefinition$4<PostDeletedEnvelope, "wix.blog.v3.post_deleted">;
9459
+ declare const onPostLiked$1: EventDefinition$4<PostLikedEnvelope, "wix.blog.v3.post_liked">;
9460
+ declare const onPostUnliked$1: EventDefinition$4<PostUnlikedEnvelope, "wix.blog.v3.post_unliked">;
9461
+
9462
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
9463
+ __type: 'event-definition';
9464
+ type: Type;
9465
+ isDomainEvent?: boolean;
9466
+ transformations?: (envelope: unknown) => Payload;
9467
+ __payload: Payload;
9468
+ };
9469
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
9470
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
9471
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
9059
9472
 
9060
- declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
9473
+ declare global {
9474
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
9475
+ interface SymbolConstructor {
9476
+ readonly observable: symbol;
9477
+ }
9478
+ }
9061
9479
 
9062
- declare const getPost: BuildRESTFunction<typeof getPost$1> & typeof getPost$1;
9063
- declare const getPostBySlug: BuildRESTFunction<typeof getPostBySlug$1> & typeof getPostBySlug$1;
9064
- declare const listPosts: BuildRESTFunction<typeof listPosts$1> & typeof listPosts$1;
9065
- declare const queryPosts: BuildRESTFunction<typeof queryPosts$1> & typeof queryPosts$1;
9066
- declare const getPostMetrics: BuildRESTFunction<typeof getPostMetrics$1> & typeof getPostMetrics$1;
9067
- declare const queryPostCountStats: BuildRESTFunction<typeof queryPostCountStats$1> & typeof queryPostCountStats$1;
9068
- declare const getTotalPosts: BuildRESTFunction<typeof getTotalPosts$1> & typeof getTotalPosts$1;
9480
+ declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
9481
+
9482
+ declare const getPost: MaybeContext<BuildRESTFunction<typeof getPost$1> & typeof getPost$1>;
9483
+ declare const getPostBySlug: MaybeContext<BuildRESTFunction<typeof getPostBySlug$1> & typeof getPostBySlug$1>;
9484
+ declare const listPosts: MaybeContext<BuildRESTFunction<typeof listPosts$1> & typeof listPosts$1>;
9485
+ declare const queryPosts: MaybeContext<BuildRESTFunction<typeof queryPosts$1> & typeof queryPosts$1>;
9486
+ declare const getPostMetrics: MaybeContext<BuildRESTFunction<typeof getPostMetrics$1> & typeof getPostMetrics$1>;
9487
+ declare const queryPostCountStats: MaybeContext<BuildRESTFunction<typeof queryPostCountStats$1> & typeof queryPostCountStats$1>;
9488
+ declare const getTotalPosts: MaybeContext<BuildRESTFunction<typeof getTotalPosts$1> & typeof getTotalPosts$1>;
9069
9489
 
9070
9490
  type _publicOnPostCreatedType = typeof onPostCreated$1;
9071
9491
  /**
@@ -10389,18 +10809,36 @@ interface DeleteTagSignature {
10389
10809
  */
10390
10810
  (tagId: string): Promise<void>;
10391
10811
  }
10392
- declare const onTagCreated$1: EventDefinition<TagCreatedEnvelope, "wix.blog.v3.tag_created">;
10393
- declare const onTagUpdated$1: EventDefinition<TagUpdatedEnvelope, "wix.blog.v3.tag_updated">;
10394
- declare const onTagDeleted$1: EventDefinition<TagDeletedEnvelope, "wix.blog.v3.tag_deleted">;
10812
+ declare const onTagCreated$1: EventDefinition$4<TagCreatedEnvelope, "wix.blog.v3.tag_created">;
10813
+ declare const onTagUpdated$1: EventDefinition$4<TagUpdatedEnvelope, "wix.blog.v3.tag_updated">;
10814
+ declare const onTagDeleted$1: EventDefinition$4<TagDeletedEnvelope, "wix.blog.v3.tag_deleted">;
10815
+
10816
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
10817
+ __type: 'event-definition';
10818
+ type: Type;
10819
+ isDomainEvent?: boolean;
10820
+ transformations?: (envelope: unknown) => Payload;
10821
+ __payload: Payload;
10822
+ };
10823
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
10824
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
10825
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
10826
+
10827
+ declare global {
10828
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
10829
+ interface SymbolConstructor {
10830
+ readonly observable: symbol;
10831
+ }
10832
+ }
10395
10833
 
10396
10834
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
10397
10835
 
10398
- declare const createTag: BuildRESTFunction<typeof createTag$1> & typeof createTag$1;
10399
- declare const getTagByLabel: BuildRESTFunction<typeof getTagByLabel$1> & typeof getTagByLabel$1;
10400
- declare const getTag: BuildRESTFunction<typeof getTag$1> & typeof getTag$1;
10401
- declare const getTagBySlug: BuildRESTFunction<typeof getTagBySlug$1> & typeof getTagBySlug$1;
10402
- declare const queryTags: BuildRESTFunction<typeof queryTags$1> & typeof queryTags$1;
10403
- declare const deleteTag: BuildRESTFunction<typeof deleteTag$1> & typeof deleteTag$1;
10836
+ declare const createTag: MaybeContext<BuildRESTFunction<typeof createTag$1> & typeof createTag$1>;
10837
+ declare const getTagByLabel: MaybeContext<BuildRESTFunction<typeof getTagByLabel$1> & typeof getTagByLabel$1>;
10838
+ declare const getTag: MaybeContext<BuildRESTFunction<typeof getTag$1> & typeof getTag$1>;
10839
+ declare const getTagBySlug: MaybeContext<BuildRESTFunction<typeof getTagBySlug$1> & typeof getTagBySlug$1>;
10840
+ declare const queryTags: MaybeContext<BuildRESTFunction<typeof queryTags$1> & typeof queryTags$1>;
10841
+ declare const deleteTag: MaybeContext<BuildRESTFunction<typeof deleteTag$1> & typeof deleteTag$1>;
10404
10842
 
10405
10843
  type _publicOnTagCreatedType = typeof onTagCreated$1;
10406
10844
  /**