@wix/secrets 1.0.43 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,836 +0,0 @@
1
- type HostModule<T, H extends Host> = {
2
- __type: 'host';
3
- create(host: H): T;
4
- };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
7
- channel: {
8
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
- disconnect: () => void;
10
- } | Promise<{
11
- disconnect: () => void;
12
- }>;
13
- };
14
- environment?: Environment;
15
- /**
16
- * Optional name of the environment, use for logging
17
- */
18
- name?: string;
19
- /**
20
- * Optional bast url to use for API requests, for example `www.wixapis.com`
21
- */
22
- apiBaseUrl?: string;
23
- /**
24
- * Possible data to be provided by every host, for cross cutting concerns
25
- * like internationalization, billing, etc.
26
- */
27
- essentials?: {
28
- /**
29
- * The language of the currently viewed session
30
- */
31
- language?: string;
32
- /**
33
- * The locale of the currently viewed session
34
- */
35
- locale?: string;
36
- /**
37
- * Any headers that should be passed through to the API requests
38
- */
39
- passThroughHeaders?: Record<string, string>;
40
- };
41
- };
42
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
- interface HttpClient {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
- type HttpResponse<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata;
64
- type APIMetadata = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
77
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
-
81
- type ServicePluginMethodInput = {
82
- request: any;
83
- metadata: any;
84
- };
85
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata = {
87
- name: string;
88
- primaryHttpMappingPath: string;
89
- transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
- toREST: (...args: unknown[]) => unknown;
92
- };
93
- };
94
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
- __type: 'service-plugin-definition';
96
- componentType: string;
97
- methods: ServicePluginMethodMetadata[];
98
- __contract: Contract;
99
- };
100
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
-
104
- type RequestContext = {
105
- isSSR: boolean;
106
- host: string;
107
- protocol?: string;
108
- };
109
- type ResponseTransformer = (data: any, headers?: any) => any;
110
- /**
111
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
- */
115
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions<T = any> = {
117
- _?: T;
118
- url?: string;
119
- method?: Method;
120
- params?: any;
121
- data?: any;
122
- transformResponse?: ResponseTransformer | ResponseTransformer[];
123
- };
124
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
- __isAmbassador: boolean;
126
- };
127
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
129
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
137
- declare const emptyObjectSymbol: unique symbol;
138
-
139
- /**
140
- Represents a strictly empty plain object, the `{}` value.
141
-
142
- When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
143
-
144
- @example
145
- ```
146
- import type {EmptyObject} from 'type-fest';
147
-
148
- // The following illustrates the problem with `{}`.
149
- const foo1: {} = {}; // Pass
150
- const foo2: {} = []; // Pass
151
- const foo3: {} = 42; // Pass
152
- const foo4: {} = {a: 1}; // Pass
153
-
154
- // With `EmptyObject` only the first case is valid.
155
- const bar1: EmptyObject = {}; // Pass
156
- const bar2: EmptyObject = 42; // Fail
157
- const bar3: EmptyObject = []; // Fail
158
- const bar4: EmptyObject = {a: 1}; // Fail
159
- ```
160
-
161
- Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
162
-
163
- @category Object
164
- */
165
- type EmptyObject = {[emptyObjectSymbol]?: never};
166
-
167
- /**
168
- Returns a boolean for whether the two given types are equal.
169
-
170
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
-
173
- Use-cases:
174
- - If you want to make a conditional branch based on the result of a comparison of two types.
175
-
176
- @example
177
- ```
178
- import type {IsEqual} from 'type-fest';
179
-
180
- // This type returns a boolean for whether the given array includes the given item.
181
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
- type Includes<Value extends readonly any[], Item> =
183
- Value extends readonly [Value[0], ...infer rest]
184
- ? IsEqual<Value[0], Item> extends true
185
- ? true
186
- : Includes<rest, Item>
187
- : false;
188
- ```
189
-
190
- @category Type Guard
191
- @category Utilities
192
- */
193
- type IsEqual<A, B> =
194
- (<G>() => G extends A ? 1 : 2) extends
195
- (<G>() => G extends B ? 1 : 2)
196
- ? true
197
- : false;
198
-
199
- /**
200
- Filter out keys from an object.
201
-
202
- Returns `never` if `Exclude` is strictly equal to `Key`.
203
- Returns `never` if `Key` extends `Exclude`.
204
- Returns `Key` otherwise.
205
-
206
- @example
207
- ```
208
- type Filtered = Filter<'foo', 'foo'>;
209
- //=> never
210
- ```
211
-
212
- @example
213
- ```
214
- type Filtered = Filter<'bar', string>;
215
- //=> never
216
- ```
217
-
218
- @example
219
- ```
220
- type Filtered = Filter<'bar', 'foo'>;
221
- //=> 'bar'
222
- ```
223
-
224
- @see {Except}
225
- */
226
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
-
228
- type ExceptOptions = {
229
- /**
230
- Disallow assigning non-specified properties.
231
-
232
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
-
234
- @default false
235
- */
236
- requireExactProps?: boolean;
237
- };
238
-
239
- /**
240
- Create a type from an object type without certain keys.
241
-
242
- We recommend setting the `requireExactProps` option to `true`.
243
-
244
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
245
-
246
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
247
-
248
- @example
249
- ```
250
- import type {Except} from 'type-fest';
251
-
252
- type Foo = {
253
- a: number;
254
- b: string;
255
- };
256
-
257
- type FooWithoutA = Except<Foo, 'a'>;
258
- //=> {b: string}
259
-
260
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
- //=> errors: 'a' does not exist in type '{ b: string; }'
262
-
263
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
- //=> {a: number} & Partial<Record<"b", never>>
265
-
266
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
- ```
269
-
270
- @category Object
271
- */
272
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
- } & (Options['requireExactProps'] extends true
275
- ? Partial<Record<KeysType, never>>
276
- : {});
277
-
278
- /**
279
- Returns a boolean for whether the given type is `never`.
280
-
281
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
- @link https://stackoverflow.com/a/53984913/10292952
283
- @link https://www.zhenghao.io/posts/ts-never
284
-
285
- Useful in type utilities, such as checking if something does not occur.
286
-
287
- @example
288
- ```
289
- import type {IsNever, And} from 'type-fest';
290
-
291
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
- type AreStringsEqual<A extends string, B extends string> =
293
- And<
294
- IsNever<Exclude<A, B>> extends true ? true : false,
295
- IsNever<Exclude<B, A>> extends true ? true : false
296
- >;
297
-
298
- type EndIfEqual<I extends string, O extends string> =
299
- AreStringsEqual<I, O> extends true
300
- ? never
301
- : void;
302
-
303
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
- if (input === output) {
305
- process.exit(0);
306
- }
307
- }
308
-
309
- endIfEqual('abc', 'abc');
310
- //=> never
311
-
312
- endIfEqual('abc', '123');
313
- //=> void
314
- ```
315
-
316
- @category Type Guard
317
- @category Utilities
318
- */
319
- type IsNever<T> = [T] extends [never] ? true : false;
320
-
321
- /**
322
- An if-else-like type that resolves depending on whether the given type is `never`.
323
-
324
- @see {@link IsNever}
325
-
326
- @example
327
- ```
328
- import type {IfNever} from 'type-fest';
329
-
330
- type ShouldBeTrue = IfNever<never>;
331
- //=> true
332
-
333
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
- //=> 'bar'
335
- ```
336
-
337
- @category Type Guard
338
- @category Utilities
339
- */
340
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
- );
343
-
344
- /**
345
- Extract the keys from a type where the value type of the key extends the given `Condition`.
346
-
347
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
-
349
- @example
350
- ```
351
- import type {ConditionalKeys} from 'type-fest';
352
-
353
- interface Example {
354
- a: string;
355
- b: string | number;
356
- c?: string;
357
- d: {};
358
- }
359
-
360
- type StringKeysOnly = ConditionalKeys<Example, string>;
361
- //=> 'a'
362
- ```
363
-
364
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
-
366
- @example
367
- ```
368
- import type {ConditionalKeys} from 'type-fest';
369
-
370
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
- //=> 'a' | 'c'
372
- ```
373
-
374
- @category Object
375
- */
376
- type ConditionalKeys<Base, Condition> =
377
- {
378
- // Map through all the keys of the given base type.
379
- [Key in keyof Base]-?:
380
- // Pick only keys with types extending the given `Condition` type.
381
- Base[Key] extends Condition
382
- // Retain this key
383
- // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
- // Discard this key since the condition fails.
386
- : never;
387
- // Convert the produced object into a union type of the keys which passed the conditional test.
388
- }[keyof Base];
389
-
390
- /**
391
- Exclude keys from a shape that matches the given `Condition`.
392
-
393
- This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
394
-
395
- @example
396
- ```
397
- import type {Primitive, ConditionalExcept} from 'type-fest';
398
-
399
- class Awesome {
400
- name: string;
401
- successes: number;
402
- failures: bigint;
403
-
404
- run() {}
405
- }
406
-
407
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
- //=> {run: () => void}
409
- ```
410
-
411
- @example
412
- ```
413
- import type {ConditionalExcept} from 'type-fest';
414
-
415
- interface Example {
416
- a: string;
417
- b: string | number;
418
- c: () => void;
419
- d: {};
420
- }
421
-
422
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
- //=> {b: string | number; c: () => void; d: {}}
424
- ```
425
-
426
- @category Object
427
- */
428
- type ConditionalExcept<Base, Condition> = Except<
429
- Base,
430
- ConditionalKeys<Base, Condition>
431
- >;
432
-
433
- /**
434
- * Descriptors are objects that describe the API of a module, and the module
435
- * can either be a REST module or a host module.
436
- * This type is recursive, so it can describe nested modules.
437
- */
438
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
- [key: string]: Descriptors | PublicMetadata | any;
440
- };
441
- /**
442
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
- * and returns an object with the same structure, but with all descriptors replaced with their API.
444
- * Any non-descriptor properties are removed from the returned object, including descriptors that
445
- * do not match the given host (as they will not work with the given host).
446
- */
447
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
- done: T;
449
- recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
- -1,
454
- 0,
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ][Depth]> : never;
461
- }, EmptyObject>;
462
- }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata = {
464
- PACKAGE_NAME?: string;
465
- };
466
-
467
- declare global {
468
- interface ContextualClient {
469
- }
470
- }
471
- /**
472
- * A type used to create concerete types from SDK descriptors in
473
- * case a contextual client is available.
474
- */
475
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
- host: Host;
477
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
-
479
- interface Secret {
480
- /**
481
- * Secret ID.
482
- * @readonly
483
- */
484
- _id?: string | null;
485
- /**
486
- * A unique, human-friendly name for the secret. Use it to retrieve the secret value easily with the [Get Secret Value](https://dev.wix.com/docs/rest/business-management/secrets/get-secret-value) endpoint.
487
- *
488
- * **Note:** You can use alphanumeric characters and the following special characters: `_+=-@#$`. Spaces are not supported.
489
- */
490
- name?: string | null;
491
- /** An optional text describing the secret's purpose or any other notes about it. */
492
- description?: string | null;
493
- /** The encrypted confidential value. */
494
- value?: string | null;
495
- /**
496
- * Date and time when the secret was created.
497
- * @readonly
498
- */
499
- _createdDate?: Date | null;
500
- /**
501
- * Date and time when the secret was updated.
502
- * @readonly
503
- */
504
- _updatedDate?: Date | null;
505
- }
506
- interface GetSecretValueRequest {
507
- /** Secret name. */
508
- name: string;
509
- }
510
- interface GetSecretValueResponse {
511
- /** The plaintext, unencrypted value of the secret. */
512
- value?: string;
513
- }
514
- interface ListSecretInfoRequest {
515
- }
516
- interface ListSecretInfoResponse {
517
- /** A list of secrets with encrypted values. */
518
- secrets?: Secret[];
519
- }
520
- interface CreateSecretRequest {
521
- /** Details of a secret. */
522
- secret: Secret;
523
- }
524
- interface CreateSecretResponse {
525
- /** Secret ID. */
526
- _id?: string;
527
- }
528
- interface DeleteSecretRequest {
529
- /** ID of the secret to delete. */
530
- _id: string;
531
- }
532
- interface DeleteSecretResponse {
533
- }
534
- interface UpdateSecretRequest {
535
- /** ID of the secret to update. */
536
- _id: string;
537
- /** Details of a secret. */
538
- secret: Secret;
539
- }
540
- interface UpdateSecretResponse {
541
- }
542
- interface DomainEvent extends DomainEventBodyOneOf {
543
- createdEvent?: EntityCreatedEvent;
544
- updatedEvent?: EntityUpdatedEvent;
545
- deletedEvent?: EntityDeletedEvent;
546
- actionEvent?: ActionEvent;
547
- /**
548
- * Unique event ID.
549
- * Allows clients to ignore duplicate webhooks.
550
- */
551
- _id?: string;
552
- /**
553
- * Assumes actions are also always typed to an entity_type
554
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
555
- */
556
- entityFqdn?: string;
557
- /**
558
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
559
- * This is although the created/updated/deleted notion is duplication of the oneof types
560
- * Example: created/updated/deleted/started/completed/email_opened
561
- */
562
- slug?: string;
563
- /** ID of the entity associated with the event. */
564
- entityId?: string;
565
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
566
- eventTime?: Date | null;
567
- /**
568
- * Whether the event was triggered as a result of a privacy regulation application
569
- * (for example, GDPR).
570
- */
571
- triggeredByAnonymizeRequest?: boolean | null;
572
- /** If present, indicates the action that triggered the event. */
573
- originatedFrom?: string | null;
574
- /**
575
- * A sequence number defining the order of updates to the underlying entity.
576
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
577
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
578
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
579
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
580
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
581
- */
582
- entityEventSequence?: string | null;
583
- }
584
- /** @oneof */
585
- interface DomainEventBodyOneOf {
586
- createdEvent?: EntityCreatedEvent;
587
- updatedEvent?: EntityUpdatedEvent;
588
- deletedEvent?: EntityDeletedEvent;
589
- actionEvent?: ActionEvent;
590
- }
591
- interface EntityCreatedEvent {
592
- entity?: string;
593
- }
594
- interface RestoreInfo {
595
- deletedDate?: Date | null;
596
- }
597
- interface EntityUpdatedEvent {
598
- /**
599
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
600
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
601
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
602
- */
603
- currentEntity?: string;
604
- }
605
- interface EntityDeletedEvent {
606
- /** Entity that was deleted */
607
- deletedEntity?: string | null;
608
- }
609
- interface ActionEvent {
610
- body?: string;
611
- }
612
- interface MessageEnvelope {
613
- /** App instance ID. */
614
- instanceId?: string | null;
615
- /** Event type. */
616
- eventType?: string;
617
- /** The identification type and identity data. */
618
- identity?: IdentificationData;
619
- /** Stringify payload. */
620
- data?: string;
621
- }
622
- interface IdentificationData extends IdentificationDataIdOneOf {
623
- /** ID of a site visitor that has not logged in to the site. */
624
- anonymousVisitorId?: string;
625
- /** ID of a site visitor that has logged in to the site. */
626
- memberId?: string;
627
- /** ID of a Wix user (site owner, contributor, etc.). */
628
- wixUserId?: string;
629
- /** ID of an app. */
630
- appId?: string;
631
- /** @readonly */
632
- identityType?: WebhookIdentityType;
633
- }
634
- /** @oneof */
635
- interface IdentificationDataIdOneOf {
636
- /** ID of a site visitor that has not logged in to the site. */
637
- anonymousVisitorId?: string;
638
- /** ID of a site visitor that has logged in to the site. */
639
- memberId?: string;
640
- /** ID of a Wix user (site owner, contributor, etc.). */
641
- wixUserId?: string;
642
- /** ID of an app. */
643
- appId?: string;
644
- }
645
- declare enum WebhookIdentityType {
646
- UNKNOWN = "UNKNOWN",
647
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
648
- MEMBER = "MEMBER",
649
- WIX_USER = "WIX_USER",
650
- APP = "APP"
651
- }
652
- interface GetSecretValueResponseNonNullableFields {
653
- value: string;
654
- }
655
- interface CreateSecretResponseNonNullableFields {
656
- _id: string;
657
- }
658
- interface BaseEventMetadata {
659
- /** App instance ID. */
660
- instanceId?: string | null;
661
- /** Event type. */
662
- eventType?: string;
663
- /** The identification type and identity data. */
664
- identity?: IdentificationData;
665
- }
666
- interface EventMetadata extends BaseEventMetadata {
667
- /**
668
- * Unique event ID.
669
- * Allows clients to ignore duplicate webhooks.
670
- */
671
- _id?: string;
672
- /**
673
- * Assumes actions are also always typed to an entity_type
674
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
675
- */
676
- entityFqdn?: string;
677
- /**
678
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
679
- * This is although the created/updated/deleted notion is duplication of the oneof types
680
- * Example: created/updated/deleted/started/completed/email_opened
681
- */
682
- slug?: string;
683
- /** ID of the entity associated with the event. */
684
- entityId?: string;
685
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
686
- eventTime?: Date | null;
687
- /**
688
- * Whether the event was triggered as a result of a privacy regulation application
689
- * (for example, GDPR).
690
- */
691
- triggeredByAnonymizeRequest?: boolean | null;
692
- /** If present, indicates the action that triggered the event. */
693
- originatedFrom?: string | null;
694
- /**
695
- * A sequence number defining the order of updates to the underlying entity.
696
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
697
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
698
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
699
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
700
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
701
- */
702
- entityEventSequence?: string | null;
703
- }
704
- interface SecretCreatedEnvelope {
705
- entity: Secret;
706
- metadata: EventMetadata;
707
- }
708
- interface SecretDeletedEnvelope {
709
- metadata: EventMetadata;
710
- }
711
- interface SecretUpdatedEnvelope {
712
- entity: Secret;
713
- metadata: EventMetadata;
714
- }
715
-
716
- declare function getSecretValue$1(httpClient: HttpClient): GetSecretValueSignature;
717
- interface GetSecretValueSignature {
718
- /**
719
- * Retrieves a secret value by name.
720
- * @param - The name of the secret to get the value of.
721
- */
722
- (name: string): Promise<GetSecretValueResponse & GetSecretValueResponseNonNullableFields>;
723
- }
724
- declare function listSecretInfo$1(httpClient: HttpClient): ListSecretInfoSignature;
725
- interface ListSecretInfoSignature {
726
- /**
727
- * Retrieves a list of secrets.
728
- *
729
- * >**Note:** This endpoint doesn't return the secret's value for security reasons. To retrieve the value, call [Get Secret Value](https://dev.wix.com/docs/rest/business-management/secrets/get-secret-value).
730
- */
731
- (): Promise<ListSecretInfoResponse>;
732
- }
733
- declare function createSecret$1(httpClient: HttpClient): CreateSecretSignature;
734
- interface CreateSecretSignature {
735
- /**
736
- * Creates a secret.
737
- * @param - Fields of a new secret.
738
- * @returns Secret ID.
739
- */
740
- (secret: Secret): Promise<string>;
741
- }
742
- declare function deleteSecret$1(httpClient: HttpClient): DeleteSecretSignature;
743
- interface DeleteSecretSignature {
744
- /**
745
- * Deletes a secret.
746
- * @param - The unique ID of the secret to be deleted.
747
- */
748
- (_id: string): Promise<void>;
749
- }
750
- declare function updateSecret$1(httpClient: HttpClient): UpdateSecretSignature;
751
- interface UpdateSecretSignature {
752
- /**
753
- * Updates 1 or all fields of a secret.
754
- *
755
- * To get the secret ID, call [List Secret Info](https://dev.wix.com/docs/rest/business-management/secrets/list-secret-info).
756
- * @param - ID of the secret to update.
757
- * @param - Details of a secret.
758
- */
759
- (_id: string, secret: Secret): Promise<void>;
760
- }
761
- declare const onSecretCreated$1: EventDefinition<SecretCreatedEnvelope, "wix.velo.secrets_vault.v1.secret_created">;
762
- declare const onSecretDeleted$1: EventDefinition<SecretDeletedEnvelope, "wix.velo.secrets_vault.v1.secret_deleted">;
763
- declare const onSecretUpdated$1: EventDefinition<SecretUpdatedEnvelope, "wix.velo.secrets_vault.v1.secret_updated">;
764
-
765
- declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
766
-
767
- declare const getSecretValue: MaybeContext<BuildRESTFunction<typeof getSecretValue$1> & typeof getSecretValue$1>;
768
- declare const listSecretInfo: MaybeContext<BuildRESTFunction<typeof listSecretInfo$1> & typeof listSecretInfo$1>;
769
- declare const createSecret: MaybeContext<BuildRESTFunction<typeof createSecret$1> & typeof createSecret$1>;
770
- declare const deleteSecret: MaybeContext<BuildRESTFunction<typeof deleteSecret$1> & typeof deleteSecret$1>;
771
- declare const updateSecret: MaybeContext<BuildRESTFunction<typeof updateSecret$1> & typeof updateSecret$1>;
772
-
773
- type _publicOnSecretCreatedType = typeof onSecretCreated$1;
774
- /**
775
- * Triggered when a secret is created.
776
- */
777
- declare const onSecretCreated: ReturnType<typeof createEventModule<_publicOnSecretCreatedType>>;
778
-
779
- type _publicOnSecretDeletedType = typeof onSecretDeleted$1;
780
- /**
781
- * Triggered when a secret is deleted.
782
- */
783
- declare const onSecretDeleted: ReturnType<typeof createEventModule<_publicOnSecretDeletedType>>;
784
-
785
- type _publicOnSecretUpdatedType = typeof onSecretUpdated$1;
786
- /**
787
- * Triggered when a secret is updated.
788
- */
789
- declare const onSecretUpdated: ReturnType<typeof createEventModule<_publicOnSecretUpdatedType>>;
790
-
791
- type index_d_ActionEvent = ActionEvent;
792
- type index_d_BaseEventMetadata = BaseEventMetadata;
793
- type index_d_CreateSecretRequest = CreateSecretRequest;
794
- type index_d_CreateSecretResponse = CreateSecretResponse;
795
- type index_d_CreateSecretResponseNonNullableFields = CreateSecretResponseNonNullableFields;
796
- type index_d_DeleteSecretRequest = DeleteSecretRequest;
797
- type index_d_DeleteSecretResponse = DeleteSecretResponse;
798
- type index_d_DomainEvent = DomainEvent;
799
- type index_d_DomainEventBodyOneOf = DomainEventBodyOneOf;
800
- type index_d_EntityCreatedEvent = EntityCreatedEvent;
801
- type index_d_EntityDeletedEvent = EntityDeletedEvent;
802
- type index_d_EntityUpdatedEvent = EntityUpdatedEvent;
803
- type index_d_EventMetadata = EventMetadata;
804
- type index_d_GetSecretValueRequest = GetSecretValueRequest;
805
- type index_d_GetSecretValueResponse = GetSecretValueResponse;
806
- type index_d_GetSecretValueResponseNonNullableFields = GetSecretValueResponseNonNullableFields;
807
- type index_d_IdentificationData = IdentificationData;
808
- type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
809
- type index_d_ListSecretInfoRequest = ListSecretInfoRequest;
810
- type index_d_ListSecretInfoResponse = ListSecretInfoResponse;
811
- type index_d_MessageEnvelope = MessageEnvelope;
812
- type index_d_RestoreInfo = RestoreInfo;
813
- type index_d_Secret = Secret;
814
- type index_d_SecretCreatedEnvelope = SecretCreatedEnvelope;
815
- type index_d_SecretDeletedEnvelope = SecretDeletedEnvelope;
816
- type index_d_SecretUpdatedEnvelope = SecretUpdatedEnvelope;
817
- type index_d_UpdateSecretRequest = UpdateSecretRequest;
818
- type index_d_UpdateSecretResponse = UpdateSecretResponse;
819
- type index_d_WebhookIdentityType = WebhookIdentityType;
820
- declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
821
- type index_d__publicOnSecretCreatedType = _publicOnSecretCreatedType;
822
- type index_d__publicOnSecretDeletedType = _publicOnSecretDeletedType;
823
- type index_d__publicOnSecretUpdatedType = _publicOnSecretUpdatedType;
824
- declare const index_d_createSecret: typeof createSecret;
825
- declare const index_d_deleteSecret: typeof deleteSecret;
826
- declare const index_d_getSecretValue: typeof getSecretValue;
827
- declare const index_d_listSecretInfo: typeof listSecretInfo;
828
- declare const index_d_onSecretCreated: typeof onSecretCreated;
829
- declare const index_d_onSecretDeleted: typeof onSecretDeleted;
830
- declare const index_d_onSecretUpdated: typeof onSecretUpdated;
831
- declare const index_d_updateSecret: typeof updateSecret;
832
- declare namespace index_d {
833
- export { type index_d_ActionEvent as ActionEvent, type index_d_BaseEventMetadata as BaseEventMetadata, type index_d_CreateSecretRequest as CreateSecretRequest, type index_d_CreateSecretResponse as CreateSecretResponse, type index_d_CreateSecretResponseNonNullableFields as CreateSecretResponseNonNullableFields, type index_d_DeleteSecretRequest as DeleteSecretRequest, type index_d_DeleteSecretResponse as DeleteSecretResponse, type index_d_DomainEvent as DomainEvent, type index_d_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d_EntityCreatedEvent as EntityCreatedEvent, type index_d_EntityDeletedEvent as EntityDeletedEvent, type index_d_EntityUpdatedEvent as EntityUpdatedEvent, type index_d_EventMetadata as EventMetadata, type index_d_GetSecretValueRequest as GetSecretValueRequest, type index_d_GetSecretValueResponse as GetSecretValueResponse, type index_d_GetSecretValueResponseNonNullableFields as GetSecretValueResponseNonNullableFields, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d_ListSecretInfoRequest as ListSecretInfoRequest, type index_d_ListSecretInfoResponse as ListSecretInfoResponse, type index_d_MessageEnvelope as MessageEnvelope, type index_d_RestoreInfo as RestoreInfo, type index_d_Secret as Secret, type index_d_SecretCreatedEnvelope as SecretCreatedEnvelope, type index_d_SecretDeletedEnvelope as SecretDeletedEnvelope, type index_d_SecretUpdatedEnvelope as SecretUpdatedEnvelope, type index_d_UpdateSecretRequest as UpdateSecretRequest, type index_d_UpdateSecretResponse as UpdateSecretResponse, index_d_WebhookIdentityType as WebhookIdentityType, type index_d__publicOnSecretCreatedType as _publicOnSecretCreatedType, type index_d__publicOnSecretDeletedType as _publicOnSecretDeletedType, type index_d__publicOnSecretUpdatedType as _publicOnSecretUpdatedType, index_d_createSecret as createSecret, index_d_deleteSecret as deleteSecret, index_d_getSecretValue as getSecretValue, index_d_listSecretInfo as listSecretInfo, index_d_onSecretCreated as onSecretCreated, index_d_onSecretDeleted as onSecretDeleted, index_d_onSecretUpdated as onSecretUpdated, onSecretCreated$1 as publicOnSecretCreated, onSecretDeleted$1 as publicOnSecretDeleted, onSecretUpdated$1 as publicOnSecretUpdated, index_d_updateSecret as updateSecret };
834
- }
835
-
836
- export { index_d as secrets };