@wix/analytics-session 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/analytics-session",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"type-bundles"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@wix/analytics-session_analytics-session": "1.0.
|
|
21
|
+
"@wix/analytics-session_analytics-session": "1.0.15"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"glob": "^10.4.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"fqdn": ""
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"falconPackageHash": "
|
|
46
|
+
"falconPackageHash": "2fe449a00786ac7cf2abd640277ff4ebf90091715cc0fbc6a5366960"
|
|
47
47
|
}
|
|
@@ -1,8 +1,47 @@
|
|
|
1
|
+
type HostModule<T, H extends Host> = {
|
|
2
|
+
__type: 'host';
|
|
3
|
+
create(host: H): T;
|
|
4
|
+
};
|
|
5
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
+
type Host<Environment = unknown> = {
|
|
7
|
+
channel: {
|
|
8
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
|
+
disconnect: () => void;
|
|
10
|
+
} | Promise<{
|
|
11
|
+
disconnect: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
|
+
*/
|
|
18
|
+
apiBaseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
21
|
+
* like internationalization, billing, etc.
|
|
22
|
+
*/
|
|
23
|
+
essentials?: {
|
|
24
|
+
/**
|
|
25
|
+
* The language of the currently viewed session
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The locale of the currently viewed session
|
|
30
|
+
*/
|
|
31
|
+
locale?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Any headers that should be passed through to the API requests
|
|
34
|
+
*/
|
|
35
|
+
passThroughHeaders?: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
1
39
|
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
2
40
|
interface HttpClient {
|
|
3
41
|
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
4
42
|
fetchWithAuth: typeof fetch;
|
|
5
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
|
+
getActiveToken?: () => string | undefined;
|
|
6
45
|
}
|
|
7
46
|
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
8
47
|
type HttpResponse<T = any> = {
|
|
@@ -24,6 +63,65 @@ type APIMetadata = {
|
|
|
24
63
|
packageName?: string;
|
|
25
64
|
};
|
|
26
65
|
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
67
|
+
__type: 'event-definition';
|
|
68
|
+
type: Type;
|
|
69
|
+
isDomainEvent?: boolean;
|
|
70
|
+
transformations?: (envelope: unknown) => Payload;
|
|
71
|
+
__payload: Payload;
|
|
72
|
+
};
|
|
73
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
74
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
76
|
+
|
|
77
|
+
type ServicePluginMethodInput = {
|
|
78
|
+
request: any;
|
|
79
|
+
metadata: any;
|
|
80
|
+
};
|
|
81
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata = {
|
|
83
|
+
name: string;
|
|
84
|
+
primaryHttpMappingPath: string;
|
|
85
|
+
transformations: {
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
87
|
+
toREST: (...args: unknown[]) => unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
91
|
+
__type: 'service-plugin-definition';
|
|
92
|
+
componentType: string;
|
|
93
|
+
methods: ServicePluginMethodMetadata[];
|
|
94
|
+
__contract: Contract;
|
|
95
|
+
};
|
|
96
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
99
|
+
|
|
100
|
+
type RequestContext = {
|
|
101
|
+
isSSR: boolean;
|
|
102
|
+
host: string;
|
|
103
|
+
protocol?: string;
|
|
104
|
+
};
|
|
105
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
106
|
+
/**
|
|
107
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
|
+
*/
|
|
111
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
113
|
+
_?: T;
|
|
114
|
+
url?: string;
|
|
115
|
+
method?: Method;
|
|
116
|
+
params?: any;
|
|
117
|
+
data?: any;
|
|
118
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
119
|
+
};
|
|
120
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
121
|
+
__isAmbassador: boolean;
|
|
122
|
+
};
|
|
123
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
27
125
|
|
|
28
126
|
declare global {
|
|
29
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -32,6 +130,284 @@ declare global {
|
|
|
32
130
|
}
|
|
33
131
|
}
|
|
34
132
|
|
|
133
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
137
|
+
|
|
138
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
139
|
+
|
|
140
|
+
@example
|
|
141
|
+
```
|
|
142
|
+
import type {EmptyObject} from 'type-fest';
|
|
143
|
+
|
|
144
|
+
// The following illustrates the problem with `{}`.
|
|
145
|
+
const foo1: {} = {}; // Pass
|
|
146
|
+
const foo2: {} = []; // Pass
|
|
147
|
+
const foo3: {} = 42; // Pass
|
|
148
|
+
const foo4: {} = {a: 1}; // Pass
|
|
149
|
+
|
|
150
|
+
// With `EmptyObject` only the first case is valid.
|
|
151
|
+
const bar1: EmptyObject = {}; // Pass
|
|
152
|
+
const bar2: EmptyObject = 42; // Fail
|
|
153
|
+
const bar3: EmptyObject = []; // Fail
|
|
154
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
158
|
+
|
|
159
|
+
@category Object
|
|
160
|
+
*/
|
|
161
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Returns a boolean for whether the two given types are equal.
|
|
165
|
+
|
|
166
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
167
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
168
|
+
|
|
169
|
+
Use-cases:
|
|
170
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
171
|
+
|
|
172
|
+
@example
|
|
173
|
+
```
|
|
174
|
+
import type {IsEqual} from 'type-fest';
|
|
175
|
+
|
|
176
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
177
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
178
|
+
type Includes<Value extends readonly any[], Item> =
|
|
179
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
180
|
+
? IsEqual<Value[0], Item> extends true
|
|
181
|
+
? true
|
|
182
|
+
: Includes<rest, Item>
|
|
183
|
+
: false;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
@category Type Guard
|
|
187
|
+
@category Utilities
|
|
188
|
+
*/
|
|
189
|
+
type IsEqual<A, B> =
|
|
190
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
191
|
+
(<G>() => G extends B ? 1 : 2)
|
|
192
|
+
? true
|
|
193
|
+
: false;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
Filter out keys from an object.
|
|
197
|
+
|
|
198
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
199
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
200
|
+
Returns `Key` otherwise.
|
|
201
|
+
|
|
202
|
+
@example
|
|
203
|
+
```
|
|
204
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
205
|
+
//=> never
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
@example
|
|
209
|
+
```
|
|
210
|
+
type Filtered = Filter<'bar', string>;
|
|
211
|
+
//=> never
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
@example
|
|
215
|
+
```
|
|
216
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
217
|
+
//=> 'bar'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
@see {Except}
|
|
221
|
+
*/
|
|
222
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
|
+
|
|
224
|
+
type ExceptOptions = {
|
|
225
|
+
/**
|
|
226
|
+
Disallow assigning non-specified properties.
|
|
227
|
+
|
|
228
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
229
|
+
|
|
230
|
+
@default false
|
|
231
|
+
*/
|
|
232
|
+
requireExactProps?: boolean;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
Create a type from an object type without certain keys.
|
|
237
|
+
|
|
238
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
239
|
+
|
|
240
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
241
|
+
|
|
242
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
243
|
+
|
|
244
|
+
@example
|
|
245
|
+
```
|
|
246
|
+
import type {Except} from 'type-fest';
|
|
247
|
+
|
|
248
|
+
type Foo = {
|
|
249
|
+
a: number;
|
|
250
|
+
b: string;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
254
|
+
//=> {b: string}
|
|
255
|
+
|
|
256
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
257
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
258
|
+
|
|
259
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
260
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
261
|
+
|
|
262
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
263
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
@category Object
|
|
267
|
+
*/
|
|
268
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
|
+
} & (Options['requireExactProps'] extends true
|
|
271
|
+
? Partial<Record<KeysType, never>>
|
|
272
|
+
: {});
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
|
+
|
|
277
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
278
|
+
|
|
279
|
+
@example
|
|
280
|
+
```
|
|
281
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
282
|
+
|
|
283
|
+
interface Example {
|
|
284
|
+
a: string;
|
|
285
|
+
b: string | number;
|
|
286
|
+
c?: string;
|
|
287
|
+
d: {};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
291
|
+
//=> 'a'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
295
|
+
|
|
296
|
+
@example
|
|
297
|
+
```
|
|
298
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
299
|
+
|
|
300
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
301
|
+
//=> 'a' | 'c'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
@category Object
|
|
305
|
+
*/
|
|
306
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
307
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
|
+
{
|
|
309
|
+
// Map through all the keys of the given base type.
|
|
310
|
+
[Key in keyof Base]:
|
|
311
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
312
|
+
Base[Key] extends Condition
|
|
313
|
+
// Retain this key since the condition passes.
|
|
314
|
+
? Key
|
|
315
|
+
// Discard this key since the condition fails.
|
|
316
|
+
: never;
|
|
317
|
+
|
|
318
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
+
}[keyof Base]
|
|
320
|
+
>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
324
|
+
|
|
325
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
326
|
+
|
|
327
|
+
@example
|
|
328
|
+
```
|
|
329
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
330
|
+
|
|
331
|
+
class Awesome {
|
|
332
|
+
name: string;
|
|
333
|
+
successes: number;
|
|
334
|
+
failures: bigint;
|
|
335
|
+
|
|
336
|
+
run() {}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
340
|
+
//=> {run: () => void}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
@example
|
|
344
|
+
```
|
|
345
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
346
|
+
|
|
347
|
+
interface Example {
|
|
348
|
+
a: string;
|
|
349
|
+
b: string | number;
|
|
350
|
+
c: () => void;
|
|
351
|
+
d: {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
355
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
@category Object
|
|
359
|
+
*/
|
|
360
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
361
|
+
Base,
|
|
362
|
+
ConditionalKeys<Base, Condition>
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
367
|
+
* can either be a REST module or a host module.
|
|
368
|
+
* This type is recursive, so it can describe nested modules.
|
|
369
|
+
*/
|
|
370
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
371
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
375
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
376
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
|
+
* do not match the given host (as they will not work with the given host).
|
|
378
|
+
*/
|
|
379
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
380
|
+
done: T;
|
|
381
|
+
recurse: T extends {
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
385
|
+
-1,
|
|
386
|
+
0,
|
|
387
|
+
1,
|
|
388
|
+
2,
|
|
389
|
+
3,
|
|
390
|
+
4,
|
|
391
|
+
5
|
|
392
|
+
][Depth]> : never;
|
|
393
|
+
}, EmptyObject>;
|
|
394
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
+
type PublicMetadata = {
|
|
396
|
+
PACKAGE_NAME?: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare global {
|
|
400
|
+
interface ContextualClient {
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A type used to create concerete types from SDK descriptors in
|
|
405
|
+
* case a contextual client is available.
|
|
406
|
+
*/
|
|
407
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host;
|
|
409
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
410
|
+
|
|
35
411
|
interface Session {
|
|
36
412
|
/** Session ID. */
|
|
37
413
|
_id?: string;
|
|
@@ -271,6 +647,14 @@ interface MarkSessionAsRecordedRequest {
|
|
|
271
647
|
/** Mark a browser session as recorded. */
|
|
272
648
|
interface MarkSessionAsRecordedResponse {
|
|
273
649
|
}
|
|
650
|
+
/** Marks browser session recordings as deleted. */
|
|
651
|
+
interface MarkRecordingsAsDeletedRequest {
|
|
652
|
+
/** Browser session IDs. */
|
|
653
|
+
sessionIds: string[];
|
|
654
|
+
}
|
|
655
|
+
/** Marks browser session recordings as deleted. */
|
|
656
|
+
interface MarkRecordingsAsDeletedResponse {
|
|
657
|
+
}
|
|
274
658
|
interface ListSessionsAsyncResponseNonNullableFields {
|
|
275
659
|
jobId: string;
|
|
276
660
|
}
|
|
@@ -336,10 +720,20 @@ interface MarkSessionAsRecordedSignature {
|
|
|
336
720
|
*/
|
|
337
721
|
(sessionId: string): Promise<void>;
|
|
338
722
|
}
|
|
723
|
+
declare function markRecordingsAsDeleted$1(httpClient: HttpClient): MarkRecordingsAsDeletedSignature;
|
|
724
|
+
interface MarkRecordingsAsDeletedSignature {
|
|
725
|
+
/**
|
|
726
|
+
* Marks browser session recordings as deleted.
|
|
727
|
+
* @param - Browser session IDs.
|
|
728
|
+
* @returns Marks browser session recordings as deleted.
|
|
729
|
+
*/
|
|
730
|
+
(sessionIds: string[]): Promise<void>;
|
|
731
|
+
}
|
|
339
732
|
|
|
340
|
-
declare const listSessionsAsync: BuildRESTFunction<typeof listSessionsAsync$1> & typeof listSessionsAsync$1
|
|
341
|
-
declare const getListSessionsJobResult: BuildRESTFunction<typeof getListSessionsJobResult$1> & typeof getListSessionsJobResult$1
|
|
342
|
-
declare const markSessionAsRecorded: BuildRESTFunction<typeof markSessionAsRecorded$1> & typeof markSessionAsRecorded$1
|
|
733
|
+
declare const listSessionsAsync: MaybeContext<BuildRESTFunction<typeof listSessionsAsync$1> & typeof listSessionsAsync$1>;
|
|
734
|
+
declare const getListSessionsJobResult: MaybeContext<BuildRESTFunction<typeof getListSessionsJobResult$1> & typeof getListSessionsJobResult$1>;
|
|
735
|
+
declare const markSessionAsRecorded: MaybeContext<BuildRESTFunction<typeof markSessionAsRecorded$1> & typeof markSessionAsRecorded$1>;
|
|
736
|
+
declare const markRecordingsAsDeleted: MaybeContext<BuildRESTFunction<typeof markRecordingsAsDeleted$1> & typeof markRecordingsAsDeleted$1>;
|
|
343
737
|
|
|
344
738
|
type context_ConversionFunnelSessionsParams = ConversionFunnelSessionsParams;
|
|
345
739
|
type context_CountFunnelSessionsRequest = CountFunnelSessionsRequest;
|
|
@@ -366,6 +760,8 @@ type context_ListSessionsAsyncRequestParamsOneOf = ListSessionsAsyncRequestParam
|
|
|
366
760
|
type context_ListSessionsAsyncRequestPeriodOneOf = ListSessionsAsyncRequestPeriodOneOf;
|
|
367
761
|
type context_ListSessionsAsyncResponse = ListSessionsAsyncResponse;
|
|
368
762
|
type context_ListSessionsAsyncResponseNonNullableFields = ListSessionsAsyncResponseNonNullableFields;
|
|
763
|
+
type context_MarkRecordingsAsDeletedRequest = MarkRecordingsAsDeletedRequest;
|
|
764
|
+
type context_MarkRecordingsAsDeletedResponse = MarkRecordingsAsDeletedResponse;
|
|
369
765
|
type context_MarkSessionAsRecordedRequest = MarkSessionAsRecordedRequest;
|
|
370
766
|
type context_MarkSessionAsRecordedResponse = MarkSessionAsRecordedResponse;
|
|
371
767
|
type context_NavigationFlowSessionsParams = NavigationFlowSessionsParams;
|
|
@@ -376,9 +772,10 @@ type context_Session = Session;
|
|
|
376
772
|
type context_SessionsByDeviceParams = SessionsByDeviceParams;
|
|
377
773
|
declare const context_getListSessionsJobResult: typeof getListSessionsJobResult;
|
|
378
774
|
declare const context_listSessionsAsync: typeof listSessionsAsync;
|
|
775
|
+
declare const context_markRecordingsAsDeleted: typeof markRecordingsAsDeleted;
|
|
379
776
|
declare const context_markSessionAsRecorded: typeof markSessionAsRecorded;
|
|
380
777
|
declare namespace context {
|
|
381
|
-
export { type context_ConversionFunnelSessionsParams as ConversionFunnelSessionsParams, type context_CountFunnelSessionsRequest as CountFunnelSessionsRequest, type context_CountFunnelSessionsRequestPeriodOneOf as CountFunnelSessionsRequestPeriodOneOf, type context_CountFunnelSessionsResponse as CountFunnelSessionsResponse, type context_CountSessionsRequest as CountSessionsRequest, type context_CountSessionsRequestPeriodOneOf as CountSessionsRequestPeriodOneOf, type context_CountSessionsResponse as CountSessionsResponse, type context_CustomTimePeriod as CustomTimePeriod, context_DeviceType as DeviceType, context_FunnelStep as FunnelStep, type context_GetListSessionsJobResultOptions as GetListSessionsJobResultOptions, type context_GetListSessionsJobResultRequest as GetListSessionsJobResultRequest, type context_GetListSessionsJobResultResponse as GetListSessionsJobResultResponse, type context_GetListSessionsJobResultResponseNonNullableFields as GetListSessionsJobResultResponseNonNullableFields, type context_JobResult as JobResult, context_JobStatus as JobStatus, type context_ListSessionsAsyncOptions as ListSessionsAsyncOptions, type context_ListSessionsAsyncRequest as ListSessionsAsyncRequest, type context_ListSessionsAsyncRequestParamsOneOf as ListSessionsAsyncRequestParamsOneOf, type context_ListSessionsAsyncRequestPeriodOneOf as ListSessionsAsyncRequestPeriodOneOf, type context_ListSessionsAsyncResponse as ListSessionsAsyncResponse, type context_ListSessionsAsyncResponseNonNullableFields as ListSessionsAsyncResponseNonNullableFields, type context_MarkSessionAsRecordedRequest as MarkSessionAsRecordedRequest, type context_MarkSessionAsRecordedResponse as MarkSessionAsRecordedResponse, type context_NavigationFlowSessionsParams as NavigationFlowSessionsParams, context_PredefinedTimePeriod as PredefinedTimePeriod, type context_Recordings as Recordings, type context_Session as Session, type context_SessionsByDeviceParams as SessionsByDeviceParams, context_getListSessionsJobResult as getListSessionsJobResult, context_listSessionsAsync as listSessionsAsync, context_markSessionAsRecorded as markSessionAsRecorded };
|
|
778
|
+
export { type context_ConversionFunnelSessionsParams as ConversionFunnelSessionsParams, type context_CountFunnelSessionsRequest as CountFunnelSessionsRequest, type context_CountFunnelSessionsRequestPeriodOneOf as CountFunnelSessionsRequestPeriodOneOf, type context_CountFunnelSessionsResponse as CountFunnelSessionsResponse, type context_CountSessionsRequest as CountSessionsRequest, type context_CountSessionsRequestPeriodOneOf as CountSessionsRequestPeriodOneOf, type context_CountSessionsResponse as CountSessionsResponse, type context_CustomTimePeriod as CustomTimePeriod, context_DeviceType as DeviceType, context_FunnelStep as FunnelStep, type context_GetListSessionsJobResultOptions as GetListSessionsJobResultOptions, type context_GetListSessionsJobResultRequest as GetListSessionsJobResultRequest, type context_GetListSessionsJobResultResponse as GetListSessionsJobResultResponse, type context_GetListSessionsJobResultResponseNonNullableFields as GetListSessionsJobResultResponseNonNullableFields, type context_JobResult as JobResult, context_JobStatus as JobStatus, type context_ListSessionsAsyncOptions as ListSessionsAsyncOptions, type context_ListSessionsAsyncRequest as ListSessionsAsyncRequest, type context_ListSessionsAsyncRequestParamsOneOf as ListSessionsAsyncRequestParamsOneOf, type context_ListSessionsAsyncRequestPeriodOneOf as ListSessionsAsyncRequestPeriodOneOf, type context_ListSessionsAsyncResponse as ListSessionsAsyncResponse, type context_ListSessionsAsyncResponseNonNullableFields as ListSessionsAsyncResponseNonNullableFields, type context_MarkRecordingsAsDeletedRequest as MarkRecordingsAsDeletedRequest, type context_MarkRecordingsAsDeletedResponse as MarkRecordingsAsDeletedResponse, type context_MarkSessionAsRecordedRequest as MarkSessionAsRecordedRequest, type context_MarkSessionAsRecordedResponse as MarkSessionAsRecordedResponse, type context_NavigationFlowSessionsParams as NavigationFlowSessionsParams, context_PredefinedTimePeriod as PredefinedTimePeriod, type context_Recordings as Recordings, type context_Session as Session, type context_SessionsByDeviceParams as SessionsByDeviceParams, context_getListSessionsJobResult as getListSessionsJobResult, context_listSessionsAsync as listSessionsAsync, context_markRecordingsAsDeleted as markRecordingsAsDeleted, context_markSessionAsRecorded as markSessionAsRecorded };
|
|
382
779
|
}
|
|
383
780
|
|
|
384
781
|
export { context as analyticsSession };
|
|
@@ -1,8 +1,47 @@
|
|
|
1
|
+
type HostModule<T, H extends Host> = {
|
|
2
|
+
__type: 'host';
|
|
3
|
+
create(host: H): T;
|
|
4
|
+
};
|
|
5
|
+
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
|
|
6
|
+
type Host<Environment = unknown> = {
|
|
7
|
+
channel: {
|
|
8
|
+
observeState(callback: (props: unknown, environment: Environment) => unknown): {
|
|
9
|
+
disconnect: () => void;
|
|
10
|
+
} | Promise<{
|
|
11
|
+
disconnect: () => void;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
environment?: Environment;
|
|
15
|
+
/**
|
|
16
|
+
* Optional bast url to use for API requests, for example `www.wixapis.com`
|
|
17
|
+
*/
|
|
18
|
+
apiBaseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Possible data to be provided by every host, for cross cutting concerns
|
|
21
|
+
* like internationalization, billing, etc.
|
|
22
|
+
*/
|
|
23
|
+
essentials?: {
|
|
24
|
+
/**
|
|
25
|
+
* The language of the currently viewed session
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The locale of the currently viewed session
|
|
30
|
+
*/
|
|
31
|
+
locale?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Any headers that should be passed through to the API requests
|
|
34
|
+
*/
|
|
35
|
+
passThroughHeaders?: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
1
39
|
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
|
|
2
40
|
interface HttpClient {
|
|
3
41
|
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
4
42
|
fetchWithAuth: typeof fetch;
|
|
5
43
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
44
|
+
getActiveToken?: () => string | undefined;
|
|
6
45
|
}
|
|
7
46
|
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
8
47
|
type HttpResponse<T = any> = {
|
|
@@ -24,6 +63,65 @@ type APIMetadata = {
|
|
|
24
63
|
packageName?: string;
|
|
25
64
|
};
|
|
26
65
|
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
|
|
66
|
+
type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
67
|
+
__type: 'event-definition';
|
|
68
|
+
type: Type;
|
|
69
|
+
isDomainEvent?: boolean;
|
|
70
|
+
transformations?: (envelope: unknown) => Payload;
|
|
71
|
+
__payload: Payload;
|
|
72
|
+
};
|
|
73
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
74
|
+
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
75
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
76
|
+
|
|
77
|
+
type ServicePluginMethodInput = {
|
|
78
|
+
request: any;
|
|
79
|
+
metadata: any;
|
|
80
|
+
};
|
|
81
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
82
|
+
type ServicePluginMethodMetadata = {
|
|
83
|
+
name: string;
|
|
84
|
+
primaryHttpMappingPath: string;
|
|
85
|
+
transformations: {
|
|
86
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
87
|
+
toREST: (...args: unknown[]) => unknown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
91
|
+
__type: 'service-plugin-definition';
|
|
92
|
+
componentType: string;
|
|
93
|
+
methods: ServicePluginMethodMetadata[];
|
|
94
|
+
__contract: Contract;
|
|
95
|
+
};
|
|
96
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
97
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
98
|
+
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
99
|
+
|
|
100
|
+
type RequestContext = {
|
|
101
|
+
isSSR: boolean;
|
|
102
|
+
host: string;
|
|
103
|
+
protocol?: string;
|
|
104
|
+
};
|
|
105
|
+
type ResponseTransformer = (data: any, headers?: any) => any;
|
|
106
|
+
/**
|
|
107
|
+
* Ambassador request options types are copied mostly from AxiosRequestConfig.
|
|
108
|
+
* They are copied and not imported to reduce the amount of dependencies (to reduce install time).
|
|
109
|
+
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
|
|
110
|
+
*/
|
|
111
|
+
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
112
|
+
type AmbassadorRequestOptions<T = any> = {
|
|
113
|
+
_?: T;
|
|
114
|
+
url?: string;
|
|
115
|
+
method?: Method;
|
|
116
|
+
params?: any;
|
|
117
|
+
data?: any;
|
|
118
|
+
transformResponse?: ResponseTransformer | ResponseTransformer[];
|
|
119
|
+
};
|
|
120
|
+
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
|
|
121
|
+
__isAmbassador: boolean;
|
|
122
|
+
};
|
|
123
|
+
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
|
|
124
|
+
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
|
|
27
125
|
|
|
28
126
|
declare global {
|
|
29
127
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -32,6 +130,284 @@ declare global {
|
|
|
32
130
|
}
|
|
33
131
|
}
|
|
34
132
|
|
|
133
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
Represents a strictly empty plain object, the `{}` value.
|
|
137
|
+
|
|
138
|
+
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
|
|
139
|
+
|
|
140
|
+
@example
|
|
141
|
+
```
|
|
142
|
+
import type {EmptyObject} from 'type-fest';
|
|
143
|
+
|
|
144
|
+
// The following illustrates the problem with `{}`.
|
|
145
|
+
const foo1: {} = {}; // Pass
|
|
146
|
+
const foo2: {} = []; // Pass
|
|
147
|
+
const foo3: {} = 42; // Pass
|
|
148
|
+
const foo4: {} = {a: 1}; // Pass
|
|
149
|
+
|
|
150
|
+
// With `EmptyObject` only the first case is valid.
|
|
151
|
+
const bar1: EmptyObject = {}; // Pass
|
|
152
|
+
const bar2: EmptyObject = 42; // Fail
|
|
153
|
+
const bar3: EmptyObject = []; // Fail
|
|
154
|
+
const bar4: EmptyObject = {a: 1}; // Fail
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
|
|
158
|
+
|
|
159
|
+
@category Object
|
|
160
|
+
*/
|
|
161
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Returns a boolean for whether the two given types are equal.
|
|
165
|
+
|
|
166
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
167
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
168
|
+
|
|
169
|
+
Use-cases:
|
|
170
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
171
|
+
|
|
172
|
+
@example
|
|
173
|
+
```
|
|
174
|
+
import type {IsEqual} from 'type-fest';
|
|
175
|
+
|
|
176
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
177
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
178
|
+
type Includes<Value extends readonly any[], Item> =
|
|
179
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
180
|
+
? IsEqual<Value[0], Item> extends true
|
|
181
|
+
? true
|
|
182
|
+
: Includes<rest, Item>
|
|
183
|
+
: false;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
@category Type Guard
|
|
187
|
+
@category Utilities
|
|
188
|
+
*/
|
|
189
|
+
type IsEqual<A, B> =
|
|
190
|
+
(<G>() => G extends A ? 1 : 2) extends
|
|
191
|
+
(<G>() => G extends B ? 1 : 2)
|
|
192
|
+
? true
|
|
193
|
+
: false;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
Filter out keys from an object.
|
|
197
|
+
|
|
198
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
199
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
200
|
+
Returns `Key` otherwise.
|
|
201
|
+
|
|
202
|
+
@example
|
|
203
|
+
```
|
|
204
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
205
|
+
//=> never
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
@example
|
|
209
|
+
```
|
|
210
|
+
type Filtered = Filter<'bar', string>;
|
|
211
|
+
//=> never
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
@example
|
|
215
|
+
```
|
|
216
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
217
|
+
//=> 'bar'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
@see {Except}
|
|
221
|
+
*/
|
|
222
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
223
|
+
|
|
224
|
+
type ExceptOptions = {
|
|
225
|
+
/**
|
|
226
|
+
Disallow assigning non-specified properties.
|
|
227
|
+
|
|
228
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
229
|
+
|
|
230
|
+
@default false
|
|
231
|
+
*/
|
|
232
|
+
requireExactProps?: boolean;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
Create a type from an object type without certain keys.
|
|
237
|
+
|
|
238
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
239
|
+
|
|
240
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
241
|
+
|
|
242
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
243
|
+
|
|
244
|
+
@example
|
|
245
|
+
```
|
|
246
|
+
import type {Except} from 'type-fest';
|
|
247
|
+
|
|
248
|
+
type Foo = {
|
|
249
|
+
a: number;
|
|
250
|
+
b: string;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
254
|
+
//=> {b: string}
|
|
255
|
+
|
|
256
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
257
|
+
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
258
|
+
|
|
259
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
260
|
+
//=> {a: number} & Partial<Record<"b", never>>
|
|
261
|
+
|
|
262
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
263
|
+
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
@category Object
|
|
267
|
+
*/
|
|
268
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
|
|
269
|
+
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
|
|
270
|
+
} & (Options['requireExactProps'] extends true
|
|
271
|
+
? Partial<Record<KeysType, never>>
|
|
272
|
+
: {});
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
276
|
+
|
|
277
|
+
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
|
278
|
+
|
|
279
|
+
@example
|
|
280
|
+
```
|
|
281
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
282
|
+
|
|
283
|
+
interface Example {
|
|
284
|
+
a: string;
|
|
285
|
+
b: string | number;
|
|
286
|
+
c?: string;
|
|
287
|
+
d: {};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type StringKeysOnly = ConditionalKeys<Example, string>;
|
|
291
|
+
//=> 'a'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
|
295
|
+
|
|
296
|
+
@example
|
|
297
|
+
```
|
|
298
|
+
import type {ConditionalKeys} from 'type-fest';
|
|
299
|
+
|
|
300
|
+
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
|
301
|
+
//=> 'a' | 'c'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
@category Object
|
|
305
|
+
*/
|
|
306
|
+
type ConditionalKeys<Base, Condition> = NonNullable<
|
|
307
|
+
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
|
308
|
+
{
|
|
309
|
+
// Map through all the keys of the given base type.
|
|
310
|
+
[Key in keyof Base]:
|
|
311
|
+
// Pick only keys with types extending the given `Condition` type.
|
|
312
|
+
Base[Key] extends Condition
|
|
313
|
+
// Retain this key since the condition passes.
|
|
314
|
+
? Key
|
|
315
|
+
// Discard this key since the condition fails.
|
|
316
|
+
: never;
|
|
317
|
+
|
|
318
|
+
// Convert the produced object into a union type of the keys which passed the conditional test.
|
|
319
|
+
}[keyof Base]
|
|
320
|
+
>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
Exclude keys from a shape that matches the given `Condition`.
|
|
324
|
+
|
|
325
|
+
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
|
326
|
+
|
|
327
|
+
@example
|
|
328
|
+
```
|
|
329
|
+
import type {Primitive, ConditionalExcept} from 'type-fest';
|
|
330
|
+
|
|
331
|
+
class Awesome {
|
|
332
|
+
name: string;
|
|
333
|
+
successes: number;
|
|
334
|
+
failures: bigint;
|
|
335
|
+
|
|
336
|
+
run() {}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
|
340
|
+
//=> {run: () => void}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
@example
|
|
344
|
+
```
|
|
345
|
+
import type {ConditionalExcept} from 'type-fest';
|
|
346
|
+
|
|
347
|
+
interface Example {
|
|
348
|
+
a: string;
|
|
349
|
+
b: string | number;
|
|
350
|
+
c: () => void;
|
|
351
|
+
d: {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
|
355
|
+
//=> {b: string | number; c: () => void; d: {}}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
@category Object
|
|
359
|
+
*/
|
|
360
|
+
type ConditionalExcept<Base, Condition> = Except<
|
|
361
|
+
Base,
|
|
362
|
+
ConditionalKeys<Base, Condition>
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Descriptors are objects that describe the API of a module, and the module
|
|
367
|
+
* can either be a REST module or a host module.
|
|
368
|
+
* This type is recursive, so it can describe nested modules.
|
|
369
|
+
*/
|
|
370
|
+
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
|
|
371
|
+
[key: string]: Descriptors | PublicMetadata | any;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* This type takes in a descriptors object of a certain Host (including an `unknown` host)
|
|
375
|
+
* and returns an object with the same structure, but with all descriptors replaced with their API.
|
|
376
|
+
* Any non-descriptor properties are removed from the returned object, including descriptors that
|
|
377
|
+
* do not match the given host (as they will not work with the given host).
|
|
378
|
+
*/
|
|
379
|
+
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
|
|
380
|
+
done: T;
|
|
381
|
+
recurse: T extends {
|
|
382
|
+
__type: typeof SERVICE_PLUGIN_ERROR_TYPE;
|
|
383
|
+
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
|
|
384
|
+
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
|
|
385
|
+
-1,
|
|
386
|
+
0,
|
|
387
|
+
1,
|
|
388
|
+
2,
|
|
389
|
+
3,
|
|
390
|
+
4,
|
|
391
|
+
5
|
|
392
|
+
][Depth]> : never;
|
|
393
|
+
}, EmptyObject>;
|
|
394
|
+
}[Depth extends -1 ? 'done' : 'recurse'];
|
|
395
|
+
type PublicMetadata = {
|
|
396
|
+
PACKAGE_NAME?: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare global {
|
|
400
|
+
interface ContextualClient {
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A type used to create concerete types from SDK descriptors in
|
|
405
|
+
* case a contextual client is available.
|
|
406
|
+
*/
|
|
407
|
+
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
|
|
408
|
+
host: Host;
|
|
409
|
+
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
|
|
410
|
+
|
|
35
411
|
interface Session {
|
|
36
412
|
/** Session ID. */
|
|
37
413
|
_id?: string;
|
|
@@ -271,6 +647,14 @@ interface MarkSessionAsRecordedRequest {
|
|
|
271
647
|
/** Mark a browser session as recorded. */
|
|
272
648
|
interface MarkSessionAsRecordedResponse {
|
|
273
649
|
}
|
|
650
|
+
/** Marks browser session recordings as deleted. */
|
|
651
|
+
interface MarkRecordingsAsDeletedRequest {
|
|
652
|
+
/** Browser session IDs. */
|
|
653
|
+
sessionIds: string[];
|
|
654
|
+
}
|
|
655
|
+
/** Marks browser session recordings as deleted. */
|
|
656
|
+
interface MarkRecordingsAsDeletedResponse {
|
|
657
|
+
}
|
|
274
658
|
interface ListSessionsAsyncResponseNonNullableFields {
|
|
275
659
|
jobId: string;
|
|
276
660
|
}
|
|
@@ -336,10 +720,20 @@ interface MarkSessionAsRecordedSignature {
|
|
|
336
720
|
*/
|
|
337
721
|
(sessionId: string): Promise<void>;
|
|
338
722
|
}
|
|
723
|
+
declare function markRecordingsAsDeleted$1(httpClient: HttpClient): MarkRecordingsAsDeletedSignature;
|
|
724
|
+
interface MarkRecordingsAsDeletedSignature {
|
|
725
|
+
/**
|
|
726
|
+
* Marks browser session recordings as deleted.
|
|
727
|
+
* @param - Browser session IDs.
|
|
728
|
+
* @returns Marks browser session recordings as deleted.
|
|
729
|
+
*/
|
|
730
|
+
(sessionIds: string[]): Promise<void>;
|
|
731
|
+
}
|
|
339
732
|
|
|
340
|
-
declare const listSessionsAsync: BuildRESTFunction<typeof listSessionsAsync$1> & typeof listSessionsAsync$1
|
|
341
|
-
declare const getListSessionsJobResult: BuildRESTFunction<typeof getListSessionsJobResult$1> & typeof getListSessionsJobResult$1
|
|
342
|
-
declare const markSessionAsRecorded: BuildRESTFunction<typeof markSessionAsRecorded$1> & typeof markSessionAsRecorded$1
|
|
733
|
+
declare const listSessionsAsync: MaybeContext<BuildRESTFunction<typeof listSessionsAsync$1> & typeof listSessionsAsync$1>;
|
|
734
|
+
declare const getListSessionsJobResult: MaybeContext<BuildRESTFunction<typeof getListSessionsJobResult$1> & typeof getListSessionsJobResult$1>;
|
|
735
|
+
declare const markSessionAsRecorded: MaybeContext<BuildRESTFunction<typeof markSessionAsRecorded$1> & typeof markSessionAsRecorded$1>;
|
|
736
|
+
declare const markRecordingsAsDeleted: MaybeContext<BuildRESTFunction<typeof markRecordingsAsDeleted$1> & typeof markRecordingsAsDeleted$1>;
|
|
343
737
|
|
|
344
738
|
type index_d_ConversionFunnelSessionsParams = ConversionFunnelSessionsParams;
|
|
345
739
|
type index_d_CountFunnelSessionsRequest = CountFunnelSessionsRequest;
|
|
@@ -366,6 +760,8 @@ type index_d_ListSessionsAsyncRequestParamsOneOf = ListSessionsAsyncRequestParam
|
|
|
366
760
|
type index_d_ListSessionsAsyncRequestPeriodOneOf = ListSessionsAsyncRequestPeriodOneOf;
|
|
367
761
|
type index_d_ListSessionsAsyncResponse = ListSessionsAsyncResponse;
|
|
368
762
|
type index_d_ListSessionsAsyncResponseNonNullableFields = ListSessionsAsyncResponseNonNullableFields;
|
|
763
|
+
type index_d_MarkRecordingsAsDeletedRequest = MarkRecordingsAsDeletedRequest;
|
|
764
|
+
type index_d_MarkRecordingsAsDeletedResponse = MarkRecordingsAsDeletedResponse;
|
|
369
765
|
type index_d_MarkSessionAsRecordedRequest = MarkSessionAsRecordedRequest;
|
|
370
766
|
type index_d_MarkSessionAsRecordedResponse = MarkSessionAsRecordedResponse;
|
|
371
767
|
type index_d_NavigationFlowSessionsParams = NavigationFlowSessionsParams;
|
|
@@ -376,9 +772,10 @@ type index_d_Session = Session;
|
|
|
376
772
|
type index_d_SessionsByDeviceParams = SessionsByDeviceParams;
|
|
377
773
|
declare const index_d_getListSessionsJobResult: typeof getListSessionsJobResult;
|
|
378
774
|
declare const index_d_listSessionsAsync: typeof listSessionsAsync;
|
|
775
|
+
declare const index_d_markRecordingsAsDeleted: typeof markRecordingsAsDeleted;
|
|
379
776
|
declare const index_d_markSessionAsRecorded: typeof markSessionAsRecorded;
|
|
380
777
|
declare namespace index_d {
|
|
381
|
-
export { type index_d_ConversionFunnelSessionsParams as ConversionFunnelSessionsParams, type index_d_CountFunnelSessionsRequest as CountFunnelSessionsRequest, type index_d_CountFunnelSessionsRequestPeriodOneOf as CountFunnelSessionsRequestPeriodOneOf, type index_d_CountFunnelSessionsResponse as CountFunnelSessionsResponse, type index_d_CountSessionsRequest as CountSessionsRequest, type index_d_CountSessionsRequestPeriodOneOf as CountSessionsRequestPeriodOneOf, type index_d_CountSessionsResponse as CountSessionsResponse, type index_d_CustomTimePeriod as CustomTimePeriod, index_d_DeviceType as DeviceType, index_d_FunnelStep as FunnelStep, type index_d_GetListSessionsJobResultOptions as GetListSessionsJobResultOptions, type index_d_GetListSessionsJobResultRequest as GetListSessionsJobResultRequest, type index_d_GetListSessionsJobResultResponse as GetListSessionsJobResultResponse, type index_d_GetListSessionsJobResultResponseNonNullableFields as GetListSessionsJobResultResponseNonNullableFields, type index_d_JobResult as JobResult, index_d_JobStatus as JobStatus, type index_d_ListSessionsAsyncOptions as ListSessionsAsyncOptions, type index_d_ListSessionsAsyncRequest as ListSessionsAsyncRequest, type index_d_ListSessionsAsyncRequestParamsOneOf as ListSessionsAsyncRequestParamsOneOf, type index_d_ListSessionsAsyncRequestPeriodOneOf as ListSessionsAsyncRequestPeriodOneOf, type index_d_ListSessionsAsyncResponse as ListSessionsAsyncResponse, type index_d_ListSessionsAsyncResponseNonNullableFields as ListSessionsAsyncResponseNonNullableFields, type index_d_MarkSessionAsRecordedRequest as MarkSessionAsRecordedRequest, type index_d_MarkSessionAsRecordedResponse as MarkSessionAsRecordedResponse, type index_d_NavigationFlowSessionsParams as NavigationFlowSessionsParams, index_d_PredefinedTimePeriod as PredefinedTimePeriod, type index_d_Recordings as Recordings, type index_d_Session as Session, type index_d_SessionsByDeviceParams as SessionsByDeviceParams, index_d_getListSessionsJobResult as getListSessionsJobResult, index_d_listSessionsAsync as listSessionsAsync, index_d_markSessionAsRecorded as markSessionAsRecorded };
|
|
778
|
+
export { type index_d_ConversionFunnelSessionsParams as ConversionFunnelSessionsParams, type index_d_CountFunnelSessionsRequest as CountFunnelSessionsRequest, type index_d_CountFunnelSessionsRequestPeriodOneOf as CountFunnelSessionsRequestPeriodOneOf, type index_d_CountFunnelSessionsResponse as CountFunnelSessionsResponse, type index_d_CountSessionsRequest as CountSessionsRequest, type index_d_CountSessionsRequestPeriodOneOf as CountSessionsRequestPeriodOneOf, type index_d_CountSessionsResponse as CountSessionsResponse, type index_d_CustomTimePeriod as CustomTimePeriod, index_d_DeviceType as DeviceType, index_d_FunnelStep as FunnelStep, type index_d_GetListSessionsJobResultOptions as GetListSessionsJobResultOptions, type index_d_GetListSessionsJobResultRequest as GetListSessionsJobResultRequest, type index_d_GetListSessionsJobResultResponse as GetListSessionsJobResultResponse, type index_d_GetListSessionsJobResultResponseNonNullableFields as GetListSessionsJobResultResponseNonNullableFields, type index_d_JobResult as JobResult, index_d_JobStatus as JobStatus, type index_d_ListSessionsAsyncOptions as ListSessionsAsyncOptions, type index_d_ListSessionsAsyncRequest as ListSessionsAsyncRequest, type index_d_ListSessionsAsyncRequestParamsOneOf as ListSessionsAsyncRequestParamsOneOf, type index_d_ListSessionsAsyncRequestPeriodOneOf as ListSessionsAsyncRequestPeriodOneOf, type index_d_ListSessionsAsyncResponse as ListSessionsAsyncResponse, type index_d_ListSessionsAsyncResponseNonNullableFields as ListSessionsAsyncResponseNonNullableFields, type index_d_MarkRecordingsAsDeletedRequest as MarkRecordingsAsDeletedRequest, type index_d_MarkRecordingsAsDeletedResponse as MarkRecordingsAsDeletedResponse, type index_d_MarkSessionAsRecordedRequest as MarkSessionAsRecordedRequest, type index_d_MarkSessionAsRecordedResponse as MarkSessionAsRecordedResponse, type index_d_NavigationFlowSessionsParams as NavigationFlowSessionsParams, index_d_PredefinedTimePeriod as PredefinedTimePeriod, type index_d_Recordings as Recordings, type index_d_Session as Session, type index_d_SessionsByDeviceParams as SessionsByDeviceParams, index_d_getListSessionsJobResult as getListSessionsJobResult, index_d_listSessionsAsync as listSessionsAsync, index_d_markRecordingsAsDeleted as markRecordingsAsDeleted, index_d_markSessionAsRecorded as markSessionAsRecorded };
|
|
382
779
|
}
|
|
383
780
|
|
|
384
781
|
export { index_d as analyticsSession };
|
|
@@ -178,6 +178,14 @@ interface MarkSessionAsRecordedRequest$1 {
|
|
|
178
178
|
/** Mark a browser session as recorded. */
|
|
179
179
|
interface MarkSessionAsRecordedResponse$1 {
|
|
180
180
|
}
|
|
181
|
+
/** Marks browser session recordings as deleted. */
|
|
182
|
+
interface MarkRecordingsAsDeletedRequest$1 {
|
|
183
|
+
/** Browser session IDs. */
|
|
184
|
+
sessionIds: string[];
|
|
185
|
+
}
|
|
186
|
+
/** Marks browser session recordings as deleted. */
|
|
187
|
+
interface MarkRecordingsAsDeletedResponse$1 {
|
|
188
|
+
}
|
|
181
189
|
interface ListSessionsAsyncResponseNonNullableFields$1 {
|
|
182
190
|
jobId: string;
|
|
183
191
|
}
|
|
@@ -369,6 +377,14 @@ interface MarkSessionAsRecordedRequest {
|
|
|
369
377
|
/** Mark a browser session as recorded. */
|
|
370
378
|
interface MarkSessionAsRecordedResponse {
|
|
371
379
|
}
|
|
380
|
+
/** Marks browser session recordings as deleted. */
|
|
381
|
+
interface MarkRecordingsAsDeletedRequest {
|
|
382
|
+
/** Browser session IDs. */
|
|
383
|
+
sessionIds: string[];
|
|
384
|
+
}
|
|
385
|
+
/** Marks browser session recordings as deleted. */
|
|
386
|
+
interface MarkRecordingsAsDeletedResponse {
|
|
387
|
+
}
|
|
372
388
|
interface ListSessionsAsyncResponseNonNullableFields {
|
|
373
389
|
jobId: string;
|
|
374
390
|
}
|
|
@@ -393,13 +409,15 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
|
|
|
393
409
|
declare function listSessionsAsync(): __PublicMethodMetaInfo<'POST', {}, ListSessionsAsyncRequest, ListSessionsAsyncRequest$1, ListSessionsAsyncResponse & ListSessionsAsyncResponseNonNullableFields, ListSessionsAsyncResponse$1 & ListSessionsAsyncResponseNonNullableFields$1>;
|
|
394
410
|
declare function getListSessionsJobResult(): __PublicMethodMetaInfo<'GET', {}, GetListSessionsJobResultRequest, GetListSessionsJobResultRequest$1, GetListSessionsJobResultResponse & GetListSessionsJobResultResponseNonNullableFields, GetListSessionsJobResultResponse$1 & GetListSessionsJobResultResponseNonNullableFields$1>;
|
|
395
411
|
declare function markSessionAsRecorded(): __PublicMethodMetaInfo<'POST', {}, MarkSessionAsRecordedRequest, MarkSessionAsRecordedRequest$1, MarkSessionAsRecordedResponse, MarkSessionAsRecordedResponse$1>;
|
|
412
|
+
declare function markRecordingsAsDeleted(): __PublicMethodMetaInfo<'POST', {}, MarkRecordingsAsDeletedRequest, MarkRecordingsAsDeletedRequest$1, MarkRecordingsAsDeletedResponse, MarkRecordingsAsDeletedResponse$1>;
|
|
396
413
|
|
|
397
414
|
type meta___PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = __PublicMethodMetaInfo<K, M, T, S, Q, R>;
|
|
398
415
|
declare const meta_getListSessionsJobResult: typeof getListSessionsJobResult;
|
|
399
416
|
declare const meta_listSessionsAsync: typeof listSessionsAsync;
|
|
417
|
+
declare const meta_markRecordingsAsDeleted: typeof markRecordingsAsDeleted;
|
|
400
418
|
declare const meta_markSessionAsRecorded: typeof markSessionAsRecorded;
|
|
401
419
|
declare namespace meta {
|
|
402
|
-
export { type meta___PublicMethodMetaInfo as __PublicMethodMetaInfo, meta_getListSessionsJobResult as getListSessionsJobResult, meta_listSessionsAsync as listSessionsAsync, meta_markSessionAsRecorded as markSessionAsRecorded };
|
|
420
|
+
export { type meta___PublicMethodMetaInfo as __PublicMethodMetaInfo, meta_getListSessionsJobResult as getListSessionsJobResult, meta_listSessionsAsync as listSessionsAsync, meta_markRecordingsAsDeleted as markRecordingsAsDeleted, meta_markSessionAsRecorded as markSessionAsRecorded };
|
|
403
421
|
}
|
|
404
422
|
|
|
405
423
|
export { meta as analyticsSession };
|