@unboundcx/sdk 4.4.0 → 4.6.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.
@@ -30,6 +30,8 @@ export class ObjectsService {
30
30
  * re-subscribe, revoked teardown).
31
31
  *
32
32
  * sdk.objects.liveQuery({ socket, object, filter, fields, recordTypeId, onEvent, onStateChange })
33
+ * sdk.objects.liveQuery({ socket, uoql, onEvent, onStateChange }) // uoql is mutually
34
+ * exclusive with object/filter/fields/recordTypeId
33
35
  * -> Promise<{ subscriptionId, mode, unsubscribe() }>
34
36
  */
35
37
  liveQuery(args) {
@@ -209,25 +211,27 @@ export class ObjectsService {
209
211
  * Update an object record by ID
210
212
  *
211
213
  * Preferred usage (new signature):
212
- * sdk.objects.updateById({ object: 'users', id: 'userId', update: { name: 'Jane' } })
214
+ * sdk.objects.updateById({ object: 'users', id: 'userId', update: { name: 'Jane' }, skipTriggers: true })
213
215
  *
214
216
  * Legacy usage (deprecated, but supported):
215
217
  * sdk.objects.updateById('users', 'userId', { name: 'Jane' })
216
218
  *
217
219
  * @param {object} args - Update parameters
220
+ * @param {boolean} [args.skipTriggers=false] - Skip trigger execution for this write
218
221
  * @returns {Promise} Updated object data
219
222
  */
220
223
  async updateById(...args) {
221
- // New signature: updateById({ object, id, update })
224
+ // New signature: updateById({ object, id, update, skipTriggers })
222
225
  if (args.length === 1 && typeof args[0] === 'object' && args[0].object) {
223
- const { object, id, update } = args[0];
226
+ const { object, id, update, skipTriggers = false } = args[0];
224
227
 
225
228
  this.sdk.validateParams(
226
- { object, id, update },
229
+ { object, id, update, skipTriggers },
227
230
  {
228
231
  object: { type: 'string', required: true },
229
232
  id: { type: 'string', required: true },
230
233
  update: { type: 'object', required: true },
234
+ skipTriggers: { type: 'boolean', required: false },
231
235
  },
232
236
  );
233
237
 
@@ -237,6 +241,7 @@ export class ObjectsService {
237
241
  update,
238
242
  },
239
243
  };
244
+ if (skipTriggers) params.query = { skipTriggers: true };
240
245
 
241
246
  return await this.sdk._fetch(`/object/${object}`, 'PUT', params);
242
247
  }
@@ -267,13 +272,32 @@ export class ObjectsService {
267
272
  throw new Error('Invalid arguments for updateById method');
268
273
  }
269
274
 
270
- async update({ object, where, update }) {
275
+ /**
276
+ * Update records matching a where clause.
277
+ *
278
+ * @param {object} args
279
+ * @param {string} args.object
280
+ * @param {object} args.where
281
+ * @param {object} args.update
282
+ * @param {boolean} [args.skipTriggers=false] - Do not run triggers for this write
283
+ * @returns {Promise} Update result
284
+ *
285
+ * @example
286
+ * await sdk.objects.update({
287
+ * object: 'people',
288
+ * where: { id: '013…' },
289
+ * update: { leadScore: 200 },
290
+ * skipTriggers: true,
291
+ * });
292
+ */
293
+ async update({ object, where, update, skipTriggers = false }) {
271
294
  this.sdk.validateParams(
272
- { object, where, update },
295
+ { object, where, update, skipTriggers },
273
296
  {
274
297
  object: { type: 'string', required: true },
275
298
  where: { type: 'object', required: true },
276
299
  update: { type: 'object', required: true },
300
+ skipTriggers: { type: 'boolean', required: false },
277
301
  },
278
302
  );
279
303
 
@@ -283,6 +307,7 @@ export class ObjectsService {
283
307
  update,
284
308
  },
285
309
  };
310
+ if (skipTriggers) params.query = { skipTriggers: true };
286
311
 
287
312
  const result = await this.sdk._fetch(`/object/${object}`, 'PUT', params);
288
313
  return result;
@@ -292,28 +317,31 @@ export class ObjectsService {
292
317
  * Create a new object record
293
318
  *
294
319
  * Preferred usage (new signature):
295
- * sdk.objects.create({ object: 'users', body: { name: 'John', email: 'john@example.com' } })
320
+ * sdk.objects.create({ object: 'users', body: { name: 'John', email: 'john@example.com' }, skipTriggers: true })
296
321
  *
297
322
  * Legacy usage (deprecated, but supported):
298
323
  * sdk.objects.create('users', { name: 'John', email: 'john@example.com' })
299
324
  *
300
325
  * @param {object} args - Creation parameters
326
+ * @param {boolean} [args.skipTriggers=false] - Skip trigger execution for this write
301
327
  * @returns {Promise} Created object data
302
328
  */
303
329
  async create(...args) {
304
- // New signature: create({ object, body })
330
+ // New signature: create({ object, body, skipTriggers })
305
331
  if (args.length === 1 && typeof args[0] === 'object' && args[0].object) {
306
- const { object, body } = args[0];
332
+ const { object, body, skipTriggers = false } = args[0];
307
333
 
308
334
  this.sdk.validateParams(
309
- { object, body },
335
+ { object, body, skipTriggers },
310
336
  {
311
337
  object: { type: 'string', required: true },
312
338
  body: { type: 'object', required: true },
339
+ skipTriggers: { type: 'boolean', required: false },
313
340
  },
314
341
  );
315
342
 
316
343
  const params = { body };
344
+ if (skipTriggers) params.query = { skipTriggers: true };
317
345
  return await this.sdk._fetch(`/object/${object}`, 'POST', params);
318
346
  }
319
347
 
@@ -336,12 +364,29 @@ export class ObjectsService {
336
364
  throw new Error('Invalid arguments for create method');
337
365
  }
338
366
 
339
- async delete({ object, where }) {
367
+ /**
368
+ * Delete records matching a where clause.
369
+ *
370
+ * @param {object} args
371
+ * @param {string} args.object
372
+ * @param {object} args.where
373
+ * @param {boolean} [args.skipTriggers=false] - Do not run triggers for this write
374
+ * @returns {Promise} Delete result
375
+ *
376
+ * @example
377
+ * await sdk.objects.delete({
378
+ * object: 'people',
379
+ * where: { id: '013…' },
380
+ * skipTriggers: true,
381
+ * });
382
+ */
383
+ async delete({ object, where, skipTriggers = false }) {
340
384
  this.sdk.validateParams(
341
- { object, where },
385
+ { object, where, skipTriggers },
342
386
  {
343
387
  object: { type: 'string', required: true },
344
388
  where: { type: 'object', required: true },
389
+ skipTriggers: { type: 'boolean', required: false },
345
390
  },
346
391
  );
347
392
 
@@ -350,17 +395,31 @@ export class ObjectsService {
350
395
  where,
351
396
  },
352
397
  };
398
+ if (skipTriggers) params.query = { skipTriggers: true };
353
399
 
354
400
  const result = await this.sdk._fetch(`/object/${object}`, 'DELETE', params);
355
401
  return result;
356
402
  }
357
403
 
358
- async deleteById({ object, id }) {
404
+ /**
405
+ * Delete a record by id.
406
+ *
407
+ * @param {object} args
408
+ * @param {string} args.object
409
+ * @param {string} args.id
410
+ * @param {boolean} [args.skipTriggers=false] - Do not run triggers for this write
411
+ * @returns {Promise} Delete result
412
+ *
413
+ * @example
414
+ * await sdk.objects.deleteById({ object: 'people', id: '013…', skipTriggers: true });
415
+ */
416
+ async deleteById({ object, id, skipTriggers = false }) {
359
417
  this.sdk.validateParams(
360
- { object, id },
418
+ { object, id, skipTriggers },
361
419
  {
362
420
  object: { type: 'string', required: true },
363
421
  id: { type: 'string', required: true },
422
+ skipTriggers: { type: 'boolean', required: false },
364
423
  },
365
424
  );
366
425
 
@@ -371,6 +430,7 @@ export class ObjectsService {
371
430
  },
372
431
  },
373
432
  };
433
+ if (skipTriggers) params.query = { skipTriggers: true };
374
434
 
375
435
  const result = await this.sdk._fetch(`/object/${object}`, 'DELETE', params);
376
436
  return result;
@@ -940,4 +1000,83 @@ export class ObjectsService {
940
1000
  );
941
1001
  return result;
942
1002
  }
1003
+
1004
+ /**
1005
+ * List Google Ads customer IDs for an OAuth connection.
1006
+ *
1007
+ * @param {object} args
1008
+ * @param {string} args.connectionId
1009
+ * @returns {Promise<{results: object[], warning?: string|null}>}
1010
+ */
1011
+ async listGoogleAdAccounts({ connectionId }) {
1012
+ this.sdk.validateParams(
1013
+ { connectionId },
1014
+ { connectionId: { type: 'string', required: true } },
1015
+ );
1016
+ return this.sdk._fetch('/object/ad-catalog/google/accounts', 'GET', {
1017
+ query: { connectionId },
1018
+ });
1019
+ }
1020
+
1021
+ /**
1022
+ * List Google Ads campaigns for a customer.
1023
+ *
1024
+ * @param {object} args
1025
+ * @param {string} args.connectionId
1026
+ * @param {string} args.customerId
1027
+ * @param {string} [args.loginCustomerId]
1028
+ * @returns {Promise<{results: object[]}>}
1029
+ */
1030
+ async listGoogleAdCampaigns({ connectionId, customerId, loginCustomerId }) {
1031
+ this.sdk.validateParams(
1032
+ { connectionId, customerId },
1033
+ {
1034
+ connectionId: { type: 'string', required: true },
1035
+ customerId: { type: 'string', required: true },
1036
+ },
1037
+ );
1038
+ const query = { connectionId, customerId };
1039
+ if (loginCustomerId) query.loginCustomerId = loginCustomerId;
1040
+ return this.sdk._fetch('/object/ad-catalog/google/campaigns', 'GET', {
1041
+ query,
1042
+ });
1043
+ }
1044
+
1045
+ /**
1046
+ * List Meta ad accounts for an OAuth connection.
1047
+ *
1048
+ * @param {object} args
1049
+ * @param {string} args.connectionId
1050
+ * @returns {Promise<{results: object[]}>}
1051
+ */
1052
+ async listMetaAdAccounts({ connectionId }) {
1053
+ this.sdk.validateParams(
1054
+ { connectionId },
1055
+ { connectionId: { type: 'string', required: true } },
1056
+ );
1057
+ return this.sdk._fetch('/object/ad-catalog/meta/accounts', 'GET', {
1058
+ query: { connectionId },
1059
+ });
1060
+ }
1061
+
1062
+ /**
1063
+ * List Meta campaigns for an ad account.
1064
+ *
1065
+ * @param {object} args
1066
+ * @param {string} args.connectionId
1067
+ * @param {string} args.adAccountId
1068
+ * @returns {Promise<{results: object[]}>}
1069
+ */
1070
+ async listMetaAdCampaigns({ connectionId, adAccountId }) {
1071
+ this.sdk.validateParams(
1072
+ { connectionId, adAccountId },
1073
+ {
1074
+ connectionId: { type: 'string', required: true },
1075
+ adAccountId: { type: 'string', required: true },
1076
+ },
1077
+ );
1078
+ return this.sdk._fetch('/object/ad-catalog/meta/campaigns', 'GET', {
1079
+ query: { connectionId, adAccountId },
1080
+ });
1081
+ }
943
1082
  }
@@ -374,4 +374,115 @@ export class PermissionsService {
374
374
  const result = await this.sdk._fetch('/permissions/scope-catalog', 'GET');
375
375
  return result;
376
376
  }
377
+
378
+ /**
379
+ * Catalog of group-settable configuration keys, plus the never-settable list.
380
+ * @returns {Promise<Object>} { groupSettable: [{key,label,type,pillar,...}], neverSettable: [] }
381
+ */
382
+ async getSettingsCatalog() {
383
+ return this.sdk._fetch('/permissions/settings/catalog', 'GET');
384
+ }
385
+
386
+ /**
387
+ * Configuration values set at group level.
388
+ * @param {string|number} groupId - Group ID (required)
389
+ * @returns {Promise<Object>} { results: [{settingKey, value, updatedAt}] }
390
+ */
391
+ async listGroupSettings(groupId) {
392
+ groupId = String(groupId);
393
+ this.sdk.validateParams({ groupId }, { groupId: { type: 'string', required: true } });
394
+ return this.sdk._fetch(`/permissions/groups/${groupId}/settings`, 'GET');
395
+ }
396
+
397
+ /** Set one configuration value on a group. */
398
+ async setGroupSetting(groupId, settingKey, value) {
399
+ groupId = String(groupId);
400
+ settingKey = String(settingKey);
401
+ this.sdk.validateParams(
402
+ { groupId, settingKey },
403
+ {
404
+ groupId: { type: 'string', required: true },
405
+ settingKey: { type: 'string', required: true },
406
+ },
407
+ );
408
+ return this.sdk._fetch(
409
+ `/permissions/groups/${groupId}/settings/${settingKey}`,
410
+ 'PUT',
411
+ { value },
412
+ );
413
+ }
414
+
415
+ /** Unset one configuration value on a group (members revert to the next tier). */
416
+ async deleteGroupSetting(groupId, settingKey) {
417
+ groupId = String(groupId);
418
+ settingKey = String(settingKey);
419
+ this.sdk.validateParams(
420
+ { groupId, settingKey },
421
+ {
422
+ groupId: { type: 'string', required: true },
423
+ settingKey: { type: 'string', required: true },
424
+ },
425
+ );
426
+ return this.sdk._fetch(
427
+ `/permissions/groups/${groupId}/settings/${settingKey}`,
428
+ 'DELETE',
429
+ );
430
+ }
431
+
432
+ /**
433
+ * Rank groups for same-key conflict resolution; first entry wins.
434
+ * @param {Array<string|number>} order - Group IDs, highest priority first
435
+ */
436
+ async setGroupPriority(order) {
437
+ this.sdk.validateParams({ order }, { order: { type: 'array', required: true } });
438
+ return this.sdk._fetch('/permissions/groups/priority', 'PUT', {
439
+ order: order.map(String),
440
+ });
441
+ }
442
+
443
+ /**
444
+ * Resolved configuration for a user: value, where it came from, and any
445
+ * losing group values for the same key.
446
+ * @returns {Promise<Object>} { [key]: { value, source: {tier, groupId, groupName}, conflicts: [] } }
447
+ */
448
+ async getUserSettings(userId) {
449
+ userId = String(userId);
450
+ this.sdk.validateParams({ userId }, { userId: { type: 'string', required: true } });
451
+ return this.sdk._fetch(`/permissions/users/${userId}/settings`, 'GET');
452
+ }
453
+
454
+ /** Override one configuration value for a single user. */
455
+ async setUserSetting(userId, settingKey, value) {
456
+ userId = String(userId);
457
+ settingKey = String(settingKey);
458
+ this.sdk.validateParams(
459
+ { userId, settingKey },
460
+ {
461
+ userId: { type: 'string', required: true },
462
+ settingKey: { type: 'string', required: true },
463
+ },
464
+ );
465
+ return this.sdk._fetch(
466
+ `/permissions/users/${userId}/settings/${settingKey}`,
467
+ 'PUT',
468
+ { value },
469
+ );
470
+ }
471
+
472
+ /** Clear a user's override, reverting to the inherited value. */
473
+ async deleteUserSetting(userId, settingKey) {
474
+ userId = String(userId);
475
+ settingKey = String(settingKey);
476
+ this.sdk.validateParams(
477
+ { userId, settingKey },
478
+ {
479
+ userId: { type: 'string', required: true },
480
+ settingKey: { type: 'string', required: true },
481
+ },
482
+ );
483
+ return this.sdk._fetch(
484
+ `/permissions/users/${userId}/settings/${settingKey}`,
485
+ 'DELETE',
486
+ );
487
+ }
377
488
  }
@@ -463,7 +463,7 @@ Response:
463
463
  * @param {string} [config.convertTo] - Convert uploaded file to this format before storing. Supported: 'pdf', 'tiff'. Input must be PDF, DOC, or DOCX.
464
464
  * @param {Object} [config.convertOptions] - Options for file conversion (used with convertTo)
465
465
  * @param {('fine'|'normal')} [config.convertOptions.resolution='fine'] - Fax resolution: 'fine' (204x196) or 'normal' (204x98)
466
- * @param {('letter'|'a4')} [config.convertOptions.paperSize='letter'] - Paper size for conversion
466
+ * @param {('letter'|'legal'|'a4')} [config.convertOptions.paperSize='letter'] - Paper size for conversion
467
467
  * @param {('g4'|'g3')} [config.convertOptions.compression='g4'] - TIFF compression: 'g4' (default) or 'g3' for older fax machines
468
468
  * @param {Function} [config.onProgress] - Progress callback for browser uploads
469
469
  * @param {Object} [config._options] - Internal options
@@ -1005,7 +1005,7 @@ Response:
1005
1005
  * @param {string} config.convertTo - Target format: 'pdf' or 'tiff' (required)
1006
1006
  * @param {Object} [config.convertOptions] - Options controlling the conversion output
1007
1007
  * @param {('fine'|'normal')} [config.convertOptions.resolution='fine'] - Fax resolution: 'fine' (204x196 DPI) or 'normal' (204x98 DPI)
1008
- * @param {('letter'|'a4')} [config.convertOptions.paperSize='letter'] - Paper size for conversion
1008
+ * @param {('letter'|'legal'|'a4')} [config.convertOptions.paperSize='letter'] - Paper size for conversion
1009
1009
  * @param {('g4'|'g3')} [config.convertOptions.compression='g4'] - TIFF compression: 'g4' (modern, default) or 'g3' (legacy fax machines)
1010
1010
  * @param {string} [config.classification] - Storage classification for the new file. Defaults to source file's classification.
1011
1011
  * @param {string} [config.folder] - Folder path for the new file. Defaults to source file's folder.
@@ -41,6 +41,7 @@ async function testPublicSDKCompleteness() {
41
41
  'phoneNumbers',
42
42
  'recordTypes',
43
43
  'generateId',
44
+ 'documents',
44
45
  ];
45
46
 
46
47
  console.log(`📊 Checking ${publicServices.length} public services...`);