@wix/data-extension-schema 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/context.d.ts +1 -0
- package/build/cjs/context.js +28 -0
- package/build/cjs/context.js.map +1 -0
- package/build/cjs/index.d.ts +2 -0
- package/build/cjs/index.js +29 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +28 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/es/context.d.ts +1 -0
- package/build/es/context.js +2 -0
- package/build/es/context.js.map +1 -0
- package/build/es/index.d.ts +2 -0
- package/build/es/index.js +3 -0
- package/build/es/index.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/context/package.json +7 -0
- package/meta/package.json +7 -0
- package/package.json +47 -0
- package/type-bundles/context.bundle.d.ts +1075 -0
- package/type-bundles/index.bundle.d.ts +1075 -0
- package/type-bundles/meta.bundle.d.ts +371 -0
|
@@ -0,0 +1,1075 @@
|
|
|
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
|
+
interface DataExtensionSchema {
|
|
480
|
+
/**
|
|
481
|
+
* Schema ID.
|
|
482
|
+
* @readonly
|
|
483
|
+
*/
|
|
484
|
+
_id?: string | null;
|
|
485
|
+
/** FQDN of the entity this schema extends. */
|
|
486
|
+
fqdn?: string | null;
|
|
487
|
+
/**
|
|
488
|
+
* Namespace for this schema. For example, an app creating schemas might use their app name as a namespace.
|
|
489
|
+
* When a site owner creates a user-defined schema, the namespace is: `_user_fields`.
|
|
490
|
+
*/
|
|
491
|
+
namespace?: string | null;
|
|
492
|
+
/**
|
|
493
|
+
* Schema definition in [JSON schema format](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema) with the following [vocab](https://docs.json-everything.net/schema/vocabs/) extension:
|
|
494
|
+
* ```
|
|
495
|
+
* {
|
|
496
|
+
* "$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
497
|
+
* "$id": "https://wixapis.com/v1/json-schema/extensions",
|
|
498
|
+
* "$vocabulary": {
|
|
499
|
+
* "https://wixapis.com/v1/json-schema/extensions/vocab/data-extensions": true
|
|
500
|
+
* },
|
|
501
|
+
* "$dynamicAnchor": "meta",
|
|
502
|
+
* "title": "Wix' data-extensions vocabulary meta schema",
|
|
503
|
+
* "type": [
|
|
504
|
+
* "object",
|
|
505
|
+
* "boolean"
|
|
506
|
+
* ],
|
|
507
|
+
* "properties": {
|
|
508
|
+
* "x-wix-permissions": {
|
|
509
|
+
* "type": "object",
|
|
510
|
+
* "description": "list of identity types that are allowed reading schema properties",
|
|
511
|
+
* "properties": {
|
|
512
|
+
* "read": {
|
|
513
|
+
* "type": "array",
|
|
514
|
+
* "items": {
|
|
515
|
+
* "type": "string",
|
|
516
|
+
* "enum": [
|
|
517
|
+
* "apps",
|
|
518
|
+
* "owning-app",
|
|
519
|
+
* "users",
|
|
520
|
+
* "users-of-users"
|
|
521
|
+
* ]
|
|
522
|
+
* }
|
|
523
|
+
* },
|
|
524
|
+
* "write": {
|
|
525
|
+
* "type": "array",
|
|
526
|
+
* "items": {
|
|
527
|
+
* "type": "string",
|
|
528
|
+
* "enum": [
|
|
529
|
+
* "apps",
|
|
530
|
+
* "owning-app",
|
|
531
|
+
* "users",
|
|
532
|
+
* "users-of-users"
|
|
533
|
+
* ]
|
|
534
|
+
* }
|
|
535
|
+
* }
|
|
536
|
+
* }
|
|
537
|
+
* },
|
|
538
|
+
* "x-wix-display": {
|
|
539
|
+
* "type": "object",
|
|
540
|
+
* "description": "field display properties",
|
|
541
|
+
* "schema": {
|
|
542
|
+
* "properties": {
|
|
543
|
+
* "placeholder": {
|
|
544
|
+
* "type": "string",
|
|
545
|
+
* "maxLength": 255,
|
|
546
|
+
* "description": "placeholder text for input fields"
|
|
547
|
+
* },
|
|
548
|
+
* "label": {
|
|
549
|
+
* "type": "string",
|
|
550
|
+
* "maxLength": 255,
|
|
551
|
+
* "description": "label of the input fields"
|
|
552
|
+
* },
|
|
553
|
+
* "hint": {
|
|
554
|
+
* "type": "string",
|
|
555
|
+
* "maxLength": 255,
|
|
556
|
+
* "description": "a short explanation that appears next to the input field"
|
|
557
|
+
* }
|
|
558
|
+
* }
|
|
559
|
+
* }
|
|
560
|
+
* }
|
|
561
|
+
* }
|
|
562
|
+
* }
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
jsonSchema?: Record<string, any> | null;
|
|
566
|
+
/**
|
|
567
|
+
* Date and time the schema was last updated.
|
|
568
|
+
* @readonly
|
|
569
|
+
*/
|
|
570
|
+
_updatedDate?: Date;
|
|
571
|
+
/**
|
|
572
|
+
* Date and time the schema was created.
|
|
573
|
+
* @readonly
|
|
574
|
+
*/
|
|
575
|
+
_createdDate?: Date;
|
|
576
|
+
/**
|
|
577
|
+
* Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing revision must be used when updating a schema.
|
|
578
|
+
* @readonly
|
|
579
|
+
*/
|
|
580
|
+
revision?: string | null;
|
|
581
|
+
/**
|
|
582
|
+
* Maximum allowed schema size in bytes.
|
|
583
|
+
* @readonly
|
|
584
|
+
*/
|
|
585
|
+
maxLimitBytes?: number | null;
|
|
586
|
+
/**
|
|
587
|
+
* Current schema size in bytes.
|
|
588
|
+
* @readonly
|
|
589
|
+
*/
|
|
590
|
+
currentSizeBytes?: number | null;
|
|
591
|
+
/** Name of the specific entity field this schema is extending, or `"ROOT"` for extensions for the entire entity. Default: `"ROOT"`. */
|
|
592
|
+
extensionPoint?: string;
|
|
593
|
+
}
|
|
594
|
+
interface ReindexEvent {
|
|
595
|
+
/** fqdn of the dext schema that needs reindexing */
|
|
596
|
+
fqdn?: string;
|
|
597
|
+
/** List of fields that needs reindexing */
|
|
598
|
+
fields?: ReindexField[];
|
|
599
|
+
}
|
|
600
|
+
interface ReindexField {
|
|
601
|
+
/** path of field that needs reindexing */
|
|
602
|
+
fieldPath?: string;
|
|
603
|
+
/** only reindex records updated after this timestamp */
|
|
604
|
+
reindexSince?: Date;
|
|
605
|
+
}
|
|
606
|
+
interface CreateDataExtensionSchemaRequest {
|
|
607
|
+
/** Schema to create. */
|
|
608
|
+
dataExtensionSchema: DataExtensionSchema;
|
|
609
|
+
}
|
|
610
|
+
interface CreateDataExtensionSchemaResponse {
|
|
611
|
+
/** Created schema. */
|
|
612
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
613
|
+
}
|
|
614
|
+
interface UpdateDataExtensionSchemaRequest {
|
|
615
|
+
/** Schema to update. */
|
|
616
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
617
|
+
}
|
|
618
|
+
interface UpdateDataExtensionSchemaResponse {
|
|
619
|
+
/** Updated schema. */
|
|
620
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
621
|
+
}
|
|
622
|
+
interface ListDataExtensionSchemasRequest {
|
|
623
|
+
/** [Fully qualified domain name](https://dev.wix.com/docs/rest/articles/getting-started/fqdns). */
|
|
624
|
+
fqdn: string;
|
|
625
|
+
/** Namespaces within the given entity. */
|
|
626
|
+
namespaces?: string[];
|
|
627
|
+
/** Additional fields that are hidden by default. For example, fields with `"x-wix-archived": true`. */
|
|
628
|
+
fields?: RequestedField[];
|
|
629
|
+
}
|
|
630
|
+
declare enum RequestedField {
|
|
631
|
+
/** Doesn't do anything */
|
|
632
|
+
UNKNOWN_REQUESTED_FIELD = "UNKNOWN_REQUESTED_FIELD",
|
|
633
|
+
/** Returns `x-wix-archived` fields in `DataExtensionSchema.json_schema`. */
|
|
634
|
+
ARCHIVED = "ARCHIVED"
|
|
635
|
+
}
|
|
636
|
+
interface ListDataExtensionSchemasResponse {
|
|
637
|
+
/** Requested schemas. */
|
|
638
|
+
dataExtensionSchemas?: DataExtensionSchema[];
|
|
639
|
+
}
|
|
640
|
+
interface ListAllDataExtensionSchemasRequest {
|
|
641
|
+
/** [Fully qualified domain name](https://dev.wix.com/docs/rest/articles/getting-started/fqdns). */
|
|
642
|
+
fqdn?: string;
|
|
643
|
+
/** Namespaces within the given entity. */
|
|
644
|
+
namespaces?: string[];
|
|
645
|
+
/** Additional fields that are hidden by default. For example, fields with `"x-wix-archived": true`. */
|
|
646
|
+
fields?: RequestedField[];
|
|
647
|
+
}
|
|
648
|
+
interface ListAllDataExtensionSchemasResponse {
|
|
649
|
+
/** Requested schemas. */
|
|
650
|
+
dataExtensionSchemas?: DataExtensionSchema[];
|
|
651
|
+
}
|
|
652
|
+
interface UpsertDataExtensionGlobalSchemaRequest {
|
|
653
|
+
/** the upsert to create */
|
|
654
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
655
|
+
}
|
|
656
|
+
interface UpsertDataExtensionGlobalSchemaResponse {
|
|
657
|
+
/** the upsert schema */
|
|
658
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
659
|
+
}
|
|
660
|
+
interface DeleteDemoDataExtensionSchemaRequest {
|
|
661
|
+
/** Schema ID. */
|
|
662
|
+
dataExtensionSchemaId?: string;
|
|
663
|
+
}
|
|
664
|
+
interface DeleteDemoDataExtensionSchemaResponse {
|
|
665
|
+
}
|
|
666
|
+
interface DeleteGlobalExtensionSchemaRequest {
|
|
667
|
+
/** fqdn */
|
|
668
|
+
fqdn?: string;
|
|
669
|
+
/** namespace */
|
|
670
|
+
namespace?: string;
|
|
671
|
+
}
|
|
672
|
+
interface DeleteGlobalExtensionSchemaResponse {
|
|
673
|
+
}
|
|
674
|
+
interface DeleteByWhiteListedMetaSiteRequest {
|
|
675
|
+
/** Meta site id */
|
|
676
|
+
metaSiteId: string;
|
|
677
|
+
}
|
|
678
|
+
interface DeleteByWhiteListedMetaSiteResponse {
|
|
679
|
+
/** has more */
|
|
680
|
+
hasMore?: boolean;
|
|
681
|
+
}
|
|
682
|
+
interface DomainEvent extends DomainEventBodyOneOf {
|
|
683
|
+
createdEvent?: EntityCreatedEvent;
|
|
684
|
+
updatedEvent?: EntityUpdatedEvent;
|
|
685
|
+
deletedEvent?: EntityDeletedEvent;
|
|
686
|
+
actionEvent?: ActionEvent;
|
|
687
|
+
/**
|
|
688
|
+
* Unique event ID.
|
|
689
|
+
* Allows clients to ignore duplicate webhooks.
|
|
690
|
+
*/
|
|
691
|
+
_id?: string;
|
|
692
|
+
/**
|
|
693
|
+
* Assumes actions are also always typed to an entity_type
|
|
694
|
+
* Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
|
|
695
|
+
*/
|
|
696
|
+
entityFqdn?: string;
|
|
697
|
+
/**
|
|
698
|
+
* This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
|
|
699
|
+
* This is although the created/updated/deleted notion is duplication of the oneof types
|
|
700
|
+
* Example: created/updated/deleted/started/completed/email_opened
|
|
701
|
+
*/
|
|
702
|
+
slug?: string;
|
|
703
|
+
/** ID of the entity associated with the event. */
|
|
704
|
+
entityId?: string;
|
|
705
|
+
/** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
|
|
706
|
+
eventTime?: Date;
|
|
707
|
+
/**
|
|
708
|
+
* Whether the event was triggered as a result of a privacy regulation application
|
|
709
|
+
* (for example, GDPR).
|
|
710
|
+
*/
|
|
711
|
+
triggeredByAnonymizeRequest?: boolean | null;
|
|
712
|
+
/** If present, indicates the action that triggered the event. */
|
|
713
|
+
originatedFrom?: string | null;
|
|
714
|
+
/**
|
|
715
|
+
* A sequence number defining the order of updates to the underlying entity.
|
|
716
|
+
* For example, given that some entity was updated at 16:00 and than again at 16:01,
|
|
717
|
+
* it is guaranteed that the sequence number of the second update is strictly higher than the first.
|
|
718
|
+
* As the consumer, you can use this value to ensure that you handle messages in the correct order.
|
|
719
|
+
* To do so, you will need to persist this number on your end, and compare the sequence number from the
|
|
720
|
+
* message against the one you have stored. Given that the stored number is higher, you should ignore the message.
|
|
721
|
+
*/
|
|
722
|
+
entityEventSequence?: string | null;
|
|
723
|
+
}
|
|
724
|
+
/** @oneof */
|
|
725
|
+
interface DomainEventBodyOneOf {
|
|
726
|
+
createdEvent?: EntityCreatedEvent;
|
|
727
|
+
updatedEvent?: EntityUpdatedEvent;
|
|
728
|
+
deletedEvent?: EntityDeletedEvent;
|
|
729
|
+
actionEvent?: ActionEvent;
|
|
730
|
+
}
|
|
731
|
+
interface EntityCreatedEvent {
|
|
732
|
+
entity?: string;
|
|
733
|
+
}
|
|
734
|
+
interface RestoreInfo {
|
|
735
|
+
deletedDate?: Date;
|
|
736
|
+
}
|
|
737
|
+
interface EntityUpdatedEvent {
|
|
738
|
+
/**
|
|
739
|
+
* Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
|
|
740
|
+
* This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
|
|
741
|
+
* We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
|
|
742
|
+
*/
|
|
743
|
+
currentEntity?: string;
|
|
744
|
+
}
|
|
745
|
+
interface EntityDeletedEvent {
|
|
746
|
+
/** Entity that was deleted */
|
|
747
|
+
deletedEntity?: string | null;
|
|
748
|
+
}
|
|
749
|
+
interface ActionEvent {
|
|
750
|
+
body?: string;
|
|
751
|
+
}
|
|
752
|
+
interface Empty {
|
|
753
|
+
}
|
|
754
|
+
/** payload for kafka event for this version on app submit */
|
|
755
|
+
interface AppVersionStateChanged extends AppVersionStateChangedStateOneOf {
|
|
756
|
+
created?: AppVersionCreated;
|
|
757
|
+
submitted?: AppVersionSubmitted;
|
|
758
|
+
published?: AppVersionPublished;
|
|
759
|
+
declined?: AppVersionDeclined;
|
|
760
|
+
released?: AppVersionReleased;
|
|
761
|
+
approved?: AppVersionApproved;
|
|
762
|
+
draftChanged?: AppVersionDraftChanged;
|
|
763
|
+
archived?: AppVersionArchived;
|
|
764
|
+
appId?: string;
|
|
765
|
+
/** @readonly */
|
|
766
|
+
version?: string;
|
|
767
|
+
previousState?: VersionStatus;
|
|
768
|
+
}
|
|
769
|
+
/** @oneof */
|
|
770
|
+
interface AppVersionStateChangedStateOneOf {
|
|
771
|
+
created?: AppVersionCreated;
|
|
772
|
+
submitted?: AppVersionSubmitted;
|
|
773
|
+
published?: AppVersionPublished;
|
|
774
|
+
declined?: AppVersionDeclined;
|
|
775
|
+
released?: AppVersionReleased;
|
|
776
|
+
approved?: AppVersionApproved;
|
|
777
|
+
draftChanged?: AppVersionDraftChanged;
|
|
778
|
+
archived?: AppVersionArchived;
|
|
779
|
+
}
|
|
780
|
+
interface AppVersionCreated {
|
|
781
|
+
}
|
|
782
|
+
interface AppVersionSubmitted {
|
|
783
|
+
}
|
|
784
|
+
interface AppVersionPublished {
|
|
785
|
+
}
|
|
786
|
+
interface AppVersionDeclined {
|
|
787
|
+
}
|
|
788
|
+
interface AppVersionReleased {
|
|
789
|
+
}
|
|
790
|
+
interface AppVersionApproved {
|
|
791
|
+
}
|
|
792
|
+
interface AppVersionDraftChanged {
|
|
793
|
+
}
|
|
794
|
+
interface AppVersionArchived {
|
|
795
|
+
}
|
|
796
|
+
declare enum VersionStatus {
|
|
797
|
+
/** default, internal use status. do not use */
|
|
798
|
+
NONE_STATUS = "NONE_STATUS",
|
|
799
|
+
/** a version which was created in the dev center and has not started the approval process yet */
|
|
800
|
+
DRAFT = "DRAFT",
|
|
801
|
+
/** the version was submitted for review by the developer */
|
|
802
|
+
SUBMITTED = "SUBMITTED",
|
|
803
|
+
/** the version is being reviewed by the app market team in cactus */
|
|
804
|
+
IN_REVIEW = "IN_REVIEW",
|
|
805
|
+
/** our team approved the version */
|
|
806
|
+
APPROVED = "APPROVED",
|
|
807
|
+
/** this version is published - only one version can be published at any given time; if this app was already published, the previously published version's status is now ARCHIVED */
|
|
808
|
+
PUBLISHED = "PUBLISHED",
|
|
809
|
+
/** our team did not accept this version of the app */
|
|
810
|
+
DECLINED = "DECLINED",
|
|
811
|
+
/** the status for versions that are no longer relevant */
|
|
812
|
+
ARCHIVED = "ARCHIVED",
|
|
813
|
+
/** status for versions with no significant changes, e.g. for test app. for questions contact our team */
|
|
814
|
+
HIDDEN = "HIDDEN",
|
|
815
|
+
/** mark apps as RELEASED, without adding to the apps cache, and allow users to install */
|
|
816
|
+
RELEASED = "RELEASED"
|
|
817
|
+
}
|
|
818
|
+
interface MessageEnvelope {
|
|
819
|
+
/** App instance ID. */
|
|
820
|
+
instanceId?: string | null;
|
|
821
|
+
/** Event type. */
|
|
822
|
+
eventType?: string;
|
|
823
|
+
/** The identification type and identity data. */
|
|
824
|
+
identity?: IdentificationData;
|
|
825
|
+
/** Stringify payload. */
|
|
826
|
+
data?: string;
|
|
827
|
+
}
|
|
828
|
+
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
829
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
830
|
+
anonymousVisitorId?: string;
|
|
831
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
832
|
+
memberId?: string;
|
|
833
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
834
|
+
wixUserId?: string;
|
|
835
|
+
/** ID of an app. */
|
|
836
|
+
appId?: string;
|
|
837
|
+
/** @readonly */
|
|
838
|
+
identityType?: WebhookIdentityType;
|
|
839
|
+
}
|
|
840
|
+
/** @oneof */
|
|
841
|
+
interface IdentificationDataIdOneOf {
|
|
842
|
+
/** ID of a site visitor that has not logged in to the site. */
|
|
843
|
+
anonymousVisitorId?: string;
|
|
844
|
+
/** ID of a site visitor that has logged in to the site. */
|
|
845
|
+
memberId?: string;
|
|
846
|
+
/** ID of a Wix user (site owner, contributor, etc.). */
|
|
847
|
+
wixUserId?: string;
|
|
848
|
+
/** ID of an app. */
|
|
849
|
+
appId?: string;
|
|
850
|
+
}
|
|
851
|
+
declare enum WebhookIdentityType {
|
|
852
|
+
UNKNOWN = "UNKNOWN",
|
|
853
|
+
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
854
|
+
MEMBER = "MEMBER",
|
|
855
|
+
WIX_USER = "WIX_USER",
|
|
856
|
+
APP = "APP"
|
|
857
|
+
}
|
|
858
|
+
interface DataExtensionSchemaNonNullableFields {
|
|
859
|
+
extensionPoint: string;
|
|
860
|
+
}
|
|
861
|
+
interface CreateDataExtensionSchemaResponseNonNullableFields {
|
|
862
|
+
dataExtensionSchema?: DataExtensionSchemaNonNullableFields;
|
|
863
|
+
}
|
|
864
|
+
interface UpdateDataExtensionSchemaResponseNonNullableFields {
|
|
865
|
+
dataExtensionSchema?: DataExtensionSchemaNonNullableFields;
|
|
866
|
+
}
|
|
867
|
+
interface ListDataExtensionSchemasResponseNonNullableFields {
|
|
868
|
+
dataExtensionSchemas: DataExtensionSchemaNonNullableFields[];
|
|
869
|
+
}
|
|
870
|
+
interface DeleteByWhiteListedMetaSiteResponseNonNullableFields {
|
|
871
|
+
hasMore: boolean;
|
|
872
|
+
}
|
|
873
|
+
interface BaseEventMetadata {
|
|
874
|
+
/** App instance ID. */
|
|
875
|
+
instanceId?: string | null;
|
|
876
|
+
/** Event type. */
|
|
877
|
+
eventType?: string;
|
|
878
|
+
/** The identification type and identity data. */
|
|
879
|
+
identity?: IdentificationData;
|
|
880
|
+
}
|
|
881
|
+
interface EventMetadata extends BaseEventMetadata {
|
|
882
|
+
/**
|
|
883
|
+
* Unique event ID.
|
|
884
|
+
* Allows clients to ignore duplicate webhooks.
|
|
885
|
+
*/
|
|
886
|
+
_id?: string;
|
|
887
|
+
/**
|
|
888
|
+
* Assumes actions are also always typed to an entity_type
|
|
889
|
+
* Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
|
|
890
|
+
*/
|
|
891
|
+
entityFqdn?: string;
|
|
892
|
+
/**
|
|
893
|
+
* This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
|
|
894
|
+
* This is although the created/updated/deleted notion is duplication of the oneof types
|
|
895
|
+
* Example: created/updated/deleted/started/completed/email_opened
|
|
896
|
+
*/
|
|
897
|
+
slug?: string;
|
|
898
|
+
/** ID of the entity associated with the event. */
|
|
899
|
+
entityId?: string;
|
|
900
|
+
/** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
|
|
901
|
+
eventTime?: Date;
|
|
902
|
+
/**
|
|
903
|
+
* Whether the event was triggered as a result of a privacy regulation application
|
|
904
|
+
* (for example, GDPR).
|
|
905
|
+
*/
|
|
906
|
+
triggeredByAnonymizeRequest?: boolean | null;
|
|
907
|
+
/** If present, indicates the action that triggered the event. */
|
|
908
|
+
originatedFrom?: string | null;
|
|
909
|
+
/**
|
|
910
|
+
* A sequence number defining the order of updates to the underlying entity.
|
|
911
|
+
* For example, given that some entity was updated at 16:00 and than again at 16:01,
|
|
912
|
+
* it is guaranteed that the sequence number of the second update is strictly higher than the first.
|
|
913
|
+
* As the consumer, you can use this value to ensure that you handle messages in the correct order.
|
|
914
|
+
* To do so, you will need to persist this number on your end, and compare the sequence number from the
|
|
915
|
+
* message against the one you have stored. Given that the stored number is higher, you should ignore the message.
|
|
916
|
+
*/
|
|
917
|
+
entityEventSequence?: string | null;
|
|
918
|
+
}
|
|
919
|
+
interface DataExtensionSchemaCreatedEnvelope {
|
|
920
|
+
entity: DataExtensionSchema;
|
|
921
|
+
metadata: EventMetadata;
|
|
922
|
+
}
|
|
923
|
+
interface DataExtensionSchemaUpdatedEnvelope {
|
|
924
|
+
entity: DataExtensionSchema;
|
|
925
|
+
metadata: EventMetadata;
|
|
926
|
+
}
|
|
927
|
+
interface DataExtensionSchemaDeletedEnvelope {
|
|
928
|
+
metadata: EventMetadata;
|
|
929
|
+
}
|
|
930
|
+
interface UpdateDataExtensionSchemaOptions {
|
|
931
|
+
/** Schema to update. */
|
|
932
|
+
dataExtensionSchema?: DataExtensionSchema;
|
|
933
|
+
}
|
|
934
|
+
interface ListDataExtensionSchemasOptions {
|
|
935
|
+
/** Namespaces within the given entity. */
|
|
936
|
+
namespaces?: string[];
|
|
937
|
+
/** Additional fields that are hidden by default. For example, fields with `"x-wix-archived": true`. */
|
|
938
|
+
fields?: RequestedField[];
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
declare function createDataExtensionSchema$1(httpClient: HttpClient): CreateDataExtensionSchemaSignature;
|
|
942
|
+
interface CreateDataExtensionSchemaSignature {
|
|
943
|
+
/**
|
|
944
|
+
* Creates a user-defined data extension schema.
|
|
945
|
+
* @param - Schema to create.
|
|
946
|
+
* @returns Created schema.
|
|
947
|
+
*/
|
|
948
|
+
(dataExtensionSchema: DataExtensionSchema): Promise<DataExtensionSchema & DataExtensionSchemaNonNullableFields>;
|
|
949
|
+
}
|
|
950
|
+
declare function updateDataExtensionSchema$1(httpClient: HttpClient): UpdateDataExtensionSchemaSignature;
|
|
951
|
+
interface UpdateDataExtensionSchemaSignature {
|
|
952
|
+
/**
|
|
953
|
+
* Updates a user-defined data extension schema, overriding the existing data.
|
|
954
|
+
* @param - Field options. The following fields **must** be passed: `_id`, `jsonSchema`, `revision`.
|
|
955
|
+
*/
|
|
956
|
+
(options?: UpdateDataExtensionSchemaOptions | undefined): Promise<UpdateDataExtensionSchemaResponse & UpdateDataExtensionSchemaResponseNonNullableFields>;
|
|
957
|
+
}
|
|
958
|
+
declare function listDataExtensionSchemas$1(httpClient: HttpClient): ListDataExtensionSchemasSignature;
|
|
959
|
+
interface ListDataExtensionSchemasSignature {
|
|
960
|
+
/**
|
|
961
|
+
* Retrieves a list of global and user-defined data extension schemas for a given FQDN.
|
|
962
|
+
* @param - [Fully qualified domain name](https://dev.wix.com/docs/rest/articles/getting-started/fqdns).
|
|
963
|
+
*/
|
|
964
|
+
(fqdn: string, options?: ListDataExtensionSchemasOptions | undefined): Promise<ListDataExtensionSchemasResponse & ListDataExtensionSchemasResponseNonNullableFields>;
|
|
965
|
+
}
|
|
966
|
+
declare function deleteByWhiteListedMetaSite$1(httpClient: HttpClient): DeleteByWhiteListedMetaSiteSignature;
|
|
967
|
+
interface DeleteByWhiteListedMetaSiteSignature {
|
|
968
|
+
/**
|
|
969
|
+
* Deletes schemas of whitelisted metasite ids
|
|
970
|
+
* @param - Meta site id
|
|
971
|
+
*/
|
|
972
|
+
(metaSiteId: string): Promise<DeleteByWhiteListedMetaSiteResponse & DeleteByWhiteListedMetaSiteResponseNonNullableFields>;
|
|
973
|
+
}
|
|
974
|
+
declare const onDataExtensionSchemaCreated$1: EventDefinition<DataExtensionSchemaCreatedEnvelope, "wix.data_extensions.v1.data_extension_schema_created">;
|
|
975
|
+
declare const onDataExtensionSchemaUpdated$1: EventDefinition<DataExtensionSchemaUpdatedEnvelope, "wix.data_extensions.v1.data_extension_schema_updated">;
|
|
976
|
+
declare const onDataExtensionSchemaDeleted$1: EventDefinition<DataExtensionSchemaDeletedEnvelope, "wix.data_extensions.v1.data_extension_schema_deleted">;
|
|
977
|
+
|
|
978
|
+
declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
|
|
979
|
+
|
|
980
|
+
declare const createDataExtensionSchema: MaybeContext<BuildRESTFunction<typeof createDataExtensionSchema$1> & typeof createDataExtensionSchema$1>;
|
|
981
|
+
declare const updateDataExtensionSchema: MaybeContext<BuildRESTFunction<typeof updateDataExtensionSchema$1> & typeof updateDataExtensionSchema$1>;
|
|
982
|
+
declare const listDataExtensionSchemas: MaybeContext<BuildRESTFunction<typeof listDataExtensionSchemas$1> & typeof listDataExtensionSchemas$1>;
|
|
983
|
+
declare const deleteByWhiteListedMetaSite: MaybeContext<BuildRESTFunction<typeof deleteByWhiteListedMetaSite$1> & typeof deleteByWhiteListedMetaSite$1>;
|
|
984
|
+
|
|
985
|
+
type _publicOnDataExtensionSchemaCreatedType = typeof onDataExtensionSchemaCreated$1;
|
|
986
|
+
/**
|
|
987
|
+
* Triggered when a data extension schema is created.
|
|
988
|
+
*/
|
|
989
|
+
declare const onDataExtensionSchemaCreated: ReturnType<typeof createEventModule<_publicOnDataExtensionSchemaCreatedType>>;
|
|
990
|
+
|
|
991
|
+
type _publicOnDataExtensionSchemaUpdatedType = typeof onDataExtensionSchemaUpdated$1;
|
|
992
|
+
/**
|
|
993
|
+
* Triggered when a data extension schema is updated.
|
|
994
|
+
*/
|
|
995
|
+
declare const onDataExtensionSchemaUpdated: ReturnType<typeof createEventModule<_publicOnDataExtensionSchemaUpdatedType>>;
|
|
996
|
+
|
|
997
|
+
type _publicOnDataExtensionSchemaDeletedType = typeof onDataExtensionSchemaDeleted$1;
|
|
998
|
+
/**
|
|
999
|
+
* Triggered when a data extension schema is deleted.
|
|
1000
|
+
*/
|
|
1001
|
+
declare const onDataExtensionSchemaDeleted: ReturnType<typeof createEventModule<_publicOnDataExtensionSchemaDeletedType>>;
|
|
1002
|
+
|
|
1003
|
+
type context_ActionEvent = ActionEvent;
|
|
1004
|
+
type context_AppVersionApproved = AppVersionApproved;
|
|
1005
|
+
type context_AppVersionArchived = AppVersionArchived;
|
|
1006
|
+
type context_AppVersionCreated = AppVersionCreated;
|
|
1007
|
+
type context_AppVersionDeclined = AppVersionDeclined;
|
|
1008
|
+
type context_AppVersionDraftChanged = AppVersionDraftChanged;
|
|
1009
|
+
type context_AppVersionPublished = AppVersionPublished;
|
|
1010
|
+
type context_AppVersionReleased = AppVersionReleased;
|
|
1011
|
+
type context_AppVersionStateChanged = AppVersionStateChanged;
|
|
1012
|
+
type context_AppVersionStateChangedStateOneOf = AppVersionStateChangedStateOneOf;
|
|
1013
|
+
type context_AppVersionSubmitted = AppVersionSubmitted;
|
|
1014
|
+
type context_BaseEventMetadata = BaseEventMetadata;
|
|
1015
|
+
type context_CreateDataExtensionSchemaRequest = CreateDataExtensionSchemaRequest;
|
|
1016
|
+
type context_CreateDataExtensionSchemaResponse = CreateDataExtensionSchemaResponse;
|
|
1017
|
+
type context_CreateDataExtensionSchemaResponseNonNullableFields = CreateDataExtensionSchemaResponseNonNullableFields;
|
|
1018
|
+
type context_DataExtensionSchema = DataExtensionSchema;
|
|
1019
|
+
type context_DataExtensionSchemaCreatedEnvelope = DataExtensionSchemaCreatedEnvelope;
|
|
1020
|
+
type context_DataExtensionSchemaDeletedEnvelope = DataExtensionSchemaDeletedEnvelope;
|
|
1021
|
+
type context_DataExtensionSchemaNonNullableFields = DataExtensionSchemaNonNullableFields;
|
|
1022
|
+
type context_DataExtensionSchemaUpdatedEnvelope = DataExtensionSchemaUpdatedEnvelope;
|
|
1023
|
+
type context_DeleteByWhiteListedMetaSiteRequest = DeleteByWhiteListedMetaSiteRequest;
|
|
1024
|
+
type context_DeleteByWhiteListedMetaSiteResponse = DeleteByWhiteListedMetaSiteResponse;
|
|
1025
|
+
type context_DeleteByWhiteListedMetaSiteResponseNonNullableFields = DeleteByWhiteListedMetaSiteResponseNonNullableFields;
|
|
1026
|
+
type context_DeleteDemoDataExtensionSchemaRequest = DeleteDemoDataExtensionSchemaRequest;
|
|
1027
|
+
type context_DeleteDemoDataExtensionSchemaResponse = DeleteDemoDataExtensionSchemaResponse;
|
|
1028
|
+
type context_DeleteGlobalExtensionSchemaRequest = DeleteGlobalExtensionSchemaRequest;
|
|
1029
|
+
type context_DeleteGlobalExtensionSchemaResponse = DeleteGlobalExtensionSchemaResponse;
|
|
1030
|
+
type context_DomainEvent = DomainEvent;
|
|
1031
|
+
type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
|
|
1032
|
+
type context_Empty = Empty;
|
|
1033
|
+
type context_EntityCreatedEvent = EntityCreatedEvent;
|
|
1034
|
+
type context_EntityDeletedEvent = EntityDeletedEvent;
|
|
1035
|
+
type context_EntityUpdatedEvent = EntityUpdatedEvent;
|
|
1036
|
+
type context_EventMetadata = EventMetadata;
|
|
1037
|
+
type context_IdentificationData = IdentificationData;
|
|
1038
|
+
type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
|
|
1039
|
+
type context_ListAllDataExtensionSchemasRequest = ListAllDataExtensionSchemasRequest;
|
|
1040
|
+
type context_ListAllDataExtensionSchemasResponse = ListAllDataExtensionSchemasResponse;
|
|
1041
|
+
type context_ListDataExtensionSchemasOptions = ListDataExtensionSchemasOptions;
|
|
1042
|
+
type context_ListDataExtensionSchemasRequest = ListDataExtensionSchemasRequest;
|
|
1043
|
+
type context_ListDataExtensionSchemasResponse = ListDataExtensionSchemasResponse;
|
|
1044
|
+
type context_ListDataExtensionSchemasResponseNonNullableFields = ListDataExtensionSchemasResponseNonNullableFields;
|
|
1045
|
+
type context_MessageEnvelope = MessageEnvelope;
|
|
1046
|
+
type context_ReindexEvent = ReindexEvent;
|
|
1047
|
+
type context_ReindexField = ReindexField;
|
|
1048
|
+
type context_RequestedField = RequestedField;
|
|
1049
|
+
declare const context_RequestedField: typeof RequestedField;
|
|
1050
|
+
type context_RestoreInfo = RestoreInfo;
|
|
1051
|
+
type context_UpdateDataExtensionSchemaOptions = UpdateDataExtensionSchemaOptions;
|
|
1052
|
+
type context_UpdateDataExtensionSchemaRequest = UpdateDataExtensionSchemaRequest;
|
|
1053
|
+
type context_UpdateDataExtensionSchemaResponse = UpdateDataExtensionSchemaResponse;
|
|
1054
|
+
type context_UpdateDataExtensionSchemaResponseNonNullableFields = UpdateDataExtensionSchemaResponseNonNullableFields;
|
|
1055
|
+
type context_UpsertDataExtensionGlobalSchemaRequest = UpsertDataExtensionGlobalSchemaRequest;
|
|
1056
|
+
type context_UpsertDataExtensionGlobalSchemaResponse = UpsertDataExtensionGlobalSchemaResponse;
|
|
1057
|
+
type context_VersionStatus = VersionStatus;
|
|
1058
|
+
declare const context_VersionStatus: typeof VersionStatus;
|
|
1059
|
+
type context_WebhookIdentityType = WebhookIdentityType;
|
|
1060
|
+
declare const context_WebhookIdentityType: typeof WebhookIdentityType;
|
|
1061
|
+
type context__publicOnDataExtensionSchemaCreatedType = _publicOnDataExtensionSchemaCreatedType;
|
|
1062
|
+
type context__publicOnDataExtensionSchemaDeletedType = _publicOnDataExtensionSchemaDeletedType;
|
|
1063
|
+
type context__publicOnDataExtensionSchemaUpdatedType = _publicOnDataExtensionSchemaUpdatedType;
|
|
1064
|
+
declare const context_createDataExtensionSchema: typeof createDataExtensionSchema;
|
|
1065
|
+
declare const context_deleteByWhiteListedMetaSite: typeof deleteByWhiteListedMetaSite;
|
|
1066
|
+
declare const context_listDataExtensionSchemas: typeof listDataExtensionSchemas;
|
|
1067
|
+
declare const context_onDataExtensionSchemaCreated: typeof onDataExtensionSchemaCreated;
|
|
1068
|
+
declare const context_onDataExtensionSchemaDeleted: typeof onDataExtensionSchemaDeleted;
|
|
1069
|
+
declare const context_onDataExtensionSchemaUpdated: typeof onDataExtensionSchemaUpdated;
|
|
1070
|
+
declare const context_updateDataExtensionSchema: typeof updateDataExtensionSchema;
|
|
1071
|
+
declare namespace context {
|
|
1072
|
+
export { type context_ActionEvent as ActionEvent, type context_AppVersionApproved as AppVersionApproved, type context_AppVersionArchived as AppVersionArchived, type context_AppVersionCreated as AppVersionCreated, type context_AppVersionDeclined as AppVersionDeclined, type context_AppVersionDraftChanged as AppVersionDraftChanged, type context_AppVersionPublished as AppVersionPublished, type context_AppVersionReleased as AppVersionReleased, type context_AppVersionStateChanged as AppVersionStateChanged, type context_AppVersionStateChangedStateOneOf as AppVersionStateChangedStateOneOf, type context_AppVersionSubmitted as AppVersionSubmitted, type context_BaseEventMetadata as BaseEventMetadata, type context_CreateDataExtensionSchemaRequest as CreateDataExtensionSchemaRequest, type context_CreateDataExtensionSchemaResponse as CreateDataExtensionSchemaResponse, type context_CreateDataExtensionSchemaResponseNonNullableFields as CreateDataExtensionSchemaResponseNonNullableFields, type context_DataExtensionSchema as DataExtensionSchema, type context_DataExtensionSchemaCreatedEnvelope as DataExtensionSchemaCreatedEnvelope, type context_DataExtensionSchemaDeletedEnvelope as DataExtensionSchemaDeletedEnvelope, type context_DataExtensionSchemaNonNullableFields as DataExtensionSchemaNonNullableFields, type context_DataExtensionSchemaUpdatedEnvelope as DataExtensionSchemaUpdatedEnvelope, type context_DeleteByWhiteListedMetaSiteRequest as DeleteByWhiteListedMetaSiteRequest, type context_DeleteByWhiteListedMetaSiteResponse as DeleteByWhiteListedMetaSiteResponse, type context_DeleteByWhiteListedMetaSiteResponseNonNullableFields as DeleteByWhiteListedMetaSiteResponseNonNullableFields, type context_DeleteDemoDataExtensionSchemaRequest as DeleteDemoDataExtensionSchemaRequest, type context_DeleteDemoDataExtensionSchemaResponse as DeleteDemoDataExtensionSchemaResponse, type context_DeleteGlobalExtensionSchemaRequest as DeleteGlobalExtensionSchemaRequest, type context_DeleteGlobalExtensionSchemaResponse as DeleteGlobalExtensionSchemaResponse, 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_EventMetadata as EventMetadata, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context_ListAllDataExtensionSchemasRequest as ListAllDataExtensionSchemasRequest, type context_ListAllDataExtensionSchemasResponse as ListAllDataExtensionSchemasResponse, type context_ListDataExtensionSchemasOptions as ListDataExtensionSchemasOptions, type context_ListDataExtensionSchemasRequest as ListDataExtensionSchemasRequest, type context_ListDataExtensionSchemasResponse as ListDataExtensionSchemasResponse, type context_ListDataExtensionSchemasResponseNonNullableFields as ListDataExtensionSchemasResponseNonNullableFields, type context_MessageEnvelope as MessageEnvelope, type context_ReindexEvent as ReindexEvent, type context_ReindexField as ReindexField, context_RequestedField as RequestedField, type context_RestoreInfo as RestoreInfo, type context_UpdateDataExtensionSchemaOptions as UpdateDataExtensionSchemaOptions, type context_UpdateDataExtensionSchemaRequest as UpdateDataExtensionSchemaRequest, type context_UpdateDataExtensionSchemaResponse as UpdateDataExtensionSchemaResponse, type context_UpdateDataExtensionSchemaResponseNonNullableFields as UpdateDataExtensionSchemaResponseNonNullableFields, type context_UpsertDataExtensionGlobalSchemaRequest as UpsertDataExtensionGlobalSchemaRequest, type context_UpsertDataExtensionGlobalSchemaResponse as UpsertDataExtensionGlobalSchemaResponse, context_VersionStatus as VersionStatus, context_WebhookIdentityType as WebhookIdentityType, type context__publicOnDataExtensionSchemaCreatedType as _publicOnDataExtensionSchemaCreatedType, type context__publicOnDataExtensionSchemaDeletedType as _publicOnDataExtensionSchemaDeletedType, type context__publicOnDataExtensionSchemaUpdatedType as _publicOnDataExtensionSchemaUpdatedType, context_createDataExtensionSchema as createDataExtensionSchema, context_deleteByWhiteListedMetaSite as deleteByWhiteListedMetaSite, context_listDataExtensionSchemas as listDataExtensionSchemas, context_onDataExtensionSchemaCreated as onDataExtensionSchemaCreated, context_onDataExtensionSchemaDeleted as onDataExtensionSchemaDeleted, context_onDataExtensionSchemaUpdated as onDataExtensionSchemaUpdated, onDataExtensionSchemaCreated$1 as publicOnDataExtensionSchemaCreated, onDataExtensionSchemaDeleted$1 as publicOnDataExtensionSchemaDeleted, onDataExtensionSchemaUpdated$1 as publicOnDataExtensionSchemaUpdated, context_updateDataExtensionSchema as updateDataExtensionSchema };
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
export { context as schemas };
|