@unboundcx/sdk 4.13.107 → 4.13.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.107",
3
+ "version": "4.13.109",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1416,4 +1416,44 @@ export class ObjectsService {
1416
1416
  { body: {} },
1417
1417
  );
1418
1418
  }
1419
+
1420
+ /**
1421
+ * P7 (workflows-v2-plan.md W10/W11/W23) -- runs an immediate full
1422
+ * enter+exit sweep for a journey program. Same diff-and-enqueue path a
1423
+ * scheduled tick runs, so this can never 429.
1424
+ * @param {string} programId
1425
+ * @returns {Promise<{queued: true, enterEnqueued: number, exitEnqueued: number}>}
1426
+ */
1427
+ async runMarketingProgramNow(programId) {
1428
+ this.sdk.validateParams(
1429
+ { programId },
1430
+ { programId: { type: 'string', required: true } },
1431
+ );
1432
+ return internalRequest(
1433
+ this.sdk,
1434
+ `/object/marketing-programs/${programId}/run`,
1435
+ 'POST',
1436
+ { body: {} },
1437
+ );
1438
+ }
1439
+
1440
+ /**
1441
+ * P7 -- paginated member list for a journey program (joined to people
1442
+ * for display name; never raw peopleId).
1443
+ * @param {string} programId
1444
+ * @param {{nextId?: string, limit?: number}} [opts]
1445
+ * @returns {Promise<{results: object[], pagination: object}>}
1446
+ */
1447
+ async listMarketingProgramMembers(programId, opts = {}) {
1448
+ this.sdk.validateParams(
1449
+ { programId },
1450
+ { programId: { type: 'string', required: true } },
1451
+ );
1452
+ return internalRequest(
1453
+ this.sdk,
1454
+ `/object/marketing-programs/${programId}/members`,
1455
+ 'GET',
1456
+ { query: opts },
1457
+ );
1458
+ }
1419
1459
  }
@@ -437,17 +437,25 @@ export class WorkflowSessionsService {
437
437
  return result;
438
438
  }
439
439
 
440
- async complete(sessionId) {
440
+ /**
441
+ * @param {string} sessionId
442
+ * @param {string} [reason] - passed through as body.reason -- the
443
+ * sessionComplete.js controller already accepts this (defaults to
444
+ * 'completed' server-side); P7's exitProgramMember.js passes
445
+ * 'programExit'. Backward compatible -- omitting it is unchanged.
446
+ */
447
+ async complete(sessionId, reason) {
441
448
  this.sdk.validateParams(
442
- { sessionId },
449
+ { sessionId, reason },
443
450
  {
444
451
  sessionId: { type: 'string', required: true },
452
+ reason: { type: 'string', required: false },
445
453
  },
446
454
  );
447
455
 
448
- const params = {};
456
+ const params = reason ? { body: { reason } } : {};
449
457
 
450
- const result = await internalRequest(this.sdk,
458
+ const result = await internalRequest(this.sdk,
451
459
  `/workflows/session/${sessionId}/complete`,
452
460
  'PUT',
453
461
  params,
@@ -511,4 +519,34 @@ export class WorkflowSessionsService {
511
519
  );
512
520
  return result;
513
521
  }
522
+
523
+ // P10 click-to-filter: GET /workflows/:workflowVersionId/sessions ->
524
+ // {sessionIds}. filter is {workflowItemId?, fromItemId?, toItemId?,
525
+ // startDate?, endDate?} -- workflowItemId alone, or fromItemId+toItemId
526
+ // together, is required (validated server-side in sessionsByPath.js).
527
+ async sessionsByPath(workflowVersionId, filter = {}) {
528
+ this.sdk.validateParams(
529
+ { workflowVersionId },
530
+ {
531
+ workflowVersionId: { type: 'string', required: true },
532
+ },
533
+ );
534
+
535
+ const { workflowItemId, fromItemId, toItemId, startDate, endDate } =
536
+ filter || {};
537
+ const query = {};
538
+ if (workflowItemId) query.workflowItemId = workflowItemId;
539
+ if (fromItemId) query.fromItemId = fromItemId;
540
+ if (toItemId) query.toItemId = toItemId;
541
+ if (startDate) query.startDate = startDate;
542
+ if (endDate) query.endDate = endDate;
543
+
544
+ const result = await internalRequest(
545
+ this.sdk,
546
+ `/workflows/${workflowVersionId}/sessions`,
547
+ 'GET',
548
+ { query },
549
+ );
550
+ return result;
551
+ }
514
552
  }