@pilot-status/sdk 0.18.0 → 0.20.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/CHANGELOG.md +62 -0
- package/README.md +87 -1
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +24 -0
- package/dist/client.js.map +1 -1
- package/dist/http.d.ts +6 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +3 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/billing.d.ts +58 -8
- package/dist/resources/billing.d.ts.map +1 -1
- package/dist/resources/billing.js +96 -7
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/templates.d.ts +13 -1
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +18 -0
- package/dist/resources/templates.js.map +1 -1
- package/dist/resources/workspace-webhooks.d.ts +46 -0
- package/dist/resources/workspace-webhooks.d.ts.map +1 -0
- package/dist/resources/workspace-webhooks.js +83 -0
- package/dist/resources/workspace-webhooks.js.map +1 -0
- package/dist/resources/workspace.d.ts +3 -0
- package/dist/resources/workspace.d.ts.map +1 -1
- package/dist/resources/workspace.js +4 -0
- package/dist/resources/workspace.js.map +1 -1
- package/dist/resources/workspaces.d.ts +47 -0
- package/dist/resources/workspaces.d.ts.map +1 -0
- package/dist/resources/workspaces.js +75 -0
- package/dist/resources/workspaces.js.map +1 -0
- package/dist/types.d.ts +318 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/webhooks/types.d.ts +20 -0
- package/dist/webhooks/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pilot-status/sdk`.
|
|
4
4
|
|
|
5
|
+
## 0.20.0 - 2026-10-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `templates.insights(id, { days? })` → `TemplateInsights` (`GET
|
|
10
|
+
/v1/templates/{id}/insights`): Meta's sent/delivered/read totals, `readRate`, button
|
|
11
|
+
`clicks` and a `daily` series over 7, 30 or 90 days (server default 30; anything else
|
|
12
|
+
is 400 `INVALID_DAYS`). The first call may enable insights on the WABA at Meta. 422
|
|
13
|
+
`TEMPLATE_INSIGHTS_UNAVAILABLE_SMB` on WhatsApp Business App / coexistence accounts;
|
|
14
|
+
409 `TEMPLATE_NOT_ON_META` / `NO_META_NUMBER_FOR_WABA`; 503 `META_UNAVAILABLE`.
|
|
15
|
+
- Types: `TemplateInsights`, `TemplateInsightsDays`, `TemplateInsightsOptions`,
|
|
16
|
+
`TemplateInsightsTotals`, `TemplateInsightsClick`, `TemplateInsightsDay`.
|
|
17
|
+
|
|
18
|
+
## 0.19.0 - 2026-10-28
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Account keys** (`ps_account_…`): `PilotStatusClientOptions.workspaceId`, sent as
|
|
23
|
+
`x-workspace-id` on every request, and `client.withWorkspace(id)`, a sibling client on
|
|
24
|
+
another workspace. An account key needs it on every workspace route (400
|
|
25
|
+
`WORKSPACE_ID_REQUIRED` without it; 403 `WORKSPACE_MEMBERSHIP_REQUIRED` when its user
|
|
26
|
+
is not an active member).
|
|
27
|
+
- **`client.workspaces`** (`WorkspacesResource`, account key only — 403
|
|
28
|
+
`ACCOUNT_KEY_REQUIRED` otherwise): `list()` → `{ data }` (`GET /v1/workspaces`),
|
|
29
|
+
`create({ name })` → the workspace with its primary key in `apiKey` (shown once; `null`
|
|
30
|
+
if minting failed), and `apiKeys` (`WorkspaceApiKeysResource`): `list(workspaceId)`
|
|
31
|
+
(masked), `create(workspaceId, { name })` → `{ apiKey }` with a named `ps_workspace_`
|
|
32
|
+
key, `revoke(workspaceId, keyId)` → `{ id, revokedAt }`. Responses untouched; the POSTs
|
|
33
|
+
are never retried.
|
|
34
|
+
- **Pix top-up**: `billing.createCheckout({ ..., method: "pix" })` (BRL only) answers
|
|
35
|
+
`{ orderId, status, pix: { transactionId, copyPaste, qrCode, expiresAt } }`; `method`
|
|
36
|
+
is sent only when given. `CheckoutResult` is now the union `AddCardCheckoutResult |
|
|
37
|
+
CardTopupCheckoutResult | PixTopupCheckoutResult` (the card answers also carry
|
|
38
|
+
`purpose`, `method`, `orderId`, `amount`, `currency`).
|
|
39
|
+
- `billing.getTopup(id)` → `{ topup }` (`GET /v1/billing/topups/{id}`: `pending`,
|
|
40
|
+
`paid`, `expired`, `failed`).
|
|
41
|
+
- **Stripe Elements**: `billing.createCardSetupIntent()`,
|
|
42
|
+
`billing.syncCardSetupIntent(id)`, `billing.createPaymentIntent({ purpose:
|
|
43
|
+
"wallet_topup", amount, saveCard? }, { idempotencyKey? })` → `{ paymentIntent,
|
|
44
|
+
replayed }` (`Idempotency-Key` header; `replayed` from `Idempotent-Replayed: true`) and
|
|
45
|
+
`billing.syncPaymentIntent(id)`. 503 `PAYMENTS_NOT_CONFIGURED` while unavailable.
|
|
46
|
+
- **`client.workspace.webhooks`** (`WorkspaceWebhooksResource`) over
|
|
47
|
+
`/v1/workspace/webhooks*`, the same methods as `phoneLines.webhooks`, with the event
|
|
48
|
+
`wallet.topup_paid` (opt-in: `"*"` is every phone-line event only).
|
|
49
|
+
- Types: `CheckoutMethod`, `AddCardCheckoutResult`, `CardTopupCheckoutResult`,
|
|
50
|
+
`PixTopupCheckoutResult`, `PixCharge`, `WalletTopup`, `WalletTopupStatus`,
|
|
51
|
+
`WalletTopupResponse`, `CardSetupIntent`, `CardSetupIntentSync`, `SavedCard`,
|
|
52
|
+
`CreatePaymentIntentInput`, `CreatePaymentIntentOptions`, `CreatePaymentIntentResult`,
|
|
53
|
+
`WalletTopupPaymentIntent`, `PaymentIntentSync`, `AccountWorkspace`,
|
|
54
|
+
`AccountWorkspaceList`, `CreateWorkspaceInput`, `CreatedWorkspace`,
|
|
55
|
+
`MintedWorkspaceKey`, `WorkspaceKey`, `WorkspaceKeyList`, `CreateWorkspaceKeyInput`,
|
|
56
|
+
`CreatedWorkspaceKey`, `RevokedWorkspaceKey`, `WorkspaceWebhook*`,
|
|
57
|
+
`CreateWorkspaceWebhookInput`, `UpdateWorkspaceWebhookInput`,
|
|
58
|
+
`WorkspaceWebhookSubscription`, and the webhook types `WalletTopupPaidEvent`,
|
|
59
|
+
`WorkspaceWebhookEvent`, `WorkspaceWebhookEventName`.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- `CheckoutResult` was `{ url: string }`; code that reads `.url` must now narrow on
|
|
64
|
+
`purpose`/`method` first (a Pix answer has no `url`). The wire is unchanged for calls
|
|
65
|
+
without `method`.
|
|
66
|
+
|
|
5
67
|
## 0.18.0 - 2026-10-27
|
|
6
68
|
|
|
7
69
|
### Added
|
package/README.md
CHANGED
|
@@ -58,6 +58,36 @@ credential is tenant-scoped: `chatwoot.*` and `webhooks.logs()` answer
|
|
|
58
58
|
`400 NUMBER_REQUIRED` without it. A number-scoped key already carries its
|
|
59
59
|
number, and the header is ignored (the key wins).
|
|
60
60
|
|
|
61
|
+
### Account keys and resellers (`ps_account_`, 0.19.0)
|
|
62
|
+
|
|
63
|
+
An **account key** (`ps_account_…`, created in Profile → API) belongs to a USER, not to
|
|
64
|
+
a workspace: it reaches every workspace the user is an active member of, with the
|
|
65
|
+
user's live role there. Name the workspace with `workspaceId` (sent as
|
|
66
|
+
`x-workspace-id`); without it every workspace route is `400 WORKSPACE_ID_REQUIRED`,
|
|
67
|
+
and a workspace the user is not an active member of is `403
|
|
68
|
+
WORKSPACE_MEMBERSHIP_REQUIRED`.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const account = new PilotStatusClient({ apiKey: process.env.PILOT_STATUS_ACCOUNT_KEY! });
|
|
72
|
+
|
|
73
|
+
// Account-level routes — account key ONLY (anything else: 403 ACCOUNT_KEY_REQUIRED)
|
|
74
|
+
const { data } = await account.workspaces.list(); // [{ id, name, role, plan, createdAt }]
|
|
75
|
+
const created = await account.workspaces.create({ name: "Client A" }); // 201
|
|
76
|
+
// created.apiKey: the new workspace's PRIMARY key, shown ONCE (null if minting failed:
|
|
77
|
+
// mint one with apiKeys.create — do NOT create the workspace again)
|
|
78
|
+
const { apiKey } = await account.workspaces.apiKeys.create(created.id, { name: "CRM" }); // ps_workspace_…
|
|
79
|
+
await account.workspaces.apiKeys.list(created.id); // masked
|
|
80
|
+
await account.workspaces.apiKeys.revoke(created.id, apiKey.id); // { id, revokedAt }
|
|
81
|
+
|
|
82
|
+
// Any other route, on one workspace:
|
|
83
|
+
await account.withWorkspace(created.id).billing.getTopup("ord_1");
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`workspaces.create()` answers `409 WORKSPACE_LIMIT_REACHED` (with `limit`) at the
|
|
87
|
+
user's ceiling, `apiKeys.create()` `409 WORKSPACE_KEY_LIMIT_REACHED`, and revoking the
|
|
88
|
+
primary key `409 PRIMARY_KEY_NOT_REVOCABLE` (rotate it with
|
|
89
|
+
`POST /v1/api-keys/regenerate` instead). Neither POST is idempotent nor retried.
|
|
90
|
+
|
|
61
91
|
## Management (API keys, numbers, workspace)
|
|
62
92
|
|
|
63
93
|
### API keys
|
|
@@ -340,6 +370,11 @@ await client.templates.create({
|
|
|
340
370
|
examples: { nome: "Alice" },
|
|
341
371
|
});
|
|
342
372
|
|
|
373
|
+
// Template insights from Meta (days: 7 | 30 | 90, default 30). Not available on
|
|
374
|
+
// WhatsApp Business App / coexistence numbers (422 TEMPLATE_INSIGHTS_UNAVAILABLE_SMB)
|
|
375
|
+
const stats = await client.templates.insights("tpl_1", { days: 7 });
|
|
376
|
+
console.log(stats.totals.read, stats.readRate, stats.clicks);
|
|
377
|
+
|
|
343
378
|
// Groups — E.164 digits, not JIDs, in `participants`
|
|
344
379
|
const group = await client.groups.create({ subject: "Support", participants: ["5511999999999"] });
|
|
345
380
|
await client.groups.promoteParticipants(group.id, ["5511999999999"]);
|
|
@@ -362,7 +397,15 @@ await cw.test({ instanceUrl: "https://app.chatwoot.com", accountId: "7" }); // d
|
|
|
362
397
|
await cw.connect({ instanceUrl: "https://app.chatwoot.com", accountId: "7", userAccessToken: t });
|
|
363
398
|
|
|
364
399
|
// A hosted payment page URL — nothing is charged until a human completes it
|
|
365
|
-
const
|
|
400
|
+
const page = await client.billing.createCheckout({ purpose: "wallet_topup", amount: 100 });
|
|
401
|
+
if ("url" in page) redirect(page.url); // card and add_card answers carry `url`; a Pix does not
|
|
402
|
+
|
|
403
|
+
// Pix (BRL workspaces): no URL — show the code to the payer, then poll the order
|
|
404
|
+
const pix = await client.billing.createCheckout({ purpose: "wallet_topup", amount: 100, method: "pix" });
|
|
405
|
+
if (pix.purpose === "wallet_topup" && pix.method === "pix") {
|
|
406
|
+
show(pix.pix.copyPaste, pix.pix.qrCode);
|
|
407
|
+
const { topup } = await client.billing.getTopup(pix.orderId); // pending | paid | expired | failed
|
|
408
|
+
}
|
|
366
409
|
|
|
367
410
|
// Mint an embed token on YOUR backend, then hand it to the browser
|
|
368
411
|
const session = await client.embed.createSession({
|
|
@@ -372,6 +415,33 @@ const session = await client.embed.createSession({
|
|
|
372
415
|
});
|
|
373
416
|
```
|
|
374
417
|
|
|
418
|
+
### Card on your own page (Stripe Elements, 0.19.0)
|
|
419
|
+
|
|
420
|
+
The card goes browser → Stripe; your backend only creates the intent and syncs it.
|
|
421
|
+
OWNER only. ⛔ A `clientSecret` lets its holder confirm the intent — never log it.
|
|
422
|
+
|
|
423
|
+
```ts
|
|
424
|
+
// Save a card
|
|
425
|
+
const { clientSecret, setupIntentId, publishableKey } = await client.billing.createCardSetupIntent();
|
|
426
|
+
// …browser: stripe.confirmSetup({ elements, … })…
|
|
427
|
+
const { saved, card } = await client.billing.syncCardSetupIntent(setupIntentId);
|
|
428
|
+
|
|
429
|
+
// Top up the wallet
|
|
430
|
+
const { paymentIntent, replayed } = await client.billing.createPaymentIntent(
|
|
431
|
+
{ purpose: "wallet_topup", amount: 100, saveCard: true },
|
|
432
|
+
{ idempotencyKey: "topup-order-42" }, // optional; reuse it on retry
|
|
433
|
+
);
|
|
434
|
+
// …browser: stripe.confirmPayment({ elements, clientSecret: paymentIntent.clientSecret, … })…
|
|
435
|
+
const sync = await client.billing.syncPaymentIntent(paymentIntent.paymentIntentId);
|
|
436
|
+
// sync.credited is true only on the call that credited the wallet; it never charges
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
- `503 PAYMENTS_NOT_CONFIGURED` while card payments are unavailable.
|
|
440
|
+
- Same `idempotencyKey` + different body: `409 IDEMPOTENCY_KEY_REUSED`; while the first
|
|
441
|
+
call runs: `409 IDEMPOTENCY_KEY_IN_USE`.
|
|
442
|
+
- Unknown or another workspace's id: `404 SETUP_INTENT_NOT_FOUND` /
|
|
443
|
+
`404 PAYMENT_INTENT_NOT_FOUND`; a top-up order: `404 TOPUP_NOT_FOUND`.
|
|
444
|
+
|
|
375
445
|
## Analytics
|
|
376
446
|
|
|
377
447
|
```ts
|
|
@@ -599,6 +669,22 @@ const { delivery } = await client.phoneLines.webhooks.getDelivery(webhook.id, de
|
|
|
599
669
|
`400 UNKNOWN_FIELDS`, a wrong type `400 INVALID_FIELD_TYPE`, a bad `limit`
|
|
600
670
|
`400 INVALID_LIMIT`.
|
|
601
671
|
|
|
672
|
+
### Workspace webhooks (`client.workspace.webhooks`, 0.19.0)
|
|
673
|
+
|
|
674
|
+
The same registry as `client.phoneLines.webhooks` (same rows, `plwh_` secret and
|
|
675
|
+
signature), with the wider workspace event set: every phone-line event plus
|
|
676
|
+
`wallet.topup_paid` (a top-up order was credited; `data`: `orderId`, `amount`,
|
|
677
|
+
`currency`, `method`, `provider`, `paidAt`, `balance` — type `WalletTopupPaidEvent`).
|
|
678
|
+
Same methods: `list`, `get`, `create`, `update`, `delete`, `listDeliveries`,
|
|
679
|
+
`getDelivery`.
|
|
680
|
+
|
|
681
|
+
```ts
|
|
682
|
+
const { webhook } = await client.workspace.webhooks.create({
|
|
683
|
+
url: "https://example.com/hooks/billing",
|
|
684
|
+
events: ["*", "wallet.topup_paid"], // "*" = phone-line events ONLY; wallet events are opt-in
|
|
685
|
+
});
|
|
686
|
+
```
|
|
687
|
+
|
|
602
688
|
## Receiving webhooks (verify, then parse)
|
|
603
689
|
|
|
604
690
|
`parseCustomerWebhook` proves the **shape** of an event, nothing else — anyone on
|
package/dist/client.d.ts
CHANGED
|
@@ -24,10 +24,22 @@ import { RemotePairingResource } from "./resources/remote-pairing.js";
|
|
|
24
24
|
import { MediaResource } from "./resources/media.js";
|
|
25
25
|
import { WebhooksResource } from "./resources/webhooks.js";
|
|
26
26
|
import { WorkspaceResource } from "./resources/workspace.js";
|
|
27
|
+
import { WorkspacesResource } from "./resources/workspaces.js";
|
|
27
28
|
import { type FetchLike } from "./http.js";
|
|
28
29
|
/** Production. Override with `baseUrl` to point at staging or a mock. */
|
|
29
30
|
export declare const DEFAULT_BASE_URL = "https://pilotstatus.com.br";
|
|
30
31
|
export type PilotStatusClientOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* A workspace key (`ps_workspace_…`, or a legacy `ps_…`), a number key
|
|
34
|
+
* (`ps_number_…`), or an ACCOUNT key (`ps_account_…`, created in Profile → API).
|
|
35
|
+
*
|
|
36
|
+
* An account key is a USER's credential: it reaches every workspace the user is an
|
|
37
|
+
* active member of, with the user's live role there. Every workspace route then
|
|
38
|
+
* needs {@link workspaceId} (400 `WORKSPACE_ID_REQUIRED` without it; 403
|
|
39
|
+
* `WORKSPACE_MEMBERSHIP_REQUIRED` when the user is not an active member of it).
|
|
40
|
+
* `client.workspaces.*` accepts ONLY an account key (403 `ACCOUNT_KEY_REQUIRED`
|
|
41
|
+
* for any other credential).
|
|
42
|
+
*/
|
|
31
43
|
apiKey: string;
|
|
32
44
|
/**
|
|
33
45
|
* API root, without `/v1` (that already comes with each path). Defaults to
|
|
@@ -44,6 +56,13 @@ export type PilotStatusClientOptions = {
|
|
|
44
56
|
* header is then ignored by the server (the key wins).
|
|
45
57
|
*/
|
|
46
58
|
whatsappNumberId?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Default workspace, sent as `x-workspace-id` on every call — the workspace an
|
|
61
|
+
* ACCOUNT key (`ps_account_`) acts on (an id from `client.workspaces.list()`).
|
|
62
|
+
* Ignored by the server for workspace and number keys. Per-call override:
|
|
63
|
+
* {@link PilotStatusClient.withWorkspace}.
|
|
64
|
+
*/
|
|
65
|
+
workspaceId?: string;
|
|
47
66
|
timeoutMs?: number;
|
|
48
67
|
userAgent?: string;
|
|
49
68
|
fetch?: FetchLike;
|
|
@@ -80,6 +99,11 @@ export declare class PilotStatusClient {
|
|
|
80
99
|
readonly subscription: SubscriptionResource;
|
|
81
100
|
readonly chatwoot: ChatwootResource;
|
|
82
101
|
readonly workspace: WorkspaceResource;
|
|
102
|
+
/**
|
|
103
|
+
* Account-level workspaces (`/v1/workspaces*`) — ACCOUNT key (`ps_account_`) only:
|
|
104
|
+
* list and create workspaces, and manage each workspace's keys.
|
|
105
|
+
*/
|
|
106
|
+
readonly workspaces: WorkspacesResource;
|
|
83
107
|
/** Phone lines (`/v1/phone-lines/*`) — tenant-scoped key only. */
|
|
84
108
|
readonly phoneLines: PhoneLinesResource;
|
|
85
109
|
constructor(options: PilotStatusClientOptions);
|
|
@@ -96,5 +120,19 @@ export declare class PilotStatusClient {
|
|
|
96
120
|
* depend on when it was dispatched, which inside a `Promise.all` is a race.
|
|
97
121
|
*/
|
|
98
122
|
withNumber(whatsappNumberId: string): PilotStatusClient;
|
|
123
|
+
/**
|
|
124
|
+
* A sibling client pointed at ANOTHER workspace — the per-call override of
|
|
125
|
+
* `workspaceId`, for an ACCOUNT key (`ps_account_`):
|
|
126
|
+
*
|
|
127
|
+
* ```ts
|
|
128
|
+
* const account = new PilotStatusClient({ apiKey: "ps_account_..." });
|
|
129
|
+
* const { data } = await account.workspaces.list();
|
|
130
|
+
* await account.withWorkspace(data[0].id).billing.getTopup("ord_1");
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* A new instance, for the same reason as {@link withNumber}: the header travels on
|
|
134
|
+
* every request, so mutating the default would race inside a `Promise.all`.
|
|
135
|
+
*/
|
|
136
|
+
withWorkspace(workspaceId: string): PilotStatusClient;
|
|
99
137
|
}
|
|
100
138
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BA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,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;gBAI5B,OAAO,EAAE,wBAAwB;IAoD7C;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,iBAAiB;IAIvD;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB;CAGtD"}
|
package/dist/client.js
CHANGED
|
@@ -24,6 +24,7 @@ import { RemotePairingResource } from "./resources/remote-pairing.js";
|
|
|
24
24
|
import { MediaResource } from "./resources/media.js";
|
|
25
25
|
import { WebhooksResource } from "./resources/webhooks.js";
|
|
26
26
|
import { WorkspaceResource } from "./resources/workspace.js";
|
|
27
|
+
import { WorkspacesResource } from "./resources/workspaces.js";
|
|
27
28
|
import { createHttpClient } from "./http.js";
|
|
28
29
|
/** Production. Override with `baseUrl` to point at staging or a mock. */
|
|
29
30
|
export const DEFAULT_BASE_URL = "https://pilotstatus.com.br";
|
|
@@ -57,6 +58,11 @@ export class PilotStatusClient {
|
|
|
57
58
|
subscription;
|
|
58
59
|
chatwoot;
|
|
59
60
|
workspace;
|
|
61
|
+
/**
|
|
62
|
+
* Account-level workspaces (`/v1/workspaces*`) — ACCOUNT key (`ps_account_`) only:
|
|
63
|
+
* list and create workspaces, and manage each workspace's keys.
|
|
64
|
+
*/
|
|
65
|
+
workspaces;
|
|
60
66
|
/** Phone lines (`/v1/phone-lines/*`) — tenant-scoped key only. */
|
|
61
67
|
phoneLines;
|
|
62
68
|
#options;
|
|
@@ -74,6 +80,7 @@ export class PilotStatusClient {
|
|
|
74
80
|
fetch: fetchImpl,
|
|
75
81
|
getRetries: options.getRetries ?? 2,
|
|
76
82
|
whatsappNumberId: options.whatsappNumberId,
|
|
83
|
+
workspaceId: options.workspaceId,
|
|
77
84
|
});
|
|
78
85
|
this.messages = new MessagesResource(http);
|
|
79
86
|
this.analytics = new AnalyticsResource(http);
|
|
@@ -100,6 +107,7 @@ export class PilotStatusClient {
|
|
|
100
107
|
this.subscription = new SubscriptionResource(http);
|
|
101
108
|
this.chatwoot = new ChatwootResource(http);
|
|
102
109
|
this.workspace = new WorkspaceResource(http);
|
|
110
|
+
this.workspaces = new WorkspacesResource(http);
|
|
103
111
|
this.phoneLines = new PhoneLinesResource(http);
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
@@ -117,5 +125,21 @@ export class PilotStatusClient {
|
|
|
117
125
|
withNumber(whatsappNumberId) {
|
|
118
126
|
return new PilotStatusClient({ ...this.#options, whatsappNumberId });
|
|
119
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* A sibling client pointed at ANOTHER workspace — the per-call override of
|
|
130
|
+
* `workspaceId`, for an ACCOUNT key (`ps_account_`):
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* const account = new PilotStatusClient({ apiKey: "ps_account_..." });
|
|
134
|
+
* const { data } = await account.workspaces.list();
|
|
135
|
+
* await account.withWorkspace(data[0].id).billing.getTopup("ord_1");
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* A new instance, for the same reason as {@link withNumber}: the header travels on
|
|
139
|
+
* every request, so mutating the default would race inside a `Promise.all`.
|
|
140
|
+
*/
|
|
141
|
+
withWorkspace(workspaceId) {
|
|
142
|
+
return new PilotStatusClient({ ...this.#options, workspaceId });
|
|
143
|
+
}
|
|
120
144
|
}
|
|
121
145
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM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AC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,gBAAwB;QACjC,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,WAAmB;QAC/B,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/dist/http.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export type HttpClientOptions = {
|
|
|
12
12
|
* `/v1/chatwoot*` (400 NUMBER_REQUIRED) nor the webhook logs.
|
|
13
13
|
*/
|
|
14
14
|
whatsappNumberId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Goes out as `x-workspace-id` on every request: the workspace an ACCOUNT key
|
|
17
|
+
* (`ps_account_`) acts on. A workspace or number key already belongs to one
|
|
18
|
+
* workspace, and the server ignores the header for it.
|
|
19
|
+
*/
|
|
20
|
+
workspaceId?: string;
|
|
15
21
|
};
|
|
16
22
|
export type HttpRequest = {
|
|
17
23
|
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC1B,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AA+CF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB;kBA6G5B,CAAC,OAAO,WAAW,KAAG,OAAO,CAAC,CAAC,CAAC;6BAPrB,CAAC,OAAO,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;yBAelD,WAAW,UAAU,MAAM,KAAG,OAAO,CAAC,cAAc,CAAC;EAQ1F;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/http.js
CHANGED
|
@@ -66,6 +66,9 @@ export function createHttpClient(options) {
|
|
|
66
66
|
if (options.whatsappNumberId) {
|
|
67
67
|
headers["x-whatsapp-number-id"] = options.whatsappNumberId;
|
|
68
68
|
}
|
|
69
|
+
if (options.workspaceId) {
|
|
70
|
+
headers["x-workspace-id"] = options.workspaceId;
|
|
71
|
+
}
|
|
69
72
|
let body;
|
|
70
73
|
if (req.body !== undefined) {
|
|
71
74
|
headers["content-type"] = "application/json";
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqD9C,SAAS,gBAAgB,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE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AAE,MAAc;QACzD,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YACrC,IAAI,EAAE,MAAM,GAAG,CAAC,WAAW,EAAE;YAC7B,OAAO,EAAE,GAAG,CAAC,OAAO;SACvB,CAAC,CAAC,CAAC;IACR,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,CAAC;AAClE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export { NUMBER_STATUS_FAILURE_CODES, KNOWN_MESSAGE_ORIGINS } from "./types.js";
|
|
|
10
10
|
export { flowJsonValidationErrors } from "./resources/flows.js";
|
|
11
11
|
/** Phone lines: the resource classes, the `data:` URI helper and the `Content-Disposition` parser. */
|
|
12
12
|
export { PhoneLinesResource, PhoneLineVerificationResource, PhoneLineWebhooksResource, toDataUri, parseContentDispositionFileName, } from "./resources/phone-lines.js";
|
|
13
|
-
|
|
14
|
-
export
|
|
13
|
+
/** Account-level workspaces (account key) and the workspace webhooks. */
|
|
14
|
+
export { WorkspacesResource, WorkspaceApiKeysResource } from "./resources/workspaces.js";
|
|
15
|
+
export { WorkspaceWebhooksResource } from "./resources/workspace-webhooks.js";
|
|
16
|
+
export type { MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageOptions, SendMessageHeader, SendMessageAccepted, MessageDetails, MessageMetaPricing, MessageLogDirection, MessageLogEntry, KnownMessageOrigin, MessageListParams, MessageListResult, GroupMessagesParams, GroupMessagesResult, UnreadMessagesParams, UnreadMessagesResult, MarkReadResult, TypingState, TypingInput, TypingResult, DashboardStats, ApiKeyCreated, ApiKeyListItem, ApiKeyListResult, NumberApiKeyReveal, RegeneratedNumberKey, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, NumberCoexistence, CreateNumberInput, CreateNumberResult, CreateMetaNumberInput, CheckNumbersInput, CheckNumbersResult, NumberConnectResult, NumberStatusResult, NumberStatusFailureCode, NumberDetail, NumberSettings, NumberSettingsInput, NumberSettingsSync, NumberPiiInput, NumberLogoutResult, NumberRestoreResult, NumberPurgeResult, NumberPayResult, NumberPayErrorBody, UpdateNumberInput, UpdateNumberResult, ChatHistoryMedia, ChatHistoryMessage, MessageHistoryParams, MessageHistoryResult, NumberLinkBundle, RemotePairingInput, RemotePairingResult, RemotePairingInfo, RemotePairingStatus, RemotePairingConnectResult, CancelMessagesResult, DeleteNumberResult, TemplateCategory, TemplateExamples, TemplateListItem, TemplateDetail, CreateTemplateInput, UpdateTemplateInput, TemplateDeleteResult, TemplateInsightsDays, TemplateInsightsOptions, TemplateInsightsTotals, TemplateInsightsClick, TemplateInsightsDay, TemplateInsights, FlowCategory, Flow, FlowListParams, FlowListResult, CreateFlowInput, FlowCreated, UpdateFlowInput, FlowUpdateResult, FlowDeleteResult, FlowJsonUploadResult, FlowJsonValidationFailure, FlowPublishInput, FlowPublishResult, FlowDeprecateInput, FlowDeprecateResult, FlowResponse, FlowResponseMedia, FlowSubmittedExchange, FlowResponseListParams, FlowResponseListResult, FlowEndpointKeyMetaStatus, FlowEndpointKeyStatus, FlowEndpointKeyRotateInput, FlowEndpointKeyRotateResult, GroupListItem, GroupDetail, GroupParticipant, CreateGroupInput, GroupActionResult, GroupInviteResult, GroupPinAction, NewsletterListItem, MediaDownloadResult, ConversationListParams, ConversationListResult, ConversationSummary, LeadListParams, LeadListResult, LeadGetResult, Lead, LeadField, ChatReferral, ReferralListParams, ReferralMessage, ReferralListResult, ReferralSummaryParams, ReferralSummaryAd, ReferralSummaryResult, LinkedAdAccount, AdAccountCandidate, AdAccountListResult, AdAccountLinkResult, AdAccountUnlinkResult, AdsSummaryParams, AdsSummaryAd, AdsSummaryResult, LeadPageLink, LeadPageCandidate, LeadPageListResult, LeadPageLinkInput, LeadPageLinkResult, LeadPageUpdateInput, LeadPageUpdateResult, LeadPageUnlinkResult, LeadPageResyncResult, LeadVariableSource, LeadFormConfig, LeadFormQuestion, LeadForm, LeadFormListResult, LeadFormConfigInput, LeadFormConfigResult, ServiceWindowType, ServiceWindowResult, MetaPricingParams, MetaPricingResult, Webhook, CreateWebhookInput, UpdateWebhookInput, WebhookDeleteResult, WebhookLogsParams, WebhookLogEntry, BrandingInput, BrandingResult, EmbedSurface, EmbedSessionInput, EmbedSessionResult, CheckoutPurpose, CheckoutInput, CheckoutResult, CheckoutMethod, AddCardCheckoutResult, CardTopupCheckoutResult, PixTopupCheckoutResult, PixCharge, WalletTopupStatus, WalletTopup, WalletTopupResponse, CardSetupIntent, SavedCard, CardSetupIntentSync, CreatePaymentIntentInput, CreatePaymentIntentOptions, WalletTopupPaymentIntent, CreatePaymentIntentResult, PaymentIntentSync, ExtraNumbersPreview, ExtraNumbersPurchaseResult, ExtraNumbersScheduleResult, ChatwootChannelMode, ChatwootStatus, ChatwootConnectInput, ChatwootUpdateInput, ChatwootTestInput, ChatwootTestResult, ChatwootHistoryReplayInput, ChatwootHistoryReplayState, WorkspaceRole, WorkspaceMemberStatus, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList, CallDirection, CallStatus, CallDetails, CallInitiateInput, CallInitiateAccepted, CallActionResult, CallListResult, CallingSettingsResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallPermissionResult, CallPermissionRequestInput, CallPermissionRequestResult, CallRealtimeSessionMode, CallRealtimeSessionResult, VerificationStatus, VerificationDocumentType, VerificationContactChannel, VerificationContactChannelPath, VerificationDocumentStatus, VerificationReviewReason, VerificationDetails, VerificationState, StartVerificationParams, StartVerificationOptions, StartVerificationResult, ActivationAudio, PhoneLineWebhookSubscription, PhoneLineWebhook, CreatedPhoneLineWebhook, PhoneLineWebhookList, PhoneLineWebhookResponse, CreatePhoneLineWebhookResponse, CreatePhoneLineWebhookInput, UpdatePhoneLineWebhookInput, PhoneLineWebhookDeleteResult, PhoneLineWebhookDeliveryStatus, PhoneLineWebhookDelivery, PhoneLineWebhookDeliveryDetail, ListPhoneLineWebhookDeliveriesParams, PhoneLineWebhookDeliveryList, PhoneLineWebhookDeliveryResponse, WorkspaceWebhookSubscription, WorkspaceWebhook, CreatedWorkspaceWebhook, WorkspaceWebhookList, WorkspaceWebhookResponse, CreateWorkspaceWebhookResponse, WorkspaceWebhookDeleteResult, WorkspaceWebhookDelivery, WorkspaceWebhookDeliveryDetail, ListWorkspaceWebhookDeliveriesParams, WorkspaceWebhookDeliveryList, WorkspaceWebhookDeliveryResponse, CreateWorkspaceWebhookInput, UpdateWorkspaceWebhookInput, AccountWorkspace, AccountWorkspaceList, CreateWorkspaceInput, MintedWorkspaceKey, CreatedWorkspace, WorkspaceKey, WorkspaceKeyList, CreateWorkspaceKeyInput, CreatedWorkspaceKey, RevokedWorkspaceKey, } from "./types.js";
|
|
17
|
+
export type { CustomerWebhookEvent, UnknownCustomerWebhookEvent, WhatsAppMessageType, MessageSentEvent, MessageDeliveredEvent, MessageReadEvent, MessageFailedEvent, MessageReplyEvent, MessageReceivedEvent, MessageGroupEvent, MessageNewsletterEvent, NumberCreatedEvent, NumberConnectedEvent, NumberDisconnectedEvent, NumberRemovedEvent, NumberRestoredEvent, CallRingingEvent, CallConnectedEvent, CallEndedEvent, CallMissedEvent, CallPermissionUpdatedEvent, EvolutionGoCallEventData, EvolutionGoCallOfferEvent, EvolutionGoCallAcceptEvent, EvolutionGoCallTerminateEvent, EvolutionGoCallEvent, FlowResponseReceivedEvent, FlowResponseReceivedEventData, FlowResponseMediaAttachment, LeadReceivedEvent, LeadReceivedEventData, LeadReceivedField, PhoneLineWebhookEvent, PhoneLineWebhookEventName, PhoneLineReturnedReason, PhoneLinePurchasedEvent, PhoneLineAudioReceivedEvent, PhoneLineCodeReceivedEvent, PhoneLineCodeFailedEvent, PhoneLineRenewedEvent, PhoneLinePaymentFailedEvent, PhoneLineSuspendedEvent, PhoneLineReturnedEvent, PhoneLineCanceledEvent, PhoneLineVerificationUpdatedEvent, WalletTopupPaidEvent, WorkspaceWebhookEvent, WorkspaceWebhookEventName, } from "./webhooks/types.js";
|
|
15
18
|
export { parseCustomerWebhook, isCustomerWebhookEvent, isUnknownCustomerWebhookEvent, CUSTOMER_WEBHOOK_EVENTS, } from "./webhooks/parse.js";
|
|
16
19
|
export type { ParseCustomerWebhookOptions } from "./webhooks/parse.js";
|
|
17
20
|
export { verifyWebhookSignature, WEBHOOK_SIGNATURE_HEADER, } from "./webhooks/signature.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,sGAAsG;AACtG,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,yBAAyB,EACzB,SAAS,EACT,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,aAAa,EACb,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,E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AAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mutation-exempt-file: PURE RE-EXPORT BARREL — every non-blank line is `export … from`, ⚠️ (this used to say "209 lines" and the file had 219: a count in a justification rots the moment an export is added, and a reader who counts and finds a mismatch distrusts the whole exemption — or "verifies" it away. The claim is now the one that stays checkable no matter how the file grows.) with no statement, no expression and no branch to mutate. EVERY value it re-exports is ASSERTED in the test of the module it comes from — the list below is the claim, and it is checkable name by name (⚠️ this used to say "7"; measured 2026-09-06 there are SIX blocks carrying nineteen names, because `CUSTOMER_WEBHOOK_EVENTS` ships in the same block as `parseCustomerWebhook` even though a different test asserts it. A count that disagrees with the enumeration beside it makes a reader doubt both), so nothing here is unmeasured: `PilotStatusClient`/`DEFAULT_BASE_URL` in `client.test.ts`; the 10 error classes (`UnprocessableEntityError` included, 16 references, structural assertions on the prototype chain) in `errors.test.ts`; `NUMBER_STATUS_FAILURE_CODES` and `KNOWN_MESSAGE_ORIGINS` in `resources/resources.test.ts`, each list asserted whole; `flowJsonValidationErrors` in `resources/flows.test.ts`; `parseCustomerWebhook`/`isCustomerWebhookEvent` in `webhooks/parse.test.ts`; `CUSTOMER_WEBHOOK_EVENTS` in `webhooks/readme-events.test.ts`, compared name-by-name against `README.md`; `verifyWebhookSignature`/`WEBHOOK_SIGNATURE_HEADER` in `webhooks/signature.test.ts`; `PhoneLinesResource`/`PhoneLineVerificationResource`/`PhoneLineWebhooksResource`/`toDataUri`/`parseContentDispositionFileName` in `resources/phone-lines.test.ts`. Everything else it forwards is `export type`, erased before a mutant could exist. This is the declared escape hatch for the gate's OWN documented limit — `mutate-diff.mjs` does not follow barrels, so a barrel resolves to `index` and lands in `semTeste`; the same reason already excludes this exact file from `vitest.coverage.config.ts` ("pure re-export barrel"). A dropped export is caught by `tsc`, in this package and in every consumer, not by mutation.
|
|
1
|
+
// mutation-exempt-file: PURE RE-EXPORT BARREL — every non-blank line is `export … from`, ⚠️ (this used to say "209 lines" and the file had 219: a count in a justification rots the moment an export is added, and a reader who counts and finds a mismatch distrusts the whole exemption — or "verifies" it away. The claim is now the one that stays checkable no matter how the file grows.) with no statement, no expression and no branch to mutate. EVERY value it re-exports is ASSERTED in the test of the module it comes from — the list below is the claim, and it is checkable name by name (⚠️ this used to say "7"; measured 2026-09-06 there are SIX blocks carrying nineteen names, because `CUSTOMER_WEBHOOK_EVENTS` ships in the same block as `parseCustomerWebhook` even though a different test asserts it. A count that disagrees with the enumeration beside it makes a reader doubt both), so nothing here is unmeasured: `PilotStatusClient`/`DEFAULT_BASE_URL` in `client.test.ts`; the 10 error classes (`UnprocessableEntityError` included, 16 references, structural assertions on the prototype chain) in `errors.test.ts`; `NUMBER_STATUS_FAILURE_CODES` and `KNOWN_MESSAGE_ORIGINS` in `resources/resources.test.ts`, each list asserted whole; `flowJsonValidationErrors` in `resources/flows.test.ts`; `parseCustomerWebhook`/`isCustomerWebhookEvent` in `webhooks/parse.test.ts`; `CUSTOMER_WEBHOOK_EVENTS` in `webhooks/readme-events.test.ts`, compared name-by-name against `README.md`; `verifyWebhookSignature`/`WEBHOOK_SIGNATURE_HEADER` in `webhooks/signature.test.ts`; `PhoneLinesResource`/`PhoneLineVerificationResource`/`PhoneLineWebhooksResource`/`toDataUri`/`parseContentDispositionFileName` in `resources/phone-lines.test.ts`; `WorkspacesResource`/`WorkspaceApiKeysResource` in `resources/workspaces.test.ts`; `WorkspaceWebhooksResource` in `resources/workspace-webhooks.test.ts`. Everything else it forwards is `export type`, erased before a mutant could exist. This is the declared escape hatch for the gate's OWN documented limit — `mutate-diff.mjs` does not follow barrels, so a barrel resolves to `index` and lands in `semTeste`; the same reason already excludes this exact file from `vitest.coverage.config.ts` ("pure re-export barrel"). A dropped export is caught by `tsc`, in this package and in every consumer, not by mutation.
|
|
2
2
|
export { PilotStatusClient, DEFAULT_BASE_URL } from "./client.js";
|
|
3
3
|
export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, ServerError, } from "./errors.js";
|
|
4
4
|
export { NUMBER_STATUS_FAILURE_CODES, KNOWN_MESSAGE_ORIGINS } from "./types.js";
|
|
@@ -9,6 +9,9 @@ export { NUMBER_STATUS_FAILURE_CODES, KNOWN_MESSAGE_ORIGINS } from "./types.js";
|
|
|
9
9
|
export { flowJsonValidationErrors } from "./resources/flows.js";
|
|
10
10
|
/** Phone lines: the resource classes, the `data:` URI helper and the `Content-Disposition` parser. */
|
|
11
11
|
export { PhoneLinesResource, PhoneLineVerificationResource, PhoneLineWebhooksResource, toDataUri, parseContentDispositionFileName, } from "./resources/phone-lines.js";
|
|
12
|
+
/** Account-level workspaces (account key) and the workspace webhooks. */
|
|
13
|
+
export { WorkspacesResource, WorkspaceApiKeysResource } from "./resources/workspaces.js";
|
|
14
|
+
export { WorkspaceWebhooksResource } from "./resources/workspace-webhooks.js";
|
|
12
15
|
export { parseCustomerWebhook, isCustomerWebhookEvent, isUnknownCustomerWebhookEvent, CUSTOMER_WEBHOOK_EVENTS, } from "./webhooks/parse.js";
|
|
13
16
|
export { verifyWebhookSignature, WEBHOOK_SIGNATURE_HEADER, } from "./webhooks/signature.js";
|
|
14
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2xEAA2xE;AAE3xE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,sGAAsG;AACtG,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,yBAAyB,EACzB,SAAS,EACT,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAEpC,yEAAyE;AACzE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAiU9E,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,18 +1,68 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { CheckoutInput, CheckoutResult } from "../types.js";
|
|
3
|
-
/**
|
|
2
|
+
import type { CardSetupIntent, CardSetupIntentSync, CheckoutInput, CheckoutResult, CreatePaymentIntentInput, CreatePaymentIntentOptions, CreatePaymentIntentResult, PaymentIntentSync, WalletTopupResponse } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Billing (`/v1/billing/*`). Requires a tenant-scoped credential (with an account key,
|
|
5
|
+
* `workspaceId`). Card payments through Stripe Elements answer 503
|
|
6
|
+
* `PAYMENTS_NOT_CONFIGURED` while the platform has no Stripe publishable key.
|
|
7
|
+
*/
|
|
4
8
|
export declare class BillingResource {
|
|
5
9
|
#private;
|
|
6
10
|
constructor(http: HttpClient);
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
* (`POST /v1/billing/checkout`).
|
|
12
|
+
* `POST /v1/billing/checkout`.
|
|
10
13
|
*
|
|
11
|
-
* **Nothing is charged here.**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* **Nothing is charged here.** `purpose: "add_card"` returns the `url` of a hosted
|
|
15
|
+
* page that saves a card. `purpose: "wallet_topup"` (requires `amount`, in the
|
|
16
|
+
* account currency) creates a PENDING order (`orderId`, poll it with
|
|
17
|
+
* {@link getTopup}) and returns either a hosted page `url` (`method: "card"`, the
|
|
18
|
+
* default) or, with `method: "pix"` (BRL workspaces only, 400 `PIX_NOT_ELIGIBLE`
|
|
19
|
+
* otherwise), the Pix to show the payer in `pix.copyPaste` / `pix.qrCode`.
|
|
20
|
+
* `method` is sent only when given; `successUrl`/`cancelUrl` with a Pix, or
|
|
21
|
+
* `method` on `add_card`, is 400 `FIELD_NOT_APPLICABLE`.
|
|
15
22
|
*/
|
|
16
23
|
createCheckout(input: CheckoutInput): Promise<CheckoutResult>;
|
|
24
|
+
/**
|
|
25
|
+
* `GET /v1/billing/topups/{id}` — the status of a wallet top-up order (`pending`,
|
|
26
|
+
* `paid`, `expired`, `failed`). Read-only: polling it calls no payment provider.
|
|
27
|
+
* Another workspace's id is 404 `TOPUP_NOT_FOUND`, like an unknown one.
|
|
28
|
+
*/
|
|
29
|
+
getTopup(id: string): Promise<WalletTopupResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* `POST /v1/billing/card/setup-intent` — a Stripe SetupIntent to save a card with
|
|
32
|
+
* the Payment Element on YOUR page (`stripe.confirmSetup(...)`); the card goes
|
|
33
|
+
* browser → Stripe. OWNER only (`billing:payment_method:manage`). Sends no body.
|
|
34
|
+
* ⛔ `clientSecret` lets its holder confirm the intent: never log it.
|
|
35
|
+
*/
|
|
36
|
+
createCardSetupIntent(): Promise<CardSetupIntent>;
|
|
37
|
+
/**
|
|
38
|
+
* `POST /v1/billing/card/setup-intent/{id}/sync` — call right after
|
|
39
|
+
* `confirmSetup` resolves: the server reads the SetupIntent from Stripe and, if it
|
|
40
|
+
* `succeeded`, makes the card the workspace's saved card now (`saved: true`).
|
|
41
|
+
* Idempotent. Not succeeded yet → `saved: false` and Stripe's `status`. A
|
|
42
|
+
* malformed id is 400 `INVALID_SETUP_INTENT_ID`; unknown or another workspace's,
|
|
43
|
+
* 404 `SETUP_INTENT_NOT_FOUND`.
|
|
44
|
+
*/
|
|
45
|
+
syncCardSetupIntent(setupIntentId: string): Promise<CardSetupIntentSync>;
|
|
46
|
+
/**
|
|
47
|
+
* `POST /v1/billing/payment-intents` — a transparent wallet top-up: a PENDING
|
|
48
|
+
* order and a card PaymentIntent for `stripe.confirmPayment(...)` on YOUR page.
|
|
49
|
+
* Nothing is charged here. OWNER only (`billing:wallet:topup`).
|
|
50
|
+
*
|
|
51
|
+
* `options.idempotencyKey` (optional) goes out as the `Idempotency-Key` header:
|
|
52
|
+
* reuse it on retry and the server returns the SAME order and PaymentIntent
|
|
53
|
+
* (`replayed: true`) instead of creating another; the same key with a different
|
|
54
|
+
* body is 409 `IDEMPOTENCY_KEY_REUSED`, while the first call runs 409
|
|
55
|
+
* `IDEMPOTENCY_KEY_IN_USE`. This POST is never retried automatically by the SDK.
|
|
56
|
+
* Resolves to `{ paymentIntent, replayed }`, `paymentIntent` being the body untouched.
|
|
57
|
+
*/
|
|
58
|
+
createPaymentIntent(input: CreatePaymentIntentInput, options?: CreatePaymentIntentOptions): Promise<CreatePaymentIntentResult>;
|
|
59
|
+
/**
|
|
60
|
+
* `POST /v1/billing/payment-intents/{id}/sync` — call right after
|
|
61
|
+
* `confirmPayment` resolves: the server reads the PaymentIntent from Stripe and, if
|
|
62
|
+
* it `succeeded`, credits the wallet exactly once (`credited: true` on that call
|
|
63
|
+
* only). It never charges. A malformed id is 400 `INVALID_PAYMENT_INTENT_ID`;
|
|
64
|
+
* unknown or another workspace's, 404 `PAYMENT_INTENT_NOT_FOUND`.
|
|
65
|
+
*/
|
|
66
|
+
syncPaymentIntent(paymentIntentId: string): Promise<PaymentIntentSync>;
|
|
17
67
|
}
|
|
18
68
|
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,iBAAiB,EAEjB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,eAAe;;gBAGZ,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;;;OAWG;IACG,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAcnE;;;;OAIG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOxD;;;;;OAKG;IACG,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC;IAOvD;;;;;;;OAOG;IACG,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO9E;;;;;;;;;;;OAWG;IACG,mBAAmB,CACrB,KAAK,EAAE,wBAAwB,EAC/B,OAAO,CAAC,EAAE,0BAA0B,GACrC,OAAO,CAAC,yBAAyB,CAAC;IAsBrC;;;;;;OAMG;IACG,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAM/E"}
|