@wix/autocms-collection-metadata-service 1.0.4 → 1.0.6

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,51 @@
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 name of the environment, use for logging
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
21
+ */
22
+ apiBaseUrl?: string;
23
+ /**
24
+ * Possible data to be provided by every host, for cross cutting concerns
25
+ * like internationalization, billing, etc.
26
+ */
27
+ essentials?: {
28
+ /**
29
+ * The language of the currently viewed session
30
+ */
31
+ language?: string;
32
+ /**
33
+ * The locale of the currently viewed session
34
+ */
35
+ locale?: string;
36
+ /**
37
+ * Any headers that should be passed through to the API requests
38
+ */
39
+ passThroughHeaders?: Record<string, string>;
40
+ };
41
+ };
42
+
1
43
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
44
  interface HttpClient {
3
45
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
46
  fetchWithAuth: typeof fetch;
5
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
+ getActiveToken?: () => string | undefined;
6
49
  }
7
50
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
51
  type HttpResponse<T = any> = {
@@ -35,6 +78,55 @@ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?
35
78
  type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
36
79
  type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
37
80
 
81
+ type ServicePluginMethodInput = {
82
+ request: any;
83
+ metadata: any;
84
+ };
85
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata = {
87
+ name: string;
88
+ primaryHttpMappingPath: string;
89
+ transformations: {
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
+ toREST: (...args: unknown[]) => unknown;
92
+ };
93
+ };
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
+ __type: 'service-plugin-definition';
96
+ componentType: string;
97
+ methods: ServicePluginMethodMetadata[];
98
+ __contract: Contract;
99
+ };
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";
103
+
104
+ type RequestContext = {
105
+ isSSR: boolean;
106
+ host: string;
107
+ protocol?: string;
108
+ };
109
+ type ResponseTransformer = (data: any, headers?: any) => any;
110
+ /**
111
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
+ */
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> = {
117
+ _?: T;
118
+ url?: string;
119
+ method?: Method;
120
+ params?: any;
121
+ data?: any;
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
123
+ };
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
+ __isAmbassador: boolean;
126
+ };
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;
129
+
38
130
  declare global {
39
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
40
132
  interface SymbolConstructor {
@@ -42,19 +134,361 @@ declare global {
42
134
  }
43
135
  }
44
136
 
45
- /** CollectionMetadata contains CM-specific metadata for a collection */
137
+ declare const emptyObjectSymbol: unique symbol;
138
+
139
+ /**
140
+ Represents a strictly empty plain object, the `{}` value.
141
+
142
+ 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)).
143
+
144
+ @example
145
+ ```
146
+ import type {EmptyObject} from 'type-fest';
147
+
148
+ // The following illustrates the problem with `{}`.
149
+ const foo1: {} = {}; // Pass
150
+ const foo2: {} = []; // Pass
151
+ const foo3: {} = 42; // Pass
152
+ const foo4: {} = {a: 1}; // Pass
153
+
154
+ // With `EmptyObject` only the first case is valid.
155
+ const bar1: EmptyObject = {}; // Pass
156
+ const bar2: EmptyObject = 42; // Fail
157
+ const bar3: EmptyObject = []; // Fail
158
+ const bar4: EmptyObject = {a: 1}; // Fail
159
+ ```
160
+
161
+ 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}.
162
+
163
+ @category Object
164
+ */
165
+ type EmptyObject = {[emptyObjectSymbol]?: never};
166
+
167
+ /**
168
+ Returns a boolean for whether the two given types are equal.
169
+
170
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
+
173
+ Use-cases:
174
+ - If you want to make a conditional branch based on the result of a comparison of two types.
175
+
176
+ @example
177
+ ```
178
+ import type {IsEqual} from 'type-fest';
179
+
180
+ // This type returns a boolean for whether the given array includes the given item.
181
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
+ type Includes<Value extends readonly any[], Item> =
183
+ Value extends readonly [Value[0], ...infer rest]
184
+ ? IsEqual<Value[0], Item> extends true
185
+ ? true
186
+ : Includes<rest, Item>
187
+ : false;
188
+ ```
189
+
190
+ @category Type Guard
191
+ @category Utilities
192
+ */
193
+ type IsEqual<A, B> =
194
+ (<G>() => G extends A ? 1 : 2) extends
195
+ (<G>() => G extends B ? 1 : 2)
196
+ ? true
197
+ : false;
198
+
199
+ /**
200
+ Filter out keys from an object.
201
+
202
+ Returns `never` if `Exclude` is strictly equal to `Key`.
203
+ Returns `never` if `Key` extends `Exclude`.
204
+ Returns `Key` otherwise.
205
+
206
+ @example
207
+ ```
208
+ type Filtered = Filter<'foo', 'foo'>;
209
+ //=> never
210
+ ```
211
+
212
+ @example
213
+ ```
214
+ type Filtered = Filter<'bar', string>;
215
+ //=> never
216
+ ```
217
+
218
+ @example
219
+ ```
220
+ type Filtered = Filter<'bar', 'foo'>;
221
+ //=> 'bar'
222
+ ```
223
+
224
+ @see {Except}
225
+ */
226
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
+
228
+ type ExceptOptions = {
229
+ /**
230
+ Disallow assigning non-specified properties.
231
+
232
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
+
234
+ @default false
235
+ */
236
+ requireExactProps?: boolean;
237
+ };
238
+
239
+ /**
240
+ Create a type from an object type without certain keys.
241
+
242
+ We recommend setting the `requireExactProps` option to `true`.
243
+
244
+ 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.
245
+
246
+ 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)).
247
+
248
+ @example
249
+ ```
250
+ import type {Except} from 'type-fest';
251
+
252
+ type Foo = {
253
+ a: number;
254
+ b: string;
255
+ };
256
+
257
+ type FooWithoutA = Except<Foo, 'a'>;
258
+ //=> {b: string}
259
+
260
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
+ //=> errors: 'a' does not exist in type '{ b: string; }'
262
+
263
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
+ //=> {a: number} & Partial<Record<"b", never>>
265
+
266
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
+ ```
269
+
270
+ @category Object
271
+ */
272
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
+ } & (Options['requireExactProps'] extends true
275
+ ? Partial<Record<KeysType, never>>
276
+ : {});
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
+
344
+ /**
345
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
346
+
347
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
+
349
+ @example
350
+ ```
351
+ import type {ConditionalKeys} from 'type-fest';
352
+
353
+ interface Example {
354
+ a: string;
355
+ b: string | number;
356
+ c?: string;
357
+ d: {};
358
+ }
359
+
360
+ type StringKeysOnly = ConditionalKeys<Example, string>;
361
+ //=> 'a'
362
+ ```
363
+
364
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
+
366
+ @example
367
+ ```
368
+ import type {ConditionalKeys} from 'type-fest';
369
+
370
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
+ //=> 'a' | 'c'
372
+ ```
373
+
374
+ @category Object
375
+ */
376
+ type ConditionalKeys<Base, Condition> =
377
+ {
378
+ // Map through all the keys of the given base type.
379
+ [Key in keyof Base]-?:
380
+ // Pick only keys with types extending the given `Condition` type.
381
+ Base[Key] extends Condition
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>
385
+ // Discard this key since the condition fails.
386
+ : never;
387
+ // Convert the produced object into a union type of the keys which passed the conditional test.
388
+ }[keyof Base];
389
+
390
+ /**
391
+ Exclude keys from a shape that matches the given `Condition`.
392
+
393
+ 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.
394
+
395
+ @example
396
+ ```
397
+ import type {Primitive, ConditionalExcept} from 'type-fest';
398
+
399
+ class Awesome {
400
+ name: string;
401
+ successes: number;
402
+ failures: bigint;
403
+
404
+ run() {}
405
+ }
406
+
407
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
+ //=> {run: () => void}
409
+ ```
410
+
411
+ @example
412
+ ```
413
+ import type {ConditionalExcept} from 'type-fest';
414
+
415
+ interface Example {
416
+ a: string;
417
+ b: string | number;
418
+ c: () => void;
419
+ d: {};
420
+ }
421
+
422
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
+ //=> {b: string | number; c: () => void; d: {}}
424
+ ```
425
+
426
+ @category Object
427
+ */
428
+ type ConditionalExcept<Base, Condition> = Except<
429
+ Base,
430
+ ConditionalKeys<Base, Condition>
431
+ >;
432
+
433
+ /**
434
+ * Descriptors are objects that describe the API of a module, and the module
435
+ * can either be a REST module or a host module.
436
+ * This type is recursive, so it can describe nested modules.
437
+ */
438
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
+ [key: string]: Descriptors | PublicMetadata | any;
440
+ };
441
+ /**
442
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
444
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
445
+ * do not match the given host (as they will not work with the given host).
446
+ */
447
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
+ done: T;
449
+ recurse: T extends {
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, [
453
+ -1,
454
+ 0,
455
+ 1,
456
+ 2,
457
+ 3,
458
+ 4,
459
+ 5
460
+ ][Depth]> : never;
461
+ }, EmptyObject>;
462
+ }[Depth extends -1 ? 'done' : 'recurse'];
463
+ type PublicMetadata = {
464
+ PACKAGE_NAME?: string;
465
+ };
466
+
467
+ declare global {
468
+ interface ContextualClient {
469
+ }
470
+ }
471
+ /**
472
+ * A type used to create concerete types from SDK descriptors in
473
+ * case a contextual client is available.
474
+ */
475
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
+ host: Host;
477
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
+
479
+ /** Contains the CMS metadata for the given collection. */
46
480
  interface CollectionMetadata {
47
- /** ID of data collection */
481
+ /** ID of the associated data collection. */
48
482
  dataCollectionId?: string;
49
- /** active named view */
483
+ /** ID of the active named (custom) view. Learn more about [creating custom collection views](https://support.wix.com/en/article/cms-creating-custom-collection-views) in the CMS. */
50
484
  activeNamedViewId?: string | null;
51
- /** if table view should be hidden */
485
+ /** Whether to [hide the table layout view](https://support.wix.com/en/article/cms-setting-field-validations-in-your-collections#hiding-the-table-layout-to-prevent-empty-required-fields). Default: `false`. */
52
486
  hideTableView?: boolean | null;
53
- /** named views */
487
+ /** List of [custom collection views](https://support.wix.com/en/article/cms-creating-custom-collection-views). */
54
488
  namedViews?: Record<string, any>[] | null;
55
- /** named view ID used for default site sort in datasets */
489
+ /** Custom view to mirror on the Wix site. Learn more about [mirroring item order to the site's connected elements](https://support.wix.com/en/article/cms-mirroring-the-order-of-items-in-your-collection-to-your-sites-connected-elements). */
56
490
  namedViewIdForSiteSort?: string | null;
57
- /** Type of data permissions template used initially */
491
+ /** Collection permission template. Each collection has a permissions template that determines what Learn more about [collection permissions](https://support.wix.com/en/article/cms-changing-your-collection-permissions). */
58
492
  permissionsTemplate?: PermissionsTemplateType;
59
493
  }
