@unboundcx/sdk 4.13.94 → 4.13.96

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.
@@ -1,66 +0,0 @@
1
- import { internalRequest } from "../../base.js";
2
-
3
- // Agent-authenticated `formsAccountSettings` singleton -- `sdk.forms.settings`
4
- // (defaultRegion, turnstileSiteKey, turnstileSecretRef; plan §6.5's
5
- // account-settings page, `/app/setup/forms/account-settings`).
6
- //
7
- // Methods call:
8
- // - get() → GET /forms/settings (services/forms/routes.js)
9
- // - set() → PUT /forms/settings (services/forms/routes.js)
10
- // - setForm() → PUT /forms/:id/settings (services/forms/routes.js)
11
- export class FormsSettingsService {
12
- constructor(sdk) {
13
- this.sdk = sdk;
14
- }
15
-
16
- /**
17
- * @returns {Promise<{defaultRegion?:string, turnstileSiteKey?:string, turnstileSecretRef?:string}>}
18
- * `turnstileSecretRef` is a reference/handle only -- the raw secret
19
- * never round-trips to the client.
20
- */
21
- async get() {
22
- return internalRequest(this.sdk, "/forms/settings", "GET");
23
- }
24
-
25
- /**
26
- * Merge-patch the singleton row.
27
- * @param {Object} patch
28
- * @param {string} [patch.defaultRegion]
29
- * @param {string} [patch.turnstileSiteKey]
30
- * @param {string} [patch.turnstileSecret] - Plaintext; server stores only
31
- * `turnstileSecretRef` and never echoes the raw value back.
32
- * @returns {Promise<Object>}
33
- */
34
- async set(patch) {
35
- return internalRequest(this.sdk, "/forms/settings", "PUT", {
36
- body: { ...(patch || {}) },
37
- });
38
- }
39
-
40
- /**
41
- * Review fix -- per-form Turnstile override (Settings tab's "Secret key
42
- * (override)" field). Mirrors `set()`: the raw secret goes under
43
- * `turnstileSecret`, never the stored `turnstileSecretRef` column name.
44
- * Server route: `PUT /forms/:id/settings`
45
- * (app1-api/src/services/forms/controllers/putFormSettings.js).
46
- * @param {string} formId
47
- * @param {Object} patch
48
- * @param {string|null} [patch.captchaProvider]
49
- * @param {string|null} [patch.turnstileSiteKey]
50
- * @param {string} [patch.turnstileSecret] - Plaintext; omit (or send '')
51
- * to leave the currently stored secret untouched.
52
- * @returns {Promise<Object>}
53
- */
54
- async setForm(formId, patch) {
55
- this.sdk.validateParams(
56
- { formId },
57
- { formId: { type: "string", required: true } },
58
- );
59
- return internalRequest(
60
- this.sdk,
61
- `/forms/${encodeURIComponent(formId)}/settings`,
62
- "PUT",
63
- { body: { ...(patch || {}) } },
64
- );
65
- }
66
- }
@@ -1,68 +0,0 @@
1
- import { internalRequest } from "../../base.js";
2
-
3
- // Agent-authenticated formSubmissions actions -- `sdk.forms.submissions`.
4
- // Normal agent-token path (no forceFetch, no authHeaders), same as any
5
- // other authenticated service method (e.g. WebchatWidgetsService.get()).
6
- //
7
- // Methods call:
8
- // - reprocess() → POST /object/formSubmissions/:id/reprocess (api objects/routes.js)
9
- // - markNotSpam() → POST /object/formSubmissions/:id/mark-not-spam (api objects/routes.js)
10
- // - resolveReview() → POST /object/formSubmissions/:id/resolve-review (api objects/routes.js)
11
- export class FormsSubmissionsService {
12
- constructor(sdk) {
13
- this.sdk = sdk;
14
- }
15
-
16
- /**
17
- * Re-run the pipeline for an existing submission from its stored
18
- * rawFields (marks the new submission's `reprocessedFromId`).
19
- * @param {string} id - formSubmissions id.
20
- * @returns {Promise<Object>}
21
- */
22
- async reprocess(id) {
23
- this.sdk.validateParams({ id }, { id: { type: "string", required: true } });
24
- return internalRequest(
25
- this.sdk,
26
- `/object/formSubmissions/${id}/reprocess`,
27
- "POST",
28
- );
29
- }
30
-
31
- /**
32
- * Clear a submission's spam status (Quarantine "Not spam" action, D10).
33
- * @param {string} id - formSubmissions id.
34
- * @returns {Promise<Object>}
35
- */
36
- async markNotSpam(id) {
37
- this.sdk.validateParams({ id }, { id: { type: "string", required: true } });
38
- return internalRequest(
39
- this.sdk,
40
- `/object/formSubmissions/${id}/mark-not-spam`,
41
- "POST",
42
- );
43
- }
44
-
45
- /**
46
- * Resolve a submission flagged `identityConflict`/`review` (D16).
47
- * @param {string} id - formSubmissions id.
48
- * @param {string} choice - Which candidate record to keep/link; shape is
49
- * whatever the Review queue UI (P4) settles on -- documented here as a
50
- * passthrough until that's built.
51
- * @returns {Promise<Object>}
52
- */
53
- async resolveReview(id, choice) {
54
- this.sdk.validateParams(
55
- { id, choice },
56
- {
57
- id: { type: "string", required: true },
58
- choice: { type: "string", required: true },
59
- },
60
- );
61
- return internalRequest(
62
- this.sdk,
63
- `/object/formSubmissions/${id}/resolve-review`,
64
- "POST",
65
- { body: { choice } },
66
- );
67
- }
68
- }
package/services/forms.js DELETED
@@ -1,64 +0,0 @@
1
- import { internalRequest } from '../base.js';
2
- import { FormsPublicService } from './forms/PublicService.js';
3
- import { FormsSubmissionsService } from './forms/SubmissionsService.js';
4
- import { FormsSettingsService } from './forms/SettingsService.js';
5
- import { FormsHealthService } from './forms/HealthService.js';
6
-
7
- // Forms v2 (forms-v2-plan.md §7 / forms-v2-precheck.md §5) -- `sdk.forms`.
8
- // `public` needs no agent auth (VisitorService pattern, publicKey-scoped);
9
- // `submissions`/`settings`/`health` are normal agent-token calls.
10
- export class FormsService {
11
- constructor(sdk) {
12
- this.sdk = sdk;
13
- this.public = new FormsPublicService(sdk);
14
- this.submissions = new FormsSubmissionsService(sdk);
15
- this.settings = new FormsSettingsService(sdk);
16
- this.health = new FormsHealthService(sdk);
17
- }
18
-
19
- /**
20
- * Gap closure (task item 2, D1/D20). Mints a brand new `forms.publicKey`
21
- * and overwrites the old one -- every embed snippet/HTML still carrying
22
- * the old key stops resolving immediately (see the server route's doc
23
- * comment). A destructive action; callers should confirm with the user
24
- * before invoking (FormIdentitySettingsCard.svelte's "Regenerate" flow).
25
- * Server route: `POST /forms/:id/regenerate-key`
26
- * (app1-api/src/services/forms/controllers/regenerateFormPublicKey.js).
27
- * @param {string} formId
28
- * @returns {Promise<{publicKey:string}>}
29
- */
30
- async regeneratePublicKey(formId) {
31
- this.sdk.validateParams(
32
- { formId },
33
- { formId: { type: 'string', required: true } },
34
- );
35
- return internalRequest(
36
- this.sdk,
37
- `/forms/${encodeURIComponent(formId)}/regenerate-key`,
38
- 'POST',
39
- );
40
- }
41
-
42
- /**
43
- * Gap closure (task item 3, D19). Mints a signed, 15-min-TTL token
44
- * scoped to this exact formId so a `draft`/non-`active` form's real
45
- * embed script can be requested via
46
- * `GET /f/:publicKey.js?preview=<token>` without making the form
47
- * publicly live. Server route: `POST /forms/:id/preview-token`
48
- * (app1-api/src/services/forms/controllers/mintFormPreviewToken.js);
49
- * verify side has been live since P2 (formEmbedPublicKey.js).
50
- * @param {string} formId
51
- * @returns {Promise<{token:string, expiresIn:number}>}
52
- */
53
- async previewToken(formId) {
54
- this.sdk.validateParams(
55
- { formId },
56
- { formId: { type: 'string', required: true } },
57
- );
58
- return internalRequest(
59
- this.sdk,
60
- `/forms/${encodeURIComponent(formId)}/preview-token`,
61
- 'POST',
62
- );
63
- }
64
- }