@wix/data-resourceusage-service 1.0.14 → 1.0.16

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,938 +0,0 @@
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
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
- interface HttpClient {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
- type HttpResponse<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata;
64
- type APIMetadata = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
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;
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
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
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
- /** ResourceUsage describes site-wide resource limits and usage */
480
- interface ResourceUsage {
481
- /**
482
- * Used storage sum of Sandbox and Live environments, bytes
483
- * Replaced by live_used_storage_in_bytes
484
- * @deprecated
485
- * @replacedBy live_used_storage_in_bytes + sandbox_used_storage_in_bytes
486
- */
487
- totalUsedStorageInBytes?: string | null;
488
- /** Max storage, bytes */
489
- totalUsedStorageInBytesLimit?: string | null;
490
- /** Total number of native collections created */
491
- collectionCount?: number | null;
492
- /** Max number of native collections allowed */
493
- collectionCountLimit?: number | null;
494
- /**
495
- * Total number of items in native collections sum of Sandbox and Live environments
496
- * Replaced by live_item_count
497
- * @deprecated
498
- * @replacedBy live_item_count + sandbox_item_count
499
- */
500
- totalItemCount?: string | null;
501
- /** Max number of items in native collections */
502
- totalItemCountLimit?: string | null;
503
- /** Resource usages per data collection */
504
- dataCollectionUsages?: DataCollectionResourceUsage[];
505
- /** Used storage in Live environment */
506
- liveUsedStorageInBytes?: string | null;
507
- /** Number of items in native collections in Live environment */
508
- liveItemCount?: string | null;
509
- /** Used storage in Sandbox environment */
510
- sandboxUsedStorageInBytes?: string | null;
511
- /** Number of items in native collections in Sandbox environment */
512
- sandboxItemCount?: string | null;
513
- }
514
- interface DataCollectionResourceUsage {
515
- /** Data Collection ID */
516
- dataCollectionId?: string;
517
- /** Data Collection display name */
518
- displayName?: string | null;
519
- /** Data Collection item count in the live environment */
520
- liveItemCount?: string;
521
- /** Data Collection item count in the sandbox environment, none if disabled */
522
- sandboxItemCount?: string | null;
523
- /** Data Collection used storage in bytes in the live environment */
524
- liveUsedStorageInBytes?: string;
525
- /** Data Collection used storage in bytes in the sandbox environment, none if disabled */
526
- sandboxUsedStorageInBytes?: string | null;
527
- /** Type of data collection, currently only NATIVE are returned in this API */
528
- dataCollectionType?: CollectionType;
529
- }
530
- declare enum CollectionType {
531
- /** User-created collection. */
532
- NATIVE = "NATIVE",
533
- /** [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). */
534
- WIX_APP = "WIX_APP",
535
- /** Collection created by a Wix Blocks app. */
536
- BLOCKS_APP = "BLOCKS_APP",
537
- /** Collection located in externally connected storage. */
538
- EXTERNAL = "EXTERNAL"
539
- }
540
- interface GetResourceUsageRequest {
541
- /** ResourceUsage fields to return, if empty all are returned */
542
- fields?: string[];
543
- /** If true, operation queries collections for up-to-date values (rather than using cached values) */
544
- consistentRead?: boolean;
545
- }
546
- interface GetResourceUsageResponse {
547
- /** The retrieved ResourceUsage */
548
- resourceUsage?: ResourceUsage;
549
- }
550
- interface BulkUpdateUsagesRequest {
551
- updates?: InstanceUsageUpdate[];
552
- }
553
- interface DataCollectionResourceUsageUpdate {
554
- /** Data Collection ID */
555
- dataCollectionId?: string;
556
- /** if true present values are added to existing, otherwise values are replaced */
557
- relative?: boolean;
558
- /** Data Collection item count in the live environment */
559
- liveItemCount?: string | null;
560
- /** Data Collection item count in the sandbox environment */
561
- sandboxItemCount?: string | null;
562
- /** Data Collection used storage in bytes in the live environment */
563
- liveUsedStorageInBytes?: string | null;
564
- /** Data Collection used storage in bytes in the sandbox environment */
565
- sandboxUsedStorageInBytes?: string | null;
566
- }
567
- declare enum Segment {
568
- BOTH = "BOTH",
569
- LIVE = "LIVE",
570
- SANDBOX = "SANDBOX"
571
- }
572
- interface InstanceUsageUpdate {
573
- /** Data Instance ID */
574
- instanceId?: string;
575
- /** Usage updates per collection */
576
- collections?: DataCollectionResourceUsageUpdate[];
577
- /** if true all collections not in the list assumed to have 0 usage */
578
- allCollectionsPresent?: boolean;
579
- /** Indicates which segment is being updated */
580
- segment?: Segment;
581
- }
582
- interface BulkUpdateUsagesResponse {
583
- }
584
- interface GetStoredUsageRequest {
585
- instanceId?: string;
586
- }
587
- interface GetStoredUsageResponse {
588
- usages?: DataCollectionResourceUsage[];
589
- }
590
- interface DomainEvent extends DomainEventBodyOneOf {
591
- createdEvent?: EntityCreatedEvent;
592
- updatedEvent?: EntityUpdatedEvent;
593
- deletedEvent?: EntityDeletedEvent;
594
- actionEvent?: ActionEvent;
595
- /**
596
- * Unique event ID.
597
- * Allows clients to ignore duplicate webhooks.
598
- */
599
- _id?: string;
600
- /**
601
- * Assumes actions are also always typed to an entity_type
602
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
603
- */
604
- entityFqdn?: string;
605
- /**
606
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
607
- * This is although the created/updated/deleted notion is duplication of the oneof types
608
- * Example: created/updated/deleted/started/completed/email_opened
609
- */
610
- slug?: string;
611
- /** ID of the entity associated with the event. */
612
- entityId?: string;
613
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
614
- eventTime?: Date | null;
615
- /**
616
- * Whether the event was triggered as a result of a privacy regulation application
617
- * (for example, GDPR).
618
- */
619
- triggeredByAnonymizeRequest?: boolean | null;
620
- /** If present, indicates the action that triggered the event. */
621
- originatedFrom?: string | null;
622
- /**
623
- * A sequence number defining the order of updates to the underlying entity.
624
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
625
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
626
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
627
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
628
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
629
- */
630
- entityEventSequence?: string | null;
631
- }
632
- /** @oneof */
633
- interface DomainEventBodyOneOf {
634
- createdEvent?: EntityCreatedEvent;
635
- updatedEvent?: EntityUpdatedEvent;
636
- deletedEvent?: EntityDeletedEvent;
637
- actionEvent?: ActionEvent;
638
- }
639
- interface EntityCreatedEvent {
640
- entity?: string;
641
- }
642
- interface RestoreInfo {
643
- deletedDate?: Date | null;
644
- }
645
- interface EntityUpdatedEvent {
646
- /**
647
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
648
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
649
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
650
- */
651
- currentEntity?: string;
652
- }
653
- interface EntityDeletedEvent {
654
- /** Entity that was deleted */
655
- deletedEntity?: string | null;
656
- }
657
- interface ActionEvent {
658
- body?: string;
659
- }
660
- interface Empty {
661
- }
662
- interface DataChangeEvent extends DataChangeEventEventOneOf {
663
- dataChanged?: DataChanged;
664
- /** resume point is lost so some changes may be lost */
665
- changesLost?: ChangesLost;
666
- referenceChanged?: ReferenceChanged;
667
- /** segment access or mapping changed */
668
- segmentChanged?: SegmentChanged;
669
- /** segment migration started to new physical location */
670
- segmentMigrationStarted?: SegmentMigrationStarted;
671
- idempotenceKey?: string;
672
- }
673
- /** @oneof */
674
- interface DataChangeEventEventOneOf {
675
- dataChanged?: DataChanged;
676
- /** resume point is lost so some changes may be lost */
677
- changesLost?: ChangesLost;
678
- referenceChanged?: ReferenceChanged;
679
- /** segment access or mapping changed */
680
- segmentChanged?: SegmentChanged;
681
- /** segment migration started to new physical location */
682
- segmentMigrationStarted?: SegmentMigrationStarted;
683
- }
684
- interface DataChanged extends DataChangedChangeOneOf {
685
- /** inserted document */
686
- inserted?: Record<string, any> | null;
687
- /** full replaced document */
688
- replaced?: Record<string, any> | null;
689
- /** partial update, removed fields are set to Empty */
690
- partial?: Record<string, any> | null;
691
- /** deleted document ID */
692
- removedId?: string;
693
- /** physical cluster ID */
694
- clusterId?: string;
695
- /**
696
- * physical source
697
- * db.collection for MongoDB
698
- */
699
- source?: string;
700
- /** instance ID */
701
- tenantId?: string;
702
- /** logical collection name */
703
- collectionName?: string;
704
- dataStore?: DataStore;
705
- documentId?: string;
706
- clusterTime?: Date | null;
707
- /** raw resume token BSON */
708
- resumeToken?: string;
709
- /** Initiator of the request */
710
- initiator?: Initiator;
711
- /** Identity of the user who initiated the request */
712
- writer?: Identity;
713
- }
714
- /** @oneof */
715
- interface DataChangedChangeOneOf {
716
- /** inserted document */
717
- inserted?: Record<string, any> | null;
718
- /** full replaced document */
719
- replaced?: Record<string, any> | null;
720
- /** partial update, removed fields are set to Empty */
721
- partial?: Record<string, any> | null;
722
- /** deleted document ID */
723
- removedId?: string;
724
- }
725
- declare enum Type {
726
- /** Initiator is unknown */
727
- Unknown = "Unknown",
728
- /** Indicated that write has been initiated by SSR indexer */
729
- SsrIndexer = "SsrIndexer"
730
- }
731
- declare enum DataStore {
732
- Dev = "Dev",
733
- Public = "Public"
734
- }
735
- interface Initiator {
736
- type?: Type;
737
- }
738
- interface Identity {
739
- /** User ID, when the request is initiated by a user */
740
- userId?: string | null;
741
- /** Member ID, when the request is initiated by a member */
742
- memberId?: string | null;
743
- /** Visitor ID, when the request is initiated by a visitor */
744
- visitorId?: string | null;
745
- /** External App ID, when the request is initiated by an external app */
746
- externalAppId?: string | null;
747
- /** Service ID, when the request is initiated by a service */
748
- serviceId?: string | null;
749
- }
750
- interface ChangesLost {
751
- clusterId?: string;
752
- }
753
- interface ReferenceChanged {
754
- /** physical cluster ID */
755
- clusterId?: string;
756
- /**
757
- * physical source
758
- * db.collection for MongoDB
759
- */
760
- source?: string;
761
- /** instance ID */
762
- tenantId?: string;
763
- dataStore?: DataStore;
764
- relationshipName?: string;
765
- leftId?: string;
766
- rightId?: string;
767
- /** if reference is set or unset */
768
- isRemoved?: boolean;
769
- clusterTime?: Date | null;
770
- /** raw resume token BSON */
771
- resumeToken?: string;
772
- /** ref created date */
773
- createdAt?: Date | null;
774
- }
775
- interface SegmentChanged {
776
- /** physical cluster ID */
777
- clusterId?: string;
778
- /**
779
- * physical source
780
- * db.collection for MongoDB
781
- */
782
- source?: string;
783
- /** instance ID */
784
- tenantId?: string;
785
- /** segment */
786
- dataStore?: DataStore;
787
- /** new db name if changed */
788
- newDatabase?: string | null;
789
- /** new cluster if changed */
790
- newClusterId?: string | null;
791
- /** read permissions if changed */
792
- readsEnabled?: boolean | null;
793
- /** write permissions if changed */
794
- writesEnabled?: boolean | null;
795
- /** event time */
796
- clusterTime?: Date | null;
797
- /** raw resume token BSON */
798
- resumeToken?: string;
799
- }
800
- interface SegmentMigrationStarted {
801
- /** physical cluster ID */
802
- clusterId?: string;
803
- /**
804
- * physical source
805
- * db.collection for MongoDB
806
- */
807
- source?: string;
808
- /** instance ID */
809
- tenantId?: string;
810
- /** segment */
811
- dataStore?: DataStore;
812
- /** new db name if changed */
813
- newDatabase?: string;
814
- /** new cluster if changed */
815
- newClusterId?: string;
816
- /** event time */
817
- clusterTime?: Date | null;
818
- /** raw resume token BSON */
819
- resumeToken?: string;
820
- }
821
- interface MessageEnvelope {
822
- /** App instance ID. */
823
- instanceId?: string | null;
824
- /** Event type. */
825
- eventType?: string;
826
- /** The identification type and identity data. */
827
- identity?: IdentificationData;
828
- /** Stringify payload. */
829
- data?: string;
830
- }
831
- interface IdentificationData extends IdentificationDataIdOneOf {
832
- /** ID of a site visitor that has not logged in to the site. */
833
- anonymousVisitorId?: string;
834
- /** ID of a site visitor that has logged in to the site. */
835
- memberId?: string;
836
- /** ID of a Wix user (site owner, contributor, etc.). */
837
- wixUserId?: string;
838
- /** ID of an app. */
839
- appId?: string;
840
- /** @readonly */
841
- identityType?: WebhookIdentityType;
842
- }
843
- /** @oneof */
844
- interface IdentificationDataIdOneOf {
845
- /** ID of a site visitor that has not logged in to the site. */
846
- anonymousVisitorId?: string;
847
- /** ID of a site visitor that has logged in to the site. */
848
- memberId?: string;
849
- /** ID of a Wix user (site owner, contributor, etc.). */
850
- wixUserId?: string;
851
- /** ID of an app. */
852
- appId?: string;
853
- }
854
- declare enum WebhookIdentityType {
855
- UNKNOWN = "UNKNOWN",
856
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
857
- MEMBER = "MEMBER",
858
- WIX_USER = "WIX_USER",
859
- APP = "APP"
860
- }
861
- interface DataCollectionResourceUsageNonNullableFields {
862
- dataCollectionId: string;
863
- liveItemCount: string;
864
- liveUsedStorageInBytes: string;
865
- dataCollectionType: CollectionType;
866
- }
867
- interface ResourceUsageNonNullableFields {
868
- dataCollectionUsages: DataCollectionResourceUsageNonNullableFields[];
869
- }
870
- interface GetResourceUsageResponseNonNullableFields {
871
- resourceUsage?: ResourceUsageNonNullableFields;
872
- }
873
- interface GetResourceUsageOptions {
874
- /** ResourceUsage fields to return, if empty all are returned */
875
- fields?: string[];
876
- /** If true, operation queries collections for up-to-date values (rather than using cached values) */
877
- consistentRead?: boolean;
878
- }
879
-
880
- declare function getResourceUsage$1(httpClient: HttpClient): GetResourceUsageSignature;
881
- interface GetResourceUsageSignature {
882
- /**
883
- * Get current Resource Usage
884
- */
885
- (options?: GetResourceUsageOptions | undefined): Promise<GetResourceUsageResponse & GetResourceUsageResponseNonNullableFields>;
886
- }
887
-
888
- declare const getResourceUsage: MaybeContext<BuildRESTFunction<typeof getResourceUsage$1> & typeof getResourceUsage$1>;
889
-
890
- type context_ActionEvent = ActionEvent;
891
- type context_BulkUpdateUsagesRequest = BulkUpdateUsagesRequest;
892
- type context_BulkUpdateUsagesResponse = BulkUpdateUsagesResponse;
893
- type context_ChangesLost = ChangesLost;
894
- type context_CollectionType = CollectionType;
895
- declare const context_CollectionType: typeof CollectionType;
896
- type context_DataChangeEvent = DataChangeEvent;
897
- type context_DataChangeEventEventOneOf = DataChangeEventEventOneOf;
898
- type context_DataChanged = DataChanged;
899
- type context_DataChangedChangeOneOf = DataChangedChangeOneOf;
900
- type context_DataCollectionResourceUsage = DataCollectionResourceUsage;
901
- type context_DataCollectionResourceUsageUpdate = DataCollectionResourceUsageUpdate;
902
- type context_DataStore = DataStore;
903
- declare const context_DataStore: typeof DataStore;
904
- type context_DomainEvent = DomainEvent;
905
- type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
906
- type context_Empty = Empty;
907
- type context_EntityCreatedEvent = EntityCreatedEvent;
908
- type context_EntityDeletedEvent = EntityDeletedEvent;
909
- type context_EntityUpdatedEvent = EntityUpdatedEvent;
910
- type context_GetResourceUsageOptions = GetResourceUsageOptions;
911
- type context_GetResourceUsageRequest = GetResourceUsageRequest;
912
- type context_GetResourceUsageResponse = GetResourceUsageResponse;
913
- type context_GetResourceUsageResponseNonNullableFields = GetResourceUsageResponseNonNullableFields;
914
- type context_GetStoredUsageRequest = GetStoredUsageRequest;
915
- type context_GetStoredUsageResponse = GetStoredUsageResponse;
916
- type context_IdentificationData = IdentificationData;
917
- type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
918
- type context_Identity = Identity;
919
- type context_Initiator = Initiator;
920
- type context_InstanceUsageUpdate = InstanceUsageUpdate;
921
- type context_MessageEnvelope = MessageEnvelope;
922
- type context_ReferenceChanged = ReferenceChanged;
923
- type context_ResourceUsage = ResourceUsage;
924
- type context_RestoreInfo = RestoreInfo;
925
- type context_Segment = Segment;
926
- declare const context_Segment: typeof Segment;
927
- type context_SegmentChanged = SegmentChanged;
928
- type context_SegmentMigrationStarted = SegmentMigrationStarted;
929
- type context_Type = Type;
930
- declare const context_Type: typeof Type;
931
- type context_WebhookIdentityType = WebhookIdentityType;
932
- declare const context_WebhookIdentityType: typeof WebhookIdentityType;
933
- declare const context_getResourceUsage: typeof getResourceUsage;
934
- declare namespace context {
935
- export { type context_ActionEvent as ActionEvent, type context_BulkUpdateUsagesRequest as BulkUpdateUsagesRequest, type context_BulkUpdateUsagesResponse as BulkUpdateUsagesResponse, type context_ChangesLost as ChangesLost, context_CollectionType as CollectionType, type context_DataChangeEvent as DataChangeEvent, type context_DataChangeEventEventOneOf as DataChangeEventEventOneOf, type context_DataChanged as DataChanged, type context_DataChangedChangeOneOf as DataChangedChangeOneOf, type context_DataCollectionResourceUsage as DataCollectionResourceUsage, type context_DataCollectionResourceUsageUpdate as DataCollectionResourceUsageUpdate, context_DataStore as DataStore, type context_DomainEvent as DomainEvent, type context_DomainEventBodyOneOf as DomainEventBodyOneOf, type context_Empty as Empty, type context_EntityCreatedEvent as EntityCreatedEvent, type context_EntityDeletedEvent as EntityDeletedEvent, type context_EntityUpdatedEvent as EntityUpdatedEvent, type context_GetResourceUsageOptions as GetResourceUsageOptions, type context_GetResourceUsageRequest as GetResourceUsageRequest, type context_GetResourceUsageResponse as GetResourceUsageResponse, type context_GetResourceUsageResponseNonNullableFields as GetResourceUsageResponseNonNullableFields, type context_GetStoredUsageRequest as GetStoredUsageRequest, type context_GetStoredUsageResponse as GetStoredUsageResponse, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context_Identity as Identity, type context_Initiator as Initiator, type context_InstanceUsageUpdate as InstanceUsageUpdate, type context_MessageEnvelope as MessageEnvelope, type context_ReferenceChanged as ReferenceChanged, type context_ResourceUsage as ResourceUsage, type context_RestoreInfo as RestoreInfo, context_Segment as Segment, type context_SegmentChanged as SegmentChanged, type context_SegmentMigrationStarted as SegmentMigrationStarted, context_Type as Type, context_WebhookIdentityType as WebhookIdentityType, context_getResourceUsage as getResourceUsage };
936
- }
937
-
938
- export { context as data };