60
494
  declare enum PermissionsTemplateType {
@@ -64,48 +498,51 @@ declare enum PermissionsTemplateType {
64
498
  CUSTOM = "CUSTOM"
65
499
  }
66
500
  interface CreateCollectionMetadataRequest {
67
- /** CollectionMetadata to be created */
501
+ /** Collection metadata details. */
68
502
  collectionMetadata: CollectionMetadata;
69
503
  }
70
504
  interface CreateCollectionMetadataResponse {
71
- /** The created CollectionMetadata */
505
+ /** Created collection metadata instance. */
72
506
  collectionMetadata?: CollectionMetadata;
73
507
  }
74
508
  interface GetCollectionMetadataRequest {
75
- /** Id of collection to retrieve metadata for */
509
+ /** ID of the collection for which to retrieve metadata. */
76
510
  dataCollectionId?: string;
77
511
  }
78
512
  interface GetCollectionMetadataResponse {
79
- /** The retrieved CollectionMetadata */
513
+ /** Retrieved collection metadata instance. */
80
514
  collectionMetadata?: CollectionMetadata;
81
515
  }
82
516
  interface UpdateCollectionMetadataRequest {
83
517
  /**
84
- * ID of metadata to update, ignored if collection_metadata.data_collection_id is non-empty
518
+ * TODO CLARIFY WHAT THIS MEANS:
519
+ * ID of metadata to update, ignored if **collection_metadata.data_collection_id** is non-empty // a technical workaround
85
520
  * exists because of docs generation issue with nested fields and ** path variables
521
+ * TODO shouldn't this be required? // Yes
522
+ * ID of the collection for which to update metadata.
86
523
  */
87
524
  dataCollectionId?: string;
88
- /** CollectionMetadata to be updated, may be partial */
525
+ /** Collection metadata to update. Only the specified fields are affected. Fields not mentioned remain unchanged. */
89
526
  collectionMetadata: CollectionMetadata;
90
527
  }
91
528
  interface UpdateCollectionMetadataResponse {
92
- /** The updated CollectionMetadata */
529
+ /** Updated collection metadata instance. */
93
530
  collectionMetadata?: CollectionMetadata;
94
531
  }
95
532
  interface ReplaceCollectionMetadataRequest {
96
- /** The updated CollectionMetadatas */
533
+ /** Collection metadata to replace existing metadata. */
97
534
  items?: CollectionMetadata[];
98
535
  }
99
536
  interface ReplaceCollectionMetadataResponse {
100
537
  }
101
538
  interface DeleteCollectionMetadataRequest {
102
- /** Id of collection to delete metadata for */
539
+ /** ID of the collection for which to delete metadata. */
103
540
  dataCollectionId?: string;
104
541
  }
105
542
  interface DeleteCollectionMetadataResponse {
106
543
  }
107
544
  interface ListCollectionMetadataRequest {
108
- /** paging info */
545
+ /** Paging settings. */
109
546
  paging?: CursorPaging;
110
547
  }
111
548
  interface CursorPaging {
@@ -120,9 +557,9 @@ interface CursorPaging {
120
557
  cursor?: string | null;
121
558
  }
122
559
  interface ListCollectionMetadataResponse {
123
- /** The retrieved CollectionMetadatas */
560
+ /** List of collection metadata instances. */
124
561
  items?: CollectionMetadata[];
125
- /** paging metadata */
562
+ /** Paging information. */
126
563
  pagingMetadata?: CursorPagingMetadata;
127
564
  }
128
565
  interface CursorPagingMetadata {
@@ -168,7 +605,7 @@ interface DomainEvent extends DomainEventBodyOneOf {
168
605
  /** ID of the entity associated with the event. */
169
606
  entityId?: string;
170
607
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
171
- eventTime?: Date;
608
+ eventTime?: Date | null;
172
609
  /**
173
610
  * Whether the event was triggered as a result of a privacy regulation application
174
611
  * (for example, GDPR).
@@ -197,7 +634,7 @@ interface EntityCreatedEvent {
197
634
  entity?: string;
198
635
  }
199
636
  interface RestoreInfo {
200
- deletedDate?: Date;
637
+ deletedDate?: Date | null;
201
638
  }
202
639
  interface EntityUpdatedEvent {
203
640
  /**
@@ -253,7 +690,10 @@ interface MetaSiteSpecialEvent extends MetaSiteSpecialEventPayloadOneOf {
253
690
  version?: string;
254
691
  /** A timestamp of the event. */
255
692
  timestamp?: string;
256
- /** A list of "assets" (applications). The same as MetaSiteContext. */
693
+ /**
694
+ * TODO(meta-site): Change validation once validations are disabled for consumers
695
+ * More context: https://wix.slack.com/archives/C0UHEBPFT/p1720957844413149 and https://wix.slack.com/archives/CFWKX325T/p1728892152855659
696
+ */
257
697
  assets?: Asset[];
258
698
  }
259
699
  /** @oneof */
@@ -420,7 +860,7 @@ interface SiteDeleted {
420
860
  }
421
861
  interface DeleteContext {
422
862
  /** When the meta site was deleted. */
423
- dateDeleted?: Date;
863
+ dateDeleted?: Date | null;
424
864
  /** A status. */
425
865
  deleteStatus?: DeleteStatus;
426
866
  /** A reason (flow). */
@@ -580,7 +1020,7 @@ interface EventMetadata extends BaseEventMetadata {
580
1020
  /** ID of the entity associated with the event. */
581
1021
  entityId?: string;
582
1022
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
583
- eventTime?: Date;
1023
+ eventTime?: Date | null;
584
1024
  /**
585
1025
  * Whether the event was triggered as a result of a privacy regulation application
586
1026
  * (for example, GDPR).
@@ -610,68 +1050,75 @@ interface CollectionMetadataDeletedEnvelope {
610
1050
  metadata: EventMetadata;
611
1051
  }
612
1052
  interface ReplaceCollectionMetadataOptions {
613
- /** The updated CollectionMetadatas */
1053
+ /** Collection metadata to replace existing metadata. */
614
1054
  items?: CollectionMetadata[];
615
1055
  }
616
1056
  interface ListCollectionMetadataOptions {
617
- /** paging info */
1057
+ /** Paging settings. */
618
1058
  paging?: CursorPaging;
619
1059
  }
620
1060
 
621
1061
  declare function createCollectionMetadata$1(httpClient: HttpClient): CreateCollectionMetadataSignature;
622
1062
  interface CreateCollectionMetadataSignature {
623
1063
  /**
624
- * Creates a new CollectionMetadata
625
- * ### Error codes:
626
- * - `METADATA_EXISTS` when metadata already exists for given collection
627
- * @param - CollectionMetadata to be created
628
- * @returns The created CollectionMetadata
1064
+ * Creates a new collection metadata instance.
1065
+ *
1066
+ * In case of an error, this endpoint returns the following codes:
1067
+ * - `METADATA_EXISTS`: Metadata already exists for the specified collection.
1068
+ * @param - Collection metadata details.
1069
+ * @returns Created collection metadata instance.
629
1070
  */
630
1071
  (collectionMetadata: CollectionMetadata): Promise<CollectionMetadata & CollectionMetadataNonNullableFields>;
631
1072
  }
632
1073
  declare function getCollectionMetadata$1(httpClient: HttpClient): GetCollectionMetadataSignature;
633
1074
  interface GetCollectionMetadataSignature {
634
1075
  /**
635
- * Get a CollectionMetadata by collection id
636
- * ### Error codes:
637
- * - `ITEM_NOT_FOUND` if no metadata exists for given collection
638
- * @param - Id of collection to retrieve metadata for
639
- * @returns The retrieved CollectionMetadata
1076
+ * Gets a collection metadata instance.
1077
+ *
1078
+ * In case of an error, this endpoint returns the following codes:
1079
+ * - `ITEM_NOT_FOUND`: No metadata exists for the specified collection.
1080
+ * @param - ID of the collection for which to retrieve metadata.
1081
+ * @returns Retrieved collection metadata instance.
640
1082
  */
641
1083
  (dataCollectionId: string): Promise<CollectionMetadata & CollectionMetadataNonNullableFields>;
642
1084
  }
643
1085
  declare function updateCollectionMetadata$1(httpClient: HttpClient): UpdateCollectionMetadataSignature;
644
1086
  interface UpdateCollectionMetadataSignature {
645
1087
  /**
646
- * Updates provided metadata fields for given collection ID
647
- * ### Error codes:
648
- * - `ITEM_NOT_FOUND` if no metadata exists for given collection
649
- * @param - ID of metadata to update, ignored if collection_metadata.data_collection_id is non-empty
1088
+ * Updates the metadata for the specified collection.
1089
+ *
1090
+ * In case of an error, this endpoint returns the following codes:
1091
+ * - `ITEM_NOT_FOUND`: No metadata exists for the specified collection.
1092
+ * @param - TODO CLARIFY WHAT THIS MEANS:
1093
+ * ID of metadata to update, ignored if **collection_metadata.data_collection_id** is non-empty // a technical workaround
650
1094
  * exists because of docs generation issue with nested fields and ** path variables
651
- * @param - CollectionMetadata to be updated, may be partial
652
- * @returns The updated CollectionMetadata
1095
+ * TODO shouldn't this be required? // Yes
1096
+ * ID of the collection for which to update metadata.
1097
+ * @param - Collection metadata to update. Only the specified fields are affected. Fields not mentioned remain unchanged.
1098
+ * @returns Updated collection metadata instance.
653
1099
  */
654
1100
  (dataCollectionId: string, collectionMetadata: CollectionMetadata): Promise<CollectionMetadata & CollectionMetadataNonNullableFields>;
655
1101
  }
656
1102
  declare function replaceCollectionMetadata$1(httpClient: HttpClient): ReplaceCollectionMetadataSignature;
657
1103
  interface ReplaceCollectionMetadataSignature {
658
1104
  /**
659
- * Replaces all metadatas
1105
+ * Completely replaces all existing collection metadata with the provided metadata.
660
1106
  */
661
1107
  (options?: ReplaceCollectionMetadataOptions | undefined): Promise<void>;
662
1108
  }
663
1109
  declare function deleteCollectionMetadata$1(httpClient: HttpClient): DeleteCollectionMetadataSignature;
664
1110
  interface DeleteCollectionMetadataSignature {
665
1111
  /**
666
- * Delete a CollectionMetadata
667
- * @param - Id of collection to delete metadata for
1112
+ * Deletes a collection metadata instance. (1)
1113
+ * Deletes the specified collection's metadata. (2)
1114
+ * @param - ID of the collection for which to delete metadata.
668
1115
  */
669
1116
  (dataCollectionId: string): Promise<void>;
670
1117
  }
671
1118
  declare function listCollectionMetadata$1(httpClient: HttpClient): ListCollectionMetadataSignature;
672
1119
  interface ListCollectionMetadataSignature {
673
1120
  /**
674
- * Lists all known metadata
1121
+ * Lists all collection metadata.
675
1122
  */
676
1123
  (options?: ListCollectionMetadataOptions | undefined): Promise<ListCollectionMetadataResponse & ListCollectionMetadataResponseNonNullableFields>;
677
1124
  }
@@ -681,23 +1128,29 @@ declare const onCollectionMetadataDeleted$1: EventDefinition<CollectionMetadataD
681
1128
 
682
1129
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
683
1130
 
684
- declare const createCollectionMetadata: BuildRESTFunction<typeof createCollectionMetadata$1> & typeof createCollectionMetadata$1;
685
- declare const getCollectionMetadata: BuildRESTFunction<typeof getCollectionMetadata$1> & typeof getCollectionMetadata$1;
686
- declare const updateCollectionMetadata: BuildRESTFunction<typeof updateCollectionMetadata$1> & typeof updateCollectionMetadata$1;
687
- declare const replaceCollectionMetadata: BuildRESTFunction<typeof replaceCollectionMetadata$1> & typeof replaceCollectionMetadata$1;
688
- declare const deleteCollectionMetadata: BuildRESTFunction<typeof deleteCollectionMetadata$1> & typeof deleteCollectionMetadata$1;
689
- declare const listCollectionMetadata: BuildRESTFunction<typeof listCollectionMetadata$1> & typeof listCollectionMetadata$1;
1131
+ declare const createCollectionMetadata: MaybeContext<BuildRESTFunction<typeof createCollectionMetadata$1> & typeof createCollectionMetadata$1>;
1132
+ declare const getCollectionMetadata: MaybeContext<BuildRESTFunction<typeof getCollectionMetadata$1> & typeof getCollectionMetadata$1>;
1133
+ declare const updateCollectionMetadata: MaybeContext<BuildRESTFunction<typeof updateCollectionMetadata$1> & typeof updateCollectionMetadata$1>;
1134
+ declare const replaceCollectionMetadata: MaybeContext<BuildRESTFunction<typeof replaceCollectionMetadata$1> & typeof replaceCollectionMetadata$1>;
1135
+ declare const deleteCollectionMetadata: MaybeContext<BuildRESTFunction<typeof deleteCollectionMetadata$1> & typeof deleteCollectionMetadata$1>;
1136
+ declare const listCollectionMetadata: MaybeContext<BuildRESTFunction<typeof listCollectionMetadata$1> & typeof listCollectionMetadata$1>;
690
1137
 
691
1138
  type _publicOnCollectionMetadataCreatedType = typeof onCollectionMetadataCreated$1;
692
- /** */
1139
+ /**
1140
+ * Triggered when a collection metadata instance is created.
1141
+ */
693
1142
  declare const onCollectionMetadataCreated: ReturnType<typeof createEventModule<_publicOnCollectionMetadataCreatedType>>;
694
1143
 
695
1144
  type _publicOnCollectionMetadataUpdatedType = typeof onCollectionMetadataUpdated$1;
696
- /** */
1145
+ /**
1146
+ * Triggered when a collection metadata instance is updated.
1147
+ */
697
1148
  declare const onCollectionMetadataUpdated: ReturnType<typeof createEventModule<_publicOnCollectionMetadataUpdatedType>>;
698
1149
 
699
1150
  type _publicOnCollectionMetadataDeletedType = typeof onCollectionMetadataDeleted$1;
700
- /** */
1151
+ /**
1152
+ * Triggered when a collection metadata instance is deleted.
1153
+ */
701
1154
  declare const onCollectionMetadataDeleted: ReturnType<typeof createEventModule<_publicOnCollectionMetadataDeletedType>>;
702
1155
 
703
1156
  type context_ActionEvent = ActionEvent;