@wix/workflows 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 (79) hide show
  1. package/build/cjs/index.d.ts +3 -0
  2. package/build/cjs/index.js +26 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/workflows-v1-card.http.d.ts +92 -0
  5. package/build/cjs/src/workflows-v1-card.http.js +339 -0
  6. package/build/cjs/src/workflows-v1-card.http.js.map +1 -0
  7. package/build/cjs/src/workflows-v1-card.public.d.ts +15 -0
  8. package/build/cjs/src/workflows-v1-card.public.js +57 -0
  9. package/build/cjs/src/workflows-v1-card.public.js.map +1 -0
  10. package/build/cjs/src/workflows-v1-card.types.d.ts +240 -0
  11. package/build/cjs/src/workflows-v1-card.types.js +14 -0
  12. package/build/cjs/src/workflows-v1-card.types.js.map +1 -0
  13. package/build/cjs/src/workflows-v1-card.universal.d.ts +449 -0
  14. package/build/cjs/src/workflows-v1-card.universal.js +569 -0
  15. package/build/cjs/src/workflows-v1-card.universal.js.map +1 -0
  16. package/build/cjs/src/workflows-v1-phase.http.d.ts +61 -0
  17. package/build/cjs/src/workflows-v1-phase.http.js +288 -0
  18. package/build/cjs/src/workflows-v1-phase.http.js.map +1 -0
  19. package/build/cjs/src/workflows-v1-phase.public.d.ts +14 -0
  20. package/build/cjs/src/workflows-v1-phase.public.js +51 -0
  21. package/build/cjs/src/workflows-v1-phase.public.js.map +1 -0
  22. package/build/cjs/src/workflows-v1-phase.types.d.ts +234 -0
  23. package/build/cjs/src/workflows-v1-phase.types.js +14 -0
  24. package/build/cjs/src/workflows-v1-phase.types.js.map +1 -0
  25. package/build/cjs/src/workflows-v1-phase.universal.d.ts +388 -0
  26. package/build/cjs/src/workflows-v1-phase.universal.js +488 -0
  27. package/build/cjs/src/workflows-v1-phase.universal.js.map +1 -0
  28. package/build/cjs/src/workflows-v1-workflow.http.d.ts +74 -0
  29. package/build/cjs/src/workflows-v1-workflow.http.js +315 -0
  30. package/build/cjs/src/workflows-v1-workflow.http.js.map +1 -0
  31. package/build/cjs/src/workflows-v1-workflow.public.d.ts +14 -0
  32. package/build/cjs/src/workflows-v1-workflow.public.js +51 -0
  33. package/build/cjs/src/workflows-v1-workflow.public.js.map +1 -0
  34. package/build/cjs/src/workflows-v1-workflow.types.d.ts +273 -0
  35. package/build/cjs/src/workflows-v1-workflow.types.js +14 -0
  36. package/build/cjs/src/workflows-v1-workflow.types.js.map +1 -0
  37. package/build/cjs/src/workflows-v1-workflow.universal.d.ts +424 -0
  38. package/build/cjs/src/workflows-v1-workflow.universal.js +478 -0
  39. package/build/cjs/src/workflows-v1-workflow.universal.js.map +1 -0
  40. package/build/es/index.d.ts +3 -0
  41. package/build/es/index.js +4 -0
  42. package/build/es/index.js.map +1 -0
  43. package/build/es/src/workflows-v1-card.http.d.ts +92 -0
  44. package/build/es/src/workflows-v1-card.http.js +328 -0
  45. package/build/es/src/workflows-v1-card.http.js.map +1 -0
  46. package/build/es/src/workflows-v1-card.public.d.ts +15 -0
  47. package/build/es/src/workflows-v1-card.public.js +44 -0
  48. package/build/es/src/workflows-v1-card.public.js.map +1 -0
  49. package/build/es/src/workflows-v1-card.types.d.ts +240 -0
  50. package/build/es/src/workflows-v1-card.types.js +11 -0
  51. package/build/es/src/workflows-v1-card.types.js.map +1 -0
  52. package/build/es/src/workflows-v1-card.universal.d.ts +449 -0
  53. package/build/es/src/workflows-v1-card.universal.js +539 -0
  54. package/build/es/src/workflows-v1-card.universal.js.map +1 -0
  55. package/build/es/src/workflows-v1-phase.http.d.ts +61 -0
  56. package/build/es/src/workflows-v1-phase.http.js +278 -0
  57. package/build/es/src/workflows-v1-phase.http.js.map +1 -0
  58. package/build/es/src/workflows-v1-phase.public.d.ts +14 -0
  59. package/build/es/src/workflows-v1-phase.public.js +39 -0
  60. package/build/es/src/workflows-v1-phase.public.js.map +1 -0
  61. package/build/es/src/workflows-v1-phase.types.d.ts +234 -0
  62. package/build/es/src/workflows-v1-phase.types.js +11 -0
  63. package/build/es/src/workflows-v1-phase.types.js.map +1 -0
  64. package/build/es/src/workflows-v1-phase.universal.d.ts +388 -0
  65. package/build/es/src/workflows-v1-phase.universal.js +459 -0
  66. package/build/es/src/workflows-v1-phase.universal.js.map +1 -0
  67. package/build/es/src/workflows-v1-workflow.http.d.ts +74 -0
  68. package/build/es/src/workflows-v1-workflow.http.js +305 -0
  69. package/build/es/src/workflows-v1-workflow.http.js.map +1 -0
  70. package/build/es/src/workflows-v1-workflow.public.d.ts +14 -0
  71. package/build/es/src/workflows-v1-workflow.public.js +39 -0
  72. package/build/es/src/workflows-v1-workflow.public.js.map +1 -0
  73. package/build/es/src/workflows-v1-workflow.types.d.ts +273 -0
  74. package/build/es/src/workflows-v1-workflow.types.js +11 -0
  75. package/build/es/src/workflows-v1-workflow.types.js.map +1 -0
  76. package/build/es/src/workflows-v1-workflow.universal.d.ts +424 -0
  77. package/build/es/src/workflows-v1-workflow.universal.js +449 -0
  78. package/build/es/src/workflows-v1-workflow.universal.js.map +1 -0
  79. package/package.json +37 -0
