@checkbox-site/node 0.1.0 → 0.2.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.
- package/README.md +3 -1
- package/dist/client.d.ts +104 -2
- package/dist/client.js +3 -2
- package/dist/generated/operations.d.ts +240 -31
- package/dist/generated/operations.js +215 -27
- package/dist/generated/types.d.ts +1353 -156
- package/dist/generated/types.js +8 -3
- package/dist/index.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ sandbox and never need activation.
|
|
|
31
31
|
| Retries | Network errors, 409 `idempotency_key_in_use`, 429 (honours `Retry-After`) and 5xx are retried with exponential backoff and jitter (`maxNetworkRetries`, default 2) |
|
|
32
32
|
| Idempotency | Every POST that changes something gets an `Idempotency-Key` automatically, reused across retries; pass your own with `{ idempotencyKey }` |
|
|
33
33
|
| Versioning | Sends `Checkbox-Version: 2026-10-30` (the version the SDK was generated for); override with `new Checkbox(key, { apiVersion })` or per request |
|
|
34
|
+
| Base URL | `new Checkbox(key, { baseUrl: 'http://localhost:4000' })`, or the `CHECKBOX_API_BASE` environment variable (the same one the MCP server reads); a trailing `/v1` is ignored. Default `https://app.checkbox.site` |
|
|
34
35
|
| Mode | `checkbox.mode` is `'test'` or `'live'` from the key prefix (`ck_test_` / `ck_live_` / `rk_…` / legacy `sk_live_`) |
|
|
35
36
|
| Errors | `CheckboxInvalidRequestError`, `CheckboxAuthenticationError`, `CheckboxPermissionError`, `CheckboxRateLimitError`, `CheckboxIdempotencyError`, `CheckboxAPIError`, `CheckboxConnectionError` (all `CheckboxError`), each with a stable `code`, `param`, `statusCode`, `requestId`, `docUrl` and `nextAction` |
|
|
36
37
|
| Webhooks | `checkbox.webhooks.constructEvent(rawBody, signatureHeader, secret)` verifies `Checkbox-Signature` and returns a typed `WebhookEvent`; `constructEventAsync` for edge runtimes |
|
|
@@ -45,6 +46,7 @@ const checkbox = new Checkbox(process.env.CHECKBOX_API_KEY, {
|
|
|
45
46
|
maxNetworkRetries: 2, // default
|
|
46
47
|
timeout: 80_000, // ms per attempt
|
|
47
48
|
appInfo: { name: 'my-app', version: '1.0.0' },
|
|
49
|
+
// baseUrl: 'http://localhost:4000', // API origin (default https://app.checkbox.site); or set CHECKBOX_API_BASE
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
// Register a site (idempotent per key) and read its compliance plan: ordered tasks with the law, the exact change and
|
|
@@ -70,7 +72,7 @@ try {
|
|
|
70
72
|
await checkbox.certificates.create(site.id);
|
|
71
73
|
} catch (err) {
|
|
72
74
|
if (!(err instanceof CheckboxError)) throw err;
|
|
73
|
-
// resource_conflict: not eligible yet (verify the domain,
|
|
75
|
+
// resource_conflict: not eligible yet (verify the domain, keep the checks passing for 7 days);
|
|
74
76
|
// account_not_activated: a live key before any domain is verified.
|
|
75
77
|
console.log(err.code, err.message, err.nextAction);
|
|
76
78
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface Checkbox extends ResourceInstances {
|
|
|
45
45
|
*/
|
|
46
46
|
export declare class Checkbox implements RequestSender {
|
|
47
47
|
#private;
|
|
48
|
-
static readonly VERSION = "0.
|
|
48
|
+
static readonly VERSION = "0.2.0";
|
|
49
49
|
static readonly API_VERSION = "2026-10-30";
|
|
50
50
|
static readonly errors: typeof errors;
|
|
51
51
|
static readonly webhooks: Webhooks;
|
|
@@ -390,6 +390,23 @@ export declare class Checkbox implements RequestSender {
|
|
|
390
390
|
readonly paginated: false;
|
|
391
391
|
readonly summary: "Check domain verification now";
|
|
392
392
|
};
|
|
393
|
+
readonly resyncBilling: {
|
|
394
|
+
readonly operationId: "resyncBilling";
|
|
395
|
+
readonly namespace: "billings";
|
|
396
|
+
readonly method: "resync";
|
|
397
|
+
readonly httpMethod: "POST";
|
|
398
|
+
readonly path: "/v1/sites/{site}/billing/resync";
|
|
399
|
+
readonly pathParams: readonly ["site"];
|
|
400
|
+
readonly queryParams: readonly [];
|
|
401
|
+
readonly body: false;
|
|
402
|
+
readonly idempotent: true;
|
|
403
|
+
readonly auth: true;
|
|
404
|
+
readonly scope: "sites:write";
|
|
405
|
+
readonly response: "json";
|
|
406
|
+
readonly list: false;
|
|
407
|
+
readonly paginated: false;
|
|
408
|
+
readonly summary: "Re-sync Stripe settings";
|
|
409
|
+
};
|
|
393
410
|
readonly createScan: {
|
|
394
411
|
readonly operationId: "createScan";
|
|
395
412
|
readonly namespace: "scans";
|
|
@@ -730,6 +747,23 @@ export declare class Checkbox implements RequestSender {
|
|
|
730
747
|
readonly paginated: false;
|
|
731
748
|
readonly summary: "List fix plans for a site";
|
|
732
749
|
};
|
|
750
|
+
readonly publishShopifyTerms: {
|
|
751
|
+
readonly operationId: "publishShopifyTerms";
|
|
752
|
+
readonly namespace: "fixes";
|
|
753
|
+
readonly method: "publishShopifyTerms";
|
|
754
|
+
readonly httpMethod: "POST";
|
|
755
|
+
readonly path: "/v1/sites/{site}/fixes/shopify/publish";
|
|
756
|
+
readonly pathParams: readonly ["site"];
|
|
757
|
+
readonly queryParams: readonly [];
|
|
758
|
+
readonly body: true;
|
|
759
|
+
readonly idempotent: true;
|
|
760
|
+
readonly auth: true;
|
|
761
|
+
readonly scope: "fixes:write";
|
|
762
|
+
readonly response: "json";
|
|
763
|
+
readonly list: false;
|
|
764
|
+
readonly paginated: false;
|
|
765
|
+
readonly summary: "Publish the renewal terms to the Shopify app block";
|
|
766
|
+
};
|
|
733
767
|
readonly listEvidence: {
|
|
734
768
|
readonly operationId: "listEvidence";
|
|
735
769
|
readonly namespace: "evidence";
|
|
@@ -1138,6 +1172,40 @@ export declare class Checkbox implements RequestSender {
|
|
|
1138
1172
|
readonly paginated: false;
|
|
1139
1173
|
readonly summary: "Get the dates each required notice must be sent";
|
|
1140
1174
|
};
|
|
1175
|
+
readonly listSiteSuggestions: {
|
|
1176
|
+
readonly operationId: "listSiteSuggestions";
|
|
1177
|
+
readonly namespace: "suggestions";
|
|
1178
|
+
readonly method: "forSite";
|
|
1179
|
+
readonly httpMethod: "GET";
|
|
1180
|
+
readonly path: "/v1/sites/{site}/suggestions";
|
|
1181
|
+
readonly pathParams: readonly ["site"];
|
|
1182
|
+
readonly queryParams: readonly ["surfaces"];
|
|
1183
|
+
readonly body: false;
|
|
1184
|
+
readonly idempotent: false;
|
|
1185
|
+
readonly auth: true;
|
|
1186
|
+
readonly scope: "checks:read";
|
|
1187
|
+
readonly response: "json";
|
|
1188
|
+
readonly list: false;
|
|
1189
|
+
readonly paginated: false;
|
|
1190
|
+
readonly summary: "Get conversion suggestions for a site";
|
|
1191
|
+
};
|
|
1192
|
+
readonly suggestImprovements: {
|
|
1193
|
+
readonly operationId: "suggestImprovements";
|
|
1194
|
+
readonly namespace: "suggestions";
|
|
1195
|
+
readonly method: "generate";
|
|
1196
|
+
readonly httpMethod: "POST";
|
|
1197
|
+
readonly path: "/v1/suggestions";
|
|
1198
|
+
readonly pathParams: readonly [];
|
|
1199
|
+
readonly queryParams: readonly [];
|
|
1200
|
+
readonly body: true;
|
|
1201
|
+
readonly idempotent: false;
|
|
1202
|
+
readonly auth: true;
|
|
1203
|
+
readonly scope: "checks:read";
|
|
1204
|
+
readonly response: "json";
|
|
1205
|
+
readonly list: false;
|
|
1206
|
+
readonly paginated: false;
|
|
1207
|
+
readonly summary: "Get conversion suggestions for copy you send";
|
|
1208
|
+
};
|
|
1141
1209
|
readonly getElementsBundle: {
|
|
1142
1210
|
readonly operationId: "getElementsBundle";
|
|
1143
1211
|
readonly namespace: "elements";
|
|
@@ -1580,6 +1648,23 @@ export declare class Checkbox implements RequestSender {
|
|
|
1580
1648
|
readonly paginated: false;
|
|
1581
1649
|
readonly summary: "Delete a registered checkout config";
|
|
1582
1650
|
};
|
|
1651
|
+
readonly deleteSiteStripeCheckoutConfig: {
|
|
1652
|
+
readonly operationId: "deleteSiteStripeCheckoutConfig";
|
|
1653
|
+
readonly namespace: "siteStripeCheckoutConfigs";
|
|
1654
|
+
readonly method: "del";
|
|
1655
|
+
readonly httpMethod: "DELETE";
|
|
1656
|
+
readonly path: "/v1/sites/{site}/stripe_checkout_configs/{stripe_checkout_config}";
|
|
1657
|
+
readonly pathParams: readonly ["site", "stripe_checkout_config"];
|
|
1658
|
+
readonly queryParams: readonly [];
|
|
1659
|
+
readonly body: false;
|
|
1660
|
+
readonly idempotent: false;
|
|
1661
|
+
readonly auth: true;
|
|
1662
|
+
readonly scope: "test_runs:write";
|
|
1663
|
+
readonly response: "json";
|
|
1664
|
+
readonly list: false;
|
|
1665
|
+
readonly paginated: false;
|
|
1666
|
+
readonly summary: "Delete a registered checkout config (site path)";
|
|
1667
|
+
};
|
|
1583
1668
|
readonly createTestRun: {
|
|
1584
1669
|
readonly operationId: "createTestRun";
|
|
1585
1670
|
readonly namespace: "testRuns";
|
|
@@ -1621,7 +1706,7 @@ export declare class Checkbox implements RequestSender {
|
|
|
1621
1706
|
readonly httpMethod: "GET";
|
|
1622
1707
|
readonly path: "/v1/test_runs/{test_run}";
|
|
1623
1708
|
readonly pathParams: readonly ["test_run"];
|
|
1624
|
-
readonly queryParams: readonly [];
|
|
1709
|
+
readonly queryParams: readonly ["wait"];
|
|
1625
1710
|
readonly body: false;
|
|
1626
1711
|
readonly idempotent: false;
|
|
1627
1712
|
readonly auth: true;
|
|
@@ -1801,6 +1886,23 @@ export declare class Checkbox implements RequestSender {
|
|
|
1801
1886
|
readonly paginated: false;
|
|
1802
1887
|
readonly summary: "Send feedback";
|
|
1803
1888
|
};
|
|
1889
|
+
readonly claimReviewPrompt: {
|
|
1890
|
+
readonly operationId: "claimReviewPrompt";
|
|
1891
|
+
readonly namespace: "reviewPrompts";
|
|
1892
|
+
readonly method: "claim";
|
|
1893
|
+
readonly httpMethod: "POST";
|
|
1894
|
+
readonly path: "/v1/sites/{site}/review_prompt";
|
|
1895
|
+
readonly pathParams: readonly ["site"];
|
|
1896
|
+
readonly queryParams: readonly [];
|
|
1897
|
+
readonly body: true;
|
|
1898
|
+
readonly idempotent: false;
|
|
1899
|
+
readonly auth: true;
|
|
1900
|
+
readonly scope: "compliance_plans:read";
|
|
1901
|
+
readonly response: "json";
|
|
1902
|
+
readonly list: false;
|
|
1903
|
+
readonly paginated: false;
|
|
1904
|
+
readonly summary: "Claim the one-time review prompt for a site";
|
|
1905
|
+
};
|
|
1804
1906
|
};
|
|
1805
1907
|
static readonly Webhooks: typeof Webhooks;
|
|
1806
1908
|
/** Webhook signature verification: `checkbox.webhooks.constructEvent(rawBody, header, secret)`. */
|
package/dist/client.js
CHANGED
|
@@ -13,7 +13,7 @@ export const DEFAULT_MAX_NETWORK_RETRIES = 2;
|
|
|
13
13
|
const MAX_RETRY_DELAY_MS = 20_000;
|
|
14
14
|
/** `ck_test_…` / `rk_test_…` / `pk_test_…` -> test; `ck_live_…` / `rk_live_…` / `sk_live_…` / `pk_live_…` -> live. */
|
|
15
15
|
export function modeOfKey(key) {
|
|
16
|
-
const m = /^(?:ck|rk|sk|pk)_(test|live)_/.exec(key ?? '');
|
|
16
|
+
const m = /^(?:ckr|ck|rk|sk|pk)_(test|live)_/.exec(key ?? '');
|
|
17
17
|
return m ? m[1] : undefined;
|
|
18
18
|
}
|
|
19
19
|
const env = (name) => {
|
|
@@ -77,7 +77,8 @@ export class Checkbox {
|
|
|
77
77
|
this.#apiKey = (apiKey ?? env('CHECKBOX_API_KEY') ?? env('CHECKBOX_SECRET_KEY'))?.trim() || undefined;
|
|
78
78
|
this.#config = { maxNetworkRetries: DEFAULT_MAX_NETWORK_RETRIES, timeout: DEFAULT_TIMEOUT_MS, ...config };
|
|
79
79
|
this.apiVersion = config.apiVersion ?? API_VERSION;
|
|
80
|
-
|
|
80
|
+
// Round-4 pilot (express): the dashboard shows the base URL with /v1; with or without it, requests go to /v1/… once.
|
|
81
|
+
this.baseUrl = (config.baseUrl ?? env('CHECKBOX_API_BASE') ?? DEFAULT_BASE_URL).replace(/\/+$/, '').replace(/\/v1$/i, '');
|
|
81
82
|
this.mode = modeOfKey(this.#apiKey);
|
|
82
83
|
const app = config.appInfo ? ` ${config.appInfo.name}${config.appInfo.version ? `/${config.appInfo.version}` : ''}${config.appInfo.url ? ` (${config.appInfo.url})` : ''}` : '';
|
|
83
84
|
this.#userAgent = `checkbox-node/${SDK_VERSION} ${runtimeLabel()}${app}`;
|