@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,424 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface Workflow {
8
+ /** Workflow information and metadata. */
9
+ info?: WorkflowInfo;
10
+ /**
11
+ * Final phase of the workflow.
12
+ * Cards in `winPhase` are treated as if they are not part of the workflow.
13
+ *
14
+ * Normally, a contact can be attached to only 1 card in the workflow.
15
+ * Moving a contact's card to `winPhase`
16
+ * frees up the contact to be attached to another card in the workflow.
17
+ */
18
+ winPhase?: Phase;
19
+ /** Phases that make up the workflow. */
20
+ phasesList?: PhasesList;
21
+ }
22
+ export interface WorkflowInfo {
23
+ /**
24
+ * Workflow ID.
25
+ * @readonly
26
+ */
27
+ _id?: string | null;
28
+ /** Display name for the workflow. */
29
+ name?: string | null;
30
+ /**
31
+ * Workflow description,
32
+ * shown below the workflow's display name in the dashboard.
33
+ */
34
+ description?: string | null;
35
+ /**
36
+ * Deprecated. Use `createdDate` instead.
37
+ * @readonly
38
+ */
39
+ createdAt?: Date;
40
+ /**
41
+ * Indicates whether the workflow can be deleted.
42
+ * @readonly
43
+ */
44
+ isDeletable?: boolean | null;
45
+ /**
46
+ * Date and time the workflow was created.
47
+ * @readonly
48
+ */
49
+ _createdDate?: Date;
50
+ }
51
+ export interface Phase {
52
+ /** Phase information. */
53
+ info?: PhaseInfo;
54
+ /** Cards contained in the phase. */
55
+ cardsList?: CardsList;
56
+ }
57
+ export interface PhaseInfo {
58
+ /**
59
+ * Phase ID.
60
+ * @readonly
61
+ */
62
+ _id?: string | null;
63
+ /** Display name shown at the top of the phase. */
64
+ name?: string | null;
65
+ }
66
+ /** a list of cards (a page) along with the total number */
67
+ export interface CardsList {
68
+ /** Total number of cards in the phase. */
69
+ total?: number;
70
+ /**
71
+ * List of cards in the phase.
72
+ * Sorted according to the card display order, from top to bottom.
73
+ */
74
+ cards?: Card[];
75
+ }
76
+ export interface Card {
77
+ /** Card details. */
78
+ info?: CardInfo;
79
+ }
80
+ /** entity representing a card-info */
81
+ export interface CardInfo {
82
+ /**
83
+ * Card ID.
84
+ * @readonly
85
+ */
86
+ _id?: string | null;
87
+ /** Display name shown at the top of the card. */
88
+ name?: string | null;
89
+ /** Card description. */
90
+ description?: string | null;
91
+ /** Details about the contact attached to the card. */
92
+ primaryAttachment?: Attachment;
93
+ /** Due date. */
94
+ dueDate?: Date;
95
+ /** Name of the app or service that created the contact. */
96
+ source?: string | null;
97
+ /**
98
+ * Deprecated. Use `createdDate` instead.
99
+ * @readonly
100
+ */
101
+ createdAt?: Date;
102
+ /**
103
+ * Deprecated. Use `updatedDate` instead.
104
+ * @readonly
105
+ */
106
+ updatedAt?: Date;
107
+ /**
108
+ * ID of the phase that currently holds the card.
109
+ * @readonly
110
+ */
111
+ phaseId?: string | null;
112
+ /**
113
+ * Date and time the card was created.
114
+ * @readonly
115
+ */
116
+ _createdDate?: Date;
117
+ /**
118
+ * Date and time the card was updated.
119
+ * @readonly
120
+ */
121
+ _updatedDate?: Date;
122
+ }
123
+ export interface Attachment {
124
+ /**
125
+ * Attachment ID. For internal use.
126
+ * @readonly
127
+ */
128
+ attachmentId?: string;
129
+ /** Deprecated. Use `contactId` instead. */
130
+ value?: string;
131
+ /** Deprecated. For internal use. */
132
+ attachmentType?: AttachmentType;
133
+ /** ID of the contact attached to the card. */
134
+ contactId?: string;
135
+ }
136
+ /** describes the supported types of attachments (currently only supports Contact which is the default type) */
137
+ export declare enum AttachmentType {
138
+ ContactType = "ContactType"
139
+ }
140
+ /** a list of phases (a page) along with the total number */
141
+ export interface PhasesList {
142
+ /** Total number of phases in the workflow, excluding `winPhase`. */
143
+ total?: number;
144
+ /**
145
+ * List of phases in the workflow.
146
+ * Sorted according to the phase display order, from left to right.
147
+ */
148
+ phases?: Phase[];
149
+ }
150
+ export interface ListWorkflowsRequest {
151
+ /**
152
+ * Number of workflows to return.
153
+ * If omitted, all results are returned.
154
+ */
155
+ limit?: number | null;
156
+ /**
157
+ * Number of items to skip in the current sort order.
158
+ *
159
+ * Defaults to `0`.
160
+ */
161
+ offset?: number | null;
162
+ /**
163
+ * Supported fields:
164
+ * `id`, `name`, `description`, `createdDate`
165
+ *
166
+ * List of fields to sort by.
167
+ * Formatted as `field:direction`,
168
+ * where field is the field name
169
+ * and direction is `asc` (ascending) or `desc` (descending).
170
+ *
171
+ * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`.
172
+ */
173
+ sort?: string[];
174
+ }
175
+ export interface ListWorkflowsResponse {
176
+ /** Retrieved list of workflows. */
177
+ workflows?: WorkflowInfo[];
178
+ /** Metadata for the page of results. */
179
+ pagination?: PaginationResponse;
180
+ }
181
+ export interface PaginationResponse {
182
+ /** Number of items that were skipped in the current sort order. */
183
+ offset?: number;
184
+ /** Total number of items that matched the filter. */
185
+ total?: number;
186
+ /** Number of returned items. */
187
+ count?: number;
188
+ }
189
+ export interface QueryWorkflowsRequest {
190
+ /** Query options. */
191
+ query?: Query;
192
+ }
193
+ export interface Query {
194
+ /**
195
+ * Filter object in the following format:
196
+ * `"filter" : {
197
+ * "fieldName1": "value1",
198
+ * "fieldName2":{"$operator":"value2"}
199
+ * }`
200
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
201
+ */
202
+ filter?: any;
203
+ /**
204
+ * Sort object in the following format:
205
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
206
+ */
207
+ sort?: Sorting[];
208
+ /** Paging options to limit and skip the number of items. */
209
+ paging?: Paging;
210
+ /** 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. */
211
+ fields?: string[];
212
+ /** 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. */
213
+ fieldsets?: string[];
214
+ }
215
+ export interface Sorting {
216
+ /** Name of the field to sort by. */
217
+ fieldName?: string;
218
+ /** Sort order. */
219
+ order?: SortOrder;
220
+ }
221
+ export declare enum SortOrder {
222
+ ASC = "ASC",
223
+ DESC = "DESC"
224
+ }
225
+ export interface Paging {
226
+ /** Number of items to load. */
227
+ limit?: number | null;
228
+ /** Number of items to skip in the current sort order. */
229
+ offset?: number | null;
230
+ }
231
+ export interface QueryWorkflowsResponse {
232
+ /** List of workflows that matched the query. */
233
+ workflows?: Workflow[];
234
+ /** Metadata for the paginated results. */
235
+ pagination?: PaginationResponse;
236
+ }
237
+ export interface GetWorkflowRequest {
238
+ /** ID of the workflow to retrieve. */
239
+ _id: string;
240
+ /**
241
+ * Maximum number of cards to return per phase.
242
+ * To retrieve additional pages of cards, use
243
+ * [List Cards](https://dev.wix.com/api/rest/workflows/workflows/cards/list-cards)
244
+ * (in the Cards API).
245
+ *
246
+ * Defaults to `10`.
247
+ */
248
+ cardsPerPhase?: number | null;
249
+ }
250
+ export interface GetWorkflowResponse {
251
+ /** Requested workflow. */
252
+ workflow?: Workflow;
253
+ }
254
+ export interface UpdateWorkflowRequest {
255
+ /** ID of the workflow to update. */
256
+ _id: string;
257
+ /** Workflow info. */
258
+ workflow?: WorkflowInfo;
259
+ }
260
+ export interface UpdateWorkflowResponse {
261
+ }
262
+ export interface CreateWorkflowRequest {
263
+ /** Workflow details. */
264
+ workflow?: WorkflowInfo;
265
+ }
266
+ export interface CreateWorkflowResponse {
267
+ /** ID of the new workflow. */
268
+ _id?: string | null;
269
+ }
270
+ export interface DeleteWorkflowRequest {
271
+ /** ID of the workflow to delete. */
272
+ _id: string;
273
+ }
274
+ export interface DeleteWorkflowResponse {
275
+ }
276
+ export interface SetupWorkflowRequest {
277
+ }
278
+ export interface SetupWorkflowResponse {
279
+ }
280
+ /**
281
+ * Retrieves a list of the site's workflows.
282
+ *
283
+ * By default,
284
+ * the returned workflows are sorted by `name` in ascending order.
285
+ * Sorting is applied lexicographically,
286
+ * so `"abc"` comes after `"XYZ"`.
287
+ * @public
288
+ * @documentationMaturity preview
289
+ */
290
+ export declare function listWorkflows(options?: ListWorkflowsOptions): Promise<ListWorkflowsResponse>;
291
+ export interface ListWorkflowsOptions {
292
+ /**
293
+ * Number of workflows to return.
294
+ * If omitted, all results are returned.
295
+ */
296
+ limit?: number | null;
297
+ /**
298
+ * Number of items to skip in the current sort order.
299
+ *
300
+ * Defaults to `0`.
301
+ */
302
+ offset?: number | null;
303
+ /**
304
+ * Supported fields:
305
+ * `id`, `name`, `description`, `createdDate`
306
+ *
307
+ * List of fields to sort by.
308
+ * Formatted as `field:direction`,
309
+ * where field is the field name
310
+ * and direction is `asc` (ascending) or `desc` (descending).
311
+ *
312
+ * Sorting is applied lexicographically, so `"abc"` comes after `"XYZ"`.
313
+ */
314
+ sort?: string[];
315
+ }
316
+ /**
317
+ * Returns a list of workflows according to:
318
+ * * paging: offset, limit
319
+ * * order: by some of the following fields: id, name, createdAt
320
+ * * filter: by the following fields of WorkflowInfo
321
+ * ** workflowInfo.id - Guid
322
+ * ** workflowInfo.name - Text
323
+ * ** workflowInfo.createdAt - Date
324
+ * ** workflowInfo.visibility - Text (Visible / Archived)
325
+ * ** workflowInfo.winPhaseId - Guid
326
+ * @public
327
+ * @documentationMaturity preview
328
+ */
329
+ export declare function queryWorkflows(options?: QueryWorkflowsOptions): Promise<QueryWorkflowsResponse>;
330
+ export interface QueryWorkflowsOptions {
331
+ /** Query options. */
332
+ query?: Query;
333
+ }
334
+ /**
335
+ * Retrieves a workflow by ID.
336
+ *
337
+ * Use this endpoint to list all phases and the first cards for each phase.
338
+ *
339
+ * The returned workflow object contains all the active phases and the win phase.
340
+ * The active phases are available in the `phasesList.phases` array,
341
+ * and the win phase is available at `winPhase`.
342
+ * Each phase's ID is in the phase object at `info.id`.
343
+ * The phase ID is needed when
344
+ * [moving](https://dev.wix.com/api/rest/workflows/workflows/cards/move-card)
345
+ * or [restoring](https://dev.wix.com/api/rest/workflows/workflows/cards/restore-card)
346
+ * a card.
347
+ *
348
+ * By default, the workflow is returned with up to 10 cards per phase.
349
+ * You can change the number of cards returned
350
+ * with the `cardsInitialPageSize` parameter.
351
+ * @param _id - ID of the workflow to retrieve.
352
+ * @public
353
+ * @documentationMaturity preview
354
+ * @requiredField _id
355
+ */
356
+ export declare function getWorkflow(_id: string, options?: GetWorkflowOptions): Promise<GetWorkflowResponse>;
357
+ export interface GetWorkflowOptions {
358
+ /**
359
+ * Maximum number of cards to return per phase.
360
+ * To retrieve additional pages of cards, use
361
+ * [List Cards](https://dev.wix.com/api/rest/workflows/workflows/cards/list-cards)
362
+ * (in the Cards API).
363
+ *
364
+ * Defaults to `10`.
365
+ */
366
+ cardsPerPhase?: number | null;
367
+ }
368
+ /**
369
+ * Updates a workflow's name or description.
370
+ *
371
+ * To rename or reorder phases or cards, use the
372
+ * [Phases API](https://dev.wix.com/api/rest/workflows/workflows/phases)
373
+ * or the
374
+ * [Cards API](https://dev.wix.com/api/rest/workflows/workflows/cards),
375
+ * respectively.
376
+ * @param _id - ID of the workflow to update.
377
+ * @public
378
+ * @documentationMaturity preview
379
+ * @requiredField _id
380
+ */
381
+ export declare function updateWorkflow(_id: string, options?: UpdateWorkflowOptions): Promise<void>;
382
+ export interface UpdateWorkflowOptions {
383
+ /** Workflow info. */
384
+ workflow?: WorkflowInfo;
385
+ }
386
+ /**
387
+ * Creates a new workflow.
388
+ *
389
+ * When creating a workflow, you provide a `name` and optional `description`,
390
+ * and the new workflow's `id` is returned.
391
+ * By default, the new workflow contains a `winPhase` named "Win".
392
+ * No other phases or cards are created.
393
+ *
394
+ * To continue building the workflow,
395
+ * use the returned workflow `id` to
396
+ * [create phases](https://dev.wix.com/api/rest/workflows/workflows/phases/create-phase)
397
+ * and [add cards](https://dev.wix.com/api/rest/drafts/workflows/cards/create-card)
398
+ * to the new phases.
399
+ *
400
+ * A site can have up to 30 workflows.
401
+ * When this limit is reached, calls to this endpoint result in a 403 error.
402
+ * @public
403
+ * @documentationMaturity preview
404
+ * @requiredField options.workflow.name
405
+ */
406
+ export declare function createWorkflow(options?: CreateWorkflowOptions): Promise<CreateWorkflowResponse>;
407
+ export interface CreateWorkflowOptions {
408
+ /** Workflow details. */
409
+ workflow?: WorkflowInfo;
410
+ }
411
+ /**
412
+ * Deletes a workflow and its phases and cards.
413
+ * @param _id - ID of the workflow to delete.
414
+ * @public
415
+ * @documentationMaturity preview
416
+ * @requiredField _id
417
+ */
418
+ export declare function deleteWorkflow(_id: string): Promise<void>;
419
+ /**
420
+ * Sets up the default workflow.
421
+ * @public
422
+ * @documentationMaturity preview
423
+ */
424
+ export declare function setupWorkflow(): Promise<void>;