@wix/riseevent 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/rise-v1-event.http.d.ts +18 -0
  5. package/build/cjs/src/rise-v1-event.http.js +165 -0
  6. package/build/cjs/src/rise-v1-event.http.js.map +1 -0
  7. package/build/cjs/src/rise-v1-event.public.d.ts +12 -0
  8. package/build/cjs/src/rise-v1-event.public.js +38 -0
  9. package/build/cjs/src/rise-v1-event.public.js.map +1 -0
  10. package/build/cjs/src/rise-v1-event.types.d.ts +328 -0
  11. package/build/cjs/src/rise-v1-event.types.js +9 -0
  12. package/build/cjs/src/rise-v1-event.types.js.map +1 -0
  13. package/build/cjs/src/rise-v1-event.universal.d.ts +416 -0
  14. package/build/cjs/src/rise-v1-event.universal.js +330 -0
  15. package/build/cjs/src/rise-v1-event.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/rise-v1-event.http.d.ts +18 -0
  20. package/build/es/src/rise-v1-event.http.js +157 -0
  21. package/build/es/src/rise-v1-event.http.js.map +1 -0
  22. package/build/es/src/rise-v1-event.public.d.ts +12 -0
  23. package/build/es/src/rise-v1-event.public.js +29 -0
  24. package/build/es/src/rise-v1-event.public.js.map +1 -0
  25. package/build/es/src/rise-v1-event.types.d.ts +328 -0
  26. package/build/es/src/rise-v1-event.types.js +6 -0
  27. package/build/es/src/rise-v1-event.types.js.map +1 -0
  28. package/build/es/src/rise-v1-event.universal.d.ts +416 -0
  29. package/build/es/src/rise-v1-event.universal.js +303 -0
  30. package/build/es/src/rise-v1-event.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1,416 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ /** Event is the main entity of EventService */