@@ -0,0 +1,449 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface Card {
8
+ /** Card details. */
9
+ info?: CardInfo;
10
+ }
11
+ /** entity representing a card-info */
12
+ export interface CardInfo {
13
+ /**
14
+ * Card ID.
15
+ * @readonly
16
+ */
17
+ _id?: string | null;
18
+ /** Display name shown at the top of the card. */
19
+ name?: string | null;
20
+ /** Card description. */
21
+ description?: string | null;
22
+ /** Details about the contact attached to the card. */
23
+ primaryAttachment?: Attachment;
24
+ /** Due date. */
25
+ dueDate?: Date;
26
+ /** Name of the app or service that created the contact. */
27
+ source?: string | null;
28
+ /**
29
+ * Deprecated. Use `createdDate` instead.
30
+ * @readonly
31
+ */
32
+ createdAt?: Date;
33
+ /**
34
+ * Deprecated. Use `updatedDate` instead.
35
+ * @readonly
36
+ */
37
+ updatedAt?: Date;
38
+ /**
39
+ * ID of the phase that currently holds the card.
40
+ * @readonly
41
+ */
42
+ phaseId?: string | null;
43
+ /**
44
+ * Date and time the card was created.
45
+ * @readonly
46
+ */
47
+ _createdDate?: Date;
48
+ /**
49
+ * Date and time the card was updated.
50
+ * @readonly
51
+ */
52
+ _updatedDate?: Date;
53
+ }
54
+ export interface Attachment {
55
+ /**
56
+ * Attachment ID. For internal use.
57
+ * @readonly
58
+ */
59
+ attachmentId?: string;
60
+ /** Deprecated. Use `contactId` instead. */
61
+ value?: string;
62
+ /** Deprecated. For internal use. */
63
+ attachmentType?: AttachmentType;
64
+ /** ID of the contact attached to the card. */
65
+ contactId?: string;
66
+ }
67
+ /** describes the supported types of attachments (currently only supports Contact which is the default type) */
68
+ export declare enum AttachmentType {
69
+ ContactType = "ContactType"
70
+ }
71
+ export interface QueryCardsRequest {
72
+ /** Query, sort, and paging options. */
73
+ query?: Query;
74
+ }
75
+ export interface Query {
76
+ /**
77
+ * Filter object in the following format:
78
+ * `"filter" : {
79
+ * "fieldName1": "value1",
80
+ * "fieldName2":{"$operator":"value2"}
81
+ * }`
82
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
83
+ */
84
+ filter?: any;
85
+ /**
86
+ * Sort object in the following format:
87
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
88
+ */
89
+ sort?: Sorting[];
90
+ /** Paging options to limit and skip the number of items. */
91
+ paging?: Paging;
92
+ /** 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. */
93
+ fields?: string[];
94
+ /** 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. */
95
+ fieldsets?: string[];
96
+ }
97
+ export interface Sorting {
98
+ /** Name of the field to sort by. */
99
+ fieldName?: string;
100
+ /** Sort order. */
101
+ order?: SortOrder;
102
+ }
103
+ export declare enum SortOrder {
104
+ ASC = "ASC",
105
+ DESC = "DESC"
106
+ }
107
+ export interface Paging {
108
+ /** Number of items to load. */
109
+ limit?: number | null;
110
+ /** Number of items to skip in the current sort order. */
111
+ offset?: number | null;
112
+ }
113
+ export interface QueryCardsResponse {
114
+ /** List of cards that matched the query criteria. */
115
+ cards?: Card[];
116
+ /** Metadata for the page of results. */
117
+ pagination?: PaginationResponse;
118
+ }
119
+ export interface PaginationResponse {
120
+ /** Number of items that were skipped in the current sort order. */
121
+ offset?: number;
122
+ /** Total number of items that matched the filter. */
123
+ total?: number;
124
+ /** Number of returned items. */
125
+ count?: number;
126
+ }
127
+ export interface ListCardsRequest {
128
+ /** ID of the workflow whose cards will be listed. */
129
+ workflowId: string;
130
+ /** Filters for cards in the specified phase. */
131
+ phaseId?: string | null;
132
+ /**
133
+ * Number of items to return.
134
+ *
135
+ * Defaults to `50`.
136
+ */
137
+ limit?: number | null;
138
+ /**
139
+ * Number of items to skip in the current sort order.
140
+ *
141
+ * Defaults to `0`.
142
+ */
143
+ offset?: number | null;
144
+ /** Filters for cards with the specified contact ID. */
145
+ attachmentValue?: string | null;
146
+ /**
147
+ * Filters for archived cards.
148
+ * If set to `true`,
149
+ * only archived cards are returned.
150
+ * If set to `false`,
151
+ * only cards that are not archived are returned.
152
+ *
153
+ * Defaults to `false`.
154
+ */
155
+ fetchArchived?: boolean | null;
156
+ /**
157
+ * Supported fields:
158
+ * `id`, `name`, `createdDate`, `updatedDate`, `phaseId`
159
+ *
160
+ * List of fields to sort by.
161
+ * Formatted as `field:direction`,
162
+ * where field is the field name
163
+ * and direction is `asc` (ascending) or `desc` (descending).
164
+ *
165
+ * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`.
166
+ */
167
+ sort?: string[];
168
+ }
169
+ export interface ListCardsResponse {
170
+ /** List of cards. */
171
+ cards?: Card[];
172
+ /** Metadata for the page of results. */
173
+ pagination?: PaginationResponse;
174
+ }
175
+ export interface GetCardRequest {
176
+ /** ID of the card to retrieve. */
177
+ _id: string;
178
+ }
179
+ export interface GetCardResponse {
180
+ /** Requested card. */
181
+ card?: Card;
182
+ }
183
+ export interface UpdateCardRequest {
184
+ /** ID of the card to update. */
185
+ _id: string;
186
+ /** Card details. */
187
+ cardInfo?: CardInfo;
188
+ }
189
+ export interface UpdateCardResponse {
190
+ }
191
+ export interface CreateCardRequest {
192
+ /** ID of the workflow to create the card in. */
193
+ workflowId: string;
194
+ /** ID of the phase to create the card in. */
195
+ phaseId: string;
196
+ /** Card details. */
197
+ card?: CardInfo;
198
+ /**
199
+ * Card position, where the first card is `0`.
200
+ *
201
+ * If a card already occupies the specified position,
202
+ * that card and any subsequent cards are shifted to the right by 1.
203
+ *
204
+ * Defaults to the last position.
205
+ */
206
+ position?: number | null;
207
+ }
208
+ export interface CreateCardResponse {
209
+ /** ID of the newly created card. */
210
+ _id?: string | null;
211
+ }
212
+ export interface DeleteCardRequest {
213
+ /** ID of the card to delete. */
214
+ _id: string;
215
+ }
216
+ export interface DeleteCardResponse {
217
+ }
218
+ export interface MoveCardRequest {
219
+ /** ID of the card to move. */
220
+ _id: string;
221
+ /** ID of the phase to move the card to. */
222
+ newPhaseId?: string | null;
223
+ /** Position of the card in the phase, where the first card is `0`. */
224
+ newPosition?: number | null;
225
+ }
226
+ export interface MoveCardResponse {
227
+ }
228
+ export interface RestoreCardRequest {
229
+ /** ID of the card to restore. */
230
+ _id: string;
231
+ /** ID of the phase to restore the card to. */
232
+ newPhaseId: string;
233
+ /**
234
+ * Position of the restored card in the phase,
235
+ * where the first card is `0`.
236
+ */
237
+ newPosition?: number | null;
238
+ }
239
+ export interface RestoreCardResponse {
240
+ }
241
+ export interface ArchiveCardRequest {
242
+ /** ID of the card to archive. */
243
+ _id?: string;
244
+ }
245
+ export interface ArchiveCardResponse {
246
+ }
247
+ /**
248
+ * Returns a list of cards according to:
249
+ * * paging: offset, limit
250
+ * * order: by some of the following fields: id, name, createdAt, updatedAt, position, phaseId
251
+ * * filter: by the following fields of CardInfo
252
+ * ** cardInfo.id - Guid
253
+ * ** cardInfo.name - Text
254
+ * ** cardInfo.source - Text
255
+ * ** cardInfo.position - Number
256
+ * ** cardInfo.createdAt - Date
257
+ * ** cardInfo.updatedAt - Date
258
+ * ** cardInfo.primaryAttachment.contactId - Guid
259
+ * ** cardInfo.visibility - Text (Visible / Archived)
260
+ * @public
261
+ * @documentationMaturity preview
262
+ */
263
+ export declare function queryCards(options?: QueryCardsOptions): Promise<QueryCardsResponse>;
264
+ export interface QueryCardsOptions {
265
+ /** Query, sort, and paging options. */
266
+ query?: Query;
267
+ }
268
+ /**
269
+ * Retrieves a list of cards in the specified workflow.
270
+ *
271
+ * By default, the returned cards are sorted by their display order.
272
+ * @param workflowId - ID of the workflow whose cards will be listed.
273
+ * @public
274
+ * @documentationMaturity preview
275
+ * @requiredField workflowId
276
+ */
277
+ export declare function listCards(workflowId: string, options?: ListCardsOptions): Promise<ListCardsResponse>;
278
+ export interface ListCardsOptions {
279
+ /** Filters for cards in the specified phase. */
280
+ phaseId?: string | null;
281
+ /**
282
+ * Number of items to return.
283
+ *
284
+ * Defaults to `50`.
285
+ */
286
+ limit?: number | null;
287
+ /**
288
+ * Number of items to skip in the current sort order.
289
+ *
290
+ * Defaults to `0`.
291
+ */
292
+ offset?: number | null;
293
+ /** Filters for cards with the specified contact ID. */
294
+ attachmentValue?: string | null;
295
+ /**
296
+ * Filters for archived cards.
297
+ * If set to `true`,
298
+ * only archived cards are returned.
299
+ * If set to `false`,
300
+ * only cards that are not archived are returned.
301
+ *
302
+ * Defaults to `false`.
303
+ */
304
+ fetchArchived?: boolean | null;
305
+ /**
306
+ * Supported fields:
307
+ * `id`, `name`, `createdDate`, `updatedDate`, `phaseId`
308
+ *
309
+ * List of fields to sort by.
310
+ * Formatted as `field:direction`,
311
+ * where field is the field name
312
+ * and direction is `asc` (ascending) or `desc` (descending).
313
+ *
314
+ * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`.
315
+ */
316
+ sort?: string[];
317
+ }
318
+ /**
319
+ * Retrieves a card.
320
+ *
321
+ * If the specified card is archived, an empty object is returned.
322
+ * You can restore the card with
323
+ * [Restore Card](https://dev.wix.com/api/rest/workflows/workflows/cards/restore-card).
324
+ * @param _id - ID of the card to retrieve.
325
+ * @public
326
+ * @documentationMaturity preview
327
+ * @requiredField _id
328
+ */
329
+ export declare function getCard(_id: string): Promise<GetCardResponse>;
330
+ /**
331
+ * Updates a card's properties.
332
+ *
333
+ * To reorder cards, use
334
+ * [Move Card](https://dev.wix.com/api/rest/workflows/workflows/cards/move-card).
335
+ * To archive or restore a card, use
336
+ * [Archive Card](https://dev.wix.com/api/rest/workflows/workflows/cards/archive-card)
337
+ * or [Restore Card](https://dev.wix.com/api/rest/workflows/workflows/cards/restore-card),
338
+ * respectively.
339
+ * @param _id - ID of the card to update.
340
+ * @public
341
+ * @documentationMaturity preview
342
+ * @requiredField _id
343
+ */
344
+ export declare function updateCard(_id: string, options?: UpdateCardOptions): Promise<void>;
345
+ export interface UpdateCardOptions {
346
+ /** Card details. */
347
+ cardInfo?: CardInfo;
348
+ }
349
+ /**
350
+ * Creates a new card in the specified phase and workflow.
351
+ *
352
+ * When creating a card, you provide a `name` and an optional `position`.
353
+ *
354
+ * Cards are displayed according to their position from top to bottom,
355
+ * starting from `0` and incrementing by 1.
356
+ * If you create or move a card to an existing position,
357
+ * the card in that position and any subsequent cards
358
+ * are shifted down by 1.
359
+ *
360
+ * If `position` is not specified,
361
+ * the new card is given the bottom position.
362
+ * @public
363
+ * @documentationMaturity preview
364
+ * @requiredField identifiers
365
+ * @requiredField identifiers.phaseId
366
+ * @requiredField identifiers.workflowId
367
+ */
368
+ export declare function createCard(identifiers: CreateCardIdentifiers, options?: CreateCardOptions): Promise<CreateCardResponse>;
369
+ export interface CreateCardIdentifiers {
370
+ /** ID of the workflow to create the card in. */
371
+ workflowId: string;
372
+ /** ID of the phase to create the card in. */
373
+ phaseId: string;
374
+ }
375
+ export interface CreateCardOptions {
376
+ /** Card details. */
377
+ card?: CardInfo;
378
+ /**
379
+ * Card position, where the first card is `0`.
380
+ *
381
+ * If a card already occupies the specified position,
382
+ * that card and any subsequent cards are shifted to the right by 1.
383
+ *
384
+ * Defaults to the last position.
385
+ */
386
+ position?: number | null;
387
+ }
388
+ /**
389
+ * Deletes a card from a workflow.
390
+ *
391
+ * Deleted cards are removed from the workflow completely and can't be restored.
392
+ * To keep the card available for site contributors, use
393
+ * [Archive Card](https://dev.wix.com/api/rest/workflows/workflows/cards/archive-card)
394
+ * instead.
395
+ *
396
+ * After a card is deleted,
397
+ * its attached contact can be attached to another card in an active phase.
398
+ * @param _id - ID of the card to delete.
399
+ * @public
400
+ * @documentationMaturity preview
401
+ * @requiredField _id
402
+ */
403
+ export declare function deleteCard(_id: string): Promise<void>;
404
+ /**
405
+ * Moves a card to another phase or a new position within the current phase.
406
+ *
407
+ * To move a card, the new phase ID must be provided.
408
+ * You can use
409
+ * [Get Workflow](https://dev.wix.com/api/rest/workflows/workflows/workflows/get-workflow)
410
+ * to get IDs for all the phases in the workflow,
411
+ * including the win phase.
412
+ *
413
+ * If a card is moved to the win phase,
414
+ * its attached contact can be attached to another card in an active phase.
415
+ * @param _id - ID of the card to move.
416
+ * @public
417
+ * @documentationMaturity preview
418
+ * @requiredField _id
419
+ */
420
+ export declare function moveCard(_id: string, options?: MoveCardOptions): Promise<void>;
421
+ export interface MoveCardOptions {
422
+ /** ID of the phase to move the card to. */
423
+ newPhaseId?: string | null;
424
+ /** Position of the card in the phase, where the first card is `0`. */
425
+ newPosition?: number | null;
426
+ }
427
+ /**
428
+ * Restores an archived card to the specified phase.
429
+ *
430
+ * To restore a card, the new phase ID must be provided.
431
+ * You can use
432
+ * [Get Workflow](https://dev.wix.com/api/rest/workflows/workflows/workflows/get-workflow)
433
+ * to get IDs for all the phases in the workflow,
434
+ * including the win phase.
435
+ * @param _id - ID of the card to restore.
436
+ * @param newPhaseId - ID of the phase to restore the card to.
437
+ * @public
438
+ * @documentationMaturity preview
439
+ * @requiredField _id
440
+ * @requiredField newPhaseId
441
+ */
442
+ export declare function restoreCard(_id: string, newPhaseId: string, options?: RestoreCardOptions): Promise<void>;
443
+ export interface RestoreCardOptions {
444
+ /**
445
+ * Position of the restored card in the phase,
446
+ * where the first card is `0`.
447
+ */
448
+ newPosition?: number | null;
449
+ }