@unboundcx/sdk 4.13.86 → 4.13.87

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/index.js CHANGED
@@ -330,6 +330,7 @@ export { ExternalOAuthService } from './services/externalOAuth.js';
330
330
  export { GoogleCalendarService } from './services/googleCalendar.js';
331
331
  export { FormsService } from './services/forms.js';
332
332
  export { FormsPublicService } from './services/forms/PublicService.js';
333
+ export { FormsHealthService } from './services/forms/HealthService.js';
333
334
  export { DriveService } from './services/drive.js';
334
335
  export { EnrollService } from './services/enroll.js';
335
336
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.86",
3
+ "version": "4.13.87",
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",
@@ -0,0 +1,35 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ // Forms v2 P8 (plans/forms-v2-plan.md D13, forms-v2-precheck.md §9) --
4
+ // agent-authenticated Health tab data (`sdk.forms.health`): submissions
5
+ // tiles, a 30-day submissions-per-day sparkline, per-field fill rate, and
6
+ // drift alerts (a field with 0 non-blank values in the last 7 days after
7
+ // previously being filled >=50% of the time). Backed by the nightly
8
+ // `formFieldStats` rollup -- server route:
9
+ // `app1-api/src/services/forms/controllers/getFormHealth.js`.
10
+ export class FormsHealthService {
11
+ constructor(sdk) {
12
+ this.sdk = sdk;
13
+ }
14
+
15
+ /**
16
+ * @param {string} formId
17
+ * @returns {Promise<{
18
+ * tiles: {submissions:number, submissionsChangePct:number|null,
19
+ * spamCount:number, spamRatePct:number, companyLinkedPct:number,
20
+ * companyCreated:number, actionsFailed:number},
21
+ * sparkline: {day:string, submitted:number}[],
22
+ * fields: {fieldKey:string, label:string, fillRate:number|null,
23
+ * priorFillRate:number|null, isDrifting:boolean}[],
24
+ * driftAlerts: object[],
25
+ * windowDays: number,
26
+ * }>}
27
+ */
28
+ async get(formId) {
29
+ return internalRequest(
30
+ this.sdk,
31
+ `/forms/${encodeURIComponent(formId)}/health`,
32
+ 'GET',
33
+ );
34
+ }
35
+ }
package/services/forms.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import { FormsPublicService } from './forms/PublicService.js';
2
2
  import { FormsSubmissionsService } from './forms/SubmissionsService.js';
3
3
  import { FormsSettingsService } from './forms/SettingsService.js';
4
+ import { FormsHealthService } from './forms/HealthService.js';
4
5
 
5
6
  // Forms v2 (forms-v2-plan.md §7 / forms-v2-precheck.md §5) -- `sdk.forms`.
6
7
  // `public` needs no agent auth (VisitorService pattern, publicKey-scoped);
7
- // `submissions`/`settings` are normal agent-token calls.
8
+ // `submissions`/`settings`/`health` are normal agent-token calls.
8
9
  export class FormsService {
9
10
  constructor(sdk) {
10
11
  this.sdk = sdk;
11
12
  this.public = new FormsPublicService(sdk);
12
13
  this.submissions = new FormsSubmissionsService(sdk);
13
14
  this.settings = new FormsSettingsService(sdk);
15
+ this.health = new FormsHealthService(sdk);
14
16
  }
15
17
  }