8
+ export interface Event {
9
+ /**
10
+ * Event ID
11
+ * @readonly
12
+ */
13
+ _id?: string | null;
14
+ /** Represents the current state of an item. Each time the item is modified, its `revision` changes. For an update operation to succeed, you MUST pass the latest revision */
15
+ revision?: string | null;
16
+ /**
17
+ * Represents the time this Event was created
18
+ * @readonly
19
+ */
20
+ _createdDate?: Date;
21
+ /**
22
+ * Represents the time this Event was last updated
23
+ * @readonly
24
+ */
25
+ _updatedDate?: Date;
26
+ /** Wallet ID */
27
+ walletId?: string;
28
+ /** Represents the time when the event's amount will be added to the account */
29
+ startDate?: Date;
30
+ /** Represents the time when the unused balance will be deducted from the account */
31
+ expiresAt?: Date;
32
+ /** Represents the time when the event was manually disabled */
33
+ disabledAt?: Date;
34
+ /** The amount to be added to the customer */
35
+ amount?: string;
36
+ }
37
+ export interface CreateEventRequest {
38
+ /** Event to be created */
39
+ event: Event;
40
+ }
41
+ export interface CreateEventResponse {
42
+ /** The created Event */
43
+ event?: Event;
44
+ }
45
+ export interface EventCreationExpirationDateInThePastDetails {
46
+ /** The date when the event expires. */
47
+ expiresAt?: Date;
48
+ /** The date when the event was tried to be created. */
49
+ currentDate?: Date;
50
+ }
51
+ export interface EventCreationStartLaterThanExpirationDetails {
52
+ /** The start date of the event. */
53
+ startDate?: Date;
54
+ /** The date when the event expires. */
55
+ expiresAt?: Date;
56
+ }
57
+ export interface EventCreationDisabledAtDateSetDetails {
58
+ /** Represents the time when the event was disabled. */
59
+ disabledAt?: Date;
60
+ }
61
+ export interface GetEventRequest {
62
+ /** ID of the Event to retrieve */
63
+ eventId: string;
64
+ }
65
+ export interface GetEventResponse {
66
+ /** The retrieved Event */
67
+ event?: Event;
68
+ }
69
+ export interface UpdateEventRequest {
70
+ /** Event to be updated, may be partial */
71
+ event: Event;
72
+ }
73
+ export interface UpdateEventResponse {
74
+ /** The updated Event */
75
+ event?: Event;
76
+ }
77
+ export interface InvalidEventDetails {
78
+ /** Event ID. */
79
+ eventId?: string;
80
+ }
81
+ export interface EventUpdateStartDateInThePastDetails {
82
+ /** Event ID. */
83
+ eventId?: string;
84
+ /** The date when the event expires. */
85
+ newStartDate?: Date;
86
+ /** The date when the event was tried to be updated. */
87
+ currentDate?: Date;
88
+ }
89
+ export interface EventUpdateExpirationDateInThePastDetails {
90
+ /** Event ID. */
91
+ eventId?: string;
92
+ /** The date when the event expires. */
93
+ newExpiresAt?: Date;
94
+ /** The date when the event was tried to be updated. */
95
+ currentDate?: Date;
96
+ }
97
+ export interface EventUpdateStartLaterThanExpirationDetails {
98
+ /** Event ID. */
99
+ eventId?: string;
100
+ /** The start date of the event. */
101
+ startDate?: Date;
102
+ /** The date when the event expires. */
103
+ expiresAt?: Date;
104
+ }
105
+ export interface DisableEventRequest {
106
+ /** ID of the Event to delete */
107
+ eventId: string;
108
+ /** The revision of the Event */
109
+ revision?: string;
110
+ }
111
+ export interface DisableEventResponse {
112
+ /** The expired Event */
113
+ event?: Event;
114
+ }
115
+ export interface DeleteEventRequest {
116
+ /** ID of the Event to delete */
117
+ eventId?: string;
118
+ /** The revision of the Event */
119
+ revision?: string;
120
+ }
121
+ export interface DeleteEventResponse {
122
+ }
123
+ export interface QueryEventRequest {
124
+ /** WQL expression */
125
+ query?: QueryV2;
126
+ }
127
+ export interface QueryV2 extends QueryV2PagingMethodOneOf {
128
+ /** Paging options to limit and skip the number of items. */
129
+ paging?: Paging;
130
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
131
+ cursorPaging?: CursorPaging;
132
+ /**
133
+ * Filter object in the following format:
134
+ * `"filter" : {
135
+ * "fieldName1": "value1",
136
+ * "fieldName2":{"$operator":"value2"}
137
+ * }`
138
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
139
+ */
140
+ filter?: Record<string, any> | null;
141
+ /**
142
+ * Sort object in the following format:
143
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
144
+ */
145
+ sort?: Sorting[];
146
+ /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
147
+ fields?: string[];
148
+ /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */
149
+ fieldsets?: string[];
150
+ }
151
+ /** @oneof */
152
+ export interface QueryV2PagingMethodOneOf {
153
+ /** Paging options to limit and skip the number of items. */
154
+ paging?: Paging;
155
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
156
+ cursorPaging?: CursorPaging;
157
+ }
158
+ export interface Sorting {
159
+ /** Name of the field to sort by. */
160
+ fieldName?: string;
161
+ /** Sort order. */
162
+ order?: SortOrder;
163
+ }
164
+ export declare enum SortOrder {
165
+ ASC = "ASC",
166
+ DESC = "DESC"
167
+ }
168
+ export interface Paging {
169
+ /** Number of items to load. */
170
+ limit?: number | null;
171
+ /** Number of items to skip in the current sort order. */
172
+ offset?: number | null;
173
+ }
174
+ export interface CursorPaging {
175
+ /** Number of items to load. */
176
+ limit?: number | null;
177
+ /**
178
+ * Pointer to the next or previous page in the list of results.
179
+ *
180
+ * You can get the relevant cursor token
181
+ * from the `pagingMetadata` object in the previous call's response.
182
+ * Not relevant for the first request.
183
+ */
184
+ cursor?: string | null;
185
+ }
186
+ export interface QueryEventResponse {
187
+ /** The retrieved Events */
188
+ events?: Event[];
189
+ }
190
+ export interface QueryEventBalancesRequest {
191
+ /** WQL expression */
192
+ query: QueryV2;
193
+ }
194
+ export interface QueryEventBalancesResponse {
195
+ /** The retrieved Events with their balance */
196
+ events?: EventWithBalance[];
197
+ }
198
+ export interface EventWithBalance {
199
+ /** Event */
200
+ event?: Event;
201
+ /** Event balance */
202
+ balance?: string | null;
203
+ }
204
+ export interface Task extends TaskTriggerOneOf {
205
+ /** A trigger which will fire once at a specified timestamp */
206
+ oneTime?: Date;
207
+ /**
208
+ * A recurrent trigger defined by a specified cron expression.
209
+ *
210
+ * Cron expression is a string of five space-separated sub-expressions
211
+ *
212
+ * * * * * *
213
+ * | | | | |
214
+ * minute of hour | | | day of week
215
+ * hour of day | month of year
216
+ * day of month
217
+ *
218
+ * Field Accepted values
219
+ * ----- ---------------
220
+ * minute of hour 0..59 / * ,
221
+ * hour of day 0..23 / * ,
222
+ * day of month 1..31 / * , W L
223
+ * month of year 1..12 / * ,
224
+ * day of week 0..7 MON..SUN / * W L #
225
+ *
226
+ * Coma separates multiple values:
227
+ * 0,20,40 * * * * => on 0th, 20th and 40th minute
228
+ * Slash selects every Nth value:
229
+ * * /20 * * * * => equivalent to 0,20,40
230
+ * 5/20 * * * * => on 5th, 25th and 45th minute
231
+ * W selects working days
232
+ * 0 2 * * W => 2am on Mon..Fri
233
+ * L selects the last day of ...
234
+ * 0 0 L * * => last day of each month
235
+ * 0 0 LW * * => last working day of each month
236
+ * 0 0 * * FRIL => midnight of the last Friday of the month
237
+ * Hash selects Nth day of week
238
+ * 0 0 * * Mon#1 => midnight of the first Monday of the month
239
+ *
240
+ * Following aliases are supported: @hourly, @daily, @weekly, @monthly
241
+ *
242
+ * The first execution time will be evaluated based on the client invocation time (approximately the moment the
243
+ * client call returns).
244
+ * All executions will be evaluated in UTC.
245
+ *
246
+ * Example:
247
+ * 00:19:59 - client schedules a task with cron = 0/20 * * * * (every 20-th minute of the hour)
248
+ * 00:20:02 - task reaches Time Capsule database
249
+ * 00:21:00 - task is executed by Time Capsule, the client is triggered with a ~1 minute delay
250
+ * 00:40:00 - task is executed by Time Capsule according to the schedule with no delay
251
+ */
252
+ cron?: string;
253
+ /** Task id */
254
+ _id?: TaskId;
255
+ /** Task payload */
256
+ payload?: Record<string, any> | null;
257
+ /**
258
+ * A Greyhound topic to which the task will be produced when triggered
259
+ * @readonly
260
+ */
261
+ topic?: string;
262
+ /**
263
+ * The time when this task is scheduled to trigger. For reoccurring tasks, this will be hold the next time this task will run and will be updated after every run
264
+ * @readonly
265
+ */
266
+ scheduledFor?: Date;
267
+ }
268
+ /** @oneof */
269
+ export interface TaskTriggerOneOf {
270
+ /** A trigger which will fire once at a specified timestamp */
271
+ oneTime?: Date;
272
+ /**
273
+ * A recurrent trigger defined by a specified cron expression.
274
+ *
275
+ * Cron expression is a string of five space-separated sub-expressions
276
+ *
277
+ * * * * * *
278
+ * | | | | |
279
+ * minute of hour | | | day of week
280
+ * hour of day | month of year
281
+ * day of month
282
+ *
283
+ * Field Accepted values
284
+ * ----- ---------------
285
+ * minute of hour 0..59 / * ,
286
+ * hour of day 0..23 / * ,
287
+ * day of month 1..31 / * , W L
288
+ * month of year 1..12 / * ,
289
+ * day of week 0..7 MON..SUN / * W L #
290
+ *
291
+ * Coma separates multiple values:
292
+ * 0,20,40 * * * * => on 0th, 20th and 40th minute
293
+ * Slash selects every Nth value:
294
+ * * /20 * * * * => equivalent to 0,20,40
295
+ * 5/20 * * * * => on 5th, 25th and 45th minute
296
+ * W selects working days
297
+ * 0 2 * * W => 2am on Mon..Fri
298
+ * L selects the last day of ...
299
+ * 0 0 L * * => last day of each month
300
+ * 0 0 LW * * => last working day of each month
301
+ * 0 0 * * FRIL => midnight of the last Friday of the month
302
+ * Hash selects Nth day of week
303
+ * 0 0 * * Mon#1 => midnight of the first Monday of the month
304
+ *
305
+ * Following aliases are supported: @hourly, @daily, @weekly, @monthly
306
+ *
307
+ * The first execution time will be evaluated based on the client invocation time (approximately the moment the
308
+ * client call returns).
309
+ * All executions will be evaluated in UTC.
310
+ *
311
+ * Example:
312
+ * 00:19:59 - client schedules a task with cron = 0/20 * * * * (every 20-th minute of the hour)
313
+ * 00:20:02 - task reaches Time Capsule database
314
+ * 00:21:00 - task is executed by Time Capsule, the client is triggered with a ~1 minute delay
315
+ * 00:40:00 - task is executed by Time Capsule according to the schedule with no delay
316
+ */
317
+ cron?: string;
318
+ }
319
+ export interface TaskId {
320
+ /** A unique identifier of an application or a source that define the task. In most cases this would be the appDefId */
321
+ namespace?: string;
322
+ /**
323
+ * A free-form string distinguishing different families of tasks within a namespace.
324
+ * For example: "send-promo-email", "ClearTrashBin", "premium expiration reminder"
325
+ */
326
+ taskType?: string;
327
+ /**
328
+ * A free-form string that together with `namespace` and `task_type` uniquely identifies a task.
329
+ * When there is an entity involved, setting this to be equal to the ID of an entity related to the task is a good option.
330
+ */
331
+ key?: string;
332
+ }
333
+ export interface Empty {
334
+ }
335
+ /**
336
+ * Creates a new Event
337
+ * @param event - Event to be created
338
+ * @public
339
+ * @documentationMaturity preview
340
+ * @requiredField event
341
+ * @requiredField event.amount
342
+ * @requiredField event.walletId
343
+ * @returns The created Event
344
+ */
345
+ export declare function createEvent(event: Event): Promise<Event>;
346
+ /**
347
+ * Get an Event by ID
348
+ * @param eventId - ID of the Event to retrieve
349
+ * @public
350
+ * @documentationMaturity preview
351
+ * @requiredField eventId
352
+ * @returns The retrieved Event
353
+ */
354
+ export declare function getEvent(eventId: string): Promise<Event>;
355
+ /**
356
+ * Update an Event, supports partial update
357
+ * Pass the latest `revision` for a successful update
358
+ * @param _id - Event ID
359
+ * @public
360
+ * @documentationMaturity preview
361
+ * @requiredField _id
362
+ * @requiredField event
363
+ * @requiredField event.revision
364
+ * @returns The updated Event
365
+ */
366
+ export declare function updateEvent(_id: string | null, event: UpdateEvent): Promise<Event>;
367
+ export interface UpdateEvent {
368
+ /**
369
+ * Event ID
370
+ * @readonly
371
+ */
372
+ _id?: string | null;
373
+ /** Represents the current state of an item. Each time the item is modified, its `revision` changes. For an update operation to succeed, you MUST pass the latest revision */
374
+ revision?: string | null;
375
+ /**
376
+ * Represents the time this Event was created
377
+ * @readonly
378
+ */
379
+ _createdDate?: Date;
380
+ /**
381
+ * Represents the time this Event was last updated
382
+ * @readonly
383
+ */
384
+ _updatedDate?: Date;
385
+ /** Wallet ID */
386
+ walletId?: string;
387
+ /** Represents the time when the event's amount will be added to the account */
388
+ startDate?: Date;
389
+ /** Represents the time when the unused balance will be deducted from the account */
390
+ expiresAt?: Date;
391
+ /** Represents the time when the event was manually disabled */
392
+ disabledAt?: Date;
393
+ /** The amount to be added to the customer */
394
+ amount?: string;
395
+ }
396
+ /**
397
+ * Expire an Event immediately and deducting the remaining balance from the gift card
398
+ * @param eventId - ID of the Event to delete
399
+ * @public
400
+ * @documentationMaturity preview
401
+ * @requiredField eventId
402
+ */
403
+ export declare function disableEvent(eventId: string, options?: DisableEventOptions): Promise<DisableEventResponse>;
404
+ export interface DisableEventOptions {
405
+ /** The revision of the Event */
406
+ revision?: string;
407
+ }
408
+ /**
409
+ * Query Events using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language)
410
+ * Results will be enriched with calculated balances
411
+ * @param query - WQL expression
412
+ * @public
413
+ * @documentationMaturity preview
414
+ * @requiredField query
415
+ */
416
+ export declare function queryEventBalances(query: QueryV2): Promise<QueryEventBalancesResponse>;